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

broadcast test

This commit is contained in:
X1nto 2020-08-04 15:42:15 +04:00
parent 25d43cc191
commit 30c84873a4
2 changed files with 10 additions and 3 deletions

View file

@ -9,8 +9,9 @@ import android.util.Log
import androidx.localbroadcastmanager.content.LocalBroadcastManager
import com.vanced.manager.R
import com.vanced.manager.ui.MainActivity
import com.vanced.manager.ui.fragments.HomeFragment
import com.vanced.manager.utils.AppUtils.getErrorMessage
import com.vanced.manager.utils.AppUtils.sendRefreshHome
//import com.vanced.manager.utils.AppUtils.sendRefreshHome
import com.vanced.manager.utils.NotificationHelper.createBasicNotif
class AppInstallerService: Service() {
@ -32,7 +33,7 @@ class AppInstallerService: Service() {
PackageInstaller.STATUS_SUCCESS -> {
Log.d(TAG, "Installation succeed")
getSharedPreferences("installPrefs", Context.MODE_PRIVATE).edit().putBoolean("isInstalling", false).apply()
sendRefreshHome(this)
sendRefreshHome()
createBasicNotif(getString(
R.string.successfully_installed,
"Microg"
@ -58,6 +59,12 @@ class AppInstallerService: Service() {
LocalBroadcastManager.getInstance(this).sendBroadcast(mIntent)
}
private fun sendRefreshHome() {
val intent = Intent()
intent.action = HomeFragment.REFRESH_HOME
LocalBroadcastManager.getInstance(this).sendBroadcast(intent)
}
override fun onBind(intent: Intent?): IBinder? {
return null
}

View file

@ -127,7 +127,7 @@ class HomeFragment : Fragment(), View.OnClickListener {
Snackbar.make(binding.homeRefresh, R.string.no_microg, Snackbar.LENGTH_LONG)
.setAction(R.string.install) {
activity?.startService(Intent(activity, MicrogDownloadService::class.java))
}
}.show()
}
R.id.microg_installbtn -> {