mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-29 13:53:54 +01:00
Feature/localised image descriptions (#1634)
* wip * Changes for adding descriptions in multipe languages[issue #1501] * Added callback for the adapter * Codacy suggested changes * Sort the languages in the spinner in alphabetical order * scroll view nested scrolling enabled false * Nested scrolling enabled false [Allow rv to expand] * rebased to master, resolved conflicts * replaced setCompoundDrawables with setCompoundDrawablesWithIntrinsicBounds [the former dint used to work on all devices] * replaced setCompoundDrawables with setCompoundDrawablesWithIntrinsicBounds [the former dint used to work on all devices]
This commit is contained in:
parent
e4c518ccce
commit
12a83da3a2
12 changed files with 622 additions and 122 deletions
|
|
@ -60,6 +60,7 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment {
|
|||
private boolean isCategoryImage;
|
||||
private MediaDetailPagerFragment.MediaDetailProvider detailProvider;
|
||||
private int index;
|
||||
private Locale locale;
|
||||
|
||||
public static MediaDetailFragment forMedia(int index, boolean editable, boolean isCategoryImage) {
|
||||
MediaDetailFragment mf = new MediaDetailFragment();
|
||||
|
|
@ -198,6 +199,7 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment {
|
|||
}
|
||||
};
|
||||
view.getViewTreeObserver().addOnGlobalLayoutListener(layoutListener);
|
||||
locale = getResources().getConfiguration().locale;
|
||||
return view;
|
||||
}
|
||||
|
||||
|
|
@ -455,7 +457,7 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment {
|
|||
|
||||
private String prettyDescription(Media media) {
|
||||
// @todo use UI language when multilingual descs are available
|
||||
String desc = media.getDescription("en").trim();
|
||||
String desc = media.getDescription(locale.getLanguage()).trim();
|
||||
if (desc.equals("")) {
|
||||
return getString(R.string.detail_description_empty);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue