mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Fixed default locale and upload locales in descrptions (#3166)
This commit is contained in:
parent
55edc34dee
commit
533ba60fae
4 changed files with 103 additions and 108 deletions
|
|
@ -10,10 +10,6 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.AdapterView.OnItemSelectedListener;
|
import android.widget.AdapterView.OnItemSelectedListener;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.widget.AppCompatEditText;
|
import androidx.appcompat.widget.AppCompatEditText;
|
||||||
|
|
@ -24,22 +20,82 @@ import butterknife.ButterKnife;
|
||||||
import fr.free.nrw.commons.R;
|
import fr.free.nrw.commons.R;
|
||||||
import fr.free.nrw.commons.utils.AbstractTextWatcher;
|
import fr.free.nrw.commons.utils.AbstractTextWatcher;
|
||||||
import fr.free.nrw.commons.utils.BiMap;
|
import fr.free.nrw.commons.utils.BiMap;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import timber.log.Timber;
|
import timber.log.Timber;
|
||||||
|
|
||||||
public class DescriptionsAdapter extends RecyclerView.Adapter<DescriptionsAdapter.ViewHolder> {
|
public class DescriptionsAdapter extends RecyclerView.Adapter<DescriptionsAdapter.ViewHolder> {
|
||||||
|
|
||||||
|
private final String userDefaultLocale;
|
||||||
private List<Description> descriptions;
|
private List<Description> descriptions;
|
||||||
private Callback callback;
|
private Callback callback;
|
||||||
|
|
||||||
private BiMap<AdapterView, String> selectedLanguages;
|
private BiMap<AdapterView, String> selectedLanguages;
|
||||||
private String savedLanguageValue;
|
private String savedLanguageValue;
|
||||||
|
private List<String> languageCodesList=new ArrayList<>();
|
||||||
|
private List<String> languageNamesList=new ArrayList<>();
|
||||||
|
|
||||||
public DescriptionsAdapter(String savedLanguageValue) {
|
public DescriptionsAdapter(String savedLanguageValue, String userDefaultLocale) {
|
||||||
descriptions = new ArrayList<>();
|
descriptions = new ArrayList<>();
|
||||||
selectedLanguages = new BiMap<>();
|
selectedLanguages = new BiMap<>();
|
||||||
|
prepareLanguages();
|
||||||
|
this.userDefaultLocale=userDefaultLocale;
|
||||||
this.savedLanguageValue = savedLanguageValue;
|
this.savedLanguageValue = savedLanguageValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void prepareLanguages() {
|
||||||
|
List<Language> languages = getLocaleSupportedByDevice();
|
||||||
|
|
||||||
|
for(Language language: languages) {
|
||||||
|
if(!languageCodesList.contains(language.getLocale().getLanguage())) {
|
||||||
|
languageNamesList.add(language.getLocale().getDisplayName());
|
||||||
|
languageCodesList.add(language.getLocale().getLanguage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Language> getLocaleSupportedByDevice() {
|
||||||
|
List<Language> languages = new ArrayList<>();
|
||||||
|
Locale[] localesArray = Locale.getAvailableLocales();
|
||||||
|
for (Locale locale : localesArray) {
|
||||||
|
languages.add(new Language(locale));
|
||||||
|
}
|
||||||
|
|
||||||
|
Collections.sort(languages, (language, t1) -> language.getLocale().getDisplayName()
|
||||||
|
.compareTo(t1.getLocale().getDisplayName()));
|
||||||
|
return languages;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getIndexOfLanguageCode(String languageCode) {
|
||||||
|
return languageCodesList.indexOf(languageCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addDescription(Description description) {
|
||||||
|
if (description.getSelectedLanguageIndex() == -1) {
|
||||||
|
int localeIndex = 0;
|
||||||
|
String languageValue;
|
||||||
|
if (!TextUtils.isEmpty(savedLanguageValue)) {
|
||||||
|
// If user has chosen a default language from settings activity savedLanguageValue is not null
|
||||||
|
localeIndex = getIndexOfLanguageCode(savedLanguageValue);
|
||||||
|
languageValue = savedLanguageValue;
|
||||||
|
} else {
|
||||||
|
if (descriptions.isEmpty()) {//If this is the first description, lets let him add the description of his locale
|
||||||
|
localeIndex =
|
||||||
|
getIndexOfLanguageCode(
|
||||||
|
userDefaultLocale);
|
||||||
|
}
|
||||||
|
languageValue = languageCodesList.get(localeIndex);
|
||||||
|
}
|
||||||
|
description.setSelectedLanguageIndex(localeIndex);
|
||||||
|
description.setLanguageCode(languageValue);
|
||||||
|
}
|
||||||
|
this.descriptions.add(description);
|
||||||
|
notifyItemInserted(descriptions.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setCallback(Callback callback) {
|
public void setCallback(Callback callback) {
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
}
|
}
|
||||||
|
|
@ -76,11 +132,6 @@ public class DescriptionsAdapter extends RecyclerView.Adapter<DescriptionsAdapte
|
||||||
return descriptions;
|
return descriptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addDescription(Description description) {
|
|
||||||
this.descriptions.add(description);
|
|
||||||
notifyItemInserted(descriptions.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ViewHolder extends RecyclerView.ViewHolder {
|
public class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|
@ -127,7 +178,7 @@ public class DescriptionsAdapter extends RecyclerView.Adapter<DescriptionsAdapte
|
||||||
descItemEditText.addTextChangedListener(new AbstractTextWatcher(
|
descItemEditText.addTextChangedListener(new AbstractTextWatcher(
|
||||||
descriptionText -> descriptions.get(position)
|
descriptionText -> descriptions.get(position)
|
||||||
.setDescriptionText(descriptionText)));
|
.setDescriptionText(descriptionText)));
|
||||||
initLanguageSpinner(position, description);
|
initLanguageSpinner(description);
|
||||||
|
|
||||||
//If the description was manually added by the user, it deserves focus, if not, let the user decide
|
//If the description was manually added by the user, it deserves focus, if not, let the user decide
|
||||||
if (description.isManuallyAdded()) {
|
if (description.isManuallyAdded()) {
|
||||||
|
|
@ -139,14 +190,14 @@ public class DescriptionsAdapter extends RecyclerView.Adapter<DescriptionsAdapte
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extracted out the function to init the language spinner with different system supported languages
|
* Extracted out the function to init the language spinner with different system supported languages
|
||||||
* @param position
|
|
||||||
* @param description
|
* @param description
|
||||||
*/
|
*/
|
||||||
private void initLanguageSpinner(int position, Description description) {
|
private void initLanguageSpinner(Description description) {
|
||||||
SpinnerLanguagesAdapter languagesAdapter = new SpinnerLanguagesAdapter(
|
SpinnerLanguagesAdapter languagesAdapter = new SpinnerLanguagesAdapter(
|
||||||
spinnerDescriptionLanguages.getContext(),
|
spinnerDescriptionLanguages.getContext(),
|
||||||
R.layout.row_item_languages_spinner, selectedLanguages,
|
R.layout.row_item_languages_spinner, selectedLanguages);
|
||||||
savedLanguageValue);
|
languagesAdapter.setLanguageCodes(languageCodesList);
|
||||||
|
languagesAdapter.setLanguageNames(languageNamesList);
|
||||||
languagesAdapter.notifyDataSetChanged();
|
languagesAdapter.notifyDataSetChanged();
|
||||||
spinnerDescriptionLanguages.setAdapter(languagesAdapter);
|
spinnerDescriptionLanguages.setAdapter(languagesAdapter);
|
||||||
|
|
||||||
|
|
@ -169,26 +220,9 @@ public class DescriptionsAdapter extends RecyclerView.Adapter<DescriptionsAdapte
|
||||||
public void onNothingSelected(AdapterView<?> adapterView) {
|
public void onNothingSelected(AdapterView<?> adapterView) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (description.getSelectedLanguageIndex() == -1) {
|
|
||||||
if (savedLanguageValue != null) {
|
|
||||||
// If user has chosen a default language from settings activity savedLanguageValue is not null
|
|
||||||
spinnerDescriptionLanguages.setSelection(languagesAdapter.getIndexOfLanguageCode(savedLanguageValue));
|
|
||||||
} else {
|
|
||||||
if (position == 0) {
|
|
||||||
int defaultLocaleIndex = languagesAdapter
|
|
||||||
.getIndexOfUserDefaultLocale(spinnerDescriptionLanguages.getContext());
|
|
||||||
spinnerDescriptionLanguages.setSelection(defaultLocaleIndex, true);
|
|
||||||
} else {
|
|
||||||
spinnerDescriptionLanguages.setSelection(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
spinnerDescriptionLanguages.setSelection(description.getSelectedLanguageIndex());
|
spinnerDescriptionLanguages.setSelection(description.getSelectedLanguageIndex());
|
||||||
selectedLanguages.put(spinnerDescriptionLanguages, description.getLanguageCode());
|
selectedLanguages.put(spinnerDescriptionLanguages, description.getLanguageCode());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extracted out the method to get the icon drawable
|
* Extracted out the method to get the icon drawable
|
||||||
|
|
|
||||||
|
|
@ -37,49 +37,27 @@ public class SpinnerLanguagesAdapter extends ArrayAdapter {
|
||||||
private List<String> languageCodesList;
|
private List<String> languageCodesList;
|
||||||
private final BiMap<AdapterView, String> selectedLanguages;
|
private final BiMap<AdapterView, String> selectedLanguages;
|
||||||
public String selectedLangCode="";
|
public String selectedLangCode="";
|
||||||
private Context context;
|
|
||||||
private boolean dropDownClicked;
|
private boolean dropDownClicked;
|
||||||
private String savedLanguageValue;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public SpinnerLanguagesAdapter(@NonNull Context context,
|
public SpinnerLanguagesAdapter(@NonNull Context context,
|
||||||
int resource,
|
int resource,
|
||||||
BiMap<AdapterView, String> selectedLanguages,
|
BiMap<AdapterView, String> selectedLanguages) {
|
||||||
String savedLanguageValue) {
|
|
||||||
super(context, resource);
|
super(context, resource);
|
||||||
this.resource = resource;
|
this.resource = resource;
|
||||||
this.layoutInflater = LayoutInflater.from(context);
|
this.layoutInflater = LayoutInflater.from(context);
|
||||||
languageNamesList = new ArrayList<>();
|
languageNamesList = new ArrayList<>();
|
||||||
languageCodesList = new ArrayList<>();
|
languageCodesList = new ArrayList<>();
|
||||||
prepareLanguages();
|
|
||||||
this.selectedLanguages = selectedLanguages;
|
this.selectedLanguages = selectedLanguages;
|
||||||
this.context = context;
|
|
||||||
this.dropDownClicked = false;
|
this.dropDownClicked = false;
|
||||||
this.savedLanguageValue = savedLanguageValue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void prepareLanguages() {
|
public void setLanguageCodes(List<String> languageCodesList) {
|
||||||
List<Language> languages = getLocaleSupportedByDevice();
|
this.languageCodesList=languageCodesList;
|
||||||
|
|
||||||
for(Language language: languages) {
|
|
||||||
if(!languageCodesList.contains(language.getLocale().getLanguage())) {
|
|
||||||
languageNamesList.add(language.getLocale().getDisplayName());
|
|
||||||
languageCodesList.add(language.getLocale().getLanguage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Language> getLocaleSupportedByDevice() {
|
public void setLanguageNames(List<String> languageNamesList) {
|
||||||
List<Language> languages = new ArrayList<>();
|
this.languageNamesList = languageNamesList;
|
||||||
Locale[] localesArray = Locale.getAvailableLocales();
|
|
||||||
for (Locale locale : localesArray) {
|
|
||||||
languages.add(new Language(locale));
|
|
||||||
}
|
|
||||||
|
|
||||||
Collections.sort(languages, (language, t1) -> language.getLocale().getDisplayName()
|
|
||||||
.compareTo(t1.getLocale().getDisplayName()));
|
|
||||||
return languages;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -101,7 +79,7 @@ public class SpinnerLanguagesAdapter extends ArrayAdapter {
|
||||||
convertView = layoutInflater.inflate(resource, parent, false);
|
convertView = layoutInflater.inflate(resource, parent, false);
|
||||||
}
|
}
|
||||||
ViewHolder holder = new ViewHolder(convertView);
|
ViewHolder holder = new ViewHolder(convertView);
|
||||||
holder.init(position, true, savedLanguageValue);
|
holder.init(position, true);
|
||||||
|
|
||||||
dropDownClicked = true;
|
dropDownClicked = true;
|
||||||
return convertView;
|
return convertView;
|
||||||
|
|
@ -118,11 +96,10 @@ public class SpinnerLanguagesAdapter extends ArrayAdapter {
|
||||||
} else {
|
} else {
|
||||||
holder = (ViewHolder) convertView.getTag();
|
holder = (ViewHolder) convertView.getTag();
|
||||||
}
|
}
|
||||||
holder.init(position, false, savedLanguageValue);
|
holder.init(position, false);
|
||||||
return convertView;
|
return convertView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class ViewHolder {
|
public class ViewHolder {
|
||||||
|
|
||||||
@BindView(R.id.tv_language)
|
@BindView(R.id.tv_language)
|
||||||
|
|
@ -135,17 +112,12 @@ public class SpinnerLanguagesAdapter extends ArrayAdapter {
|
||||||
ButterKnife.bind(this, itemView);
|
ButterKnife.bind(this, itemView);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(int position, boolean isDropDownView, String savedLanguageValue) {
|
public void init(int position, boolean isDropDownView) {
|
||||||
String languageCode = LangCodeUtils.fixLanguageCode(languageCodesList.get(position));
|
String languageCode = LangCodeUtils.fixLanguageCode(languageCodesList.get(position));
|
||||||
final String languageName = StringUtils.capitalize(languageNamesList.get(position));
|
final String languageName = StringUtils.capitalize(languageNamesList.get(position));
|
||||||
|
|
||||||
if(savedLanguageValue.equals("")){
|
|
||||||
savedLanguageValue = Locale.getDefault().getLanguage();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isDropDownView) {
|
if (!isDropDownView) {
|
||||||
if( !dropDownClicked){
|
if( !dropDownClicked){
|
||||||
languageCode = LangCodeUtils.fixLanguageCode(savedLanguageValue);
|
languageCode = LangCodeUtils.fixLanguageCode(languageCode);
|
||||||
}
|
}
|
||||||
view.setVisibility(View.GONE);
|
view.setVisibility(View.GONE);
|
||||||
if (languageCode.length() > 2)
|
if (languageCode.length() > 2)
|
||||||
|
|
@ -172,12 +144,4 @@ public class SpinnerLanguagesAdapter extends ArrayAdapter {
|
||||||
String getLanguageCode(int position) {
|
String getLanguageCode(int position) {
|
||||||
return languageCodesList.get(position);
|
return languageCodesList.get(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
int getIndexOfUserDefaultLocale(Context context) {
|
|
||||||
return languageCodesList.indexOf(context.getResources().getConfiguration().locale.getLanguage());
|
|
||||||
}
|
|
||||||
|
|
||||||
int getIndexOfLanguageCode(String languageCode) {
|
|
||||||
return languageCodesList.indexOf(languageCode);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -264,7 +264,6 @@ public class UploadModel {
|
||||||
this.createdTimestampSource = createdTimestampSource;
|
this.createdTimestampSource = createdTimestampSource;
|
||||||
title = new Title();
|
title = new Title();
|
||||||
descriptions = new ArrayList<>();
|
descriptions = new ArrayList<>();
|
||||||
descriptions.add(new Description());
|
|
||||||
this.place = place;
|
this.place = place;
|
||||||
this.mediaUri = mediaUri;
|
this.mediaUri = mediaUri;
|
||||||
this.mimeType = mimeType;
|
this.mimeType = mimeType;
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
package fr.free.nrw.commons.upload.mediaDetails;
|
package fr.free.nrw.commons.upload.mediaDetails;
|
||||||
|
|
||||||
|
import static fr.free.nrw.commons.utils.ImageUtils.getErrorMessageForResult;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.util.Log;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
@ -13,30 +13,17 @@ import android.view.ViewGroup;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.widget.AppCompatButton;
|
import androidx.appcompat.widget.AppCompatButton;
|
||||||
import androidx.appcompat.widget.AppCompatImageButton;
|
import androidx.appcompat.widget.AppCompatImageButton;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.github.chrisbanes.photoview.OnScaleChangedListener;
|
|
||||||
import com.github.chrisbanes.photoview.PhotoView;
|
|
||||||
import com.jakewharton.rxbinding2.widget.RxTextView;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Named;
|
|
||||||
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import butterknife.OnClick;
|
import butterknife.OnClick;
|
||||||
|
import com.github.chrisbanes.photoview.PhotoView;
|
||||||
|
import com.jakewharton.rxbinding2.widget.RxTextView;
|
||||||
import fr.free.nrw.commons.R;
|
import fr.free.nrw.commons.R;
|
||||||
import fr.free.nrw.commons.Utils;
|
import fr.free.nrw.commons.Utils;
|
||||||
import fr.free.nrw.commons.filepicker.UploadableFile;
|
import fr.free.nrw.commons.filepicker.UploadableFile;
|
||||||
|
|
@ -55,10 +42,14 @@ import fr.free.nrw.commons.utils.DialogUtil;
|
||||||
import fr.free.nrw.commons.utils.ImageUtils;
|
import fr.free.nrw.commons.utils.ImageUtils;
|
||||||
import fr.free.nrw.commons.utils.ViewUtil;
|
import fr.free.nrw.commons.utils.ViewUtil;
|
||||||
import io.reactivex.disposables.Disposable;
|
import io.reactivex.disposables.Disposable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Named;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import timber.log.Timber;
|
import timber.log.Timber;
|
||||||
|
|
||||||
import static fr.free.nrw.commons.utils.ImageUtils.getErrorMessageForResult;
|
|
||||||
|
|
||||||
public class UploadMediaDetailFragment extends UploadBaseFragment implements
|
public class UploadMediaDetailFragment extends UploadBaseFragment implements
|
||||||
UploadMediaDetailsContract.View {
|
UploadMediaDetailsContract.View {
|
||||||
|
|
||||||
|
|
@ -222,12 +213,20 @@ public class UploadMediaDetailFragment extends UploadBaseFragment implements
|
||||||
* init the recycler veiw
|
* init the recycler veiw
|
||||||
*/
|
*/
|
||||||
private void initRecyclerView() {
|
private void initRecyclerView() {
|
||||||
descriptionsAdapter = new DescriptionsAdapter(defaultKvStore.getString(Prefs.KEY_LANGUAGE_VALUE,""));
|
descriptionsAdapter = new DescriptionsAdapter(defaultKvStore.getString(Prefs.KEY_LANGUAGE_VALUE,""),getUserDefaultLocale());
|
||||||
descriptionsAdapter.setCallback(this::showInfoAlert);
|
descriptionsAdapter.setCallback(this::showInfoAlert);
|
||||||
rvDescriptions.setLayoutManager(new LinearLayoutManager(getContext()));
|
rvDescriptions.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||||
rvDescriptions.setAdapter(descriptionsAdapter);
|
rvDescriptions.setAdapter(descriptionsAdapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns the default locale value of the user's device
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String getUserDefaultLocale() {
|
||||||
|
return getContext().getResources().getConfiguration().locale.getLanguage();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* show dialog with info
|
* show dialog with info
|
||||||
* @param titleStringID
|
* @param titleStringID
|
||||||
|
|
@ -399,12 +398,11 @@ public class UploadMediaDetailFragment extends UploadBaseFragment implements
|
||||||
if (descriptions == null) {
|
if (descriptions == null) {
|
||||||
descriptions = new ArrayList<>();
|
descriptions = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (descriptions.size() == 0) {
|
if (descriptions.size() == 0) {
|
||||||
descriptions.add(new Description());
|
descriptionsAdapter.addDescription(new Description());
|
||||||
}
|
} else {
|
||||||
|
|
||||||
descriptionsAdapter.setItems(descriptions);
|
descriptionsAdapter.setItems(descriptions);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue