diff --git a/vector/src/main/java/im/vector/riotredesign/features/home/room/detail/timeline/factory/MessageItemFactory.kt b/vector/src/main/java/im/vector/riotredesign/features/home/room/detail/timeline/factory/MessageItemFactory.kt index 25d1995d39..d61848af6d 100644 --- a/vector/src/main/java/im/vector/riotredesign/features/home/room/detail/timeline/factory/MessageItemFactory.kt +++ b/vector/src/main/java/im/vector/riotredesign/features/home/room/detail/timeline/factory/MessageItemFactory.kt @@ -375,7 +375,7 @@ class MessageItemFactory(private val colorProvider: ColorProvider, val message = messageContent.body.let { val formattedBody = span { text = it - textColor = colorProvider.getColor(R.color.slate_grey) + textColor = colorProvider.getColorFromAttribute(R.attr.riotx_text_secondary) textStyle = "italic" } linkifyBody(formattedBody, callback) diff --git a/vector/src/main/java/im/vector/riotredesign/features/home/room/list/RoomCategoryItem.kt b/vector/src/main/java/im/vector/riotredesign/features/home/room/list/RoomCategoryItem.kt index 5a837fd0a9..b19ff8e257 100644 --- a/vector/src/main/java/im/vector/riotredesign/features/home/room/list/RoomCategoryItem.kt +++ b/vector/src/main/java/im/vector/riotredesign/features/home/room/list/RoomCategoryItem.kt @@ -36,6 +36,7 @@ abstract class RoomCategoryItem : VectorEpoxyModel() { @EpoxyAttribute var listener: (() -> Unit)? = null override fun bind(holder: Holder) { + // TODO Theme get text secondary color instead val tintColor = ContextCompat.getColor(holder.rootView.context, R.color.bluey_grey_two) val expandedArrowDrawableRes = if (expanded) R.drawable.ic_expand_more_white else R.drawable.ic_expand_less_white val expandedArrowDrawable = ContextCompat.getDrawable(holder.rootView.context, expandedArrowDrawableRes)?.also { diff --git a/vector/src/main/java/im/vector/riotredesign/features/roomdirectory/PublicRoomsFragment.kt b/vector/src/main/java/im/vector/riotredesign/features/roomdirectory/PublicRoomsFragment.kt index 8010ece2ea..aae438b7d6 100644 --- a/vector/src/main/java/im/vector/riotredesign/features/roomdirectory/PublicRoomsFragment.kt +++ b/vector/src/main/java/im/vector/riotredesign/features/roomdirectory/PublicRoomsFragment.kt @@ -32,6 +32,7 @@ import im.vector.riotredesign.core.error.ErrorFormatter import im.vector.riotredesign.core.extensions.addFragmentToBackstack import im.vector.riotredesign.core.platform.VectorBaseFragment import im.vector.riotredesign.features.roomdirectory.picker.RoomDirectoryPickerFragment +import im.vector.riotredesign.features.themes.ThemeUtils import io.reactivex.rxkotlin.subscribeBy import kotlinx.android.synthetic.main.fragment_public_rooms.* import org.koin.android.ext.android.inject @@ -65,6 +66,8 @@ class PublicRoomsFragment : VectorBaseFragment(), PublicRoomsController.Callback it.setDisplayHomeAsUpEnabled(true) } + publicRoomsFilter.setBackgroundResource(ThemeUtils.getResourceId(requireContext(), R.drawable.bg_search_edit_text_light)) + RxTextView.textChanges(publicRoomsFilter) .debounce(500, TimeUnit.MILLISECONDS) .subscribeBy { 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 8550c3c162..0821aff8c6 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 @@ -20,7 +20,6 @@ package im.vector.riotredesign.features.themes import android.app.Activity import android.content.Context import android.graphics.drawable.Drawable -import android.text.TextUtils import android.util.TypedValue import android.view.Menu import androidx.annotation.AttrRes @@ -89,8 +88,8 @@ object ThemeUtils { */ fun setActivityTheme(activity: Activity, otherThemes: ActivityOtherThemes) { when (getApplicationTheme(activity)) { - THEME_DARK_VALUE -> activity.setTheme(otherThemes.dark) - THEME_BLACK_VALUE -> activity.setTheme(otherThemes.black) + THEME_DARK_VALUE -> activity.setTheme(otherThemes.dark) + THEME_BLACK_VALUE -> activity.setTheme(otherThemes.black) THEME_STATUS_VALUE -> activity.setTheme(otherThemes.status) } @@ -164,7 +163,7 @@ object ThemeUtils { try { val typedValue = TypedValue() c.theme.resolveAttribute(attribute, typedValue, true) - return typedValue + return typedValue } catch (e: Exception) { Timber.e(e, "Unable to get color") } @@ -175,19 +174,37 @@ object ThemeUtils { * Get the resource Id applied to the current theme * * @param c the context - * @param resourceId the resource id + * @param resourceId the resource id in the light theme * @return the resource Id for the current theme */ fun getResourceId(c: Context, resourceId: Int): Int { - if (TextUtils.equals(getApplicationTheme(c), THEME_LIGHT_VALUE) - || TextUtils.equals(getApplicationTheme(c), THEME_STATUS_VALUE)) { - return when (resourceId) { - R.drawable.line_divider_dark -> R.drawable.line_divider_light - R.style.Floating_Actions_Menu -> R.style.Floating_Actions_Menu_Light - else -> resourceId + val theme = getApplicationTheme(c) + + return when (theme) { + THEME_LIGHT_VALUE -> resourceId + THEME_DARK_VALUE -> { + return when (resourceId) { + R.drawable.bg_search_edit_text_light -> R.drawable.bg_search_edit_text_dark + else -> { + Timber.w("Warning, missing case for wanted drawable in dark theme") + resourceId + } + } + } + THEME_BLACK_VALUE -> { + return when (resourceId) { + R.drawable.bg_search_edit_text_light -> R.drawable.bg_search_edit_text_black + else -> { + Timber.w("Warning, missing case for wanted drawable in black theme") + resourceId + } + } + } + else -> { + Timber.w("Warning, missing theme: $theme") + resourceId } } - return resourceId } /** diff --git a/vector/src/main/res/color/color_room_title.xml b/vector/src/main/res/color/color_room_title.xml deleted file mode 100644 index 1cda9bf68b..0000000000 --- a/vector/src/main/res/color/color_room_title.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/vector/src/main/res/drawable/bg_search_edit_text_black.xml b/vector/src/main/res/drawable/bg_search_edit_text_black.xml new file mode 100644 index 0000000000..741e3c031c --- /dev/null +++ b/vector/src/main/res/drawable/bg_search_edit_text_black.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/vector/src/main/res/drawable/bg_search_edit_text.xml b/vector/src/main/res/drawable/bg_search_edit_text_dark.xml similarity index 63% rename from vector/src/main/res/drawable/bg_search_edit_text.xml rename to vector/src/main/res/drawable/bg_search_edit_text_dark.xml index bba3fa26e6..d65c331ed2 100644 --- a/vector/src/main/res/drawable/bg_search_edit_text.xml +++ b/vector/src/main/res/drawable/bg_search_edit_text_dark.xml @@ -1,5 +1,5 @@ - + \ No newline at end of file diff --git a/vector/src/main/res/drawable/bg_search_edit_text_light.xml b/vector/src/main/res/drawable/bg_search_edit_text_light.xml new file mode 100644 index 0000000000..ba0da29660 --- /dev/null +++ b/vector/src/main/res/drawable/bg_search_edit_text_light.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/vector/src/main/res/drawable/bg_splash.xml b/vector/src/main/res/drawable/bg_splash.xml deleted file mode 100644 index 86e6669748..0000000000 --- a/vector/src/main/res/drawable/bg_splash.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/vector/src/main/res/drawable/bg_unread_highlight.xml b/vector/src/main/res/drawable/bg_unread_highlight.xml index 87d7cae17c..42a1e08b8c 100644 --- a/vector/src/main/res/drawable/bg_unread_highlight.xml +++ b/vector/src/main/res/drawable/bg_unread_highlight.xml @@ -4,5 +4,5 @@ - + \ No newline at end of file diff --git a/vector/src/main/res/layout/constraint_set_composer_layout_compact.xml b/vector/src/main/res/layout/constraint_set_composer_layout_compact.xml index fd9d5d27da..a6091b92c8 100644 --- a/vector/src/main/res/layout/constraint_set_composer_layout_compact.xml +++ b/vector/src/main/res/layout/constraint_set_composer_layout_compact.xml @@ -88,10 +88,11 @@ android:layout_height="22dp" android:background="?android:attr/selectableItemBackground" android:src="@drawable/ic_close_round" - android:tint="@color/rosy_pink" + android:tint="@color/riotx_notice" android:visibility="invisible" app:layout_constraintBottom_toTopOf="parent" - app:layout_constraintStart_toEndOf="parent" /> + app:layout_constraintStart_toEndOf="parent" + tools:visibility="visible" /> diff --git a/vector/src/main/res/layout/fragment_home_detail.xml b/vector/src/main/res/layout/fragment_home_detail.xml index 9e84e3772f..a54fa61e0a 100644 --- a/vector/src/main/res/layout/fragment_home_detail.xml +++ b/vector/src/main/res/layout/fragment_home_detail.xml @@ -35,7 +35,7 @@ android:layout_marginEnd="32dp" android:ellipsize="end" android:maxLines="1" - android:textColor="?vctr_toolbar_primary_text_color" + android:textColor="?riotx_text_primary" android:textSize="20sp" android:textStyle="bold" tools:text="@tools:sample/lorem/random" /> @@ -58,8 +58,6 @@ android:layout_height="48dp" android:background="?riotx_background" app:itemIconSize="20dp" - app:itemIconTint="@color/home_bottom_nav_view_tint" - app:itemTextColor="@color/home_bottom_nav_view_tint" app:labelVisibilityMode="unlabeled" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" diff --git a/vector/src/main/res/layout/fragment_public_rooms.xml b/vector/src/main/res/layout/fragment_public_rooms.xml index 4e0f97a36c..10f87cb5d3 100644 --- a/vector/src/main/res/layout/fragment_public_rooms.xml +++ b/vector/src/main/res/layout/fragment_public_rooms.xml @@ -23,6 +23,7 @@ app:layout_constraintTop_toTopOf="parent" app:layout_scrollFlags="noScroll"> + diff --git a/vector/src/main/res/layout/fragment_room_directory_picker.xml b/vector/src/main/res/layout/fragment_room_directory_picker.xml index eb7af92bcb..2b6eec332b 100644 --- a/vector/src/main/res/layout/fragment_room_directory_picker.xml +++ b/vector/src/main/res/layout/fragment_room_directory_picker.xml @@ -5,7 +5,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@color/pale_grey"> + android:background="?riotx_header_panel_background"> + android:background="?riotx_header_panel_background"> @@ -41,7 +41,7 @@ android:duplicateParentState="true" android:ellipsize="end" android:maxLines="1" - android:textColor="@color/black_87" + android:textColor="?riotx_text_primary" android:textSize="15sp" app:layout_constrainedWidth="true" app:layout_constraintEnd_toStartOf="@+id/roomUnreadCounterBadgeView" @@ -77,7 +77,7 @@ android:layout_height="wrap_content" android:layout_marginEnd="8dp" android:layout_marginRight="8dp" - android:textColor="@color/black_38" + android:textColor="?riotx_text_secondary" android:textSize="15sp" app:layout_constraintBottom_toBottomOf="@+id/roomNameView" app:layout_constraintEnd_toEndOf="parent" @@ -93,7 +93,7 @@ android:layout_marginRight="8dp" android:ellipsize="end" android:maxLines="2" - android:textColor="@color/black_38" + android:textColor="?riotx_text_secondary" android:textSize="15sp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="@+id/roomNameView" diff --git a/vector/src/main/res/layout/item_room_category.xml b/vector/src/main/res/layout/item_room_category.xml index 26338d9b1b..ef2f05f8ee 100644 --- a/vector/src/main/res/layout/item_room_category.xml +++ b/vector/src/main/res/layout/item_room_category.xml @@ -14,7 +14,7 @@ android:paddingTop="@dimen/layout_vertical_margin" android:paddingEnd="@dimen/layout_horizontal_margin" android:paddingRight="@dimen/layout_horizontal_margin" - tools:background="@color/pale_grey"> + tools:background="?riotx_header_panel_background"> diff --git a/vector/src/main/res/layout/merge_composer_layout.xml b/vector/src/main/res/layout/merge_composer_layout.xml index 65abbe8b92..3d31621317 100644 --- a/vector/src/main/res/layout/merge_composer_layout.xml +++ b/vector/src/main/res/layout/merge_composer_layout.xml @@ -72,7 +72,7 @@ android:layout_height="22dp" android:background="?android:attr/selectableItemBackground" android:src="@drawable/ic_close_round" - android:tint="@color/rosy_pink" + android:tint="@color/riotx_notice" tools:ignore="MissingConstraints" /> diff --git a/vector/src/main/res/layout/view_button_state.xml b/vector/src/main/res/layout/view_button_state.xml index d442d51ae3..96dc48ac0d 100644 --- a/vector/src/main/res/layout/view_button_state.xml +++ b/vector/src/main/res/layout/view_button_state.xml @@ -14,7 +14,7 @@ tools:layout_gravity="center_horizontal" tools:text="@string/join" /> -