0
0
Fork 0
mirror of https://github.com/YTVanced/VancedManager synced 2024-11-27 05:23:00 +00:00
This commit is contained in:
X1nto 2020-07-22 20:43:03 +04:00
parent 90d8164f64
commit f89ad86cb0
4 changed files with 9 additions and 6 deletions

View file

@ -81,12 +81,12 @@ class MicrogDownloadService: Service() {
if (intent?.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1) == downloadId) { if (intent?.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1) == downloadId) {
//prefs?.edit()?.putBoolean("isMicrogDownloading", false)?.apply() //prefs?.edit()?.putBoolean("isMicrogDownloading", false)?.apply()
//cancelNotif(channel, this@MicrogDownloadService) //cancelNotif(channel, this@MicrogDownloadService)
val bIntent = Intent(this@MicrogDownloadService, AppInstaller::class.java) val mIntent = Intent()
bIntent.putExtra("path", "${filesDir.path}/microg.apk")
bIntent.putExtra("pkg", "com.mgoogle.android.gms")
val mIntent = Intent(HomeFragment.MICROG_DOWNLOADED)
mIntent.action = HomeFragment.MICROG_DOWNLOADED mIntent.action = HomeFragment.MICROG_DOWNLOADED
LocalBroadcastManager.getInstance(this@MicrogDownloadService).sendBroadcast(mIntent) LocalBroadcastManager.getInstance(this@MicrogDownloadService).sendBroadcast(mIntent)
val bIntent = Intent(this@MicrogDownloadService, AppInstaller::class.java)
bIntent.putExtra("path", "${getExternalFilesDir("apk")}/microg.apk")
bIntent.putExtra("pkg", "com.mgoogle.android.gms")
startService(bIntent) startService(bIntent)
} }
} }

View file

@ -76,7 +76,7 @@ class DevSettingsFragment: PreferenceFragmentCompat() {
override fun onReceive(context: Context?, intent: Intent?) { override fun onReceive(context: Context?, intent: Intent?) {
if (intent?.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1) == downloadId) { if (intent?.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1) == downloadId) {
activity?.let { activity?.let {
val apk = File("${activity?.filesDir?.path}/manager.apk") val apk = File("${activity?.getExternalFilesDir("apk")}/manager.apk")
val uri = val uri =
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
FileProvider.getUriForFile(activity!!, "${activity?.packageName}.provider", apk) FileProvider.getUriForFile(activity!!, "${activity?.packageName}.provider", apk)

View file

@ -50,7 +50,7 @@
style="@style/ButtonStyle" style="@style/ButtonStyle"
android:text="@{viewModel.vancedInstallButtonTxt}" android:text="@{viewModel.vancedInstallButtonTxt}"
android:textColor="@{viewModel.shouldBeDisabled ? @color/LightGray : @color/White}" android:textColor="@{viewModel.shouldBeDisabled ? @color/LightGray : @color/White}"
android:backgroundTint="@{viewModel.shouldBeDisabled ? @color/Gray : @color/Accent}" android:backgroundTint="@{viewModel.shouldBeDisabled ? @drawable/Gray : @drawable/Accent}"
app:icon="@{viewModel.vancedInstallButtonIcon}" app:icon="@{viewModel.vancedInstallButtonIcon}"
android:clickable="@{!viewModel.shouldBeDisabled}" android:clickable="@{!viewModel.shouldBeDisabled}"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"

View file

@ -16,4 +16,7 @@
<color name="Accent">?attr/colorPrimary</color> <color name="Accent">?attr/colorPrimary</color>
<drawable name="Accent">?attr/colorPrimary</drawable>
<drawable name="Gray">@color/Gray</drawable>
</resources> </resources>