mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +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());
|
categoryEditSearchRecyclerViewAdapter.addToCategories(media.getCategories());
|
||||||
updateSelectedCategoriesTextView(categoryEditSearchRecyclerViewAdapter.getCategories());
|
updateSelectedCategoriesTextView(categoryEditSearchRecyclerViewAdapter.getCategories());
|
||||||
|
|
||||||
|
categoryRecyclerView.setVisibility(GONE);
|
||||||
updateCategoryList();
|
updateCategoryList();
|
||||||
|
|
||||||
if (media.getAuthor() == null || media.getAuthor().equals("")) {
|
if (media.getAuthor() == null || media.getAuthor().equals("")) {
|
||||||
|
|
@ -661,20 +662,28 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment implements
|
||||||
public void updateSelectedCategoriesTextView(List<String> selectedCategories) {
|
public void updateSelectedCategoriesTextView(List<String> selectedCategories) {
|
||||||
if (selectedCategories == null || selectedCategories.size() == 0) {
|
if (selectedCategories == null || selectedCategories.size() == 0) {
|
||||||
updateCategoriesButton.setClickable(false);
|
updateCategoriesButton.setClickable(false);
|
||||||
}
|
updateCategoriesButton.setAlpha(.5f);
|
||||||
if (selectedCategories != null) {
|
} else {
|
||||||
existingCategories.setText(StringUtils.join(selectedCategories,", "));
|
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
|
@Override
|
||||||
public void noResultsFound() {
|
public void noResultsFound() {
|
||||||
|
categoryRecyclerView.setVisibility(GONE);
|
||||||
noResultsFound.setVisibility(VISIBLE);
|
noResultsFound.setVisibility(VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void someResultsFound() {
|
public void someResultsFound() {
|
||||||
|
categoryRecyclerView.setVisibility(VISIBLE);
|
||||||
noResultsFound.setVisibility(GONE);
|
noResultsFound.setVisibility(GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,114 +1,119 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout
|
<ScrollView
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/category_edit_layout"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content">
|
||||||
android:layout_margin="15dp"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:background="?attr/mainBackground"
|
|
||||||
android:elevation="30dp">
|
|
||||||
|
|
||||||
<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
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
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:orientation="vertical"
|
||||||
android:weightSum="6"
|
android:background="?attr/mainBackground"
|
||||||
>
|
android:elevation="30dp">
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<TextView
|
||||||
android:id="@+id/rv_categories"
|
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_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="4"
|
android:layout_marginTop="@dimen/standard_gap"
|
||||||
android:background="?attr/mainBackground"/>
|
>
|
||||||
|
<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
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="2">
|
android:orientation="vertical"
|
||||||
<Button
|
>
|
||||||
android:id="@+id/cancel_categories_button"
|
|
||||||
android:layout_width="wrap_content"
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:layout_margin="@dimen/quarter_standard_height"
|
android:id="@+id/rv_categories"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:text="@string/cancel"
|
android:layout_height="@dimen/dimen_200"
|
||||||
android:padding="@dimen/small_gap"
|
android:background="?attr/mainBackground"/>
|
||||||
android:textColor="@color/white"
|
|
||||||
android:background="@color/opak_middle_grey"
|
<LinearLayout
|
||||||
/>
|
android:layout_width="match_parent"
|
||||||
<Button
|
android:layout_height="wrap_content">
|
||||||
android:id="@+id/update_categories_button"
|
<Button
|
||||||
android:layout_width="wrap_content"
|
android:id="@+id/cancel_categories_button"
|
||||||
android:layout_margin="@dimen/quarter_standard_height"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_margin="@dimen/quarter_standard_height"
|
||||||
android:text="@string/category_edit_button_text"
|
android:layout_height="wrap_content"
|
||||||
android:padding="@dimen/small_gap"
|
android:text="@string/cancel"
|
||||||
android:textColor="@color/white"
|
android:padding="@dimen/small_gap"
|
||||||
android:background="@color/button_blue"
|
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>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</ScrollView>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue