mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-25 02:45:53 +03:00
commit
28ae10a4aa
8 changed files with 38 additions and 48 deletions
|
@ -9,6 +9,7 @@ Improvements 🙌:
|
|||
|
||||
Bugfix 🐛:
|
||||
- Display name not shown under Settings/General (#1926)
|
||||
- Fix bad color for settings icon on Android < 24 (#1786)
|
||||
- Change user or room avatar: when selecting Gallery, I'm not proposed to crop the selected image (#1590)
|
||||
|
||||
Translations 🗣:
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
|
|
|
@ -20,12 +20,15 @@ import android.animation.Animator
|
|||
import android.animation.ArgbEvaluator
|
||||
import android.animation.ValueAnimator
|
||||
import android.content.Context
|
||||
import android.content.res.ColorStateList
|
||||
import android.graphics.Color
|
||||
import android.graphics.Typeface
|
||||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.core.animation.doOnEnd
|
||||
import androidx.core.widget.ImageViewCompat
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.PreferenceViewHolder
|
||||
import im.vector.app.R
|
||||
|
@ -76,6 +79,12 @@ open class VectorPreference : Preference {
|
|||
notifyChanged()
|
||||
}
|
||||
|
||||
var tintIcon = false
|
||||
set(value) {
|
||||
field = value
|
||||
notifyChanged()
|
||||
}
|
||||
|
||||
var currentHighlightAnimator: Animator? = null
|
||||
|
||||
override fun onBindViewHolder(holder: PreferenceViewHolder) {
|
||||
|
@ -84,15 +93,23 @@ 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)
|
||||
|
||||
if (tintIcon) {
|
||||
// Tint icons (See #1786)
|
||||
val icon = holder.findViewById(android.R.id.icon) as? ImageView
|
||||
|
||||
icon?.let {
|
||||
val color = ThemeUtils.getColor(context, R.attr.riotx_header_panel_text_secondary)
|
||||
ImageViewCompat.setImageTintList(it, ColorStateList.valueOf(color))
|
||||
}
|
||||
}
|
||||
|
||||
// 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()
|
||||
|
|
|
@ -16,7 +16,9 @@
|
|||
|
||||
package im.vector.app.features.settings
|
||||
|
||||
import android.os.Build
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.preference.VectorPreference
|
||||
import javax.inject.Inject
|
||||
|
||||
class VectorSettingsRootFragment @Inject constructor() : VectorSettingsBaseFragment() {
|
||||
|
@ -25,6 +27,15 @@ class VectorSettingsRootFragment @Inject constructor() : VectorSettingsBaseFragm
|
|||
override val preferenceXmlRes = R.xml.vector_settings_root
|
||||
|
||||
override fun bindPref() {
|
||||
// Nothing to do
|
||||
// Tint icon on API < 24
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
|
||||
tintIcons()
|
||||
}
|
||||
}
|
||||
|
||||
private fun tintIcons() {
|
||||
for (i in 0 until preferenceScreen.preferenceCount) {
|
||||
(preferenceScreen.getPreference(i) as? VectorPreference)?.let { it.tintIcon = true }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="163dp"
|
||||
android:height="127dp"
|
||||
android:viewportWidth="163"
|
||||
android:viewportHeight="127">
|
||||
<path
|
||||
android:pathData="M113.569,169.348C129.753,185.532 153.161,188.363 165.853,175.671C178.545,162.979 175.715,139.57 159.531,123.386C143.347,107.203 44.653,8.372 44.653,8.372L35.819,18.975C35.819,18.975 39.221,27.764 37.204,30.186C35.186,32.608 24.684,32.34 24.684,32.34L6.34,54.358C6.34,54.358 4.89,60.67 6.106,61.885C41.927,97.706 77.748,133.527 113.569,169.348Z"
|
||||
android:strokeWidth="1"
|
||||
android:fillColor="#000000"
|
||||
android:fillAlpha="0.147508741"
|
||||
android:fillType="evenOdd"
|
||||
android:strokeColor="#00000000"/>
|
||||
<path
|
||||
android:pathData="M19.447,19.068L19.447,27.722L28.202,27.713C28.313,27.713 28.415,27.71 28.515,27.703C30.818,27.551 32.617,25.656 32.617,23.391C32.617,21.007 30.641,19.068 28.211,19.068L19.447,19.068ZM10.788,61.81C6.006,61.81 2.129,58.007 2.129,53.316L2.129,37.127C2.097,36.833 2.08,36.535 2.08,36.232C2.08,35.925 2.096,35.621 2.129,35.322L2.129,10.574C2.129,5.882 6.006,2.079 10.788,2.079L28.211,2.079C40.19,2.079 49.935,11.639 49.935,23.391C49.935,34.563 41.04,43.902 29.684,44.652C29.201,44.685 28.704,44.702 28.211,44.702L19.447,44.71L19.447,53.316C19.447,58.007 15.57,61.81 10.788,61.81L10.788,61.81Z"
|
||||
android:strokeWidth="1"
|
||||
android:fillColor="#A2DDEF"
|
||||
android:fillType="evenOdd"
|
||||
android:strokeColor="#00000000"/>
|
||||
<path
|
||||
android:pathData="M19.447,19.068L19.447,27.722L28.202,27.713C28.313,27.713 28.415,27.71 28.515,27.703C30.818,27.551 32.617,25.656 32.617,23.391C32.617,21.007 30.641,19.068 28.211,19.068L19.447,19.068ZM10.788,61.81C6.006,61.81 2.129,58.007 2.129,53.316L2.129,10.574C2.129,5.882 6.006,2.079 10.788,2.079L28.211,2.079C40.19,2.079 49.935,11.639 49.935,23.391C49.935,34.563 41.04,43.902 29.684,44.652C29.201,44.685 28.704,44.702 28.211,44.702L19.447,44.71L19.447,53.316C19.447,58.007 15.57,61.81 10.788,61.81Z"
|
||||
android:strokeWidth="1.52445396"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#368BD6"
|
||||
android:fillType="evenOdd"/>
|
||||
<path
|
||||
android:pathData="M10.788,53.315L10.788,10.574L28.211,10.574C35.426,10.574 41.276,16.312 41.276,23.39C41.276,30.175 35.902,35.729 29.102,36.178C28.807,36.197 28.51,36.207 28.211,36.207L10.788,36.207"
|
||||
android:strokeWidth="1.52445396"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#368BD6"
|
||||
android:fillType="evenOdd"
|
||||
android:strokeLineCap="round"/>
|
||||
<path
|
||||
android:pathData="M17.923,5.702C19.25,7.56 19.76,9.815 19.358,12.048C18.956,14.283 17.691,16.229 15.795,17.531C11.881,20.217 6.467,19.282 3.726,15.445C2.399,13.587 1.889,11.333 2.291,9.099C2.693,6.864 3.958,4.917 5.854,3.617C9.768,0.93 15.182,1.865 17.923,5.702ZM41.347,61.805C38.618,61.805 35.934,60.543 34.248,58.185L22.011,41.052C19.266,37.21 20.217,31.913 24.133,29.222C28.049,26.528 33.449,27.461 36.193,31.303L48.431,48.435C51.175,52.277 50.225,57.574 46.309,60.266C44.797,61.306 43.063,61.805 41.347,61.805Z"
|
||||
android:strokeWidth="1"
|
||||
android:fillColor="#368BD6"
|
||||
android:fillType="evenOdd"
|
||||
android:strokeColor="#00000000"/>
|
||||
</vector>
|
Loading…
Reference in a new issue