mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-16 02:05:06 +08:00
Use cached Views
This commit is contained in:
parent
ef912e066b
commit
9f3f981ab0
@ -20,7 +20,6 @@ import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
import android.widget.RadioGroup
|
||||
import android.widget.TextView
|
||||
import androidx.preference.PreferenceViewHolder
|
||||
import im.vector.app.R
|
||||
import org.matrix.android.sdk.api.pushrules.RuleSetKey
|
||||
@ -162,7 +161,7 @@ class PushRulePreference : VectorPreference {
|
||||
override fun onBindViewHolder(holder: PreferenceViewHolder) {
|
||||
super.onBindViewHolder(holder)
|
||||
|
||||
holder.itemView.findViewById<TextView>(android.R.id.summary)?.visibility = View.GONE
|
||||
holder.findViewById(android.R.id.summary)?.visibility = View.GONE
|
||||
holder.itemView.setOnClickListener(null)
|
||||
holder.itemView.setOnLongClickListener(null)
|
||||
|
||||
|
@ -45,7 +45,7 @@ class VectorEditTextPreference : EditTextPreference {
|
||||
override fun onBindViewHolder(holder: PreferenceViewHolder) {
|
||||
// display the title in multi-line to avoid ellipsis.
|
||||
try {
|
||||
holder.itemView.findViewById<TextView>(android.R.id.title)?.isSingleLine = false
|
||||
(holder.findViewById(android.R.id.title) as? TextView)?.isSingleLine = false
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e, "onBindView")
|
||||
}
|
||||
|
@ -84,15 +84,15 @@ open class VectorPreference : Preference {
|
||||
|
||||
// display the title in multi-line to avoid ellipsis.
|
||||
try {
|
||||
val title = itemView.findViewById<TextView>(android.R.id.title)
|
||||
val summary = itemView.findViewById<TextView>(android.R.id.summary)
|
||||
val title = holder.findViewById(android.R.id.title) as? TextView
|
||||
val summary = holder.findViewById(android.R.id.summary) as? TextView
|
||||
if (title != null) {
|
||||
title.isSingleLine = false
|
||||
title.setTypeface(null, mTypeface)
|
||||
}
|
||||
|
||||
if (title !== summary) {
|
||||
summary.setTypeface(null, mTypeface)
|
||||
summary?.setTypeface(null, mTypeface)
|
||||
|
||||
}
|
||||
|
||||
// cancel existing animation (find a way to resume if happens during anim?)
|
||||
|
@ -45,7 +45,7 @@ class VectorPreferenceCategory : PreferenceCategory {
|
||||
override fun onBindViewHolder(holder: PreferenceViewHolder) {
|
||||
super.onBindViewHolder(holder)
|
||||
|
||||
val titleTextView = holder.itemView.findViewById<TextView>(android.R.id.title)
|
||||
val titleTextView = holder.findViewById(android.R.id.title) as? TextView
|
||||
|
||||
titleTextView?.setTypeface(null, Typeface.BOLD)
|
||||
titleTextView?.setTextColor(ThemeUtils.getColor(context, R.attr.riotx_text_primary))
|
||||
|
@ -58,7 +58,7 @@ class VectorSwitchPreference : SwitchPreference {
|
||||
|
||||
override fun onBindViewHolder(holder: PreferenceViewHolder) {
|
||||
// display the title in multi-line to avoid ellipsis.
|
||||
holder.itemView.findViewById<TextView>(android.R.id.title)?.isSingleLine = false
|
||||
(holder.findViewById(android.R.id.title) as? TextView)?.isSingleLine = false
|
||||
|
||||
// cancel existing animation (find a way to resume if happens during anim?)
|
||||
currentHighlightAnimator?.cancel()
|
||||
|
Loading…
Reference in New Issue
Block a user