More attr uses and color fixes
This commit is contained in:
parent
db818f2e6f
commit
254e2a90dd
@ -12,6 +12,7 @@ import android.widget.ImageView
|
|||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.annotation.DrawableRes
|
import androidx.annotation.DrawableRes
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
|
import androidx.core.widget.TextViewCompat
|
||||||
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||||
import com.google.android.material.bottomsheet.BottomSheetDialog
|
import com.google.android.material.bottomsheet.BottomSheetDialog
|
||||||
import com.google.android.material.textview.MaterialTextView
|
import com.google.android.material.textview.MaterialTextView
|
||||||
@ -88,8 +89,10 @@ open class MaterialMenuSheet(
|
|||||||
if (item.id == selectedId) {
|
if (item.id == selectedId) {
|
||||||
currentIndex = index
|
currentIndex = index
|
||||||
setTextColor(context.getResourceColor(R.attr.colorAccent))
|
setTextColor(context.getResourceColor(R.attr.colorAccent))
|
||||||
compoundDrawableTintList =
|
TextViewCompat.setCompoundDrawableTintList(
|
||||||
|
this,
|
||||||
ColorStateList.valueOf(context.getResourceColor(R.attr.colorAccent))
|
ColorStateList.valueOf(context.getResourceColor(R.attr.colorAccent))
|
||||||
|
)
|
||||||
}
|
}
|
||||||
updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||||
height = 48.dpToPx
|
height = 48.dpToPx
|
||||||
@ -143,7 +146,10 @@ open class MaterialMenuSheet(
|
|||||||
val textView = (binding.menuLayout.getChildAt(it) as ViewGroup).getChildAt(0) as TextView
|
val textView = (binding.menuLayout.getChildAt(it) as ViewGroup).getChildAt(0) as TextView
|
||||||
val imageView = (binding.menuLayout.getChildAt(it) as ViewGroup).getChildAt(1) as ImageView
|
val imageView = (binding.menuLayout.getChildAt(it) as ViewGroup).getChildAt(1) as ImageView
|
||||||
textView.setTextColor(primaryColor)
|
textView.setTextColor(primaryColor)
|
||||||
textView.compoundDrawableTintList = ColorStateList.valueOf(primaryColor)
|
TextViewCompat.setCompoundDrawableTintList(
|
||||||
|
textView,
|
||||||
|
ColorStateList.valueOf(primaryColor)
|
||||||
|
)
|
||||||
imageView.invisible()
|
imageView.invisible()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -155,9 +161,13 @@ open class MaterialMenuSheet(
|
|||||||
val layout = binding.menuLayout.findViewById<ViewGroup>(id) ?: return
|
val layout = binding.menuLayout.findViewById<ViewGroup>(id) ?: return
|
||||||
val textView = layout.getChildAt(0) as? TextView
|
val textView = layout.getChildAt(0) as? TextView
|
||||||
val imageView = layout.getChildAt(1) as? ImageView
|
val imageView = layout.getChildAt(1) as? ImageView
|
||||||
textView?.setTextColor(context.getResourceColor(R.attr.colorAccent))
|
textView?.setTextColor(textView.context.getResourceColor(R.attr.colorAccent))
|
||||||
textView?.compoundDrawableTintList =
|
textView?.let {
|
||||||
ColorStateList.valueOf(context.getResourceColor(R.attr.colorAccent))
|
TextViewCompat.setCompoundDrawableTintList(
|
||||||
|
it,
|
||||||
|
ColorStateList.valueOf(it.context.getResourceColor(R.attr.colorAccent))
|
||||||
|
)
|
||||||
|
}
|
||||||
imageView?.visible()
|
imageView?.visible()
|
||||||
imageView?.setImageResource(drawableRes)
|
imageView?.setImageResource(drawableRes)
|
||||||
}
|
}
|
||||||
|
4
app/src/main/res/color/unread_badge.xml
Normal file
4
app/src/main/res/color/unread_badge.xml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:color="?colorAccent"/>
|
||||||
|
</selector>
|
@ -58,7 +58,7 @@
|
|||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:progressBackgroundTint="?actionBarTintColor"
|
android:progressBackgroundTint="@color/tint_color_secondary"
|
||||||
android:maxHeight="?attr/actionBarSize"
|
android:maxHeight="?attr/actionBarSize"
|
||||||
android:minHeight="?attr/actionBarSize" />
|
android:minHeight="?attr/actionBarSize" />
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
|
|
||||||
<color name="read_chapter">@color/text_color_hint</color>
|
<color name="read_chapter">@color/text_color_hint</color>
|
||||||
|
|
||||||
<color name="unread_badge">@color/colorAccent</color>
|
|
||||||
<color name="unread_badge_text">@color/md_white_1000</color>
|
<color name="unread_badge_text">@color/md_white_1000</color>
|
||||||
<color name="download_badge">@color/pale_green</color>
|
<color name="download_badge">@color/pale_green</color>
|
||||||
<color name="download_badge_text">@color/md_black_1000</color>
|
<color name="download_badge_text">@color/md_black_1000</color>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user