|
|
|
@ -22,17 +22,16 @@ class PreferenceCategory(context: Context, attrs: AttributeSet) : |
|
|
|
|
layoutResource = R.layout.view_preference_category |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun onBindViewHolder(holder: PreferenceViewHolder?) { |
|
|
|
|
override fun onBindViewHolder(holder: PreferenceViewHolder) { |
|
|
|
|
super.onBindViewHolder(holder) |
|
|
|
|
holder?.let { |
|
|
|
|
val view = it.findViewById(R.id.preference_title) |
|
|
|
|
val view = holder.findViewById(R.id.preference_title) |
|
|
|
|
if (view is TextView) { // && !view.isInEditMode |
|
|
|
|
view.text = title |
|
|
|
|
if (view.isInEditMode) return |
|
|
|
|
view.setTextColor(context.accentColor) |
|
|
|
|
view.isVisible = title != null && title.isNotEmpty() |
|
|
|
|
|
|
|
|
|
val da = it.findViewById(R.id.preference_divider_above) |
|
|
|
|
val da = holder.findViewById(R.id.preference_divider_above) |
|
|
|
|
val dividerColor = if (AppConfig.isNightTheme) { |
|
|
|
|
ColorUtils.withAlpha( |
|
|
|
|
ColorUtils.shiftColor(context.backgroundColor, 1.05f), |
|
|
|
@ -46,13 +45,12 @@ class PreferenceCategory(context: Context, attrs: AttributeSet) : |
|
|
|
|
} |
|
|
|
|
if (da is View) { |
|
|
|
|
da.setBackgroundColor(dividerColor) |
|
|
|
|
da.isVisible = it.isDividerAllowedAbove |
|
|
|
|
da.isVisible = holder.isDividerAllowedAbove |
|
|
|
|
} |
|
|
|
|
val db = it.findViewById(R.id.preference_divider_below) |
|
|
|
|
val db = holder.findViewById(R.id.preference_divider_below) |
|
|
|
|
if (db is View) { |
|
|
|
|
db.setBackgroundColor(dividerColor) |
|
|
|
|
db.isVisible = it.isDividerAllowedBelow |
|
|
|
|
} |
|
|
|
|
db.isVisible = holder.isDividerAllowedBelow |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|