From 907fcb4cb1cad3eb4e2897fc9f69338a639ead9d Mon Sep 17 00:00:00 2001 From: "Daniele Verducci (Slimpenguin)" Date: Sat, 15 Jan 2022 08:49:44 +0100 Subject: [PATCH] issue 9: Button color for sorting uses app accent --- .idea/misc.xml | 1 + .../main/SortingOrderDialogFragment.java | 5 +-- .../res/layout/sorting_order_fragment.xml | 33 ++++++++++++------- app/src/main/res/values/colors.xml | 4 +++ 4 files changed, 30 insertions(+), 13 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index d29dea7..2b5ef9f 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -13,6 +13,7 @@ + diff --git a/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/main/SortingOrderDialogFragment.java b/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/main/SortingOrderDialogFragment.java index afbc762..82d9cc8 100644 --- a/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/main/SortingOrderDialogFragment.java +++ b/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/main/SortingOrderDialogFragment.java @@ -32,6 +32,7 @@ import android.widget.ImageButton; import android.widget.TextView; import androidx.annotation.NonNull; +import androidx.core.content.ContextCompat; import androidx.core.graphics.drawable.DrawableCompat; import androidx.fragment.app.DialogFragment; @@ -130,10 +131,10 @@ public class SortingOrderDialogFragment extends DialogFragment { if (view instanceof ImageButton) { Drawable normalDrawable = ((ImageButton) view).getDrawable(); Drawable wrapDrawable = DrawableCompat.wrap(normalDrawable); - DrawableCompat.setTint(wrapDrawable, this.getResources().getColor(R.color.defaultTint)); + DrawableCompat.setTint(wrapDrawable, ContextCompat.getColor(getContext(), R.color.selector_item_selected)); } if (view instanceof TextView) { - ((TextView)view).setTextColor(this.getResources().getColor(R.color.defaultTint)); + ((TextView)view).setTextColor(ContextCompat.getColor(getContext(), R.color.selector_item_selected)); ((TextView)view).setTypeface(Typeface.DEFAULT_BOLD); } } diff --git a/app/src/main/res/layout/sorting_order_fragment.xml b/app/src/main/res/layout/sorting_order_fragment.xml index 386b0a8..f28189f 100644 --- a/app/src/main/res/layout/sorting_order_fragment.xml +++ b/app/src/main/res/layout/sorting_order_fragment.xml @@ -16,8 +16,9 @@ ~ along with this program. If not, see . --> + android:text="@string/sort_by" + android:textColor="@color/defaultBrand"/> + android:src="@drawable/ic_alphabetical_asc" + app:tint="@color/selector_item_unselected"/> + android:textSize="@dimen/two_line_primary_text_size" + android:textColor="@color/selector_item_unselected"/> @@ -92,7 +96,8 @@ android:paddingEnd="@dimen/standard_half_padding" android:paddingBottom="@dimen/standard_half_padding" android:contentDescription="@string/menu_item_sort_by_date_newest_first" - android:src="@drawable/ic_modification_asc"/> + android:src="@drawable/ic_modification_asc" + app:tint="@color/selector_item_unselected"/> + android:textSize="@dimen/two_line_primary_text_size" + android:textColor="@color/selector_item_unselected" /> @@ -127,7 +133,8 @@ android:paddingEnd="@dimen/standard_half_padding" android:paddingBottom="@dimen/standard_half_padding" android:contentDescription="@string/menu_item_sort_by_category_a_z" - android:src="@drawable/ic_category_asc"/> + android:src="@drawable/ic_category_asc" + app:tint="@color/selector_item_unselected"/> + android:textSize="@dimen/two_line_primary_text_size" + android:textColor="@color/selector_item_unselected" /> @@ -163,7 +171,8 @@ android:paddingEnd="@dimen/standard_half_padding" android:paddingBottom="@dimen/standard_half_padding" android:contentDescription="@string/menu_item_sort_by_distance_nearest_first" - android:src="@drawable/ic_distance_asc"/> + android:src="@drawable/ic_distance_asc" + app:tint="@color/selector_item_unselected"/> + android:textSize="@dimen/two_line_primary_text_size" + android:textColor="@color/selector_item_unselected" /> @@ -196,7 +206,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/common_cancel" - android:layout_marginTop="@dimen/standard_half_margin"/> + android:layout_marginTop="@dimen/standard_half_margin" + style="@style/Widget.AppCompat.Button.Colored"/> diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index e714b9d..76c623d 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -30,6 +30,10 @@ #333333 #666666 + + @color/defaultBrand + #666666 + #fff #cfff