|
|
@ -8,7 +8,7 @@ import android.view.View |
|
|
|
import androidx.preference.Preference |
|
|
|
import androidx.preference.Preference |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.base.BaseFragment |
|
|
|
import io.legado.app.base.BaseFragment |
|
|
|
import io.legado.app.base.BasePreferenceFragment |
|
|
|
import io.legado.app.base.PreferenceFragment |
|
|
|
import io.legado.app.constant.EventBus |
|
|
|
import io.legado.app.constant.EventBus |
|
|
|
import io.legado.app.constant.PreferKey |
|
|
|
import io.legado.app.constant.PreferKey |
|
|
|
import io.legado.app.databinding.FragmentMyConfigBinding |
|
|
|
import io.legado.app.databinding.FragmentMyConfigBinding |
|
|
@ -40,7 +40,7 @@ class MyFragment : BaseFragment(R.layout.fragment_my_config) { |
|
|
|
setSupportToolbar(binding.titleBar.toolbar) |
|
|
|
setSupportToolbar(binding.titleBar.toolbar) |
|
|
|
val fragmentTag = "prefFragment" |
|
|
|
val fragmentTag = "prefFragment" |
|
|
|
var preferenceFragment = childFragmentManager.findFragmentByTag(fragmentTag) |
|
|
|
var preferenceFragment = childFragmentManager.findFragmentByTag(fragmentTag) |
|
|
|
if (preferenceFragment == null) preferenceFragment = PreferenceFragment() |
|
|
|
if (preferenceFragment == null) preferenceFragment = MyPreferenceFragment() |
|
|
|
childFragmentManager.beginTransaction() |
|
|
|
childFragmentManager.beginTransaction() |
|
|
|
.replace(R.id.pre_fragment, preferenceFragment, fragmentTag).commit() |
|
|
|
.replace(R.id.pre_fragment, preferenceFragment, fragmentTag).commit() |
|
|
|
} |
|
|
|
} |
|
|
@ -61,7 +61,7 @@ class MyFragment : BaseFragment(R.layout.fragment_my_config) { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 配置 |
|
|
|
* 配置 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
class PreferenceFragment : BasePreferenceFragment(), |
|
|
|
class MyPreferenceFragment : PreferenceFragment(), |
|
|
|
SharedPreferences.OnSharedPreferenceChangeListener { |
|
|
|
SharedPreferences.OnSharedPreferenceChangeListener { |
|
|
|
|
|
|
|
|
|
|
|
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { |
|
|
|
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { |
|
|
|