0
0
Fork 0
mirror of https://github.com/YTVanced/VancedManager synced 2024-11-16 16:25:11 +00:00

fixed crash on chosen preference press

This commit is contained in:
X1nto 2020-05-30 21:43:47 +04:00
parent 7ef1acc38d
commit b466b5b8c4
6 changed files with 18 additions and 14 deletions

View file

@ -53,7 +53,8 @@ open class Main: BaseActivity() {
override fun onPause() { override fun onPause() {
getSharedPreferences("installPrefs", Context.MODE_PRIVATE).edit().putBoolean("isInstalling", false).apply() getSharedPreferences("installPrefs", Context.MODE_PRIVATE).edit().putBoolean("isInstalling", false).apply()
getSharedPreferences("installPrefs", Context.MODE_PRIVATE).edit().putBoolean("isDownloading", false).apply() getSharedPreferences("installPrefs", Context.MODE_PRIVATE).edit().putBoolean("isVancedDownloading", false).apply()
getSharedPreferences("installPrefs", Context.MODE_PRIVATE).edit().putBoolean("isMicrogDownloading", false).apply()
try { try {
cacheDir.deleteRecursively() cacheDir.deleteRecursively()
} catch (e: Exception) { } catch (e: Exception) {

View file

@ -46,14 +46,14 @@ class MainActivity : Main() {
private val broadcastReceiver: BroadcastReceiver = object : BroadcastReceiver() { private val broadcastReceiver: BroadcastReceiver = object : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) { override fun onReceive(context: Context, intent: Intent) {
when { when (intent.action) {
intent.action.equals(INSTALL_COMPLETED) -> launchVanced() INSTALL_COMPLETED -> launchVanced()
intent.action.equals(INSTALL_BLOCKED) -> alertBuilder(INSTALL_BLOCKED) INSTALL_BLOCKED -> alertBuilder(INSTALL_BLOCKED)
intent.action.equals(INSTALL_FAILED) -> alertBuilder(INSTALL_FAILED) INSTALL_FAILED -> alertBuilder(INSTALL_FAILED)
intent.action.equals(INSTALL_ABORTED) -> alertBuilder(INSTALL_ABORTED) INSTALL_ABORTED -> alertBuilder(INSTALL_ABORTED)
intent.action.equals(INSTALL_STORAGE) -> alertBuilder(INSTALL_STORAGE) INSTALL_STORAGE -> alertBuilder(INSTALL_STORAGE)
intent.action.equals(INSTALL_CONFLICT) -> alertBuilder(INSTALL_CONFLICT) INSTALL_CONFLICT -> alertBuilder(INSTALL_CONFLICT)
intent.action.equals(INSTALL_INVALID) -> alertBuilder(INSTALL_INVALID) INSTALL_INVALID -> alertBuilder(INSTALL_INVALID)
} }
} }

View file

@ -22,7 +22,7 @@ class ChosenPreferenceDialogFragment : DialogFragment() {
if (dialog != null && dialog?.window != null) { if (dialog != null && dialog?.window != null) {
dialog?.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) dialog?.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
} }
return inflater.inflate(R.layout.fragment_update_check, container, false) return inflater.inflate(R.layout.fragment_chosen_preferences, container, false)
} }
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {

View file

@ -36,12 +36,14 @@ class SettingsFragment : PreferenceFragmentCompat() {
true true
} }
val installMode: DropDownPreference? = findPreference("vanced_variant")
installMode?.summary = preferenceScreen.sharedPreferences.getString("vanced_variant", "nonroot")
val chosenPrefs: Preference? = findPreference("vanced_chosen_modes") val chosenPrefs: Preference? = findPreference("vanced_chosen_modes")
chosenPrefs?.summary = preferenceScreen.sharedPreferences.getString("vanced_variant", "nonroot")
chosenPrefs?.setOnPreferenceClickListener { chosenPrefs?.setOnPreferenceClickListener {
val fm = childFragmentManager.beginTransaction() val fm = childFragmentManager.beginTransaction()
val updateDialog = ChosenPreferenceDialogFragment() val chosenPrefsDialog = ChosenPreferenceDialogFragment()
updateDialog.show(fm, "Chosen Preferences") chosenPrefsDialog.show(fm, "Chosen Preferences")
true true
} }

View file

@ -19,7 +19,7 @@
<TextView <TextView
style="@style/CardTitle" style="@style/CardTitle"
android:id="@+id/update_center_text" android:id="@+id/chosen_values_text"
android:layout_gravity="center" android:layout_gravity="center"
android:text="Chosen Preferences" android:text="Chosen Preferences"
android:textAlignment="center" android:textAlignment="center"

View file

@ -29,6 +29,7 @@
android:id="@+id/update_center_checking" android:id="@+id/update_center_checking"
style="@style/AppVer.Bold" style="@style/AppVer.Bold"
android:layout_marginTop="4dp" android:layout_marginTop="4dp"
android:layout_marginStart="0dp"
android:layout_gravity="center" android:layout_gravity="center"
android:text="Checking For Updates..." android:text="Checking For Updates..."
android:textAlignment="center" android:textAlignment="center"