Introduce common parent for PreferenceFragment
This commit is contained in:
parent
87c9f6b2a0
commit
d9c8867c0b
|
@ -0,0 +1,40 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2019 New Vector Ltd
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package im.vector.riotredesign.core.platform
|
||||||
|
|
||||||
|
import androidx.annotation.CallSuper
|
||||||
|
import androidx.preference.PreferenceFragmentCompat
|
||||||
|
import timber.log.Timber
|
||||||
|
|
||||||
|
abstract class VectorPreferenceFragment : PreferenceFragmentCompat() {
|
||||||
|
|
||||||
|
val vectorActivity: RiotActivity by lazy {
|
||||||
|
activity as RiotActivity
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ==========================================================================================
|
||||||
|
* Life cycle
|
||||||
|
* ========================================================================================== */
|
||||||
|
|
||||||
|
@CallSuper
|
||||||
|
override fun onResume() {
|
||||||
|
super.onResume()
|
||||||
|
|
||||||
|
Timber.d("onResume Fragment ${this.javaClass.simpleName}")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -24,19 +24,19 @@ import android.os.Parcelable
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.core.content.edit
|
import androidx.core.content.edit
|
||||||
import androidx.preference.Preference
|
import androidx.preference.Preference
|
||||||
import androidx.preference.PreferenceFragmentCompat
|
|
||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
import im.vector.matrix.android.api.session.Session
|
import im.vector.matrix.android.api.session.Session
|
||||||
import im.vector.riotredesign.R
|
import im.vector.riotredesign.R
|
||||||
import im.vector.riotredesign.core.extensions.withArgs
|
import im.vector.riotredesign.core.extensions.withArgs
|
||||||
import im.vector.riotredesign.core.platform.RiotActivity
|
import im.vector.riotredesign.core.platform.RiotActivity
|
||||||
|
import im.vector.riotredesign.core.platform.VectorPreferenceFragment
|
||||||
import im.vector.riotredesign.core.preference.BingRule
|
import im.vector.riotredesign.core.preference.BingRule
|
||||||
import im.vector.riotredesign.core.preference.BingRulePreference
|
import im.vector.riotredesign.core.preference.BingRulePreference
|
||||||
import im.vector.riotredesign.features.notifications.NotificationUtils
|
import im.vector.riotredesign.features.notifications.NotificationUtils
|
||||||
import im.vector.riotredesign.features.notifications.supportNotificationChannels
|
import im.vector.riotredesign.features.notifications.supportNotificationChannels
|
||||||
import org.koin.android.ext.android.inject
|
import org.koin.android.ext.android.inject
|
||||||
|
|
||||||
class VectorSettingsAdvancedNotificationPreferenceFragment : PreferenceFragmentCompat() {
|
class VectorSettingsAdvancedNotificationPreferenceFragment : VectorPreferenceFragment() {
|
||||||
|
|
||||||
// members
|
// members
|
||||||
private val mSession by inject<Session>()
|
private val mSession by inject<Session>()
|
||||||
|
|
|
@ -47,6 +47,7 @@ import im.vector.riotredesign.R
|
||||||
import im.vector.riotredesign.core.extensions.showPassword
|
import im.vector.riotredesign.core.extensions.showPassword
|
||||||
import im.vector.riotredesign.core.extensions.withArgs
|
import im.vector.riotredesign.core.extensions.withArgs
|
||||||
import im.vector.riotredesign.core.platform.SimpleTextWatcher
|
import im.vector.riotredesign.core.platform.SimpleTextWatcher
|
||||||
|
import im.vector.riotredesign.core.platform.VectorPreferenceFragment
|
||||||
import im.vector.riotredesign.core.preference.BingRule
|
import im.vector.riotredesign.core.preference.BingRule
|
||||||
import im.vector.riotredesign.core.preference.ProgressBarPreference
|
import im.vector.riotredesign.core.preference.ProgressBarPreference
|
||||||
import im.vector.riotredesign.core.preference.UserAvatarPreference
|
import im.vector.riotredesign.core.preference.UserAvatarPreference
|
||||||
|
@ -57,7 +58,7 @@ import org.koin.android.ext.android.inject
|
||||||
import java.lang.ref.WeakReference
|
import java.lang.ref.WeakReference
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class VectorSettingsPreferencesFragment : PreferenceFragmentCompat(), SharedPreferences.OnSharedPreferenceChangeListener {
|
class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPreferences.OnSharedPreferenceChangeListener {
|
||||||
|
|
||||||
// members
|
// members
|
||||||
private val mSession by inject<Session>()
|
private val mSession by inject<Session>()
|
||||||
|
|
Loading…
Reference in New Issue