Update search bar style

This commit is contained in:
moezbhatti
2018-12-26 16:59:15 -05:00
parent ef857af34d
commit 1fee32e3ed
5 changed files with 32 additions and 24 deletions
@@ -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()
}
@@ -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() {