fix edit categories ui (#4414)

Co-authored-by: Pratham2305 <Pratham2305@users.noreply.github.com>
This commit is contained in:
Pratham Pahariya 2021-06-17 18:19:09 +05:30 committed by GitHub
parent 3494fd05a2
commit 22f61195b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 118 additions and 104 deletions

View file

@ -626,6 +626,7 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment implements
categoryEditSearchRecyclerViewAdapter.addToCategories(media.getCategories());
updateSelectedCategoriesTextView(categoryEditSearchRecyclerViewAdapter.getCategories());
categoryRecyclerView.setVisibility(GONE);
updateCategoryList();
if (media.getAuthor() == null || media.getAuthor().equals("")) {
@ -661,20 +662,28 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment implements
public void updateSelectedCategoriesTextView(List<String> selectedCategories) {
if (selectedCategories == null || selectedCategories.size() == 0) {
updateCategoriesButton.setClickable(false);
}
if (selectedCategories != null) {
updateCategoriesButton.setAlpha(.5f);
} else {
existingCategories.setText(StringUtils.join(selectedCategories,", "));
updateCategoriesButton.setClickable(true);
if (selectedCategories.equals(media.getCategories())) {
updateCategoriesButton.setClickable(false);
updateCategoriesButton.setAlpha(.5f);
} else {
updateCategoriesButton.setClickable(true);
updateCategoriesButton.setAlpha(1f);
}
}
}
@Override
public void noResultsFound() {
categoryRecyclerView.setVisibility(GONE);
noResultsFound.setVisibility(VISIBLE);
}
@Override
public void someResultsFound() {
categoryRecyclerView.setVisibility(VISIBLE);
noResultsFound.setVisibility(GONE);
}