Fixed issue with "Copy previous captions & descriptions". (#4109)

* Fixed issue with "Copy previous captions & descriptions".

* Added comments and also fixed the styling issue.

Co-authored-by: Pratham2305 <Pratham2305@users.noreply.github.com>
This commit is contained in:
Pratham Pahariya 2020-12-27 16:18:57 +05:30 committed by GitHub
parent 170ecaa570
commit 5bdb21cb3e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -179,12 +179,20 @@ public class UploadMediaDetailAdapter extends RecyclerView.Adapter<UploadMediaDe
// 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);
//Checking whether Language Code attribute is null or not.
if(uploadMediaDetails.get(position).getLanguageCode() != null){
//If it is not null that means it is fetching details from the previous upload (i.e. when user has pressed copy previous caption & description)
//hence providing same language code for the current upload.
spinnerDescriptionLanguages.setSelection(languagesAdapter
.getIndexOfLanguageCode(uploadMediaDetails.get(position).getLanguageCode()), true);
} else {
spinnerDescriptionLanguages.setSelection(0,true);
if (position == 0) {
int defaultLocaleIndex = languagesAdapter
.getIndexOfUserDefaultLocale(spinnerDescriptionLanguages.getContext());
spinnerDescriptionLanguages.setSelection(defaultLocaleIndex, true);
} else {
spinnerDescriptionLanguages.setSelection(0,true);
}
}
}