0
0
Fork 0
mirror of https://github.com/YTVanced/VancedManager synced 2024-11-02 01:02:39 +00:00

fixed variant selector

This commit is contained in:
X1nto 2020-06-23 19:18:17 +04:00
parent 0f1af2e80d
commit 0f823c1ed1
3 changed files with 12 additions and 27 deletions

View file

@ -31,6 +31,15 @@ open class Home : BaseFragment(), View.OnClickListener, AdapterView.OnItemSelect
val vanceduninstallbtn = view.findViewById<ImageView>(R.id.vanced_uninstallbtn)
val spinner: Spinner = view.findViewById(R.id.home_variant_selector)
activity?.let {
ArrayAdapter.createFromResource(it,
R.array.vanced_variant,
android.R.layout.simple_spinner_item).also { arrayAdapter ->
arrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
spinner.adapter = arrayAdapter
}
}
vancedinstallbtn.setOnClickListener(this)
microginstallbtn.setOnClickListener(this)
signaturebtn.setOnClickListener(this)

View file

@ -42,25 +42,6 @@ class SettingsFragment : PreferenceFragmentCompat() {
true
}
/*
val installMode: DropDownPreference? = findPreference("vanced_variant")
installMode?.summary = preferenceScreen.sharedPreferences.getString("vanced_variant",
"nonroot"
)?.capitalize(Locale.ROOT)
installMode?.setOnPreferenceChangeListener{ _, _ ->
when (installMode.value) {
"nonroot" -> {
if (!Shell.rootAccess()) {
installMode.value = "nonroot"
}
}
}
restartMain()
true
}
*/
val chosenPrefs: Preference? = findPreference("vanced_chosen_modes")
chosenPrefs?.setOnPreferenceClickListener {
val fm = childFragmentManager.beginTransaction()
@ -76,9 +57,4 @@ class SettingsFragment : PreferenceFragmentCompat() {
super .onCreateOptionsMenu(menu, inflater)
}
private fun restartMain() {
startActivity(Intent(activity, MainActivity::class.java))
activity?.finish()
}
}

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
<layout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:bind="http://schemas.android.com/apk/res-auto">
@ -42,8 +43,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/stdp"
android:layout_marginTop="@dimen/eightdp"
android:layout_marginEnd="@dimen/stdp"
android:entries="@array/vanced_variant" />
android:layout_marginEnd="@dimen/stdp" />
<include
layout="@layout/include_vanced"