Skip to content

FIX #2918 Add option for default language for file descriptions #2949

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed

FIX #2918 Add option for default language for file descriptions #2949

wants to merge 5 commits into from

Conversation

ghost
Copy link

@ghost ghost commented May 14, 2019

I made some changes in the code in order to add the option of language for default in settings section.
settings1
settings2

settings5

Fixes #2918 Add option for default language for file descriptions

@codecov-io
Copy link

codecov-io commented May 14, 2019

Codecov Report

Merging #2949 into master will decrease coverage by 0.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #2949      +/-   ##
=========================================
- Coverage    3.69%   3.67%   -0.02%     
=========================================
  Files         247     247              
  Lines       12217   12264      +47     
  Branches     1083    1088       +5     
=========================================
  Hits          451     451              
- Misses      11732   11779      +47     
  Partials       34      34
Impacted Files Coverage Δ
...main/java/fr/free/nrw/commons/upload/Language.java 0% <ø> (ø) ⬆️
...ee/nrw/commons/upload/SpinnerLanguagesAdapter.java 0% <0%> (ø) ⬆️
...fr/free/nrw/commons/settings/SettingsFragment.java 0% <0%> (ø) ⬆️
...n/java/fr/free/nrw/commons/CommonsApplication.java 0% <0%> (ø) ⬆️
.../java/fr/free/nrw/commons/auth/SessionManager.java 0% <0%> (ø) ⬆️
...r/free/nrw/commons/contributions/MainActivity.java 0% <0%> (ø) ⬆️
...nrw/commons/notification/NotificationActivity.java 0% <0%> (ø) ⬆️
...ee/nrw/commons/notification/NotificationUtils.java 0% <0%> (ø) ⬆️
.../free/nrw/commons/category/CategoryImageUtils.java 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 967d3ea...c99562d. Read the comment docs.

@neslihanturan
Copy link
Collaborator

Hi @olgalesan thanks for your PR. I get this error while testing your PR, on click settings item from navigation menu:

 Process: fr.free.nrw.commons.beta, PID: 5925
    java.lang.RuntimeException: Unable to start activity ComponentInfo{fr.free.nrw.commons.beta/fr.free.nrw.commons.settings.SettingsActivity}: android.view.InflateException: Binary XML file line #22: Binary XML file line #22: Error inflating class fragment
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
        at android.app.ActivityThread.-wrap11(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
        at android.os.Handler.dispatchMessage(Handler.java:105)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6541)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
     Caused by: android.view.InflateException: Binary XML file line #22: Binary XML file line #22: Error inflating class fragment
     Caused by: android.view.InflateException: Binary XML file line #22: Error inflating class fragment
     Caused by: java.lang.ArrayIndexOutOfBoundsException: length=192; index=-1
        at fr.free.nrw.commons.settings.SettingsFragment.prepareLanguages(SettingsFragment.java:160)
        at fr.free.nrw.commons.settings.SettingsFragment.onCreate(SettingsFragment.java:114)
        at android.app.Fragment.performCreate(Fragment.java:2593)
        at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1234)
        at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1454)
        at android.app.FragmentManagerImpl.addFragment(FragmentManager.java:1701)
        at android.app.FragmentManagerImpl.onCreateView(FragmentManager.java:3611)
        at android.app.FragmentController.onCreateView(FragmentController.java:98)
        at android.app.Activity.onCreateView(Activity.java:6187)
        at androidx.fragment.app.FragmentActivity.onCreateView(FragmentActivity.java:326)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:780)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
        at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
        at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:141)
        at fr.free.nrw.commons.settings.SettingsActivity.onCreate(SettingsActivity.java:24)

Copy link
Collaborator

@neslihanturan neslihanturan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see my minor code quality reviews along with the error

@ghost
Copy link
Author

ghost commented May 15, 2019

hi @neslihanturan I made the changes suggested.
hoping to receive your feedback.
Kind Regards.

@neslihanturan
Copy link
Collaborator

Hi @olgalesan , thanks for solving issues. Currently issues and error seems like solved. But when I testing I faced a problem:
image

  • I went settings and make the language Chinese (zh)
  • Then I come to upload and everything seemed fine, default language was Chinese (zh)
  • Then I clicked to plus icon, and it worked fine, another description field is added with Chinese default.
  • Then I send the app back, then bring it foreground, clicked to plus icon again.
  • It added a new description with Aghem (agq) which is unexpected. I would expect Chinese.

@neslihanturan
Copy link
Collaborator

Oh update, I could reproduce the same issue without sending the app to background. So the second description is correct, Chinese, but the third one is Aghem somehow.

@ghost
Copy link
Author

ghost commented May 16, 2019

hello @neslihanturan I reproduced the issue and it was fixed.However, I was wondering if it would be better to chose per default the language what is set in the phone when the user has not chosen none.

@neslihanturan
Copy link
Collaborator

Hi @olgalesan , current implementation does as you said. It uses phone language if no language is set. Surely we expect same behavior if default language isn't set. Please ping me whenever your PR is ready to be test.

@ghost
Copy link
Author

ghost commented May 18, 2019

hello @neslihanturan changes done!

@neslihanturan
Copy link
Collaborator

Hi @olgalesan , thanks for your cooperation. Two minor things and we are done:

  • Please rename Description Language to Default Description Language
  • On a fresh install, before selecting any language it uses my phone language, which is good. Tha small preview under Description Language displays English which is also good. But on the list, I would expect English be selected, but none of the items are selected. It feels odd. Can you please make phone language selected if none of languages are selected?

@harshchinu
Copy link
Contributor

is this is solved or open so i can take on it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add option for default language for file descriptions
3 participants