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,9 +123,11 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
override fun onDestroy() { override fun onDestroy() {
super.onDestroy() super.onDestroy()
PreferenceManager context?.let { context ->
.getDefaultSharedPreferences(context) PreferenceManager
.unregisterOnSharedPreferenceChangeListener(this) .getDefaultSharedPreferences(context)
.unregisterOnSharedPreferenceChangeListener(this)
}
} }
private fun addPreferencesFromResourceIfEnabled(p: PluginBase?, rootKey: String?, enabled: Boolean) { private fun addPreferencesFromResourceIfEnabled(p: PluginBase?, rootKey: String?, enabled: Boolean) {
@ -139,9 +141,11 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
PreferenceManager context?.let { context ->
.getDefaultSharedPreferences(context) PreferenceManager
.registerOnSharedPreferenceChangeListener(this) .getDefaultSharedPreferences(context)
.registerOnSharedPreferenceChangeListener(this)
}
} }
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
@ -263,19 +267,19 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
@SuppressLint("RestrictedApi") @SuppressLint("RestrictedApi")
private fun addPreferencesFromResource(@XmlRes preferencesResId: Int, key: String?) { private fun addPreferencesFromResource(@XmlRes preferencesResId: Int, key: String?) {
val xmlRoot = preferenceManager.inflateFromResource(context, context?.let { context ->
preferencesResId, null) val xmlRoot = preferenceManager.inflateFromResource(context, preferencesResId, null)
val root: Preference? val root: Preference?
if (key != null) { if (key != null) {
root = xmlRoot.findPreference(key) root = xmlRoot.findPreference(key)
if (root == null) return if (root == null) return
require(root is PreferenceScreen) { require(root is PreferenceScreen) {
("Preference object with key " + key ("Preference object with key $key is not a PreferenceScreen")
+ " is not a PreferenceScreen") }
preferenceScreen = root
} else {
addPreferencesFromResource(preferencesResId)
} }
preferenceScreen = root
} else {
addPreferencesFromResource(preferencesResId)
} }
} }
@ -305,15 +309,9 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
p.initialExpandedChildrenCount = Int.MAX_VALUE p.initialExpandedChildrenCount = Int.MAX_VALUE
} }
} else { } else {
if (p.key != null) { visible = visible || p.key?.contains(filter, true) == true
visible = visible || p.key.contains(filter, true) visible = visible || p.title?.contains(filter, true) == true
} visible = visible || p.summary?.contains(filter, true) == true
if (p.title != null) {
visible = visible || p.title.contains(filter, true)
}
if (p.summary != null) {
visible = visible || p.summary.contains(filter, true)
}
} }
p.isVisible = visible p.isVisible = visible
@ -393,32 +391,30 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
// We use Preference and custom editor instead of EditTextPreference // We use Preference and custom editor instead of EditTextPreference
// to hash password while it is saved and never have to show it, even hashed // 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 -> context?.let { context ->
if (preference != null) { if (preference.key == rh.gs(R.string.key_master_password)) {
if (preference.key == rh.gs(R.string.key_master_password)) { passwordCheck.queryPassword(context, R.string.current_master_password, 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)
passwordCheck.setPassword(context, R.string.master_password, R.string.key_master_password) })
}) return true
return true }
} if (preference.key == rh.gs(R.string.key_settings_password)) {
if (preference.key == rh.gs(R.string.key_settings_password)) { passwordCheck.setPassword(context, R.string.settings_password, R.string.key_settings_password)
passwordCheck.setPassword(context, R.string.settings_password, R.string.key_settings_password) return true
return true }
} if (preference.key == rh.gs(R.string.key_bolus_password)) {
if (preference.key == rh.gs(R.string.key_bolus_password)) { passwordCheck.setPassword(context, R.string.bolus_password, R.string.key_bolus_password)
passwordCheck.setPassword(context, R.string.bolus_password, R.string.key_bolus_password) return true
return true }
} if (preference.key == rh.gs(R.string.key_application_password)) {
if (preference.key == rh.gs(R.string.key_application_password)) { passwordCheck.setPassword(context, R.string.application_password, R.string.key_application_password)
passwordCheck.setPassword(context, R.string.application_password, R.string.key_application_password) return true
return true }
} // NSClient copy settings
// NSClient copy settings if (preference.key == rh.gs(R.string.key_statuslights_copy_ns)) {
if (preference.key == rh.gs(R.string.key_statuslights_copy_ns)) { nsSettingStatus.copyStatusLightsNsSettings(context)
nsSettingStatus.copyStatusLightsNsSettings(context) return true
return true
}
} }
} }
return super.onPreferenceTreeClick(preference) return super.onPreferenceTreeClick(preference)

View file

@ -165,7 +165,7 @@ class SmsCommunicatorPlugin @Inject constructor(
override fun updatePreferenceSummary(pref: Preference) { override fun updatePreferenceSummary(pref: Preference) {
super.updatePreferenceSummary(pref) super.updatePreferenceSummary(pref)
if (pref is EditTextPreference) { 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)) pref.setSummary(rh.gs(R.string.smscommunicator_allowednumbers_summary))
} }
} }

View file

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

View file

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