From bfbb29b2cf8df7fa71ccc59ad4a49fd23a63b9f2 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 6 Jun 2019 16:33:22 +0200 Subject: [PATCH] Theme FAB menu --- .../home/room/list/widget/FabMenuView.kt | 6 +++++ .../features/themes/ThemeUtils.kt | 14 +++++----- .../vector_label_background_black.xml | 13 +++++++++ .../drawable/vector_label_background_dark.xml | 13 +++++++++ ....xml => vector_label_background_light.xml} | 2 +- .../layout/constraint_set_fab_menu_close.xml | 3 +-- .../layout/constraint_set_fab_menu_open.xml | 3 +-- .../main/res/layout/merge_fab_menu_view.xml | 12 ++++----- vector/src/main/res/values/colors_riotx.xml | 27 ++++++++++++++++++- vector/src/main/res/values/styles_riot.xml | 5 ++-- vector/src/main/res/values/theme_black.xml | 5 ++++ vector/src/main/res/values/theme_dark.xml | 5 ++++ vector/src/main/res/values/theme_light.xml | 5 ++++ vector/src/main/res/values/theme_status.xml | 3 ++- 14 files changed, 94 insertions(+), 22 deletions(-) create mode 100644 vector/src/main/res/drawable/vector_label_background_black.xml create mode 100644 vector/src/main/res/drawable/vector_label_background_dark.xml rename vector/src/main/res/drawable/{vector_label_background.xml => vector_label_background_light.xml} (80%) diff --git a/vector/src/main/java/im/vector/riotredesign/features/home/room/list/widget/FabMenuView.kt b/vector/src/main/java/im/vector/riotredesign/features/home/room/list/widget/FabMenuView.kt index 525efb06..95b7179c 100644 --- a/vector/src/main/java/im/vector/riotredesign/features/home/room/list/widget/FabMenuView.kt +++ b/vector/src/main/java/im/vector/riotredesign/features/home/room/list/widget/FabMenuView.kt @@ -29,6 +29,7 @@ import im.vector.riotredesign.R import im.vector.riotredesign.core.animations.ANIMATION_DURATION_SHORT import im.vector.riotredesign.core.animations.SimpleTransitionListener import im.vector.riotredesign.core.animations.VectorFullTransitionSet +import im.vector.riotredesign.features.themes.ThemeUtils import kotlinx.android.synthetic.main.merge_fab_menu_view.view.* class FabMenuView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, @@ -57,6 +58,11 @@ class FabMenuView @JvmOverloads constructor(context: Context, attrs: AttributeSe createRoomItemGroupLabel.isVisible = false // Collapse end + // Tint label background + listOf(createRoomItemChatLabel, createRoomItemGroupLabel) + .forEach { + it.setBackgroundResource(ThemeUtils.getResourceId(context, R.drawable.vector_label_background_light)) + } createRoomButton.setOnClickListener { toggleFabMenu() diff --git a/vector/src/main/java/im/vector/riotredesign/features/themes/ThemeUtils.kt b/vector/src/main/java/im/vector/riotredesign/features/themes/ThemeUtils.kt index ecb918ed..e199d508 100644 --- a/vector/src/main/java/im/vector/riotredesign/features/themes/ThemeUtils.kt +++ b/vector/src/main/java/im/vector/riotredesign/features/themes/ThemeUtils.kt @@ -184,9 +184,10 @@ object ThemeUtils { THEME_LIGHT_VALUE -> resourceId THEME_DARK_VALUE -> { return when (resourceId) { - R.drawable.bg_search_edit_text_light -> R.drawable.bg_search_edit_text_dark - R.drawable.bg_unread_notification_light -> R.drawable.bg_unread_notification_dark - else -> { + R.drawable.bg_search_edit_text_light -> R.drawable.bg_search_edit_text_dark + R.drawable.bg_unread_notification_light -> R.drawable.bg_unread_notification_dark + R.drawable.vector_label_background_light -> R.drawable.vector_label_background_dark + else -> { Timber.w("Warning, missing case for wanted drawable in dark theme") resourceId } @@ -194,9 +195,10 @@ object ThemeUtils { } THEME_BLACK_VALUE -> { return when (resourceId) { - R.drawable.bg_search_edit_text_light -> R.drawable.bg_search_edit_text_black - R.drawable.bg_unread_notification_light -> R.drawable.bg_unread_notification_black - else -> { + R.drawable.bg_search_edit_text_light -> R.drawable.bg_search_edit_text_black + R.drawable.bg_unread_notification_light -> R.drawable.bg_unread_notification_black + R.drawable.vector_label_background_light -> R.drawable.vector_label_background_black + else -> { Timber.w("Warning, missing case for wanted drawable in black theme") resourceId } diff --git a/vector/src/main/res/drawable/vector_label_background_black.xml b/vector/src/main/res/drawable/vector_label_background_black.xml new file mode 100644 index 00000000..dc85b060 --- /dev/null +++ b/vector/src/main/res/drawable/vector_label_background_black.xml @@ -0,0 +1,13 @@ + + + + + + + + + + \ No newline at end of file diff --git a/vector/src/main/res/drawable/vector_label_background_dark.xml b/vector/src/main/res/drawable/vector_label_background_dark.xml new file mode 100644 index 00000000..1e375fbf --- /dev/null +++ b/vector/src/main/res/drawable/vector_label_background_dark.xml @@ -0,0 +1,13 @@ + + + + + + + + + + \ No newline at end of file diff --git a/vector/src/main/res/drawable/vector_label_background.xml b/vector/src/main/res/drawable/vector_label_background_light.xml similarity index 80% rename from vector/src/main/res/drawable/vector_label_background.xml rename to vector/src/main/res/drawable/vector_label_background_light.xml index 6e0f1c85..b09b0c7d 100644 --- a/vector/src/main/res/drawable/vector_label_background.xml +++ b/vector/src/main/res/drawable/vector_label_background_light.xml @@ -4,7 +4,7 @@ - + diff --git a/vector/src/main/res/layout/constraint_set_fab_menu_open.xml b/vector/src/main/res/layout/constraint_set_fab_menu_open.xml index 8aac13b6..fc47458e 100644 --- a/vector/src/main/res/layout/constraint_set_fab_menu_open.xml +++ b/vector/src/main/res/layout/constraint_set_fab_menu_open.xml @@ -8,8 +8,7 @@ android:id="@+id/createRoomTouchGuard" android:layout_width="match_parent" android:layout_height="match_parent" - android:alpha="0.5" - android:background="#323232" /> + android:background="?riotx_touch_guard_bg" /> + android:background="?riotx_touch_guard_bg" /> @@ -46,10 +44,10 @@ android:layout_gravity="bottom|end" android:src="@drawable/ic_fab_add_chat" android:visibility="gone" - app:backgroundTint="#FFFFFF" + app:backgroundTint="?riotx_fab_secondary_bg" app:fabCustomSize="48dp" app:maxImageSize="29dp" - app:tint="@color/black" + app:tint="?riotx_fab_secondary_color" tools:ignore="MissingConstraints" tools:visibility="visible" /> diff --git a/vector/src/main/res/values/colors_riotx.xml b/vector/src/main/res/values/colors_riotx.xml index 523f967d..3ea2d51c 100644 --- a/vector/src/main/res/values/colors_riotx.xml +++ b/vector/src/main/res/values/colors_riotx.xml @@ -119,8 +119,33 @@ #FF61708B - #FF181B21 + #FF61708B #FF61708B + + @color/white + #FF181B21 + #FF181B21 + + + @color/black + @color/white + @color/white + + + @color/white + #FF181B21 + #FF181B21 + + + #FF2E2F32 + #FFA1B2D1 + #FFA1B2D1 + + + #66000000 + #BF000000 + #BF000000 + \ No newline at end of file diff --git a/vector/src/main/res/values/styles_riot.xml b/vector/src/main/res/values/styles_riot.xml index 9504d41d..9b950b20 100644 --- a/vector/src/main/res/values/styles_riot.xml +++ b/vector/src/main/res/values/styles_riot.xml @@ -274,8 +274,9 @@ 4dp 4dp 15sp - ?riotx_text_primary - @drawable/vector_label_background + ?riotx_fab_label_color + + @drawable/vector_label_background_light \ No newline at end of file diff --git a/vector/src/main/res/values/theme_black.xml b/vector/src/main/res/values/theme_black.xml index 95d13175..8c1afb69 100644 --- a/vector/src/main/res/values/theme_black.xml +++ b/vector/src/main/res/values/theme_black.xml @@ -25,6 +25,11 @@ @color/riotx_android_status_bar_black @color/riotx_line_break_mobile_black @color/riotx_unread_room_badge_black + @color/riotx_fab_secondary_bg_black + @color/riotx_fab_secondary_color_black + @color/riotx_fab_label_bg_black + @color/riotx_fab_label_color_black + @color/riotx_touch_guard_bg_black @color/riotx_accent diff --git a/vector/src/main/res/values/theme_dark.xml b/vector/src/main/res/values/theme_dark.xml index d542d8ab..9d9b1ec6 100644 --- a/vector/src/main/res/values/theme_dark.xml +++ b/vector/src/main/res/values/theme_dark.xml @@ -23,6 +23,11 @@ @color/riotx_android_status_bar_dark @color/riotx_line_break_mobile_dark @color/riotx_unread_room_badge_dark + @color/riotx_fab_secondary_bg_dark + @color/riotx_fab_secondary_color_dark + @color/riotx_fab_label_bg_dark + @color/riotx_fab_label_color_dark + @color/riotx_touch_guard_bg_dark @color/riotx_accent diff --git a/vector/src/main/res/values/theme_light.xml b/vector/src/main/res/values/theme_light.xml index c724f097..006f026e 100644 --- a/vector/src/main/res/values/theme_light.xml +++ b/vector/src/main/res/values/theme_light.xml @@ -23,6 +23,11 @@ @color/riotx_android_status_bar_light @color/riotx_line_break_mobile_light @color/riotx_unread_room_badge_light + @color/riotx_fab_secondary_bg_light + @color/riotx_fab_secondary_color_light + @color/riotx_fab_label_bg_light + @color/riotx_fab_label_color_light + @color/riotx_touch_guard_bg_light @color/riotx_accent diff --git a/vector/src/main/res/values/theme_status.xml b/vector/src/main/res/values/theme_status.xml index a48ffda7..dd4397a1 100644 --- a/vector/src/main/res/values/theme_status.xml +++ b/vector/src/main/res/values/theme_status.xml @@ -3,7 +3,8 @@ -