diff --git a/presentation/src/main/java/com/moez/QKSMS/common/base/QkThemedActivity.kt b/presentation/src/main/java/com/moez/QKSMS/common/base/QkThemedActivity.kt index 9b2742ff..122355e2 100644 --- a/presentation/src/main/java/com/moez/QKSMS/common/base/QkThemedActivity.kt +++ b/presentation/src/main/java/com/moez/QKSMS/common/base/QkThemedActivity.kt @@ -24,6 +24,7 @@ import android.graphics.BitmapFactory import android.os.Build import android.os.Bundle import android.view.View +import androidx.core.view.iterator import androidx.lifecycle.Lifecycle import com.moez.QKSMS.R import com.moez.QKSMS.common.androidxcompat.scope @@ -92,11 +93,6 @@ abstract class QkThemedActivity : QkActivity() { window.navigationBarColor = resolveThemeColor(android.R.attr.windowBackground) } - // Set the color for the overflow and navigation icon - val textTertiary = resolveThemeColor(android.R.attr.textColorTertiary) - toolbar?.overflowIcon = toolbar?.overflowIcon?.apply { setTint(textTertiary) } - toolbar?.navigationIcon = toolbar?.navigationIcon?.apply { setTint(textTertiary) } - // Set the color for the recent apps title val toolbarColor = resolveThemeColor(R.attr.colorPrimary) val icon = BitmapFactory.decodeResource(resources, R.mipmap.ic_launcher) @@ -107,21 +103,20 @@ abstract class QkThemedActivity : QkActivity() { override fun onPostCreate(savedInstanceState: Bundle?) { super.onPostCreate(savedInstanceState) + // Set the color for the overflow and navigation icon + val textSecondary = resolveThemeColor(android.R.attr.textColorSecondary) + toolbar?.overflowIcon = toolbar?.overflowIcon?.apply { setTint(textSecondary) } + // Update the colours of the menu items Observables.combineLatest(menu, theme) { menu, theme -> - val text = resolveThemeColor(android.R.attr.textColorSecondary) - (0 until menu.size()) - .map { position -> menu.getItem(position) } - .forEach { menuItem -> - menuItem?.icon?.run { - setTint(when (menuItem.itemId) { - in getColoredMenuItems() -> theme.theme - else -> text - }) + menu.iterator().forEach { menuItem -> + val tint = when (menuItem.itemId) { + in getColoredMenuItems() -> theme.theme + else -> textSecondary + } - menuItem.icon = this - } - } + menuItem.icon = menuItem.icon?.apply { setTint(tint) } + } }.autoDisposable(scope(Lifecycle.Event.ON_DESTROY)).subscribe() } diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/main/MainActivity.kt b/presentation/src/main/java/com/moez/QKSMS/feature/main/MainActivity.kt index 227b6bb6..5bf9728b 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/main/MainActivity.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/main/MainActivity.kt @@ -177,9 +177,6 @@ class MainActivity : QkThemedActivity(), MainView { compose.setTint(theme.textPrimary) } - // Set the hamburger icon color - toggle.drawerArrowDrawable.color = resolveThemeColor(android.R.attr.textColorSecondary) - itemTouchCallback.adapter = conversationsAdapter conversationsAdapter.autoScrollToStart(recyclerView) } @@ -315,6 +312,10 @@ class MainActivity : QkThemedActivity(), MainView { override fun showBackButton(show: Boolean) { toggle.onDrawerSlide(drawer, if (show) 1f else 0f) + toggle.drawerArrowDrawable.color = when (show) { + true -> resolveThemeColor(android.R.attr.textColorSecondary) + false -> resolveThemeColor(android.R.attr.textColorPrimary) + } } override fun requestPermissions() { diff --git a/presentation/src/main/res/layout/main_activity.xml b/presentation/src/main/res/layout/main_activity.xml index 283861f0..651336ce 100644 --- a/presentation/src/main/res/layout/main_activity.xml +++ b/presentation/src/main/res/layout/main_activity.xml @@ -35,19 +35,27 @@ android:animateLayoutChanges="true" android:focusable="true" android:focusableInTouchMode="true" + app:contentInsetStartWithNavigation="0dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> + style="@style/ToolbarText" + android:layout_marginStart="16dp" /> diff --git a/presentation/src/main/res/values/colors.xml b/presentation/src/main/res/values/colors.xml index 96f2476a..fa99d77c 100644 --- a/presentation/src/main/res/values/colors.xml +++ b/presentation/src/main/res/values/colors.xml @@ -24,12 +24,14 @@ #1f000000 #33ffffff - #F7F7F7 - #1a1e22 + #FFFFFF + #1A1E22 #FFFFFF #1d262b #88000000 + #0D000000 + #26000000 #ECEFF1 #192025 diff --git a/presentation/src/main/res/values/themes.xml b/presentation/src/main/res/values/themes.xml index a038c00d..6ba38658 100644 --- a/presentation/src/main/res/values/themes.xml +++ b/presentation/src/main/res/values/themes.xml @@ -27,6 +27,7 @@