From 743c7c932670b49a7dc4151691c2c59bf3c2a1e9 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Wed, 1 Sep 2021 01:11:57 -0700 Subject: [PATCH] App code reorganization --- app/build.gradle.kts | 4 ++-- .../main/java/com/topjohnwu/magisk/arch/BaseViewModel.kt | 4 ++-- .../main/java/com/topjohnwu/magisk/core/tasks/HideAPK.kt | 4 ++-- .../com/topjohnwu/magisk/core/tasks/MagiskInstaller.kt | 2 +- .../main/java/com/topjohnwu/magisk/core/utils/Keygen.kt | 6 +++--- .../magisk/{utils => databinding}/DiffObservableList.kt | 2 +- .../FilterableDiffObservableList.kt | 4 ++-- .../com/topjohnwu/magisk/{arch => databinding}/Helpers.kt | 7 +------ .../magisk/{utils => databinding}/ObservableHost.kt | 2 +- .../com/topjohnwu/magisk/databinding/RecyclerViewItems.kt | 2 -- .../com/topjohnwu/{ => magisk}/signing/ApkSignerV2.java | 2 +- .../topjohnwu/{ => magisk}/signing/ByteArrayStream.java | 2 +- .../com/topjohnwu/{ => magisk}/signing/CryptoUtils.java | 2 +- .../java/com/topjohnwu/{ => magisk}/signing/JarMap.java | 2 +- .../java/com/topjohnwu/{ => magisk}/signing/SignApk.java | 2 +- .../java/com/topjohnwu/{ => magisk}/signing/SignBoot.java | 2 +- .../java/com/topjohnwu/{ => magisk}/signing/ZipUtils.java | 2 +- .../java/com/topjohnwu/magisk/ui/flash/FlashViewModel.kt | 6 +++--- .../main/java/com/topjohnwu/magisk/ui/hide/HideRvItems.kt | 4 ++-- .../java/com/topjohnwu/magisk/ui/hide/HideViewModel.kt | 6 +++--- .../java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt | 8 ++++++-- .../topjohnwu/magisk/ui/inflater/LayoutInflaterFactory.kt | 1 - .../com/topjohnwu/magisk/ui/install/InstallViewModel.kt | 2 +- .../main/java/com/topjohnwu/magisk/ui/log/LogRvItem.kt | 2 +- .../main/java/com/topjohnwu/magisk/ui/log/LogViewModel.kt | 6 +++--- .../java/com/topjohnwu/magisk/ui/module/ModuleRvItem.kt | 2 +- .../com/topjohnwu/magisk/ui/module/ModuleViewModel.kt | 7 +++---- .../topjohnwu/magisk/ui/safetynet/CheckSafetyNetEvent.kt | 2 +- .../topjohnwu/magisk/ui/safetynet/SafetynetViewModel.kt | 2 +- .../com/topjohnwu/magisk/ui/settings/BaseSettingsItem.kt | 2 +- .../com/topjohnwu/magisk/ui/settings/SettingsItems.kt | 2 +- .../com/topjohnwu/magisk/ui/settings/SettingsViewModel.kt | 4 ++-- .../com/topjohnwu/magisk/ui/superuser/PolicyRvItem.kt | 2 +- .../topjohnwu/magisk/ui/superuser/SuperuserViewModel.kt | 6 +++--- .../topjohnwu/magisk/ui/surequest/SuRequestViewModel.kt | 2 +- .../main/java/com/topjohnwu/magisk/view/MagiskDialog.kt | 7 +------ 36 files changed, 57 insertions(+), 67 deletions(-) rename app/src/main/java/com/topjohnwu/magisk/{utils => databinding}/DiffObservableList.kt (99%) rename app/src/main/java/com/topjohnwu/magisk/{utils => databinding}/FilterableDiffObservableList.kt (97%) rename app/src/main/java/com/topjohnwu/magisk/{arch => databinding}/Helpers.kt (78%) rename app/src/main/java/com/topjohnwu/magisk/{utils => databinding}/ObservableHost.kt (98%) rename app/src/main/java/com/topjohnwu/{ => magisk}/signing/ApkSignerV2.java (99%) rename app/src/main/java/com/topjohnwu/{ => magisk}/signing/ByteArrayStream.java (95%) rename app/src/main/java/com/topjohnwu/{ => magisk}/signing/CryptoUtils.java (99%) rename app/src/main/java/com/topjohnwu/{ => magisk}/signing/JarMap.java (99%) rename app/src/main/java/com/topjohnwu/{ => magisk}/signing/SignApk.java (99%) rename app/src/main/java/com/topjohnwu/{ => magisk}/signing/SignBoot.java (99%) rename app/src/main/java/com/topjohnwu/{ => magisk}/signing/ZipUtils.java (99%) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index cedd3d2a6..07cdaee5f 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -144,7 +144,7 @@ tasks["preBuild"]?.dependsOn(syncResources) android.applicationVariants.all { val keysDir = rootProject.file("tools/keys") val outSrcDir = File(buildDir, "generated/source/keydata/$name") - val outSrc = File(outSrcDir, "com/topjohnwu/signing/KeyData.java") + val outSrc = File(outSrcDir, "com/topjohnwu/magisk/signing/KeyData.java") fun PrintStream.newField(name: String, file: File) { println("public static byte[] $name() {") @@ -162,7 +162,7 @@ android.applicationVariants.all { doLast { outSrc.parentFile.mkdirs() PrintStream(outSrc).use { - it.println("package com.topjohnwu.signing;") + it.println("package com.topjohnwu.magisk.signing;") it.println("public final class KeyData {") it.newField("testCert", File(keysDir, "testkey.x509.pem")) diff --git a/app/src/main/java/com/topjohnwu/magisk/arch/BaseViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/arch/BaseViewModel.kt index 6018da03b..975d55e97 100644 --- a/app/src/main/java/com/topjohnwu/magisk/arch/BaseViewModel.kt +++ b/app/src/main/java/com/topjohnwu/magisk/arch/BaseViewModel.kt @@ -13,12 +13,12 @@ import androidx.navigation.NavDirections import com.topjohnwu.magisk.BR import com.topjohnwu.magisk.R import com.topjohnwu.magisk.core.Info +import com.topjohnwu.magisk.databinding.ObservableHost +import com.topjohnwu.magisk.databinding.set import com.topjohnwu.magisk.events.BackPressEvent import com.topjohnwu.magisk.events.NavigationEvent import com.topjohnwu.magisk.events.PermissionEvent import com.topjohnwu.magisk.events.SnackbarEvent -import com.topjohnwu.magisk.utils.ObservableHost -import com.topjohnwu.magisk.utils.set import kotlinx.coroutines.Job abstract class BaseViewModel( diff --git a/app/src/main/java/com/topjohnwu/magisk/core/tasks/HideAPK.kt b/app/src/main/java/com/topjohnwu/magisk/core/tasks/HideAPK.kt index ca7eb9c5f..c0006e18d 100644 --- a/app/src/main/java/com/topjohnwu/magisk/core/tasks/HideAPK.kt +++ b/app/src/main/java/com/topjohnwu/magisk/core/tasks/HideAPK.kt @@ -16,10 +16,10 @@ import com.topjohnwu.magisk.core.utils.AXML import com.topjohnwu.magisk.core.utils.Keygen import com.topjohnwu.magisk.di.ServiceLocator import com.topjohnwu.magisk.ktx.writeTo +import com.topjohnwu.magisk.signing.JarMap +import com.topjohnwu.magisk.signing.SignApk import com.topjohnwu.magisk.utils.APKInstall import com.topjohnwu.magisk.utils.Utils -import com.topjohnwu.signing.JarMap -import com.topjohnwu.signing.SignApk import com.topjohnwu.superuser.Shell import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext diff --git a/app/src/main/java/com/topjohnwu/magisk/core/tasks/MagiskInstaller.kt b/app/src/main/java/com/topjohnwu/magisk/core/tasks/MagiskInstaller.kt index 35986f8d4..9d5b6a564 100644 --- a/app/src/main/java/com/topjohnwu/magisk/core/tasks/MagiskInstaller.kt +++ b/app/src/main/java/com/topjohnwu/magisk/core/tasks/MagiskInstaller.kt @@ -16,8 +16,8 @@ import com.topjohnwu.magisk.di.ServiceLocator import com.topjohnwu.magisk.ktx.reboot import com.topjohnwu.magisk.ktx.withStreams import com.topjohnwu.magisk.ktx.writeTo +import com.topjohnwu.magisk.signing.SignBoot import com.topjohnwu.magisk.utils.Utils -import com.topjohnwu.signing.SignBoot import com.topjohnwu.superuser.Shell import com.topjohnwu.superuser.ShellUtils import com.topjohnwu.superuser.internal.NOPList diff --git a/app/src/main/java/com/topjohnwu/magisk/core/utils/Keygen.kt b/app/src/main/java/com/topjohnwu/magisk/core/utils/Keygen.kt index 3bde7161b..90dfe0ef5 100644 --- a/app/src/main/java/com/topjohnwu/magisk/core/utils/Keygen.kt +++ b/app/src/main/java/com/topjohnwu/magisk/core/utils/Keygen.kt @@ -5,9 +5,9 @@ import android.content.pm.PackageManager import android.util.Base64 import android.util.Base64OutputStream import com.topjohnwu.magisk.core.Config -import com.topjohnwu.signing.CryptoUtils.readCertificate -import com.topjohnwu.signing.CryptoUtils.readPrivateKey -import com.topjohnwu.signing.KeyData +import com.topjohnwu.magisk.signing.CryptoUtils.readCertificate +import com.topjohnwu.magisk.signing.CryptoUtils.readPrivateKey +import com.topjohnwu.magisk.signing.KeyData import org.bouncycastle.asn1.x500.X500Name import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter import org.bouncycastle.cert.jcajce.JcaX509v3CertificateBuilder diff --git a/app/src/main/java/com/topjohnwu/magisk/utils/DiffObservableList.kt b/app/src/main/java/com/topjohnwu/magisk/databinding/DiffObservableList.kt similarity index 99% rename from app/src/main/java/com/topjohnwu/magisk/utils/DiffObservableList.kt rename to app/src/main/java/com/topjohnwu/magisk/databinding/DiffObservableList.kt index 6c888bd1d..d2839161d 100644 --- a/app/src/main/java/com/topjohnwu/magisk/utils/DiffObservableList.kt +++ b/app/src/main/java/com/topjohnwu/magisk/databinding/DiffObservableList.kt @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk.utils +package com.topjohnwu.magisk.databinding import androidx.annotation.MainThread import androidx.databinding.ListChangeRegistry diff --git a/app/src/main/java/com/topjohnwu/magisk/utils/FilterableDiffObservableList.kt b/app/src/main/java/com/topjohnwu/magisk/databinding/FilterableDiffObservableList.kt similarity index 97% rename from app/src/main/java/com/topjohnwu/magisk/utils/FilterableDiffObservableList.kt rename to app/src/main/java/com/topjohnwu/magisk/databinding/FilterableDiffObservableList.kt index 80e10f968..8f3e85e10 100644 --- a/app/src/main/java/com/topjohnwu/magisk/utils/FilterableDiffObservableList.kt +++ b/app/src/main/java/com/topjohnwu/magisk/databinding/FilterableDiffObservableList.kt @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk.utils +package com.topjohnwu.magisk.databinding import android.os.Handler import android.os.HandlerThread @@ -82,4 +82,4 @@ class FilterableDiffObservableList( override val size: Int get() = sublist.size -} \ No newline at end of file +} diff --git a/app/src/main/java/com/topjohnwu/magisk/arch/Helpers.kt b/app/src/main/java/com/topjohnwu/magisk/databinding/Helpers.kt similarity index 78% rename from app/src/main/java/com/topjohnwu/magisk/arch/Helpers.kt rename to app/src/main/java/com/topjohnwu/magisk/databinding/Helpers.kt index 7ea88eaf4..22e6e5a35 100644 --- a/app/src/main/java/com/topjohnwu/magisk/arch/Helpers.kt +++ b/app/src/main/java/com/topjohnwu/magisk/databinding/Helpers.kt @@ -1,11 +1,6 @@ -package com.topjohnwu.magisk.arch +package com.topjohnwu.magisk.databinding import androidx.databinding.ViewDataBinding -import com.topjohnwu.magisk.databinding.AnyDiffRvItem -import com.topjohnwu.magisk.databinding.DiffRvItem -import com.topjohnwu.magisk.databinding.RvItem -import com.topjohnwu.magisk.utils.DiffObservableList -import com.topjohnwu.magisk.utils.FilterableDiffObservableList import me.tatarka.bindingcollectionadapter2.BindingRecyclerViewAdapter import me.tatarka.bindingcollectionadapter2.ItemBinding import me.tatarka.bindingcollectionadapter2.OnItemBind diff --git a/app/src/main/java/com/topjohnwu/magisk/utils/ObservableHost.kt b/app/src/main/java/com/topjohnwu/magisk/databinding/ObservableHost.kt similarity index 98% rename from app/src/main/java/com/topjohnwu/magisk/utils/ObservableHost.kt rename to app/src/main/java/com/topjohnwu/magisk/databinding/ObservableHost.kt index 1e1349ce8..5e38dbef0 100644 --- a/app/src/main/java/com/topjohnwu/magisk/utils/ObservableHost.kt +++ b/app/src/main/java/com/topjohnwu/magisk/databinding/ObservableHost.kt @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk.utils +package com.topjohnwu.magisk.databinding import androidx.databinding.Observable import androidx.databinding.PropertyChangeRegistry diff --git a/app/src/main/java/com/topjohnwu/magisk/databinding/RecyclerViewItems.kt b/app/src/main/java/com/topjohnwu/magisk/databinding/RecyclerViewItems.kt index 2828ee4f7..0f4a4169d 100644 --- a/app/src/main/java/com/topjohnwu/magisk/databinding/RecyclerViewItems.kt +++ b/app/src/main/java/com/topjohnwu/magisk/databinding/RecyclerViewItems.kt @@ -5,8 +5,6 @@ import androidx.databinding.PropertyChangeRegistry import androidx.databinding.ViewDataBinding import androidx.recyclerview.widget.RecyclerView import com.topjohnwu.magisk.BR -import com.topjohnwu.magisk.utils.DiffObservableList -import com.topjohnwu.magisk.utils.ObservableHost import me.tatarka.bindingcollectionadapter2.ItemBinding abstract class RvItem { diff --git a/app/src/main/java/com/topjohnwu/signing/ApkSignerV2.java b/app/src/main/java/com/topjohnwu/magisk/signing/ApkSignerV2.java similarity index 99% rename from app/src/main/java/com/topjohnwu/signing/ApkSignerV2.java rename to app/src/main/java/com/topjohnwu/magisk/signing/ApkSignerV2.java index 5249d9883..1cebd777f 100644 --- a/app/src/main/java/com/topjohnwu/signing/ApkSignerV2.java +++ b/app/src/main/java/com/topjohnwu/magisk/signing/ApkSignerV2.java @@ -1,4 +1,4 @@ -package com.topjohnwu.signing; +package com.topjohnwu.magisk.signing; import java.nio.BufferUnderflowException; import java.nio.ByteBuffer; diff --git a/app/src/main/java/com/topjohnwu/signing/ByteArrayStream.java b/app/src/main/java/com/topjohnwu/magisk/signing/ByteArrayStream.java similarity index 95% rename from app/src/main/java/com/topjohnwu/signing/ByteArrayStream.java rename to app/src/main/java/com/topjohnwu/magisk/signing/ByteArrayStream.java index 5b0722aa3..497accbed 100644 --- a/app/src/main/java/com/topjohnwu/signing/ByteArrayStream.java +++ b/app/src/main/java/com/topjohnwu/magisk/signing/ByteArrayStream.java @@ -1,4 +1,4 @@ -package com.topjohnwu.signing; +package com.topjohnwu.magisk.signing; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; diff --git a/app/src/main/java/com/topjohnwu/signing/CryptoUtils.java b/app/src/main/java/com/topjohnwu/magisk/signing/CryptoUtils.java similarity index 99% rename from app/src/main/java/com/topjohnwu/signing/CryptoUtils.java rename to app/src/main/java/com/topjohnwu/magisk/signing/CryptoUtils.java index 2bbc22a16..0edecc0a2 100644 --- a/app/src/main/java/com/topjohnwu/signing/CryptoUtils.java +++ b/app/src/main/java/com/topjohnwu/magisk/signing/CryptoUtils.java @@ -1,4 +1,4 @@ -package com.topjohnwu.signing; +package com.topjohnwu.magisk.signing; import org.bouncycastle.asn1.ASN1InputStream; import org.bouncycastle.asn1.ASN1ObjectIdentifier; diff --git a/app/src/main/java/com/topjohnwu/signing/JarMap.java b/app/src/main/java/com/topjohnwu/magisk/signing/JarMap.java similarity index 99% rename from app/src/main/java/com/topjohnwu/signing/JarMap.java rename to app/src/main/java/com/topjohnwu/magisk/signing/JarMap.java index 544f725ee..4d30ad0b7 100644 --- a/app/src/main/java/com/topjohnwu/signing/JarMap.java +++ b/app/src/main/java/com/topjohnwu/magisk/signing/JarMap.java @@ -1,4 +1,4 @@ -package com.topjohnwu.signing; +package com.topjohnwu.magisk.signing; import java.io.Closeable; import java.io.File; diff --git a/app/src/main/java/com/topjohnwu/signing/SignApk.java b/app/src/main/java/com/topjohnwu/magisk/signing/SignApk.java similarity index 99% rename from app/src/main/java/com/topjohnwu/signing/SignApk.java rename to app/src/main/java/com/topjohnwu/magisk/signing/SignApk.java index f00e259d7..821216cb0 100644 --- a/app/src/main/java/com/topjohnwu/signing/SignApk.java +++ b/app/src/main/java/com/topjohnwu/magisk/signing/SignApk.java @@ -1,4 +1,4 @@ -package com.topjohnwu.signing; +package com.topjohnwu.magisk.signing; import org.bouncycastle.asn1.ASN1Encoding; import org.bouncycastle.asn1.ASN1InputStream; diff --git a/app/src/main/java/com/topjohnwu/signing/SignBoot.java b/app/src/main/java/com/topjohnwu/magisk/signing/SignBoot.java similarity index 99% rename from app/src/main/java/com/topjohnwu/signing/SignBoot.java rename to app/src/main/java/com/topjohnwu/magisk/signing/SignBoot.java index 5a64cb20d..1073c4d46 100644 --- a/app/src/main/java/com/topjohnwu/signing/SignBoot.java +++ b/app/src/main/java/com/topjohnwu/magisk/signing/SignBoot.java @@ -1,4 +1,4 @@ -package com.topjohnwu.signing; +package com.topjohnwu.magisk.signing; import androidx.annotation.Keep; import androidx.annotation.NonNull; diff --git a/app/src/main/java/com/topjohnwu/signing/ZipUtils.java b/app/src/main/java/com/topjohnwu/magisk/signing/ZipUtils.java similarity index 99% rename from app/src/main/java/com/topjohnwu/signing/ZipUtils.java rename to app/src/main/java/com/topjohnwu/magisk/signing/ZipUtils.java index 0fd3a6960..21b220171 100644 --- a/app/src/main/java/com/topjohnwu/signing/ZipUtils.java +++ b/app/src/main/java/com/topjohnwu/magisk/signing/ZipUtils.java @@ -1,4 +1,4 @@ -package com.topjohnwu.signing; +package com.topjohnwu.magisk.signing; import java.nio.ByteBuffer; import java.nio.ByteOrder; diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/flash/FlashViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/ui/flash/FlashViewModel.kt index d8085295c..14b88fd13 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/flash/FlashViewModel.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/flash/FlashViewModel.kt @@ -8,8 +8,6 @@ import androidx.lifecycle.viewModelScope import com.topjohnwu.magisk.BR import com.topjohnwu.magisk.R import com.topjohnwu.magisk.arch.BaseViewModel -import com.topjohnwu.magisk.arch.diffListOf -import com.topjohnwu.magisk.arch.itemBindingOf import com.topjohnwu.magisk.core.Const import com.topjohnwu.magisk.core.Info import com.topjohnwu.magisk.core.tasks.FlashZip @@ -17,9 +15,11 @@ import com.topjohnwu.magisk.core.tasks.MagiskInstaller import com.topjohnwu.magisk.core.utils.MediaStoreUtils import com.topjohnwu.magisk.core.utils.MediaStoreUtils.outputStream import com.topjohnwu.magisk.databinding.RvBindingAdapter +import com.topjohnwu.magisk.databinding.diffListOf +import com.topjohnwu.magisk.databinding.itemBindingOf +import com.topjohnwu.magisk.databinding.set import com.topjohnwu.magisk.events.SnackbarEvent import com.topjohnwu.magisk.ktx.* -import com.topjohnwu.magisk.utils.set import com.topjohnwu.magisk.view.Notifications import com.topjohnwu.superuser.CallbackList import com.topjohnwu.superuser.Shell diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/hide/HideRvItems.kt b/app/src/main/java/com/topjohnwu/magisk/ui/hide/HideRvItems.kt index 5740b237e..d8b1ec891 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/hide/HideRvItems.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/hide/HideRvItems.kt @@ -7,9 +7,9 @@ import com.topjohnwu.magisk.BR import com.topjohnwu.magisk.R import com.topjohnwu.magisk.databinding.ComparableRv import com.topjohnwu.magisk.databinding.ObservableDiffRvItem +import com.topjohnwu.magisk.databinding.addOnPropertyChangedCallback +import com.topjohnwu.magisk.databinding.set import com.topjohnwu.magisk.ktx.startAnimations -import com.topjohnwu.magisk.utils.addOnPropertyChangedCallback -import com.topjohnwu.magisk.utils.set import com.topjohnwu.superuser.Shell import kotlin.math.roundToInt diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/hide/HideViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/ui/hide/HideViewModel.kt index 1472633e3..f5a2a919a 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/hide/HideViewModel.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/hide/HideViewModel.kt @@ -9,12 +9,12 @@ import androidx.lifecycle.viewModelScope import com.topjohnwu.magisk.BR import com.topjohnwu.magisk.arch.BaseViewModel import com.topjohnwu.magisk.arch.Queryable -import com.topjohnwu.magisk.arch.filterableListOf -import com.topjohnwu.magisk.arch.itemBindingOf import com.topjohnwu.magisk.core.Config +import com.topjohnwu.magisk.databinding.filterableListOf +import com.topjohnwu.magisk.databinding.itemBindingOf +import com.topjohnwu.magisk.databinding.set import com.topjohnwu.magisk.di.AppContext import com.topjohnwu.magisk.utils.Utils -import com.topjohnwu.magisk.utils.set import com.topjohnwu.superuser.Shell import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt index 5251b663e..228770215 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt @@ -4,12 +4,17 @@ import androidx.databinding.Bindable import androidx.lifecycle.viewModelScope import com.topjohnwu.magisk.BuildConfig import com.topjohnwu.magisk.R -import com.topjohnwu.magisk.arch.* +import com.topjohnwu.magisk.arch.ActivityExecutor +import com.topjohnwu.magisk.arch.BaseUIActivity +import com.topjohnwu.magisk.arch.BaseViewModel +import com.topjohnwu.magisk.arch.ViewEvent import com.topjohnwu.magisk.core.Config import com.topjohnwu.magisk.core.Info import com.topjohnwu.magisk.core.download.Subject import com.topjohnwu.magisk.core.download.Subject.Manager import com.topjohnwu.magisk.data.repository.NetworkService +import com.topjohnwu.magisk.databinding.itemBindingOf +import com.topjohnwu.magisk.databinding.set import com.topjohnwu.magisk.events.OpenInappLinkEvent import com.topjohnwu.magisk.events.SnackbarEvent import com.topjohnwu.magisk.events.dialog.EnvFixDialog @@ -17,7 +22,6 @@ import com.topjohnwu.magisk.events.dialog.ManagerInstallDialog import com.topjohnwu.magisk.events.dialog.UninstallDialog import com.topjohnwu.magisk.ktx.await import com.topjohnwu.magisk.utils.asText -import com.topjohnwu.magisk.utils.set import com.topjohnwu.superuser.Shell import kotlinx.coroutines.launch import me.tatarka.bindingcollectionadapter2.BR diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/inflater/LayoutInflaterFactory.kt b/app/src/main/java/com/topjohnwu/magisk/ui/inflater/LayoutInflaterFactory.kt index e0a6f253f..72e6eec5d 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/inflater/LayoutInflaterFactory.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/inflater/LayoutInflaterFactory.kt @@ -1,7 +1,6 @@ package com.topjohnwu.magisk.ui.inflater import android.content.Context -import android.os.Build import android.util.AttributeSet import android.view.InflateException import android.view.LayoutInflater diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/install/InstallViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/ui/install/InstallViewModel.kt index 1f8200900..b51705656 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/install/InstallViewModel.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/install/InstallViewModel.kt @@ -11,11 +11,11 @@ import com.topjohnwu.magisk.arch.BaseViewModel import com.topjohnwu.magisk.core.Const import com.topjohnwu.magisk.core.Info import com.topjohnwu.magisk.data.repository.NetworkService +import com.topjohnwu.magisk.databinding.set import com.topjohnwu.magisk.di.AppContext import com.topjohnwu.magisk.events.MagiskInstallFileEvent import com.topjohnwu.magisk.events.dialog.SecondSlotWarningDialog import com.topjohnwu.magisk.ui.flash.FlashFragment -import com.topjohnwu.magisk.utils.set import com.topjohnwu.superuser.Shell import kotlinx.coroutines.launch import timber.log.Timber diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/log/LogRvItem.kt b/app/src/main/java/com/topjohnwu/magisk/ui/log/LogRvItem.kt index 607d3f4f7..400f2c8c1 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/log/LogRvItem.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/log/LogRvItem.kt @@ -6,9 +6,9 @@ import com.topjohnwu.magisk.R import com.topjohnwu.magisk.core.model.su.SuLog import com.topjohnwu.magisk.databinding.ObservableDiffRvItem import com.topjohnwu.magisk.databinding.RvContainer +import com.topjohnwu.magisk.databinding.set import com.topjohnwu.magisk.ktx.timeDateFormat import com.topjohnwu.magisk.ktx.toTime -import com.topjohnwu.magisk.utils.set class LogRvItem( override val item: SuLog diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/log/LogViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/ui/log/LogViewModel.kt index 8639d2cbe..7853b4792 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/log/LogViewModel.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/log/LogViewModel.kt @@ -6,17 +6,17 @@ import com.topjohnwu.magisk.BR import com.topjohnwu.magisk.BuildConfig import com.topjohnwu.magisk.R import com.topjohnwu.magisk.arch.BaseViewModel -import com.topjohnwu.magisk.arch.diffListOf -import com.topjohnwu.magisk.arch.itemBindingOf import com.topjohnwu.magisk.core.Info import com.topjohnwu.magisk.core.utils.MediaStoreUtils import com.topjohnwu.magisk.core.utils.MediaStoreUtils.outputStream import com.topjohnwu.magisk.data.repository.LogRepository +import com.topjohnwu.magisk.databinding.diffListOf +import com.topjohnwu.magisk.databinding.itemBindingOf +import com.topjohnwu.magisk.databinding.set import com.topjohnwu.magisk.events.SnackbarEvent import com.topjohnwu.magisk.ktx.now import com.topjohnwu.magisk.ktx.timeFormatStandard import com.topjohnwu.magisk.ktx.toTime -import com.topjohnwu.magisk.utils.set import com.topjohnwu.magisk.view.TextItem import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/module/ModuleRvItem.kt b/app/src/main/java/com/topjohnwu/magisk/ui/module/ModuleRvItem.kt index ffad5cbb4..0166187e6 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/module/ModuleRvItem.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/module/ModuleRvItem.kt @@ -8,7 +8,7 @@ import com.topjohnwu.magisk.core.model.module.OnlineModule import com.topjohnwu.magisk.databinding.DiffRvItem import com.topjohnwu.magisk.databinding.ObservableDiffRvItem import com.topjohnwu.magisk.databinding.RvContainer -import com.topjohnwu.magisk.utils.set +import com.topjohnwu.magisk.databinding.set object InstallModule : DiffRvItem() { override val layoutRes = R.layout.item_module_download diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/module/ModuleViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/ui/module/ModuleViewModel.kt index 88937f870..cca94a334 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/module/ModuleViewModel.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/module/ModuleViewModel.kt @@ -5,19 +5,18 @@ import androidx.databinding.ObservableArrayList import androidx.lifecycle.viewModelScope import com.topjohnwu.magisk.BR import com.topjohnwu.magisk.R -import com.topjohnwu.magisk.arch.* +import com.topjohnwu.magisk.arch.BaseViewModel +import com.topjohnwu.magisk.arch.Queryable import com.topjohnwu.magisk.core.Info import com.topjohnwu.magisk.core.model.module.LocalModule import com.topjohnwu.magisk.core.model.module.OnlineModule -import com.topjohnwu.magisk.databinding.AnyDiffRvItem -import com.topjohnwu.magisk.databinding.RvItem +import com.topjohnwu.magisk.databinding.* import com.topjohnwu.magisk.events.OpenReadmeEvent import com.topjohnwu.magisk.events.SelectModuleEvent import com.topjohnwu.magisk.events.SnackbarEvent import com.topjohnwu.magisk.events.dialog.ModuleInstallDialog import com.topjohnwu.magisk.ktx.addOnListChangedCallback import com.topjohnwu.magisk.ktx.reboot -import com.topjohnwu.magisk.utils.set import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Job import kotlinx.coroutines.launch diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/safetynet/CheckSafetyNetEvent.kt b/app/src/main/java/com/topjohnwu/magisk/ui/safetynet/CheckSafetyNetEvent.kt index b18426ddb..30035ddb2 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/safetynet/CheckSafetyNetEvent.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/safetynet/CheckSafetyNetEvent.kt @@ -15,8 +15,8 @@ import com.topjohnwu.magisk.di.ServiceLocator import com.topjohnwu.magisk.ktx.createClassLoader import com.topjohnwu.magisk.ktx.reflectField import com.topjohnwu.magisk.ktx.writeTo +import com.topjohnwu.magisk.signing.CryptoUtils import com.topjohnwu.magisk.view.MagiskDialog -import com.topjohnwu.signing.CryptoUtils import com.topjohnwu.superuser.Shell import dalvik.system.BaseDexClassLoader import dalvik.system.DexFile diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/safetynet/SafetynetViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/ui/safetynet/SafetynetViewModel.kt index 0d0938e5b..7d0c138b0 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/safetynet/SafetynetViewModel.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/safetynet/SafetynetViewModel.kt @@ -4,7 +4,7 @@ import androidx.databinding.Bindable import com.topjohnwu.magisk.BR import com.topjohnwu.magisk.R import com.topjohnwu.magisk.arch.BaseViewModel -import com.topjohnwu.magisk.utils.set +import com.topjohnwu.magisk.databinding.set class SafetyNetResult( val response: SafetyNetResponse? = null, diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/settings/BaseSettingsItem.kt b/app/src/main/java/com/topjohnwu/magisk/ui/settings/BaseSettingsItem.kt index ebc393738..ad216f42f 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/settings/BaseSettingsItem.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/settings/BaseSettingsItem.kt @@ -8,8 +8,8 @@ import androidx.databinding.Bindable import com.topjohnwu.magisk.BR import com.topjohnwu.magisk.R import com.topjohnwu.magisk.databinding.ObservableRvItem +import com.topjohnwu.magisk.databinding.set import com.topjohnwu.magisk.utils.TextHolder -import com.topjohnwu.magisk.utils.set import com.topjohnwu.magisk.view.MagiskDialog sealed class BaseSettingsItem : ObservableRvItem() { diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsItems.kt b/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsItems.kt index 2bc1c8991..0bbdb2e1a 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsItems.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsItems.kt @@ -21,10 +21,10 @@ import com.topjohnwu.magisk.core.utils.currentLocale import com.topjohnwu.magisk.databinding.DialogSettingsAppNameBinding import com.topjohnwu.magisk.databinding.DialogSettingsDownloadPathBinding import com.topjohnwu.magisk.databinding.DialogSettingsUpdateChannelBinding +import com.topjohnwu.magisk.databinding.set import com.topjohnwu.magisk.di.AppContext import com.topjohnwu.magisk.utils.Utils import com.topjohnwu.magisk.utils.asText -import com.topjohnwu.magisk.utils.set import com.topjohnwu.superuser.Shell import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.launch diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsViewModel.kt index f649fd963..0e27d791c 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsViewModel.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsViewModel.kt @@ -9,13 +9,13 @@ import com.topjohnwu.magisk.BR import com.topjohnwu.magisk.BuildConfig import com.topjohnwu.magisk.R import com.topjohnwu.magisk.arch.BaseViewModel -import com.topjohnwu.magisk.arch.adapterOf -import com.topjohnwu.magisk.arch.itemBindingOf import com.topjohnwu.magisk.core.Const import com.topjohnwu.magisk.core.Info import com.topjohnwu.magisk.core.isRunningAsStub import com.topjohnwu.magisk.core.tasks.HideAPK import com.topjohnwu.magisk.data.database.RepoDao +import com.topjohnwu.magisk.databinding.adapterOf +import com.topjohnwu.magisk.databinding.itemBindingOf import com.topjohnwu.magisk.di.AppContext import com.topjohnwu.magisk.events.AddHomeIconEvent import com.topjohnwu.magisk.events.RecreateEvent diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/superuser/PolicyRvItem.kt b/app/src/main/java/com/topjohnwu/magisk/ui/superuser/PolicyRvItem.kt index 500aeba88..0dc1fcef2 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/superuser/PolicyRvItem.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/superuser/PolicyRvItem.kt @@ -7,7 +7,7 @@ import com.topjohnwu.magisk.R import com.topjohnwu.magisk.core.model.su.SuPolicy import com.topjohnwu.magisk.databinding.ObservableDiffRvItem import com.topjohnwu.magisk.databinding.RvContainer -import com.topjohnwu.magisk.utils.set +import com.topjohnwu.magisk.databinding.set class PolicyRvItem( override val item: SuPolicy, diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/superuser/SuperuserViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/ui/superuser/SuperuserViewModel.kt index bf9630945..4190e6d44 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/superuser/SuperuserViewModel.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/superuser/SuperuserViewModel.kt @@ -5,15 +5,15 @@ import androidx.lifecycle.viewModelScope import com.topjohnwu.magisk.BR import com.topjohnwu.magisk.R import com.topjohnwu.magisk.arch.BaseViewModel -import com.topjohnwu.magisk.arch.adapterOf -import com.topjohnwu.magisk.arch.diffListOf -import com.topjohnwu.magisk.arch.itemBindingOf import com.topjohnwu.magisk.core.Config import com.topjohnwu.magisk.core.magiskdb.PolicyDao import com.topjohnwu.magisk.core.model.su.SuPolicy import com.topjohnwu.magisk.core.utils.BiometricHelper import com.topjohnwu.magisk.core.utils.currentLocale import com.topjohnwu.magisk.databinding.AnyDiffRvItem +import com.topjohnwu.magisk.databinding.adapterOf +import com.topjohnwu.magisk.databinding.diffListOf +import com.topjohnwu.magisk.databinding.itemBindingOf import com.topjohnwu.magisk.events.SnackbarEvent import com.topjohnwu.magisk.events.dialog.BiometricEvent import com.topjohnwu.magisk.events.dialog.SuperuserRevokeDialog diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/surequest/SuRequestViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/ui/surequest/SuRequestViewModel.kt index 6dd4e4957..4a139c6b0 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/surequest/SuRequestViewModel.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/surequest/SuRequestViewModel.kt @@ -26,13 +26,13 @@ import com.topjohnwu.magisk.core.model.su.SuPolicy.Companion.ALLOW import com.topjohnwu.magisk.core.model.su.SuPolicy.Companion.DENY import com.topjohnwu.magisk.core.su.SuRequestHandler import com.topjohnwu.magisk.core.utils.BiometricHelper +import com.topjohnwu.magisk.databinding.set import com.topjohnwu.magisk.di.AppContext import com.topjohnwu.magisk.events.DieEvent import com.topjohnwu.magisk.events.ShowUIEvent import com.topjohnwu.magisk.events.dialog.BiometricEvent import com.topjohnwu.magisk.utils.TextHolder import com.topjohnwu.magisk.utils.Utils -import com.topjohnwu.magisk.utils.set import kotlinx.coroutines.launch import me.tatarka.bindingcollectionadapter2.ItemBinding import java.util.concurrent.TimeUnit.SECONDS diff --git a/app/src/main/java/com/topjohnwu/magisk/view/MagiskDialog.kt b/app/src/main/java/com/topjohnwu/magisk/view/MagiskDialog.kt index f2287b75f..e42093fd6 100644 --- a/app/src/main/java/com/topjohnwu/magisk/view/MagiskDialog.kt +++ b/app/src/main/java/com/topjohnwu/magisk/view/MagiskDialog.kt @@ -22,12 +22,7 @@ import com.google.android.material.color.MaterialColors import com.google.android.material.shape.MaterialShapeDrawable import com.topjohnwu.magisk.BR import com.topjohnwu.magisk.R -import com.topjohnwu.magisk.arch.itemBindingOf -import com.topjohnwu.magisk.databinding.DiffRvItem -import com.topjohnwu.magisk.databinding.DialogMagiskBaseBinding -import com.topjohnwu.magisk.databinding.RvContainer -import com.topjohnwu.magisk.utils.ObservableHost -import com.topjohnwu.magisk.utils.set +import com.topjohnwu.magisk.databinding.* import me.tatarka.bindingcollectionadapter2.BindingRecyclerViewAdapters import me.tatarka.bindingcollectionadapter2.ItemBinding