[android] add eye icons for list visibility, align & simplify fragments

Signed-off-by: Harry Bond <hrbond@pm.me>
This commit is contained in:
Harry Bond 2024-03-20 19:11:26 +00:00 committed by Alexander Borsuk
parent eb61c276d0
commit 6bc60811d1
10 changed files with 43 additions and 92 deletions

View file

@ -84,7 +84,7 @@ public class BookmarkCategoriesAdapter extends BaseBookmarkCategoryAdapter<Recyc
}
case TYPE_ACTION_ADD ->
{
View item = inflater.inflate(R.layout.item_bookmark_create_group, parent, false);
View item = inflater.inflate(R.layout.item_bookmark_button, parent, false);
item.setOnClickListener(v -> {
if (mCategoryListCallback != null)
mCategoryListCallback.onAddButtonClick();
@ -93,7 +93,7 @@ public class BookmarkCategoriesAdapter extends BaseBookmarkCategoryAdapter<Recyc
}
case TYPE_ACTION_IMPORT ->
{
View item = inflater.inflate(R.layout.item_bookmark_import, parent, false);
View item = inflater.inflate(R.layout.item_bookmark_button, parent, false);
item.setOnClickListener(v -> {
if (mCategoryListCallback != null)
mCategoryListCallback.onImportButtonClick();
@ -102,7 +102,7 @@ public class BookmarkCategoriesAdapter extends BaseBookmarkCategoryAdapter<Recyc
}
case TYPE_ACTION_EXPORT_ALL_AS_KMZ ->
{
View item = inflater.inflate(R.layout.item_bookmark_export, parent, false);
View item = inflater.inflate(R.layout.item_bookmark_button, parent, false);
item.setOnClickListener(v -> {
if (mCategoryListCallback != null)
mCategoryListCallback.onExportButtonClick();

View file

@ -281,9 +281,6 @@ public class Holders
mName = root.findViewById(R.id.name);
mVisibilityMarker = root.findViewById(R.id.checkbox);
mMoreButton = root.findViewById(R.id.more);
int left = root.getResources().getDimensionPixelOffset(R.dimen.margin_half_plus);
int right = root.getResources().getDimensionPixelOffset(R.dimen.margin_base_plus);
UiUtils.expandTouchAreaForView(mVisibilityMarker, 0, left, 0, right);
}
void setVisibilityState(boolean visible)

View file

@ -3,5 +3,8 @@
<item android:color="@color/base_accent"
android:state_selected="true"/>
<item android:color="@color/text_dark_subtitle"/>
<item android:color="@color/base_accent"
android:state_checked="true"/>
<item android:color="@color/text_dark_hint"/>
</selector>

View file

@ -3,5 +3,8 @@
<item android:color="@color/base_accent_night"
android:state_selected="true"/>
<item android:color="@color/text_light_subtitle"/>
<item android:color="@color/base_accent_night"
android:state_checked="true"/>
<item android:color="@color/text_light_hint"/>
</selector>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<inset xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/visibility_selector"
android:insetLeft="12dp" />

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="@drawable/ic_hide"
android:state_checked="false"/>
<item android:drawable="@drawable/ic_show"
android:state_checked="true"/>
</selector>

View file

@ -2,28 +2,27 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
android:paddingStart="@dimen/margin_base"
android:paddingEnd="@dimen/margin_base"
android:paddingBottom="@dimen/margin_half_plus"
android:paddingTop="@dimen/margin_half_plus">
android:paddingStart="@dimen/margin_quarter"
android:paddingEnd="@dimen/dp_0"
android:paddingVertical="@dimen/margin_half_plus">
<ImageView
android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_width="@dimen/nav_icon_size"
android:layout_height="wrap_content"
app:srcCompat="@drawable/ic_import"
tools:srcCompat="@drawable/ic_import"
app:tint="?colorAccent"/>
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/margin_half"
android:fontFamily="@string/robotoMedium"
android:text="@string/bookmarks_import"
tools:text="Some text should go here"
android:textAllCaps="true"
android:textAppearance="@style/MwmTextAppearance.Body3"
android:textColor="?colorAccent"/>

View file

@ -4,20 +4,19 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?clickableBackground"
android:gravity="center_vertical">
android:layout_height="@dimen/height_item_edit_bookmark"
android:background="?clickableBackground">
<CheckBox
android:id="@+id/checkbox"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/margin_half_plus"
android:layout_marginEnd="0dp"
android:minWidth="@dimen/bookmark_category_checkbox_width" />
android:id="@+id/checkbox"
android:layout_width="@dimen/margin_double_plus"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/margin_quarter"
android:button="@drawable/button_visibility_centre_inset"
android:background="@null"
android:buttonTint="?accentColorSelector" />
<TextView
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_base"
android:layout_toStartOf="@id/more"
@ -48,12 +47,11 @@
<ImageView
android:id="@+id/more"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentEnd="true"
android:background="?selectableItemBackgroundBorderless"
android:minHeight="@dimen/height_item_edit_bookmark"
android:paddingStart="@dimen/margin_quarter"
android:paddingEnd="@dimen/margin_half"
android:paddingHorizontal="@dimen/margin_half"
app:srcCompat="@drawable/ic_more"
app:tint="?secondary" />
app:tint="?secondary"
android:importantForAccessibility="no" />
</RelativeLayout>

View file

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
android:paddingStart="@dimen/margin_base"
android:paddingEnd="@dimen/margin_base"
android:paddingBottom="@dimen/margin_half_plus"
android:paddingTop="@dimen/margin_half_plus">
<ImageView
android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@drawable/ic_import"
app:tint="?colorAccent"/>
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/margin_half"
android:fontFamily="@string/robotoMedium"
android:text="@string/bookmarks_create_new_group"
android:textAllCaps="true"
android:textAppearance="@style/MwmTextAppearance.Body3"
android:textColor="?colorAccent"/>
</LinearLayout>

View file

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
android:paddingStart="@dimen/margin_base"
android:paddingEnd="@dimen/margin_base"
android:paddingBottom="@dimen/margin_half_plus"
android:paddingTop="@dimen/margin_half_plus">
<ImageView
android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@drawable/ic_export"
app:tint="?colorAccent"/>
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/margin_half"
android:fontFamily="@string/robotoMedium"
android:text="@string/bookmarks_export"
android:textAllCaps="true"
android:textAppearance="@style/MwmTextAppearance.Body3"
android:textColor="?colorAccent"/>
</LinearLayout>