From 122febcad2cd781838aee26e67df3b1e9d6eee28 Mon Sep 17 00:00:00 2001 From: X1nto Date: Wed, 5 Aug 2020 16:03:51 +0400 Subject: [PATCH] haha gradle errors go brrrrr --- app/src/main/java/com/vanced/manager/core/App.kt | 2 -- .../manager/core/installer/AppUninstallerService.kt | 9 ++++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/vanced/manager/core/App.kt b/app/src/main/java/com/vanced/manager/core/App.kt index b1021308..d69f5c14 100644 --- a/app/src/main/java/com/vanced/manager/core/App.kt +++ b/app/src/main/java/com/vanced/manager/core/App.kt @@ -5,14 +5,12 @@ import com.crowdin.platform.Crowdin import com.crowdin.platform.CrowdinConfig import com.crowdin.platform.data.remote.NetworkType import com.downloader.PRDownloader -import com.vanced.manager.utils.NotificationHelper.createNotifChannel class App: Application() { override fun onCreate() { super.onCreate() PRDownloader.initialize(this) - createNotifChannel(this) Crowdin.init(this, CrowdinConfig.Builder() diff --git a/app/src/main/java/com/vanced/manager/core/installer/AppUninstallerService.kt b/app/src/main/java/com/vanced/manager/core/installer/AppUninstallerService.kt index 267cdd6e..24f6eaa8 100644 --- a/app/src/main/java/com/vanced/manager/core/installer/AppUninstallerService.kt +++ b/app/src/main/java/com/vanced/manager/core/installer/AppUninstallerService.kt @@ -6,10 +6,13 @@ import android.content.pm.PackageInstaller import android.os.Handler import android.os.IBinder import android.util.Log -import com.vanced.manager.utils.AppUtils.sendRefreshHome +import androidx.localbroadcastmanager.content.LocalBroadcastManager +import com.vanced.manager.ui.fragments.HomeFragment class AppUninstallerService: Service() { + private val localBroadcastManager by lazy { LocalBroadcastManager.getInstance(this) } + override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { val pkgName = intent?.getStringExtra("pkg") when (intent?.getIntExtra(PackageInstaller.EXTRA_STATUS, -999)) { @@ -24,13 +27,13 @@ class AppUninstallerService: Service() { } PackageInstaller.STATUS_SUCCESS -> { Handler().postDelayed({ - sendRefreshHome(this) + localBroadcastManager.sendBroadcast(Intent(HomeFragment.REFRESH_HOME)) Log.d("VMpm", "Successfully uninstalled $pkgName") }, 500) } PackageInstaller.STATUS_FAILURE -> { Handler().postDelayed({ - sendRefreshHome(this) + localBroadcastManager.sendBroadcast(Intent(HomeFragment.REFRESH_HOME)) Log.d("VMpm", "Failed to uninstall $pkgName") }, 500) }