Fix tint of buttons in searchview

This commit is contained in:
Jays2Kings 2021-04-27 15:32:50 -04:00
parent 94406f6480
commit f574cfcbf7
4 changed files with 15 additions and 0 deletions

View File

@ -8,6 +8,7 @@ import androidx.appcompat.graphics.drawable.DrawerArrowDrawable
import androidx.core.view.updateLayoutParams import androidx.core.view.updateLayoutParams
import com.google.android.material.textview.MaterialTextView import com.google.android.material.textview.MaterialTextView
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.util.system.contextCompatDrawable
import eu.kanade.tachiyomi.util.system.dpToPx import eu.kanade.tachiyomi.util.system.dpToPx
import eu.kanade.tachiyomi.util.system.getResourceColor import eu.kanade.tachiyomi.util.system.getResourceColor
@ -20,6 +21,9 @@ class CenteredToolbar@JvmOverloads constructor(context: Context, attrs: Attribut
toolbarTitle = findViewById<MaterialTextView>(R.id.toolbar_title) toolbarTitle = findViewById<MaterialTextView>(R.id.toolbar_title)
toolbarTitle.setTextAppearance(titleTextAppeance) toolbarTitle.setTextAppearance(titleTextAppeance)
toolbarTitle.setTextColor(context.getResourceColor(R.attr.actionBarTintColor)) toolbarTitle.setTextColor(context.getResourceColor(R.attr.actionBarTintColor))
collapseIcon = context.contextCompatDrawable(R.drawable.ic_arrow_back_24dp)?.apply {
setTint(context.getResourceColor(R.attr.actionBarTintColor))
}
} }
override fun setCustomTitle(title: CharSequence?) { override fun setCustomTitle(title: CharSequence?) {

View File

@ -11,6 +11,7 @@ import androidx.core.view.isVisible
import androidx.core.view.updateLayoutParams import androidx.core.view.updateLayoutParams
import com.google.android.material.textview.MaterialTextView import com.google.android.material.textview.MaterialTextView
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.util.system.contextCompatDrawable
import eu.kanade.tachiyomi.util.system.getResourceColor import eu.kanade.tachiyomi.util.system.getResourceColor
class FloatingToolbar @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : class FloatingToolbar @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
@ -48,6 +49,9 @@ class FloatingToolbar @JvmOverloads constructor(context: Context, attrs: Attribu
cardIncogImage = findViewById(R.id.card_incog_image) cardIncogImage = findViewById(R.id.card_incog_image)
setNavigationIconTint(actionColorAlpha) setNavigationIconTint(actionColorAlpha)
collapseIcon = context.contextCompatDrawable(R.drawable.ic_arrow_back_24dp)?.apply {
setTint(actionColorAlpha)
}
} }
override fun setSubtitle(resId: Int) { override fun setSubtitle(resId: Int) {

View File

@ -1,8 +1,10 @@
package eu.kanade.tachiyomi.ui.base package eu.kanade.tachiyomi.ui.base
import android.content.Context import android.content.Context
import android.content.res.ColorStateList
import android.util.AttributeSet import android.util.AttributeSet
import android.util.TypedValue import android.util.TypedValue
import android.widget.ImageView
import androidx.appcompat.widget.SearchView import androidx.appcompat.widget.SearchView
import androidx.core.graphics.ColorUtils import androidx.core.graphics.ColorUtils
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
@ -20,5 +22,8 @@ class MiniSearchView @JvmOverloads constructor(context: Context, attrs: Attribut
searchTextView?.setTextColor(actionColorAlpha) searchTextView?.setTextColor(actionColorAlpha)
searchTextView?.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16f) searchTextView?.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16f)
searchTextView?.setHintTextColor(actionColorAlpha) searchTextView?.setHintTextColor(actionColorAlpha)
val clearButton = findViewById<ImageView>(androidx.appcompat.R.id.search_close_btn)
clearButton?.imageTintList = ColorStateList.valueOf(context.getResourceColor(R.attr.actionBarTintColor))
} }
} }

View File

@ -36,6 +36,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
app:titleTextColor="?actionBarTintColor" app:titleTextColor="?actionBarTintColor"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
app:collapseIcon="@drawable/ic_arrow_back_24dp"
android:background="?attr/colorSecondary"> android:background="?attr/colorSecondary">
<com.google.android.material.textview.MaterialTextView <com.google.android.material.textview.MaterialTextView
@ -81,6 +82,7 @@
app:navigationIcon="@drawable/ic_search_24dp" app:navigationIcon="@drawable/ic_search_24dp"
app:titleTextAppearance="@style/TextAppearance.MaterialComponents.Body1" app:titleTextAppearance="@style/TextAppearance.MaterialComponents.Body1"
app:subtitleTextAppearance="@style/TextAppearance.MaterialComponents.Caption" app:subtitleTextAppearance="@style/TextAppearance.MaterialComponents.Caption"
app:collapseIcon="@drawable/ic_arrow_back_24dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" > android:layout_height="match_parent" >