forked from upstream-mirrors/quik
Update search bar style
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -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">
|
||||
|
||||
<com.moez.QKSMS.common.widget.QkTextView
|
||||
android:id="@+id/toolbarTitle"
|
||||
style="@style/ToolbarText" />
|
||||
style="@style/ToolbarText"
|
||||
android:layout_marginStart="16dp" />
|
||||
|
||||
<com.moez.QKSMS.common.widget.QkEditText
|
||||
android:id="@+id/toolbarSearch"
|
||||
style="@style/ToolbarText"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:background="@drawable/rounded_rectangle_24dp"
|
||||
android:backgroundTint="?android:attr/queryBackground"
|
||||
android:hint="@string/title_conversations"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:textColorHint="?android:attr/textColorTertiary"
|
||||
app:textSize="primary"
|
||||
tools:textSize="16sp" />
|
||||
|
||||
@@ -24,12 +24,14 @@
|
||||
<color name="rippleLight">#1f000000</color>
|
||||
<color name="rippleDark">#33ffffff</color>
|
||||
|
||||
<color name="statusBarLight">#F7F7F7</color>
|
||||
<color name="statusBarDark">#1a1e22</color>
|
||||
<color name="statusBarLight">#FFFFFF</color>
|
||||
<color name="statusBarDark">#1A1E22</color>
|
||||
|
||||
<color name="toolbarLight">#FFFFFF</color>
|
||||
<color name="toolbarDark">#1d262b</color>
|
||||
<color name="toolbarTranslucent">#88000000</color>
|
||||
<color name="toolbarSearchBackgroundLight">#0D000000</color>
|
||||
<color name="toolbarSearchBackgroundDark">#26000000</color>
|
||||
|
||||
<color name="backgroundLight">#ECEFF1</color>
|
||||
<color name="backgroundDark">#192025</color>
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
<!-- Light theme -->
|
||||
<style name="AppBaseThemeLight" parent="Theme.AppCompat.Light.NoActionBar">item>
|
||||
<item name="android:divider">@color/separatorLight</item>
|
||||
<item name="android:queryBackground">@color/toolbarSearchBackgroundLight</item>
|
||||
<item name="android:statusBarColor">@color/black</item>
|
||||
<item name="android:textColorPrimary">@color/textPrimary</item>
|
||||
<item name="android:textColorSecondary">@color/textSecondary</item>
|
||||
@@ -65,6 +66,7 @@
|
||||
<style name="AppThemeDark" parent="Theme.AppCompat.NoActionBar">
|
||||
<item name="android:divider">@color/separatorDark</item>
|
||||
<item name="android:navigationBarColor">@color/backgroundDark</item>
|
||||
<item name="android:queryBackground">@color/toolbarSearchBackgroundDark</item>
|
||||
<item name="android:statusBarColor">@color/statusBarDark</item>
|
||||
<item name="android:textColorPrimary">@color/textPrimaryDark</item>
|
||||
<item name="android:textColorSecondary">@color/textSecondaryDark</item>
|
||||
|
||||
Reference in New Issue
Block a user