From 079c792d0ce5717142f607237b78016bf907b8c8 Mon Sep 17 00:00:00 2001 From: Conny Duck Date: Tue, 18 Dec 2018 22:05:33 +0100 Subject: [PATCH] update deps --- app/build.gradle | 12 +-- .../preference/PreferencesFragment.kt | 13 ++-- .../TabFilterPreferencesFragment.kt | 75 +++++++++---------- build.gradle | 2 +- 4 files changed, 51 insertions(+), 51 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index f7ee4c80..fb022941 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -75,10 +75,10 @@ dependencies { implementation 'androidx.browser:browser:1.0.0' implementation 'androidx.recyclerview:recyclerview:1.0.0' implementation 'androidx.legacy:legacy-support-v13:1.0.0' - implementation 'com.google.android.material:material:1.1.0-alpha01' + implementation 'com.google.android.material:material:1.1.0-alpha02' implementation 'androidx.exifinterface:exifinterface:1.0.0' implementation 'androidx.cardview:cardview:1.0.0' - implementation 'androidx.preference:preference:1.1.0-alpha01' + implementation 'androidx.preference:preference:1.1.0-alpha02' implementation 'com.squareup.retrofit2:retrofit:2.5.0' implementation 'com.squareup.retrofit2:converter-gson:2.5.0' implementation 'com.squareup.picasso:picasso:2.5.2' @@ -109,8 +109,8 @@ dependencies { implementation "com.google.dagger:dagger-android:$daggerVersion" implementation "com.google.dagger:dagger-android-support:$daggerVersion" kapt "com.google.dagger:dagger-android-processor:$daggerVersion" - testImplementation 'org.robolectric:robolectric:4.0.2' - testImplementation 'org.mockito:mockito-inline:2.23.0' + testImplementation 'org.robolectric:robolectric:4.1' + testImplementation 'org.mockito:mockito-inline:2.23.4' androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', { exclude group: 'com.android.support', module: 'support-annotations' }) @@ -119,6 +119,6 @@ dependencies { implementation 'io.reactivex.rxjava2:rxandroid:2.1.0' implementation 'io.reactivex.rxjava2:rxkotlin:2.3.0' implementation 'com.squareup.retrofit2:adapter-rxjava2:2.5.0' - implementation 'com.uber.autodispose:autodispose-android-archcomponents:1.0.0' - implementation 'com.uber.autodispose:autodispose-ktx:1.0.0' + implementation 'com.uber.autodispose:autodispose-android-archcomponents:1.1.0' + implementation 'com.uber.autodispose:autodispose-ktx:1.1.0' } diff --git a/app/src/main/java/com/keylesspalace/tusky/fragment/preference/PreferencesFragment.kt b/app/src/main/java/com/keylesspalace/tusky/fragment/preference/PreferencesFragment.kt index 2e4db0da..a6b19bf0 100644 --- a/app/src/main/java/com/keylesspalace/tusky/fragment/preference/PreferencesFragment.kt +++ b/app/src/main/java/com/keylesspalace/tusky/fragment/preference/PreferencesFragment.kt @@ -16,6 +16,7 @@ package com.keylesspalace.tusky.fragment.preference import android.os.Bundle +import androidx.preference.Preference import androidx.preference.PreferenceFragmentCompat import com.keylesspalace.tusky.PreferencesActivity import com.keylesspalace.tusky.R @@ -32,16 +33,16 @@ class PreferencesFragment : PreferenceFragmentCompat() { addPreferencesFromResource(R.xml.preferences) - val themePreference = findPreference("appTheme") + val themePreference: Preference = findPreference("appTheme") themePreference.icon = IconicsDrawable(context, GoogleMaterial.Icon.gmd_palette).sizePx(iconSize).color(ThemeUtils.getColor(context, R.attr.toolbar_icon_tint)) - val emojiPreference = findPreference("emojiCompat") + val emojiPreference: Preference = findPreference("emojiCompat") emojiPreference.icon = IconicsDrawable(context, GoogleMaterial.Icon.gmd_sentiment_satisfied).sizePx(iconSize).color(ThemeUtils.getColor(context, R.attr.toolbar_icon_tint)) - val textSizePreference = findPreference("statusTextSize") + val textSizePreference: Preference = findPreference("statusTextSize") textSizePreference.icon = IconicsDrawable(context, GoogleMaterial.Icon.gmd_format_size).sizePx(iconSize).color(ThemeUtils.getColor(context, R.attr.toolbar_icon_tint)) - val timelineFilterPreferences = findPreference("timelineFilterPreferences") + val timelineFilterPreferences: Preference = findPreference("timelineFilterPreferences") timelineFilterPreferences.setOnPreferenceClickListener { activity?.let { activity -> val intent = PreferencesActivity.newIntent(activity, PreferencesActivity.TAB_FILTER_PREFERENCES) @@ -51,7 +52,7 @@ class PreferencesFragment : PreferenceFragmentCompat() { true } - val httpProxyPreferences = findPreference("httpProxyPreferences") + val httpProxyPreferences: Preference = findPreference("httpProxyPreferences") httpProxyPreferences.setOnPreferenceClickListener { activity?.let { activity -> val intent = PreferencesActivity.newIntent(activity, PreferencesActivity.PROXY_PREFERENCES) @@ -70,7 +71,7 @@ class PreferencesFragment : PreferenceFragmentCompat() { private fun updateHttpProxySummary() { - val httpProxyPref = findPreference("httpProxyPreferences") + val httpProxyPref: Preference = findPreference("httpProxyPreferences") val sharedPreferences = preferenceManager.sharedPreferences diff --git a/app/src/main/java/com/keylesspalace/tusky/fragment/preference/TabFilterPreferencesFragment.kt b/app/src/main/java/com/keylesspalace/tusky/fragment/preference/TabFilterPreferencesFragment.kt index 094f8352..3199f9f1 100644 --- a/app/src/main/java/com/keylesspalace/tusky/fragment/preference/TabFilterPreferencesFragment.kt +++ b/app/src/main/java/com/keylesspalace/tusky/fragment/preference/TabFilterPreferencesFragment.kt @@ -22,6 +22,7 @@ import androidx.preference.PreferenceFragmentCompat import android.text.Editable import android.text.TextWatcher import android.widget.EditText +import androidx.preference.Preference import com.keylesspalace.tusky.R import java.util.regex.Pattern @@ -34,47 +35,45 @@ class TabFilterPreferencesFragment : PreferenceFragmentCompat() { sharedPreferences = preferenceManager.sharedPreferences - val regexPref = findPreference("tabFilterRegex") - if (regexPref != null) { - - regexPref.summary = sharedPreferences.getString("tabFilterRegex", "") - regexPref.setOnPreferenceClickListener { - - val editText = EditText(requireContext()) - editText.setText(sharedPreferences.getString("tabFilterRegex", "")) - - val dialog = AlertDialog.Builder(requireContext()) - .setTitle(R.string.pref_title_filter_regex) - .setView(editText) - .setPositiveButton(android.R.string.ok) { _, _ -> - sharedPreferences - .edit() - .putString("tabFilterRegex", editText.text.toString()) - .apply() - regexPref.summary = editText.text.toString() - } - .setNegativeButton(android.R.string.cancel, null) - .create() - - editText.addTextChangedListener(object : TextWatcher { - override fun afterTextChanged(newRegex: Editable) { - try { - Pattern.compile(newRegex.toString()) - editText.error = null - dialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = true - } catch (e: IllegalArgumentException) { - editText.error = getString(R.string.error_invalid_regex) - dialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = false - } + val regexPref: Preference = findPreference("tabFilterRegex") + + regexPref.summary = sharedPreferences.getString("tabFilterRegex", "") + regexPref.setOnPreferenceClickListener { + + val editText = EditText(requireContext()) + editText.setText(sharedPreferences.getString("tabFilterRegex", "")) + + val dialog = AlertDialog.Builder(requireContext()) + .setTitle(R.string.pref_title_filter_regex) + .setView(editText) + .setPositiveButton(android.R.string.ok) { _, _ -> + sharedPreferences + .edit() + .putString("tabFilterRegex", editText.text.toString()) + .apply() + regexPref.summary = editText.text.toString() + } + .setNegativeButton(android.R.string.cancel, null) + .create() + + editText.addTextChangedListener(object : TextWatcher { + override fun afterTextChanged(newRegex: Editable) { + try { + Pattern.compile(newRegex.toString()) + editText.error = null + dialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = true + } catch (e: IllegalArgumentException) { + editText.error = getString(R.string.error_invalid_regex) + dialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = false } + } - override fun beforeTextChanged(s1: CharSequence, start: Int, count: Int, after: Int) {} + override fun beforeTextChanged(s1: CharSequence, start: Int, count: Int, after: Int) {} - override fun onTextChanged(s1: CharSequence, start: Int, before: Int, count: Int) {} - }) - dialog.show() - true - } + override fun onTextChanged(s1: CharSequence, start: Int, before: Int, count: Int) {} + }) + dialog.show() + true } } diff --git a/build.gradle b/build.gradle index 930ba6bf..c40ef7c9 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.3.10' + ext.kotlin_version = '1.3.11' repositories { jcenter() google()