0
0
Fork 0
mirror of https://github.com/YTVanced/VancedManager synced 2024-11-10 12:55:06 +00:00

localbroadcast changes and we finally fixed themes on android 6 and 5

This commit is contained in:
X1nto 2020-05-27 21:06:24 +04:00
parent 55a12b145e
commit 02f153ee8c
3 changed files with 7 additions and 15 deletions

View file

@ -8,6 +8,7 @@ import android.os.IBinder
import android.util.Log
import android.widget.Toast
import androidx.annotation.Nullable
import androidx.localbroadcastmanager.content.LocalBroadcastManager
import com.vanced.manager.ui.MainActivity
class SplitInstallerService: Service() {
@ -30,27 +31,27 @@ class SplitInstallerService: Service() {
getSharedPreferences("installPrefs", Context.MODE_PRIVATE).edit().putBoolean("isInstalling", false).apply()
val mIntent = Intent(MainActivity.INSTALL_COMPLETED)
mIntent.action = MainActivity.INSTALL_COMPLETED
sendBroadcast(mIntent)
LocalBroadcastManager.getInstance(this).sendBroadcast(mIntent)
}
PackageInstaller.STATUS_FAILURE_ABORTED -> {
val mIntent = Intent(MainActivity.INSTALL_ABORTED)
mIntent.action = MainActivity.INSTALL_ABORTED
sendBroadcast(mIntent)
LocalBroadcastManager.getInstance(this).sendBroadcast(mIntent)
}
PackageInstaller.STATUS_FAILURE_INVALID -> {
val mIntent = Intent(MainActivity.INSTALL_INVALID)
mIntent.action = MainActivity.INSTALL_INVALID
sendBroadcast(mIntent)
LocalBroadcastManager.getInstance(this).sendBroadcast(mIntent)
}
PackageInstaller.STATUS_FAILURE_CONFLICT -> {
val mIntent = Intent(MainActivity.INSTALL_CONFLICT)
mIntent.action = MainActivity.INSTALL_CONFLICT
sendBroadcast(mIntent)
LocalBroadcastManager.getInstance(this).sendBroadcast(mIntent)
}
PackageInstaller.STATUS_FAILURE_STORAGE -> {
val mIntent = Intent(MainActivity.INSTALL_STORAGE)
mIntent.action = MainActivity.INSTALL_STORAGE
sendBroadcast(mIntent)
LocalBroadcastManager.getInstance(this).sendBroadcast(mIntent)
}
PackageInstaller.STATUS_FAILURE_BLOCKED -> {
val mIntent = Intent(MainActivity.INSTALL_BLOCKED)

View file

@ -39,6 +39,7 @@ class MainActivity : Main() {
setDisplayHomeAsUpEnabled(!isParent)
}
LocalBroadcastManager.getInstance(this).registerReceiver(broadcastReceiver, IntentFilter(
BLANK_INTENT
))

View file

@ -1,6 +1,5 @@
package com.vanced.manager.ui.fragments
import android.os.Build
import android.os.Bundle
import android.view.Menu
import android.view.MenuInflater
@ -12,15 +11,6 @@ class SettingsFragment : PreferenceFragmentCompat() {
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.preferences, rootKey)
//Fuck Android 6 android 5 users! Because theme is not working
//we can't display preference for them.
//They should've upgraded to something newer
/*if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
val prefScreen: PreferenceScreen? = findPreference("prefScreen")
val prefCategory: PreferenceCategory? = findPreference("interface_category")
prefScreen?.removePreference(prefCategory)
}*/
activity?.title = getString(R.string.title_settings)
setHasOptionsMenu(true)