mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
fix edit categories ui (#4414)
Co-authored-by: Pratham2305 <Pratham2305@users.noreply.github.com>
This commit is contained in:
parent
3494fd05a2
commit
22f61195b2
2 changed files with 118 additions and 104 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,114 +1,119 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
|
||||
android:id="@+id/category_edit_layout"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="15dp"
|
||||
android:orientation="vertical"
|
||||
android:background="?attr/mainBackground"
|
||||
android:elevation="30dp">
|
||||
<ScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_subtitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/half_standard_height"
|
||||
android:layout_margin="@dimen/quarter_standard_height"
|
||||
android:gravity="center_vertical"
|
||||
android:text="Type categories"
|
||||
android:textSize="@dimen/subtitle_text"
|
||||
android:visibility="visible" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/category_search_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/standard_gap"
|
||||
>
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/til_container_search"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<SearchView
|
||||
android:id="@+id/et_search"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/categories_search_text_hint"
|
||||
android:imeOptions="actionSearch"
|
||||
android:inputType="text"
|
||||
android:maxLines="1"/>
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/pb_categories"
|
||||
style="?android:progressBarStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/tiny_gap"
|
||||
android:layout_marginRight="@dimen/tiny_gap"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:indeterminate="true"
|
||||
android:indeterminateOnly="true"
|
||||
android:visibility="gone" />
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/existing_categories"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/quarter_standard_height"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="@dimen/subtitle_text"
|
||||
android:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/no_results_found"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/quarter_standard_height"
|
||||
android:gravity="center_vertical"
|
||||
android:text="No results found"
|
||||
android:textSize="@dimen/description_text_size"
|
||||
android:visibility="gone" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/category_edit_layout"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="15dp"
|
||||
android:orientation="vertical"
|
||||
android:weightSum="6"
|
||||
>
|
||||
android:background="?attr/mainBackground"
|
||||
android:elevation="30dp">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_categories"
|
||||
<TextView
|
||||
android:id="@+id/tv_subtitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/half_standard_height"
|
||||
android:layout_margin="@dimen/quarter_standard_height"
|
||||
android:gravity="center_vertical"
|
||||
android:text="Type categories"
|
||||
android:textSize="@dimen/subtitle_text"
|
||||
android:visibility="visible" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/category_search_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="4"
|
||||
android:background="?attr/mainBackground"/>
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/standard_gap"
|
||||
>
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/til_container_search"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<SearchView
|
||||
android:id="@+id/et_search"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:queryHint="@string/categories_search_text_hint"
|
||||
android:iconifiedByDefault="false"
|
||||
android:imeOptions="actionSearch"
|
||||
android:inputType="text"
|
||||
android:maxLines="1"/>
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/pb_categories"
|
||||
style="?android:progressBarStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/tiny_gap"
|
||||
android:layout_marginRight="@dimen/tiny_gap"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:indeterminate="true"
|
||||
android:indeterminateOnly="true"
|
||||
android:visibility="gone" />
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/existing_categories"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/quarter_standard_height"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="@dimen/subtitle_text"
|
||||
android:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/no_results_found"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/quarter_standard_height"
|
||||
android:gravity="center_vertical"
|
||||
android:text="No results found"
|
||||
android:textSize="@dimen/description_text_size"
|
||||
android:visibility="gone" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="2">
|
||||
<Button
|
||||
android:id="@+id/cancel_categories_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_margin="@dimen/quarter_standard_height"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/cancel"
|
||||
android:padding="@dimen/small_gap"
|
||||
android:textColor="@color/white"
|
||||
android:background="@color/opak_middle_grey"
|
||||
/>
|
||||
<Button
|
||||
android:id="@+id/update_categories_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_margin="@dimen/quarter_standard_height"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/category_edit_button_text"
|
||||
android:padding="@dimen/small_gap"
|
||||
android:textColor="@color/white"
|
||||
android:background="@color/button_blue"
|
||||
/>
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_categories"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dimen_200"
|
||||
android:background="?attr/mainBackground"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<Button
|
||||
android:id="@+id/cancel_categories_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_margin="@dimen/quarter_standard_height"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/cancel"
|
||||
android:padding="@dimen/small_gap"
|
||||
android:textColor="@color/white"
|
||||
android:background="@color/opak_middle_grey"
|
||||
/>
|
||||
<Button
|
||||
android:id="@+id/update_categories_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_margin="@dimen/quarter_standard_height"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/category_edit_button_text"
|
||||
android:padding="@dimen/small_gap"
|
||||
android:textColor="@color/white"
|
||||
android:background="@color/button_blue"
|
||||
/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
Loading…
Add table
Add a link
Reference in a new issue