libs update

This commit is contained in:
Milos Kozak 2022-02-24 21:25:06 +01:00
parent 99efbcad6c
commit 21a3069a40
4 changed files with 57 additions and 61 deletions

View file

@ -123,10 +123,12 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
override fun onDestroy() {
super.onDestroy()
context?.let { context ->
PreferenceManager
.getDefaultSharedPreferences(context)
.unregisterOnSharedPreferenceChangeListener(this)
}
}
private fun addPreferencesFromResourceIfEnabled(p: PluginBase?, rootKey: String?, enabled: Boolean) {
if (enabled) addPreferencesFromResourceIfEnabled(p, rootKey)
@ -139,10 +141,12 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
context?.let { context ->
PreferenceManager
.getDefaultSharedPreferences(context)
.registerOnSharedPreferenceChangeListener(this)
}
}
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
(savedInstanceState ?: arguments)?.let { bundle ->
@ -263,21 +267,21 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
@SuppressLint("RestrictedApi")
private fun addPreferencesFromResource(@XmlRes preferencesResId: Int, key: String?) {
val xmlRoot = preferenceManager.inflateFromResource(context,
preferencesResId, null)
context?.let { context ->
val xmlRoot = preferenceManager.inflateFromResource(context, preferencesResId, null)
val root: Preference?
if (key != null) {
root = xmlRoot.findPreference(key)
if (root == null) return
require(root is PreferenceScreen) {
("Preference object with key " + key
+ " is not a PreferenceScreen")
("Preference object with key $key is not a PreferenceScreen")
}
preferenceScreen = root
} else {
addPreferencesFromResource(preferencesResId)
}
}
}
private fun adjustUnitDependentPrefs(pref: Preference) { // convert preferences values to current units
val unitDependent = arrayOf(
@ -305,15 +309,9 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
p.initialExpandedChildrenCount = Int.MAX_VALUE
}
} else {
if (p.key != null) {
visible = visible || p.key.contains(filter, true)
}
if (p.title != null) {
visible = visible || p.title.contains(filter, true)
}
if (p.summary != null) {
visible = visible || p.summary.contains(filter, true)
}
visible = visible || p.key?.contains(filter, true) == true
visible = visible || p.title?.contains(filter, true) == true
visible = visible || p.summary?.contains(filter, true) == true
}
p.isVisible = visible
@ -393,9 +391,8 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
// We use Preference and custom editor instead of EditTextPreference
// to hash password while it is saved and never have to show it, even hashed
override fun onPreferenceTreeClick(preference: Preference?): Boolean {
override fun onPreferenceTreeClick(preference: Preference): Boolean {
context?.let { context ->
if (preference != null) {
if (preference.key == rh.gs(R.string.key_master_password)) {
passwordCheck.queryPassword(context, R.string.current_master_password, R.string.key_master_password, {
passwordCheck.setPassword(context, R.string.master_password, R.string.key_master_password)
@ -420,7 +417,6 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
return true
}
}
}
return super.onPreferenceTreeClick(preference)
}

View file

@ -165,7 +165,7 @@ class SmsCommunicatorPlugin @Inject constructor(
override fun updatePreferenceSummary(pref: Preference) {
super.updatePreferenceSummary(pref)
if (pref is EditTextPreference) {
if (pref.getKey().contains("smscommunicator_allowednumbers") && (pref.text == null || TextUtils.isEmpty(pref.text.trim { it <= ' ' }))) {
if (pref.getKey().contains("smscommunicator_allowednumbers") && (TextUtils.isEmpty(pref.text?.trim { it <= ' ' }))) {
pref.setSummary(rh.gs(R.string.smscommunicator_allowednumbers_summary))
}
}

View file

@ -3,11 +3,11 @@
buildscript {
ext {
kotlin_version = '1.6.10'
core_version = '1.6.0'
core_version = '1.7.0'
rxjava_version = '2.2.21'
rxandroid_version = '2.1.1'
rxkotlin_version = '2.4.0'
room_version = '2.3.0'
room_version = '2.4.2'
lifecycle_version = '2.3.1'
dagger_version = '2.41'
coroutines_version = '1.4.1'
@ -15,10 +15,10 @@ buildscript {
fragmentktx_version = '1.3.6'
ormLite_version = '4.46'
nav_version = '2.3.5'
appcompat_version = '1.3.1'
appcompat_version = '1.4.1'
material_version = '1.4.0'
constraintlayout_version = '2.1.0'
preferencektx_version = '1.1.1'
preferencektx_version = '1.2.0'
commonslang3_version = '3.11'
commonscodec_version = '1.15'
jodatime_version = '2.10.13'
@ -30,7 +30,7 @@ buildscript {
dexmaker_version = "1.2"
retrofit2_version = '2.9.0'
okhttp3_version = '4.9.0'
byteBuddy_version = '1.12.3'
byteBuddy_version = '1.12.8'
androidx_junit_version = '1.1.2'
androidx_rules_version = '1.4.0'

View file

@ -27,10 +27,10 @@ class ValidatingEditTextPreference(ctx: Context, attrs: AttributeSet, defStyleAt
constructor(ctx: Context, attrs: AttributeSet)
: this(ctx, attrs, R.attr.editTextPreferenceStyle)
override fun onBindViewHolder(holder: PreferenceViewHolder?) {
override fun onBindViewHolder(holder: PreferenceViewHolder) {
super.onBindViewHolder(holder)
holder?.isDividerAllowedAbove = false
holder?.isDividerAllowedBelow = false
holder.isDividerAllowedAbove = false
holder.isDividerAllowedBelow = false
}
private fun obtainValidatorParameters(attrs: AttributeSet): DefaultEditTextValidator.Parameters {