Fix settings crash and RTL bug.
This commit is contained in:
parent
4d472fccd2
commit
24d461c8b2
4 changed files with 7 additions and 4 deletions
|
@ -157,7 +157,7 @@ class ExternalLinkPreferenceViewHolder(itemView: View) : PreferenceViewHolder<Ex
|
||||||
val externalLinkIcon = requireNotNull(ContextCompat.getDrawable(context, R.drawable.ic_open_20))
|
val externalLinkIcon = requireNotNull(ContextCompat.getDrawable(context, R.drawable.ic_open_20))
|
||||||
externalLinkIcon.setBounds(0, 0, ViewUtil.dpToPx(20), ViewUtil.dpToPx(20))
|
externalLinkIcon.setBounds(0, 0, ViewUtil.dpToPx(20), ViewUtil.dpToPx(20))
|
||||||
|
|
||||||
if (itemView.layoutDirection == View.LAYOUT_DIRECTION_LTR) {
|
if (ViewUtil.isLtr(itemView)) {
|
||||||
titleView.setCompoundDrawables(null, null, externalLinkIcon, null)
|
titleView.setCompoundDrawables(null, null, externalLinkIcon, null)
|
||||||
} else {
|
} else {
|
||||||
titleView.setCompoundDrawables(externalLinkIcon, null, null, null)
|
titleView.setCompoundDrawables(externalLinkIcon, null, null, null)
|
||||||
|
|
|
@ -14,7 +14,6 @@ import org.thoughtcrime.securesms.components.settings.PreferenceModel
|
||||||
import org.thoughtcrime.securesms.components.settings.PreferenceViewHolder
|
import org.thoughtcrime.securesms.components.settings.PreferenceViewHolder
|
||||||
import org.thoughtcrime.securesms.components.settings.configure
|
import org.thoughtcrime.securesms.components.settings.configure
|
||||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||||
import org.thoughtcrime.securesms.mms.GlideApp
|
|
||||||
import org.thoughtcrime.securesms.phonenumbers.PhoneNumberFormatter
|
import org.thoughtcrime.securesms.phonenumbers.PhoneNumberFormatter
|
||||||
import org.thoughtcrime.securesms.recipients.Recipient
|
import org.thoughtcrime.securesms.recipients.Recipient
|
||||||
import org.thoughtcrime.securesms.util.FeatureFlags
|
import org.thoughtcrime.securesms.util.FeatureFlags
|
||||||
|
@ -181,6 +180,10 @@ class AppSettingsFragment : DSLSettingsFragment(R.string.text_secure_normal__men
|
||||||
override fun areContentsTheSame(newItem: PaymentsPreference): Boolean {
|
override fun areContentsTheSame(newItem: PaymentsPreference): Boolean {
|
||||||
return super.areContentsTheSame(newItem) && unreadCount == newItem.unreadCount
|
return super.areContentsTheSame(newItem) && unreadCount == newItem.unreadCount
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun areItemsTheSame(newItem: PaymentsPreference): Boolean {
|
||||||
|
return true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class PaymentsPreferenceViewHolder(itemView: View) : MappingViewHolder<PaymentsPreference>(itemView) {
|
private class PaymentsPreferenceViewHolder(itemView: View) : MappingViewHolder<PaymentsPreference>(itemView) {
|
||||||
|
|
|
@ -312,7 +312,7 @@ class NotificationsSettingsFragment : DSLSettingsFragment(R.string.preferences__
|
||||||
circleDrawable.setBounds(0, 0, ViewUtil.dpToPx(20), ViewUtil.dpToPx(20))
|
circleDrawable.setBounds(0, 0, ViewUtil.dpToPx(20), ViewUtil.dpToPx(20))
|
||||||
circleDrawable.colorFilter = model.colorValues[model.radioListPreference.selected].toColorFilter()
|
circleDrawable.colorFilter = model.colorValues[model.radioListPreference.selected].toColorFilter()
|
||||||
|
|
||||||
if (titleView.layoutDirection == View.LAYOUT_DIRECTION_LTR) {
|
if (ViewUtil.isLtr(itemView)) {
|
||||||
titleView.setCompoundDrawables(null, null, circleDrawable, null)
|
titleView.setCompoundDrawables(null, null, circleDrawable, null)
|
||||||
} else {
|
} else {
|
||||||
titleView.setCompoundDrawables(circleDrawable, null, null, null)
|
titleView.setCompoundDrawables(circleDrawable, null, null, null)
|
||||||
|
|
|
@ -112,7 +112,7 @@ abstract class PreferenceModel<T : PreferenceModel<T>>(
|
||||||
return when {
|
return when {
|
||||||
title != null -> title == newItem.title
|
title != null -> title == newItem.title
|
||||||
summary != null -> summary == newItem.summary
|
summary != null -> summary == newItem.summary
|
||||||
else -> throw AssertionError("Could not determine equality.")
|
else -> throw AssertionError("Could not determine equality of $newItem. Did you forget to override this method?")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue