Redesign is now the new norm
This commit is contained in:
parent
1449486958
commit
3490ba0a56
@ -1,5 +1,5 @@
|
||||
package a
|
||||
|
||||
import com.topjohnwu.magisk.redesign.MainActivity
|
||||
import com.topjohnwu.magisk.ui.MainActivity
|
||||
|
||||
class b : MainActivity()
|
||||
|
@ -1,6 +1,6 @@
|
||||
package a;
|
||||
|
||||
import com.topjohnwu.magisk.ui.flash.FlashActivity;
|
||||
import com.topjohnwu.magisk.legacy.flash.FlashActivity;
|
||||
|
||||
public class f extends FlashActivity {
|
||||
/* stub */
|
||||
|
@ -1,6 +1,6 @@
|
||||
package a;
|
||||
|
||||
import com.topjohnwu.magisk.ui.surequest.SuRequestActivity;
|
||||
import com.topjohnwu.magisk.legacy.surequest.SuRequestActivity;
|
||||
|
||||
public class m extends SuRequestActivity {
|
||||
/* stub */
|
||||
|
@ -13,7 +13,7 @@ import com.topjohnwu.magisk.di.Protected
|
||||
import com.topjohnwu.magisk.extensions.get
|
||||
import com.topjohnwu.magisk.extensions.inject
|
||||
import com.topjohnwu.magisk.model.preference.PreferenceModel
|
||||
import com.topjohnwu.magisk.redesign.theme.Theme
|
||||
import com.topjohnwu.magisk.ui.theme.Theme
|
||||
import com.topjohnwu.magisk.utils.BiometricHelper
|
||||
import com.topjohnwu.magisk.utils.Utils
|
||||
import com.topjohnwu.superuser.Shell
|
||||
|
@ -18,10 +18,10 @@ import com.topjohnwu.magisk.extensions.forceGetDeclaredField
|
||||
import com.topjohnwu.magisk.model.download.DownloadService
|
||||
import com.topjohnwu.magisk.model.receiver.GeneralReceiver
|
||||
import com.topjohnwu.magisk.model.update.UpdateCheckService
|
||||
import com.topjohnwu.magisk.redesign.MainActivity
|
||||
import com.topjohnwu.magisk.ui.MainActivity
|
||||
import com.topjohnwu.magisk.ui.SplashActivity
|
||||
import com.topjohnwu.magisk.ui.flash.FlashActivity
|
||||
import com.topjohnwu.magisk.ui.surequest.SuRequestActivity
|
||||
import com.topjohnwu.magisk.legacy.flash.FlashActivity
|
||||
import com.topjohnwu.magisk.legacy.surequest.SuRequestActivity
|
||||
import com.topjohnwu.magisk.utils.refreshLocale
|
||||
import com.topjohnwu.magisk.utils.updateConfig
|
||||
|
||||
|
@ -1,17 +1,17 @@
|
||||
package com.topjohnwu.magisk.di
|
||||
|
||||
import com.topjohnwu.magisk.redesign.MainViewModel
|
||||
import com.topjohnwu.magisk.redesign.flash.FlashViewModel
|
||||
import com.topjohnwu.magisk.redesign.hide.HideViewModel
|
||||
import com.topjohnwu.magisk.redesign.home.HomeViewModel
|
||||
import com.topjohnwu.magisk.redesign.install.InstallViewModel
|
||||
import com.topjohnwu.magisk.redesign.log.LogViewModel
|
||||
import com.topjohnwu.magisk.redesign.module.ModuleViewModel
|
||||
import com.topjohnwu.magisk.redesign.request.RequestViewModel
|
||||
import com.topjohnwu.magisk.redesign.safetynet.SafetynetViewModel
|
||||
import com.topjohnwu.magisk.redesign.settings.SettingsViewModel
|
||||
import com.topjohnwu.magisk.redesign.superuser.SuperuserViewModel
|
||||
import com.topjohnwu.magisk.redesign.theme.ThemeViewModel
|
||||
import com.topjohnwu.magisk.ui.MainViewModel
|
||||
import com.topjohnwu.magisk.ui.flash.FlashViewModel
|
||||
import com.topjohnwu.magisk.ui.hide.HideViewModel
|
||||
import com.topjohnwu.magisk.ui.home.HomeViewModel
|
||||
import com.topjohnwu.magisk.ui.install.InstallViewModel
|
||||
import com.topjohnwu.magisk.ui.log.LogViewModel
|
||||
import com.topjohnwu.magisk.ui.module.ModuleViewModel
|
||||
import com.topjohnwu.magisk.ui.request.RequestViewModel
|
||||
import com.topjohnwu.magisk.ui.safetynet.SafetynetViewModel
|
||||
import com.topjohnwu.magisk.ui.settings.SettingsViewModel
|
||||
import com.topjohnwu.magisk.ui.superuser.SuperuserViewModel
|
||||
import com.topjohnwu.magisk.ui.theme.ThemeViewModel
|
||||
import org.koin.androidx.viewmodel.dsl.viewModel
|
||||
import org.koin.dsl.module
|
||||
|
||||
@ -29,4 +29,4 @@ val redesignModule = module {
|
||||
viewModel { InstallViewModel() }
|
||||
|
||||
viewModel { MainViewModel() }
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.topjohnwu.magisk.di
|
||||
|
||||
import android.net.Uri
|
||||
import com.topjohnwu.magisk.ui.flash.FlashViewModel
|
||||
import com.topjohnwu.magisk.ui.surequest.SuRequestViewModel
|
||||
import com.topjohnwu.magisk.legacy.flash.FlashViewModel
|
||||
import com.topjohnwu.magisk.legacy.surequest.SuRequestViewModel
|
||||
import org.koin.androidx.viewmodel.dsl.viewModel
|
||||
import org.koin.dsl.module
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.topjohnwu.magisk.ui.flash
|
||||
package com.topjohnwu.magisk.legacy.flash
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
@ -0,0 +1,110 @@
|
||||
package com.topjohnwu.magisk.legacy.flash
|
||||
|
||||
import android.Manifest.permission.READ_EXTERNAL_STORAGE
|
||||
import android.Manifest.permission.WRITE_EXTERNAL_STORAGE
|
||||
import android.content.res.Resources
|
||||
import android.net.Uri
|
||||
import android.os.Handler
|
||||
import androidx.core.os.postDelayed
|
||||
import androidx.databinding.ObservableArrayList
|
||||
import com.topjohnwu.magisk.BR
|
||||
import com.topjohnwu.magisk.Config
|
||||
import com.topjohnwu.magisk.Const
|
||||
import com.topjohnwu.magisk.R
|
||||
import com.topjohnwu.magisk.base.viewmodel.BaseViewModel
|
||||
import com.topjohnwu.magisk.databinding.ComparableRvItem
|
||||
import com.topjohnwu.magisk.extensions.*
|
||||
import com.topjohnwu.magisk.model.entity.recycler.ConsoleRvItem
|
||||
import com.topjohnwu.magisk.model.events.SnackbarEvent
|
||||
import com.topjohnwu.magisk.model.flash.FlashResultListener
|
||||
import com.topjohnwu.magisk.model.flash.Flashing
|
||||
import com.topjohnwu.magisk.model.flash.Patching
|
||||
import com.topjohnwu.magisk.utils.DiffObservableList
|
||||
import com.topjohnwu.magisk.utils.KObservableField
|
||||
import com.topjohnwu.superuser.Shell
|
||||
import me.tatarka.bindingcollectionadapter2.ItemBinding
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
class FlashViewModel(
|
||||
action: String,
|
||||
installer: Uri,
|
||||
uri: Uri,
|
||||
private val resources: Resources
|
||||
) : BaseViewModel(), FlashResultListener {
|
||||
|
||||
val canShowReboot = Shell.rootAccess()
|
||||
val showRestartTitle = KObservableField(false)
|
||||
|
||||
val behaviorText = KObservableField(resources.getString(R.string.flashing))
|
||||
|
||||
val items = DiffObservableList(ComparableRvItem.callback)
|
||||
val itemBinding = ItemBinding.of<ComparableRvItem<*>> { itemBinding, _, item ->
|
||||
item.bind(itemBinding)
|
||||
itemBinding.bindExtra(BR.viewModel, this@FlashViewModel)
|
||||
}
|
||||
|
||||
private val outItems = ObservableArrayList<String>()
|
||||
private val logItems = Collections.synchronizedList(mutableListOf<String>())
|
||||
|
||||
init {
|
||||
outItems.sendUpdatesTo(items) { it.map { ConsoleRvItem(it) } }
|
||||
outItems.copyNewInputInto(logItems)
|
||||
|
||||
state = State.LOADING
|
||||
|
||||
when (action) {
|
||||
Const.Value.FLASH_ZIP -> Flashing
|
||||
.Install(installer, outItems, logItems, this)
|
||||
.exec()
|
||||
Const.Value.UNINSTALL -> Flashing
|
||||
.Uninstall(installer, outItems, logItems, this)
|
||||
.exec()
|
||||
Const.Value.FLASH_MAGISK -> Patching
|
||||
.Direct(installer, outItems, logItems, this)
|
||||
.exec()
|
||||
Const.Value.FLASH_INACTIVE_SLOT -> Patching
|
||||
.SecondSlot(installer, outItems, logItems, this)
|
||||
.exec()
|
||||
Const.Value.PATCH_FILE -> Patching
|
||||
.File(installer, uri, outItems, logItems, this)
|
||||
.exec()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResult(isSuccess: Boolean) {
|
||||
state = if (isSuccess) State.LOADED else State.LOADING_FAILED
|
||||
behaviorText.value = when {
|
||||
isSuccess -> resources.getString(R.string.done)
|
||||
else -> resources.getString(R.string.failure)
|
||||
}
|
||||
|
||||
if (isSuccess) {
|
||||
Handler().postDelayed(500) {
|
||||
showRestartTitle.value = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun savePressed() = withPermissions(READ_EXTERNAL_STORAGE, WRITE_EXTERNAL_STORAGE)
|
||||
.map { now }
|
||||
.map { it.toTime(timeFormatStandard) }
|
||||
.map { Const.MAGISK_INSTALL_LOG_FILENAME.format(it) }
|
||||
.map { File(Config.downloadDirectory, it) }
|
||||
.map { file ->
|
||||
file.bufferedWriter().use { writer ->
|
||||
logItems.forEach {
|
||||
writer.write(it)
|
||||
writer.newLine()
|
||||
}
|
||||
}
|
||||
file.path
|
||||
}
|
||||
.subscribeK { SnackbarEvent(it).publish() }
|
||||
.add()
|
||||
|
||||
fun restartPressed() = reboot()
|
||||
|
||||
fun backPressed() = back()
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.topjohnwu.magisk.ui.surequest
|
||||
package com.topjohnwu.magisk.legacy.surequest
|
||||
|
||||
import android.content.Intent
|
||||
import android.content.pm.ActivityInfo
|
@ -1,4 +1,4 @@
|
||||
package com.topjohnwu.magisk.ui.surequest
|
||||
package com.topjohnwu.magisk.legacy.surequest
|
||||
|
||||
import android.content.Intent
|
||||
import android.content.SharedPreferences
|
@ -16,7 +16,7 @@ import com.topjohnwu.magisk.model.entity.internal.Configuration.*
|
||||
import com.topjohnwu.magisk.model.entity.internal.Configuration.Flash.Secondary
|
||||
import com.topjohnwu.magisk.model.entity.internal.DownloadSubject
|
||||
import com.topjohnwu.magisk.model.entity.internal.DownloadSubject.*
|
||||
import com.topjohnwu.magisk.ui.flash.FlashActivity
|
||||
import com.topjohnwu.magisk.legacy.flash.FlashActivity
|
||||
import com.topjohnwu.magisk.utils.APKInstall
|
||||
import org.koin.core.get
|
||||
import java.io.File
|
||||
|
@ -10,7 +10,7 @@ import com.topjohnwu.magisk.extensions.toggle
|
||||
import com.topjohnwu.magisk.model.entity.ProcessHideApp
|
||||
import com.topjohnwu.magisk.model.entity.StatefulProcess
|
||||
import com.topjohnwu.magisk.model.observer.Observer
|
||||
import com.topjohnwu.magisk.redesign.hide.HideViewModel
|
||||
import com.topjohnwu.magisk.ui.hide.HideViewModel
|
||||
import com.topjohnwu.magisk.utils.KObservableField
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
|
@ -10,7 +10,7 @@ import com.topjohnwu.magisk.R
|
||||
import com.topjohnwu.magisk.databinding.ComparableRvItem
|
||||
import com.topjohnwu.magisk.model.entity.module.Module
|
||||
import com.topjohnwu.magisk.model.entity.module.Repo
|
||||
import com.topjohnwu.magisk.redesign.module.ModuleViewModel
|
||||
import com.topjohnwu.magisk.ui.module.ModuleViewModel
|
||||
import com.topjohnwu.magisk.utils.KObservableField
|
||||
|
||||
object SafeModeNotice : ComparableRvItem<SafeModeNotice>() {
|
||||
|
@ -6,7 +6,7 @@ import com.topjohnwu.magisk.databinding.ComparableRvItem
|
||||
import com.topjohnwu.magisk.extensions.toggle
|
||||
import com.topjohnwu.magisk.model.entity.MagiskPolicy
|
||||
import com.topjohnwu.magisk.model.events.PolicyUpdateEvent
|
||||
import com.topjohnwu.magisk.redesign.superuser.SuperuserViewModel
|
||||
import com.topjohnwu.magisk.ui.superuser.SuperuserViewModel
|
||||
import com.topjohnwu.magisk.utils.KObservableField
|
||||
|
||||
class PolicyItem(val item: MagiskPolicy, val icon: Drawable) : ComparableRvItem<PolicyItem>() {
|
||||
|
@ -2,7 +2,7 @@ package com.topjohnwu.magisk.model.entity.recycler
|
||||
|
||||
import com.topjohnwu.magisk.R
|
||||
import com.topjohnwu.magisk.databinding.ComparableRvItem
|
||||
import com.topjohnwu.magisk.redesign.theme.Theme
|
||||
import com.topjohnwu.magisk.ui.theme.Theme
|
||||
|
||||
class ThemeItem(val theme: Theme) : ComparableRvItem<ThemeItem>() {
|
||||
|
||||
@ -11,4 +11,4 @@ class ThemeItem(val theme: Theme) : ComparableRvItem<ThemeItem>() {
|
||||
override fun contentSameAs(other: ThemeItem) = itemSameAs(other)
|
||||
override fun itemSameAs(other: ThemeItem) = theme == other.theme
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import android.content.Intent
|
||||
import com.topjohnwu.magisk.Const
|
||||
import com.topjohnwu.magisk.base.BaseActivity
|
||||
import com.topjohnwu.magisk.intent
|
||||
import com.topjohnwu.magisk.ui.flash.FlashActivity
|
||||
import com.topjohnwu.magisk.legacy.flash.FlashActivity
|
||||
|
||||
class InstallExternalModuleEvent : ViewEvent(), ActivityExecutor {
|
||||
|
||||
|
@ -7,7 +7,7 @@ import androidx.fragment.app.Fragment
|
||||
import com.topjohnwu.magisk.base.BaseActivity
|
||||
import com.topjohnwu.magisk.model.events.ActivityExecutor
|
||||
import com.topjohnwu.magisk.model.events.ViewEvent
|
||||
import com.topjohnwu.magisk.redesign.compat.CompatActivity
|
||||
import com.topjohnwu.magisk.ui.compat.CompatActivity
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
@DslMarker
|
||||
|
@ -5,16 +5,16 @@ import android.content.Intent
|
||||
import android.os.Build
|
||||
import com.topjohnwu.magisk.Const
|
||||
import com.topjohnwu.magisk.intent
|
||||
import com.topjohnwu.magisk.redesign.MainActivity
|
||||
import com.topjohnwu.magisk.redesign.hide.HideFragment
|
||||
import com.topjohnwu.magisk.redesign.home.HomeFragment
|
||||
import com.topjohnwu.magisk.redesign.install.InstallFragment
|
||||
import com.topjohnwu.magisk.redesign.log.LogFragment
|
||||
import com.topjohnwu.magisk.redesign.module.ModuleFragment
|
||||
import com.topjohnwu.magisk.redesign.safetynet.SafetynetFragment
|
||||
import com.topjohnwu.magisk.redesign.settings.SettingsFragment
|
||||
import com.topjohnwu.magisk.redesign.superuser.SuperuserFragment
|
||||
import com.topjohnwu.magisk.redesign.theme.ThemeFragment
|
||||
import com.topjohnwu.magisk.ui.MainActivity
|
||||
import com.topjohnwu.magisk.ui.hide.HideFragment
|
||||
import com.topjohnwu.magisk.ui.home.HomeFragment
|
||||
import com.topjohnwu.magisk.ui.install.InstallFragment
|
||||
import com.topjohnwu.magisk.ui.log.LogFragment
|
||||
import com.topjohnwu.magisk.ui.module.ModuleFragment
|
||||
import com.topjohnwu.magisk.ui.safetynet.SafetynetFragment
|
||||
import com.topjohnwu.magisk.ui.settings.SettingsFragment
|
||||
import com.topjohnwu.magisk.ui.superuser.SuperuserFragment
|
||||
import com.topjohnwu.magisk.ui.theme.ThemeFragment
|
||||
|
||||
object Navigation {
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
package com.topjohnwu.magisk.redesign
|
||||
|
||||
import com.topjohnwu.magisk.redesign.compat.CompatViewModel
|
||||
|
||||
class MainViewModel : CompatViewModel()
|
@ -1,5 +0,0 @@
|
||||
package com.topjohnwu.magisk.redesign.flash
|
||||
|
||||
import com.topjohnwu.magisk.redesign.compat.CompatViewModel
|
||||
|
||||
class FlashViewModel : CompatViewModel()
|
@ -1,5 +0,0 @@
|
||||
package com.topjohnwu.magisk.redesign.request
|
||||
|
||||
import com.topjohnwu.magisk.redesign.compat.CompatViewModel
|
||||
|
||||
class RequestViewModel : CompatViewModel()
|
@ -1,4 +1,4 @@
|
||||
package com.topjohnwu.magisk.redesign
|
||||
package com.topjohnwu.magisk.ui
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.MenuItem
|
||||
@ -17,11 +17,11 @@ import com.topjohnwu.magisk.R
|
||||
import com.topjohnwu.magisk.databinding.ActivityMainMd2Binding
|
||||
import com.topjohnwu.magisk.extensions.startAnimations
|
||||
import com.topjohnwu.magisk.model.navigation.Navigation
|
||||
import com.topjohnwu.magisk.redesign.compat.CompatActivity
|
||||
import com.topjohnwu.magisk.redesign.compat.CompatNavigationDelegate
|
||||
import com.topjohnwu.magisk.redesign.home.HomeFragment
|
||||
import com.topjohnwu.magisk.redesign.module.ModuleFragment
|
||||
import com.topjohnwu.magisk.redesign.superuser.SuperuserFragment
|
||||
import com.topjohnwu.magisk.ui.compat.CompatActivity
|
||||
import com.topjohnwu.magisk.ui.compat.CompatNavigationDelegate
|
||||
import com.topjohnwu.magisk.ui.home.HomeFragment
|
||||
import com.topjohnwu.magisk.ui.module.ModuleFragment
|
||||
import com.topjohnwu.magisk.ui.superuser.SuperuserFragment
|
||||
import com.topjohnwu.magisk.utils.HideBottomViewOnScrollBehavior
|
||||
import com.topjohnwu.magisk.utils.HideTopViewOnScrollBehavior
|
||||
import com.topjohnwu.magisk.utils.HideableBehavior
|
@ -0,0 +1,5 @@
|
||||
package com.topjohnwu.magisk.ui
|
||||
|
||||
import com.topjohnwu.magisk.ui.compat.CompatViewModel
|
||||
|
||||
class MainViewModel : CompatViewModel()
|
@ -1,7 +1,7 @@
|
||||
package com.topjohnwu.magisk.redesign
|
||||
package com.topjohnwu.magisk.ui
|
||||
|
||||
interface ReselectionTarget {
|
||||
|
||||
fun onReselected()
|
||||
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.topjohnwu.magisk.redesign.compat
|
||||
package com.topjohnwu.magisk.ui.compat
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
@ -17,7 +17,7 @@ import com.topjohnwu.magisk.model.events.SnackbarEvent
|
||||
import com.topjohnwu.magisk.model.events.ViewEvent
|
||||
import com.topjohnwu.magisk.model.navigation.MagiskNavigationEvent
|
||||
import com.topjohnwu.magisk.model.navigation.Navigator
|
||||
import com.topjohnwu.magisk.redesign.theme.Theme
|
||||
import com.topjohnwu.magisk.ui.theme.Theme
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
|
||||
@ -89,4 +89,4 @@ fun Activity.hideKeyboard() {
|
||||
getSystemService<InputMethodManager>()
|
||||
?.hideSoftInputFromWindow(view.windowToken, 0)
|
||||
view.clearFocus()
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.topjohnwu.magisk.redesign.compat
|
||||
package com.topjohnwu.magisk.ui.compat
|
||||
|
||||
import android.view.View
|
||||
import androidx.core.graphics.Insets
|
@ -1,4 +1,4 @@
|
||||
package com.topjohnwu.magisk.redesign.compat
|
||||
package com.topjohnwu.magisk.ui.compat
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
@ -53,4 +53,4 @@ abstract class CompatFragment<ViewModel : CompatViewModel, Binding : ViewDataBin
|
||||
|
||||
fun Fragment.hideKeyboard() {
|
||||
activity?.hideKeyboard()
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.topjohnwu.magisk.redesign.compat
|
||||
package com.topjohnwu.magisk.ui.compat
|
||||
|
||||
import androidx.databinding.ViewDataBinding
|
||||
import com.topjohnwu.magisk.databinding.ComparableRvItem
|
||||
@ -40,4 +40,4 @@ inline fun <T : ComparableRvItem<*>> itemBindingOf(
|
||||
) = OnItemBind<T> { itemBinding, _, item ->
|
||||
item.bind(itemBinding)
|
||||
body(itemBinding)
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.topjohnwu.magisk.redesign.compat
|
||||
package com.topjohnwu.magisk.ui.compat
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
@ -8,7 +8,7 @@ import com.topjohnwu.magisk.R
|
||||
import com.topjohnwu.magisk.model.navigation.MagiskAnimBuilder
|
||||
import com.topjohnwu.magisk.model.navigation.MagiskNavigationEvent
|
||||
import com.topjohnwu.magisk.model.navigation.Navigator
|
||||
import com.topjohnwu.magisk.redesign.ReselectionTarget
|
||||
import com.topjohnwu.magisk.ui.ReselectionTarget
|
||||
import timber.log.Timber
|
||||
|
||||
class CompatNavigationDelegate<out Source>(
|
||||
@ -125,4 +125,4 @@ class CompatNavigationDelegate<out Source>(
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.topjohnwu.magisk.redesign.compat
|
||||
package com.topjohnwu.magisk.ui.compat
|
||||
|
||||
import android.view.View
|
||||
import androidx.core.graphics.Insets
|
@ -1,4 +1,4 @@
|
||||
package com.topjohnwu.magisk.redesign.compat
|
||||
package com.topjohnwu.magisk.ui.compat
|
||||
|
||||
import androidx.annotation.CallSuper
|
||||
import androidx.core.graphics.Insets
|
@ -1,4 +1,4 @@
|
||||
package com.topjohnwu.magisk.redesign.compat
|
||||
package com.topjohnwu.magisk.ui.compat
|
||||
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
@ -20,4 +20,4 @@ interface Queryable {
|
||||
override fun submitQuery() {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
package com.topjohnwu.magisk.redesign.flash
|
||||
package com.topjohnwu.magisk.ui.flash
|
||||
|
||||
import com.topjohnwu.magisk.R
|
||||
import com.topjohnwu.magisk.databinding.FragmentFlashMd2Binding
|
||||
import com.topjohnwu.magisk.redesign.compat.CompatFragment
|
||||
import com.topjohnwu.magisk.ui.compat.CompatFragment
|
||||
import org.koin.androidx.viewmodel.ext.android.viewModel
|
||||
|
||||
class FlashFragment : CompatFragment<FlashViewModel, FragmentFlashMd2Binding>() {
|
||||
@ -10,4 +10,4 @@ class FlashFragment : CompatFragment<FlashViewModel, FragmentFlashMd2Binding>()
|
||||
override val layoutRes = R.layout.fragment_flash_md2
|
||||
override val viewModel by viewModel<FlashViewModel>()
|
||||
|
||||
}
|
||||
}
|
@ -1,110 +1,5 @@
|
||||
package com.topjohnwu.magisk.ui.flash
|
||||
|
||||
import android.Manifest.permission.READ_EXTERNAL_STORAGE
|
||||
import android.Manifest.permission.WRITE_EXTERNAL_STORAGE
|
||||
import android.content.res.Resources
|
||||
import android.net.Uri
|
||||
import android.os.Handler
|
||||
import androidx.core.os.postDelayed
|
||||
import androidx.databinding.ObservableArrayList
|
||||
import com.topjohnwu.magisk.BR
|
||||
import com.topjohnwu.magisk.Config
|
||||
import com.topjohnwu.magisk.Const
|
||||
import com.topjohnwu.magisk.R
|
||||
import com.topjohnwu.magisk.base.viewmodel.BaseViewModel
|
||||
import com.topjohnwu.magisk.databinding.ComparableRvItem
|
||||
import com.topjohnwu.magisk.extensions.*
|
||||
import com.topjohnwu.magisk.model.entity.recycler.ConsoleRvItem
|
||||
import com.topjohnwu.magisk.model.events.SnackbarEvent
|
||||
import com.topjohnwu.magisk.model.flash.FlashResultListener
|
||||
import com.topjohnwu.magisk.model.flash.Flashing
|
||||
import com.topjohnwu.magisk.model.flash.Patching
|
||||
import com.topjohnwu.magisk.utils.DiffObservableList
|
||||
import com.topjohnwu.magisk.utils.KObservableField
|
||||
import com.topjohnwu.superuser.Shell
|
||||
import me.tatarka.bindingcollectionadapter2.ItemBinding
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
import com.topjohnwu.magisk.ui.compat.CompatViewModel
|
||||
|
||||
class FlashViewModel(
|
||||
action: String,
|
||||
installer: Uri,
|
||||
uri: Uri,
|
||||
private val resources: Resources
|
||||
) : BaseViewModel(), FlashResultListener {
|
||||
|
||||
val canShowReboot = Shell.rootAccess()
|
||||
val showRestartTitle = KObservableField(false)
|
||||
|
||||
val behaviorText = KObservableField(resources.getString(R.string.flashing))
|
||||
|
||||
val items = DiffObservableList(ComparableRvItem.callback)
|
||||
val itemBinding = ItemBinding.of<ComparableRvItem<*>> { itemBinding, _, item ->
|
||||
item.bind(itemBinding)
|
||||
itemBinding.bindExtra(BR.viewModel, this@FlashViewModel)
|
||||
}
|
||||
|
||||
private val outItems = ObservableArrayList<String>()
|
||||
private val logItems = Collections.synchronizedList(mutableListOf<String>())
|
||||
|
||||
init {
|
||||
outItems.sendUpdatesTo(items) { it.map { ConsoleRvItem(it) } }
|
||||
outItems.copyNewInputInto(logItems)
|
||||
|
||||
state = State.LOADING
|
||||
|
||||
when (action) {
|
||||
Const.Value.FLASH_ZIP -> Flashing
|
||||
.Install(installer, outItems, logItems, this)
|
||||
.exec()
|
||||
Const.Value.UNINSTALL -> Flashing
|
||||
.Uninstall(installer, outItems, logItems, this)
|
||||
.exec()
|
||||
Const.Value.FLASH_MAGISK -> Patching
|
||||
.Direct(installer, outItems, logItems, this)
|
||||
.exec()
|
||||
Const.Value.FLASH_INACTIVE_SLOT -> Patching
|
||||
.SecondSlot(installer, outItems, logItems, this)
|
||||
.exec()
|
||||
Const.Value.PATCH_FILE -> Patching
|
||||
.File(installer, uri, outItems, logItems, this)
|
||||
.exec()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResult(isSuccess: Boolean) {
|
||||
state = if (isSuccess) State.LOADED else State.LOADING_FAILED
|
||||
behaviorText.value = when {
|
||||
isSuccess -> resources.getString(R.string.done)
|
||||
else -> resources.getString(R.string.failure)
|
||||
}
|
||||
|
||||
if (isSuccess) {
|
||||
Handler().postDelayed(500) {
|
||||
showRestartTitle.value = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun savePressed() = withPermissions(READ_EXTERNAL_STORAGE, WRITE_EXTERNAL_STORAGE)
|
||||
.map { now }
|
||||
.map { it.toTime(timeFormatStandard) }
|
||||
.map { Const.MAGISK_INSTALL_LOG_FILENAME.format(it) }
|
||||
.map { File(Config.downloadDirectory, it) }
|
||||
.map { file ->
|
||||
file.bufferedWriter().use { writer ->
|
||||
logItems.forEach {
|
||||
writer.write(it)
|
||||
writer.newLine()
|
||||
}
|
||||
}
|
||||
file.path
|
||||
}
|
||||
.subscribeK { SnackbarEvent(it).publish() }
|
||||
.add()
|
||||
|
||||
fun restartPressed() = reboot()
|
||||
|
||||
fun backPressed() = back()
|
||||
|
||||
}
|
||||
class FlashViewModel : CompatViewModel()
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.topjohnwu.magisk.redesign.hide
|
||||
package com.topjohnwu.magisk.ui.hide
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
@ -12,8 +12,8 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.topjohnwu.magisk.R
|
||||
import com.topjohnwu.magisk.databinding.FragmentHideMd2Binding
|
||||
import com.topjohnwu.magisk.redesign.compat.CompatFragment
|
||||
import com.topjohnwu.magisk.redesign.compat.hideKeyboard
|
||||
import com.topjohnwu.magisk.ui.compat.CompatFragment
|
||||
import com.topjohnwu.magisk.ui.compat.hideKeyboard
|
||||
import com.topjohnwu.magisk.utils.MotionRevealHelper
|
||||
import org.koin.androidx.viewmodel.ext.android.viewModel
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.topjohnwu.magisk.redesign.hide
|
||||
package com.topjohnwu.magisk.ui.hide
|
||||
|
||||
import android.content.pm.ApplicationInfo
|
||||
import androidx.databinding.Bindable
|
||||
@ -12,10 +12,10 @@ import com.topjohnwu.magisk.model.entity.ProcessHideApp
|
||||
import com.topjohnwu.magisk.model.entity.StatefulProcess
|
||||
import com.topjohnwu.magisk.model.entity.recycler.HideItem
|
||||
import com.topjohnwu.magisk.model.entity.recycler.HideProcessItem
|
||||
import com.topjohnwu.magisk.redesign.compat.CompatViewModel
|
||||
import com.topjohnwu.magisk.redesign.compat.Queryable
|
||||
import com.topjohnwu.magisk.redesign.compat.filterableListOf
|
||||
import com.topjohnwu.magisk.redesign.compat.itemBindingOf
|
||||
import com.topjohnwu.magisk.ui.compat.CompatViewModel
|
||||
import com.topjohnwu.magisk.ui.compat.Queryable
|
||||
import com.topjohnwu.magisk.ui.compat.filterableListOf
|
||||
import com.topjohnwu.magisk.ui.compat.itemBindingOf
|
||||
import com.topjohnwu.magisk.utils.KObservableField
|
||||
import com.topjohnwu.magisk.utils.currentLocale
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.topjohnwu.magisk.redesign.home
|
||||
package com.topjohnwu.magisk.ui.home
|
||||
|
||||
import android.view.Menu
|
||||
import android.view.MenuInflater
|
||||
@ -7,7 +7,7 @@ import androidx.core.graphics.Insets
|
||||
import com.topjohnwu.magisk.R
|
||||
import com.topjohnwu.magisk.databinding.FragmentHomeMd2Binding
|
||||
import com.topjohnwu.magisk.model.navigation.Navigation
|
||||
import com.topjohnwu.magisk.redesign.compat.CompatFragment
|
||||
import com.topjohnwu.magisk.ui.compat.CompatFragment
|
||||
import org.koin.androidx.viewmodel.ext.android.viewModel
|
||||
|
||||
class HomeFragment : CompatFragment<HomeViewModel, FragmentHomeMd2Binding>() {
|
@ -1,4 +1,4 @@
|
||||
package com.topjohnwu.magisk.redesign.home
|
||||
package com.topjohnwu.magisk.ui.home
|
||||
|
||||
import android.Manifest
|
||||
import android.os.Build
|
||||
@ -22,8 +22,8 @@ import com.topjohnwu.magisk.model.events.dialog.ManagerInstallDialog
|
||||
import com.topjohnwu.magisk.model.events.dialog.UninstallDialog
|
||||
import com.topjohnwu.magisk.model.navigation.Navigation
|
||||
import com.topjohnwu.magisk.model.observer.Observer
|
||||
import com.topjohnwu.magisk.redesign.compat.CompatViewModel
|
||||
import com.topjohnwu.magisk.redesign.compat.itemBindingOf
|
||||
import com.topjohnwu.magisk.ui.compat.CompatViewModel
|
||||
import com.topjohnwu.magisk.ui.compat.itemBindingOf
|
||||
import com.topjohnwu.magisk.utils.KObservableField
|
||||
import com.topjohnwu.superuser.Shell
|
||||
import me.tatarka.bindingcollectionadapter2.BR
|
@ -1,11 +1,11 @@
|
||||
package com.topjohnwu.magisk.redesign.install
|
||||
package com.topjohnwu.magisk.ui.install
|
||||
|
||||
import android.content.Intent
|
||||
import androidx.core.graphics.Insets
|
||||
import com.topjohnwu.magisk.R
|
||||
import com.topjohnwu.magisk.databinding.FragmentInstallMd2Binding
|
||||
import com.topjohnwu.magisk.model.events.RequestFileEvent
|
||||
import com.topjohnwu.magisk.redesign.compat.CompatFragment
|
||||
import com.topjohnwu.magisk.ui.compat.CompatFragment
|
||||
import org.koin.androidx.viewmodel.ext.android.viewModel
|
||||
|
||||
class InstallFragment : CompatFragment<InstallViewModel, FragmentInstallMd2Binding>() {
|
@ -1,4 +1,4 @@
|
||||
package com.topjohnwu.magisk.redesign.install
|
||||
package com.topjohnwu.magisk.ui.install
|
||||
|
||||
import android.net.Uri
|
||||
import com.topjohnwu.magisk.R
|
||||
@ -8,7 +8,7 @@ import com.topjohnwu.magisk.model.download.RemoteFileService
|
||||
import com.topjohnwu.magisk.model.entity.internal.Configuration
|
||||
import com.topjohnwu.magisk.model.entity.internal.DownloadSubject
|
||||
import com.topjohnwu.magisk.model.events.RequestFileEvent
|
||||
import com.topjohnwu.magisk.redesign.compat.CompatViewModel
|
||||
import com.topjohnwu.magisk.ui.compat.CompatViewModel
|
||||
import com.topjohnwu.magisk.utils.KObservableField
|
||||
import com.topjohnwu.superuser.Shell
|
||||
import com.topjohnwu.superuser.ShellUtils
|
||||
@ -69,4 +69,4 @@ class InstallViewModel : CompatViewModel(State.LOADED) {
|
||||
.fastCmd("grep_prop ro.build.ab_update")
|
||||
.let { it.isNotEmpty() && it.toBoolean() }
|
||||
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.topjohnwu.magisk.redesign.log
|
||||
package com.topjohnwu.magisk.ui.log
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.Menu
|
||||
@ -9,8 +9,8 @@ import androidx.core.graphics.Insets
|
||||
import androidx.core.view.isVisible
|
||||
import com.topjohnwu.magisk.R
|
||||
import com.topjohnwu.magisk.databinding.FragmentLogMd2Binding
|
||||
import com.topjohnwu.magisk.redesign.MainActivity
|
||||
import com.topjohnwu.magisk.redesign.compat.CompatFragment
|
||||
import com.topjohnwu.magisk.ui.MainActivity
|
||||
import com.topjohnwu.magisk.ui.compat.CompatFragment
|
||||
import com.topjohnwu.magisk.utils.MotionRevealHelper
|
||||
import org.koin.androidx.viewmodel.ext.android.viewModel
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.topjohnwu.magisk.redesign.log
|
||||
package com.topjohnwu.magisk.ui.log
|
||||
|
||||
import com.topjohnwu.magisk.BR
|
||||
import com.topjohnwu.magisk.Config
|
||||
@ -12,9 +12,9 @@ import com.topjohnwu.magisk.model.entity.recycler.ConsoleItem
|
||||
import com.topjohnwu.magisk.model.entity.recycler.LogItem
|
||||
import com.topjohnwu.magisk.model.entity.recycler.TextItem
|
||||
import com.topjohnwu.magisk.model.events.SnackbarEvent
|
||||
import com.topjohnwu.magisk.redesign.compat.CompatViewModel
|
||||
import com.topjohnwu.magisk.redesign.compat.diffListOf
|
||||
import com.topjohnwu.magisk.redesign.compat.itemBindingOf
|
||||
import com.topjohnwu.magisk.ui.compat.CompatViewModel
|
||||
import com.topjohnwu.magisk.ui.compat.diffListOf
|
||||
import com.topjohnwu.magisk.ui.compat.itemBindingOf
|
||||
import com.topjohnwu.superuser.Shell
|
||||
import io.reactivex.Completable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
@ -1,4 +1,4 @@
|
||||
package com.topjohnwu.magisk.redesign.module
|
||||
package com.topjohnwu.magisk.ui.module
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
@ -14,10 +14,10 @@ import com.topjohnwu.magisk.R
|
||||
import com.topjohnwu.magisk.databinding.FragmentModuleMd2Binding
|
||||
import com.topjohnwu.magisk.model.events.InstallExternalModuleEvent
|
||||
import com.topjohnwu.magisk.model.events.ViewEvent
|
||||
import com.topjohnwu.magisk.redesign.MainActivity
|
||||
import com.topjohnwu.magisk.redesign.ReselectionTarget
|
||||
import com.topjohnwu.magisk.redesign.compat.CompatFragment
|
||||
import com.topjohnwu.magisk.redesign.compat.hideKeyboard
|
||||
import com.topjohnwu.magisk.ui.MainActivity
|
||||
import com.topjohnwu.magisk.ui.ReselectionTarget
|
||||
import com.topjohnwu.magisk.ui.compat.CompatFragment
|
||||
import com.topjohnwu.magisk.ui.compat.hideKeyboard
|
||||
import com.topjohnwu.magisk.utils.EndlessRecyclerScrollListener
|
||||
import com.topjohnwu.magisk.utils.MotionRevealHelper
|
||||
import com.topjohnwu.magisk.utils.PinchZoomTouchListener
|
@ -1,4 +1,4 @@
|
||||
package com.topjohnwu.magisk.redesign.module
|
||||
package com.topjohnwu.magisk.ui.module
|
||||
|
||||
import androidx.annotation.WorkerThread
|
||||
import androidx.databinding.Bindable
|
||||
@ -19,8 +19,8 @@ import com.topjohnwu.magisk.model.entity.recycler.*
|
||||
import com.topjohnwu.magisk.model.events.InstallExternalModuleEvent
|
||||
import com.topjohnwu.magisk.model.events.OpenChangelogEvent
|
||||
import com.topjohnwu.magisk.model.events.dialog.ModuleInstallDialog
|
||||
import com.topjohnwu.magisk.redesign.compat.*
|
||||
import com.topjohnwu.magisk.tasks.RepoUpdater
|
||||
import com.topjohnwu.magisk.ui.compat.*
|
||||
import com.topjohnwu.magisk.utils.EndlessRecyclerScrollListener
|
||||
import com.topjohnwu.magisk.utils.KObservableField
|
||||
import com.topjohnwu.magisk.utils.currentLocale
|
||||
@ -310,4 +310,4 @@ class ModuleViewModel(
|
||||
OpenChangelogEvent(item.repo ?: return).publish()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
package com.topjohnwu.magisk.redesign.request
|
||||
package com.topjohnwu.magisk.ui.request
|
||||
|
||||
import com.topjohnwu.magisk.R
|
||||
import com.topjohnwu.magisk.databinding.ActivityRequestMd2Binding
|
||||
import com.topjohnwu.magisk.redesign.compat.CompatActivity
|
||||
import com.topjohnwu.magisk.ui.compat.CompatActivity
|
||||
import org.koin.androidx.viewmodel.ext.android.viewModel
|
||||
|
||||
class RequestActivity : CompatActivity<RequestViewModel, ActivityRequestMd2Binding>() {
|
||||
@ -11,4 +11,4 @@ class RequestActivity : CompatActivity<RequestViewModel, ActivityRequestMd2Bindi
|
||||
override val layoutRes = R.layout.activity_request_md2
|
||||
override val viewModel by viewModel<RequestViewModel>()
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package com.topjohnwu.magisk.ui.request
|
||||
|
||||
import com.topjohnwu.magisk.ui.compat.CompatViewModel
|
||||
|
||||
class RequestViewModel : CompatViewModel()
|
@ -1,8 +1,8 @@
|
||||
package com.topjohnwu.magisk.redesign.safetynet
|
||||
package com.topjohnwu.magisk.ui.safetynet
|
||||
|
||||
import com.topjohnwu.magisk.R
|
||||
import com.topjohnwu.magisk.databinding.FragmentSafetynetMd2Binding
|
||||
import com.topjohnwu.magisk.redesign.compat.CompatFragment
|
||||
import com.topjohnwu.magisk.ui.compat.CompatFragment
|
||||
import org.koin.androidx.viewmodel.ext.android.viewModel
|
||||
|
||||
class SafetynetFragment : CompatFragment<SafetynetViewModel, FragmentSafetynetMd2Binding>() {
|
||||
@ -15,4 +15,4 @@ class SafetynetFragment : CompatFragment<SafetynetViewModel, FragmentSafetynetMd
|
||||
activity.setTitle(R.string.safetyNet)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.topjohnwu.magisk.redesign.safetynet
|
||||
package com.topjohnwu.magisk.ui.safetynet
|
||||
|
||||
import androidx.databinding.Bindable
|
||||
import com.topjohnwu.magisk.BR
|
||||
@ -6,8 +6,8 @@ import com.topjohnwu.magisk.R
|
||||
import com.topjohnwu.magisk.extensions.subscribeK
|
||||
import com.topjohnwu.magisk.model.events.SafetyNetResult
|
||||
import com.topjohnwu.magisk.model.events.UpdateSafetyNetEvent
|
||||
import com.topjohnwu.magisk.redesign.compat.CompatViewModel
|
||||
import com.topjohnwu.magisk.redesign.safetynet.SafetyNetState.*
|
||||
import com.topjohnwu.magisk.ui.compat.CompatViewModel
|
||||
import com.topjohnwu.magisk.ui.safetynet.SafetyNetState.*
|
||||
import com.topjohnwu.magisk.utils.KObservableField
|
||||
import com.topjohnwu.magisk.utils.RxBus
|
||||
import com.topjohnwu.magisk.utils.SafetyNetHelper
|
@ -1,11 +1,11 @@
|
||||
package com.topjohnwu.magisk.redesign.settings
|
||||
package com.topjohnwu.magisk.ui.settings
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.core.graphics.Insets
|
||||
import com.topjohnwu.magisk.R
|
||||
import com.topjohnwu.magisk.databinding.FragmentSettingsMd2Binding
|
||||
import com.topjohnwu.magisk.redesign.compat.CompatFragment
|
||||
import com.topjohnwu.magisk.ui.compat.CompatFragment
|
||||
import com.topjohnwu.magisk.utils.PinchZoomTouchListener
|
||||
import org.koin.androidx.viewmodel.ext.android.viewModel
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.topjohnwu.magisk.redesign.settings
|
||||
package com.topjohnwu.magisk.ui.settings
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Build
|
@ -1,4 +1,4 @@
|
||||
package com.topjohnwu.magisk.redesign.settings
|
||||
package com.topjohnwu.magisk.ui.settings
|
||||
|
||||
import android.Manifest
|
||||
import android.view.View
|
||||
@ -15,10 +15,10 @@ import com.topjohnwu.magisk.model.events.PermissionEvent
|
||||
import com.topjohnwu.magisk.model.events.RecreateEvent
|
||||
import com.topjohnwu.magisk.model.events.dialog.BiometricDialog
|
||||
import com.topjohnwu.magisk.model.navigation.Navigation
|
||||
import com.topjohnwu.magisk.redesign.compat.CompatViewModel
|
||||
import com.topjohnwu.magisk.redesign.compat.adapterOf
|
||||
import com.topjohnwu.magisk.redesign.compat.diffListOf
|
||||
import com.topjohnwu.magisk.redesign.compat.itemBindingOf
|
||||
import com.topjohnwu.magisk.ui.compat.CompatViewModel
|
||||
import com.topjohnwu.magisk.ui.compat.adapterOf
|
||||
import com.topjohnwu.magisk.ui.compat.diffListOf
|
||||
import com.topjohnwu.magisk.ui.compat.itemBindingOf
|
||||
import com.topjohnwu.magisk.utils.PatchAPK
|
||||
import com.topjohnwu.magisk.utils.Utils
|
||||
import com.topjohnwu.superuser.Shell
|
@ -1,4 +1,4 @@
|
||||
package com.topjohnwu.magisk.redesign.superuser
|
||||
package com.topjohnwu.magisk.ui.superuser
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.Menu
|
||||
@ -9,7 +9,7 @@ import androidx.core.graphics.Insets
|
||||
import com.topjohnwu.magisk.R
|
||||
import com.topjohnwu.magisk.databinding.FragmentSuperuserMd2Binding
|
||||
import com.topjohnwu.magisk.model.navigation.Navigation
|
||||
import com.topjohnwu.magisk.redesign.compat.CompatFragment
|
||||
import com.topjohnwu.magisk.ui.compat.CompatFragment
|
||||
import com.topjohnwu.magisk.utils.PinchZoomTouchListener
|
||||
import org.koin.androidx.viewmodel.ext.android.viewModel
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.topjohnwu.magisk.redesign.superuser
|
||||
package com.topjohnwu.magisk.ui.superuser
|
||||
|
||||
import android.content.pm.PackageManager
|
||||
import android.content.res.Resources
|
||||
@ -19,10 +19,10 @@ import com.topjohnwu.magisk.model.events.SnackbarEvent
|
||||
import com.topjohnwu.magisk.model.events.dialog.BiometricDialog
|
||||
import com.topjohnwu.magisk.model.events.dialog.SuperuserRevokeDialog
|
||||
import com.topjohnwu.magisk.model.navigation.Navigation
|
||||
import com.topjohnwu.magisk.redesign.compat.CompatViewModel
|
||||
import com.topjohnwu.magisk.redesign.compat.adapterOf
|
||||
import com.topjohnwu.magisk.redesign.compat.diffListOf
|
||||
import com.topjohnwu.magisk.redesign.compat.itemBindingOf
|
||||
import com.topjohnwu.magisk.ui.compat.CompatViewModel
|
||||
import com.topjohnwu.magisk.ui.compat.adapterOf
|
||||
import com.topjohnwu.magisk.ui.compat.diffListOf
|
||||
import com.topjohnwu.magisk.ui.compat.itemBindingOf
|
||||
import com.topjohnwu.magisk.utils.BiometricHelper
|
||||
import com.topjohnwu.magisk.utils.currentLocale
|
||||
import io.reactivex.Single
|
||||
@ -160,4 +160,4 @@ class SuperuserViewModel(
|
||||
private fun deletePolicy(policy: MagiskPolicy) =
|
||||
db.delete(policy.uid).andThen(Single.just(policy))
|
||||
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.topjohnwu.magisk.redesign.theme
|
||||
package com.topjohnwu.magisk.ui.theme
|
||||
|
||||
import com.topjohnwu.magisk.Config
|
||||
import com.topjohnwu.magisk.R
|
@ -1,9 +1,9 @@
|
||||
package com.topjohnwu.magisk.redesign.theme
|
||||
package com.topjohnwu.magisk.ui.theme
|
||||
|
||||
import androidx.core.graphics.Insets
|
||||
import com.topjohnwu.magisk.R
|
||||
import com.topjohnwu.magisk.databinding.FragmentThemeMd2Binding
|
||||
import com.topjohnwu.magisk.redesign.compat.CompatFragment
|
||||
import com.topjohnwu.magisk.ui.compat.CompatFragment
|
||||
import org.koin.androidx.viewmodel.ext.android.viewModel
|
||||
|
||||
class ThemeFragment : CompatFragment<ThemeViewModel, FragmentThemeMd2Binding>() {
|
@ -1,9 +1,9 @@
|
||||
package com.topjohnwu.magisk.redesign.theme
|
||||
package com.topjohnwu.magisk.ui.theme
|
||||
|
||||
import com.topjohnwu.magisk.model.entity.recycler.TappableHeadlineItem
|
||||
import com.topjohnwu.magisk.model.events.RecreateEvent
|
||||
import com.topjohnwu.magisk.model.events.dialog.DarkThemeDialog
|
||||
import com.topjohnwu.magisk.redesign.compat.CompatViewModel
|
||||
import com.topjohnwu.magisk.ui.compat.CompatViewModel
|
||||
|
||||
class ThemeViewModel : CompatViewModel(), TappableHeadlineItem.Listener {
|
||||
|
||||
@ -21,4 +21,4 @@ class ThemeViewModel : CompatViewModel(), TappableHeadlineItem.Listener {
|
||||
|
||||
private fun darkModePressed() = DarkThemeDialog().publish()
|
||||
|
||||
}
|
||||
}
|
@ -15,7 +15,7 @@ import com.topjohnwu.magisk.extensions.subscribeK
|
||||
import com.topjohnwu.magisk.model.entity.MagiskPolicy
|
||||
import com.topjohnwu.magisk.model.entity.toLog
|
||||
import com.topjohnwu.magisk.model.entity.toPolicy
|
||||
import com.topjohnwu.magisk.ui.surequest.SuRequestActivity
|
||||
import com.topjohnwu.magisk.legacy.surequest.SuRequestActivity
|
||||
import com.topjohnwu.superuser.Shell
|
||||
import timber.log.Timber
|
||||
|
||||
|
@ -22,7 +22,7 @@ import com.topjohnwu.magisk.BR
|
||||
import com.topjohnwu.magisk.R
|
||||
import com.topjohnwu.magisk.databinding.ComparableRvItem
|
||||
import com.topjohnwu.magisk.databinding.DialogMagiskBaseBinding
|
||||
import com.topjohnwu.magisk.redesign.compat.itemBindingOf
|
||||
import com.topjohnwu.magisk.ui.compat.itemBindingOf
|
||||
import com.topjohnwu.magisk.utils.KObservableField
|
||||
import me.tatarka.bindingcollectionadapter2.BindingRecyclerViewAdapters
|
||||
import me.tatarka.bindingcollectionadapter2.ItemBinding
|
||||
@ -277,4 +277,4 @@ class MagiskDialog @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
typealias OnDialogButtonClickListener = (DialogInterface) -> Unit
|
||||
typealias OnDialogClickListener = (position: Int) -> Unit
|
||||
typealias OnDialogClickListener = (position: Int) -> Unit
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.topjohnwu.magisk.ui.flash.FlashViewModel" />
|
||||
type="com.topjohnwu.magisk.legacy.flash.FlashViewModel" />
|
||||
|
||||
</data>
|
||||
|
||||
@ -149,4 +149,4 @@
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
||||
</layout>
|
||||
</layout>
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.topjohnwu.magisk.redesign.MainViewModel" />
|
||||
type="com.topjohnwu.magisk.ui.MainViewModel" />
|
||||
|
||||
</data>
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.topjohnwu.magisk.ui.surequest.SuRequestViewModel" />
|
||||
type="com.topjohnwu.magisk.legacy.surequest.SuRequestViewModel" />
|
||||
|
||||
</data>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.topjohnwu.magisk.redesign.request.RequestViewModel" />
|
||||
type="com.topjohnwu.magisk.ui.request.RequestViewModel" />
|
||||
|
||||
</data>
|
||||
|
||||
@ -20,4 +20,4 @@
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
</layout>
|
||||
</layout>
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
<variable
|
||||
name="data"
|
||||
type="com.topjohnwu.magisk.redesign.settings.Hide" />
|
||||
type="com.topjohnwu.magisk.ui.settings.Hide" />
|
||||
|
||||
</data>
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
<variable
|
||||
name="data"
|
||||
type="com.topjohnwu.magisk.redesign.settings.DownloadPath" />
|
||||
type="com.topjohnwu.magisk.ui.settings.DownloadPath" />
|
||||
|
||||
</data>
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
<variable
|
||||
name="data"
|
||||
type="com.topjohnwu.magisk.redesign.settings.UpdateChannelUrl" />
|
||||
type="com.topjohnwu.magisk.ui.settings.UpdateChannelUrl" />
|
||||
|
||||
</data>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.topjohnwu.magisk.redesign.flash.FlashViewModel" />
|
||||
type="com.topjohnwu.magisk.ui.flash.FlashViewModel" />
|
||||
|
||||
</data>
|
||||
|
||||
@ -20,4 +20,4 @@
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
</layout>
|
||||
</layout>
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.topjohnwu.magisk.redesign.hide.HideViewModel" />
|
||||
type="com.topjohnwu.magisk.ui.hide.HideViewModel" />
|
||||
|
||||
</data>
|
||||
|
||||
@ -89,4 +89,4 @@
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</layout>
|
||||
</layout>
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
<import type="com.topjohnwu.magisk.BuildConfig" />
|
||||
|
||||
<import type="com.topjohnwu.magisk.redesign.home.MagiskState" />
|
||||
<import type="com.topjohnwu.magisk.ui.home.MagiskState" />
|
||||
|
||||
<import type="com.topjohnwu.magisk.extensions.XAndroidKt" />
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.topjohnwu.magisk.redesign.home.HomeViewModel" />
|
||||
type="com.topjohnwu.magisk.ui.home.HomeViewModel" />
|
||||
|
||||
</data>
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.topjohnwu.magisk.redesign.install.InstallViewModel" />
|
||||
type="com.topjohnwu.magisk.ui.install.InstallViewModel" />
|
||||
|
||||
</data>
|
||||
|
||||
@ -278,4 +278,4 @@
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
</layout>
|
||||
</layout>
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.topjohnwu.magisk.redesign.log.LogViewModel" />
|
||||
type="com.topjohnwu.magisk.ui.log.LogViewModel" />
|
||||
|
||||
</data>
|
||||
|
||||
@ -77,4 +77,4 @@
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</layout>
|
||||
</layout>
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.topjohnwu.magisk.redesign.module.ModuleViewModel" />
|
||||
type="com.topjohnwu.magisk.ui.module.ModuleViewModel" />
|
||||
|
||||
</data>
|
||||
|
||||
@ -94,4 +94,4 @@
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
</layout>
|
||||
</layout>
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.topjohnwu.magisk.redesign.safetynet.SafetynetViewModel" />
|
||||
type="com.topjohnwu.magisk.ui.safetynet.SafetynetViewModel" />
|
||||
|
||||
</data>
|
||||
|
||||
@ -289,4 +289,4 @@
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
</layout>
|
||||
</layout>
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.topjohnwu.magisk.redesign.settings.SettingsViewModel" />
|
||||
type="com.topjohnwu.magisk.ui.settings.SettingsViewModel" />
|
||||
|
||||
</data>
|
||||
|
||||
@ -35,4 +35,4 @@
|
||||
tools:listitem="@layout/item_settings_toggle"
|
||||
tools:paddingTop="@dimen/l1" />
|
||||
|
||||
</layout>
|
||||
</layout>
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.topjohnwu.magisk.redesign.superuser.SuperuserViewModel" />
|
||||
type="com.topjohnwu.magisk.ui.superuser.SuperuserViewModel" />
|
||||
|
||||
</data>
|
||||
|
||||
@ -62,4 +62,4 @@
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</layout>
|
||||
</layout>
|
||||
|
@ -4,11 +4,11 @@
|
||||
|
||||
<data>
|
||||
|
||||
<import type="com.topjohnwu.magisk.redesign.theme.Theme" />
|
||||
<import type="com.topjohnwu.magisk.ui.theme.Theme" />
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.topjohnwu.magisk.redesign.theme.ThemeViewModel" />
|
||||
type="com.topjohnwu.magisk.ui.theme.ThemeViewModel" />
|
||||
|
||||
</data>
|
||||
|
||||
@ -159,4 +159,4 @@
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
</layout>
|
||||
</layout>
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.topjohnwu.magisk.redesign.hide.HideViewModel" />
|
||||
type="com.topjohnwu.magisk.ui.hide.HideViewModel" />
|
||||
|
||||
</data>
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.topjohnwu.magisk.redesign.log.LogViewModel" />
|
||||
type="com.topjohnwu.magisk.ui.log.LogViewModel" />
|
||||
|
||||
</data>
|
||||
|
||||
@ -51,4 +51,4 @@
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</layout>
|
||||
</layout>
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.topjohnwu.magisk.redesign.module.ModuleViewModel" />
|
||||
type="com.topjohnwu.magisk.ui.module.ModuleViewModel" />
|
||||
|
||||
</data>
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.topjohnwu.magisk.redesign.home.HomeViewModel" />
|
||||
type="com.topjohnwu.magisk.ui.home.HomeViewModel" />
|
||||
|
||||
</data>
|
||||
|
||||
@ -66,4 +66,4 @@
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</layout>
|
||||
</layout>
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.topjohnwu.magisk.redesign.home.HomeViewModel" />
|
||||
type="com.topjohnwu.magisk.ui.home.HomeViewModel" />
|
||||
|
||||
</data>
|
||||
|
||||
@ -47,4 +47,4 @@
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</layout>
|
||||
</layout>
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.topjohnwu.magisk.redesign.hide.HideViewModel" />
|
||||
type="com.topjohnwu.magisk.ui.hide.HideViewModel" />
|
||||
|
||||
</data>
|
||||
|
||||
@ -129,4 +129,4 @@
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
</layout>
|
||||
</layout>
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.topjohnwu.magisk.redesign.hide.HideViewModel" />
|
||||
type="com.topjohnwu.magisk.ui.hide.HideViewModel" />
|
||||
|
||||
</data>
|
||||
|
||||
@ -55,4 +55,4 @@
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</layout>
|
||||
</layout>
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.topjohnwu.magisk.redesign.log.LogViewModel" />
|
||||
type="com.topjohnwu.magisk.ui.log.LogViewModel" />
|
||||
|
||||
</data>
|
||||
|
||||
@ -101,4 +101,4 @@
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</layout>
|
||||
</layout>
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.topjohnwu.magisk.redesign.module.ModuleViewModel" />
|
||||
type="com.topjohnwu.magisk.ui.module.ModuleViewModel" />
|
||||
|
||||
</data>
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.topjohnwu.magisk.redesign.module.ModuleViewModel" />
|
||||
type="com.topjohnwu.magisk.ui.module.ModuleViewModel" />
|
||||
|
||||
</data>
|
||||
|
||||
@ -133,4 +133,4 @@
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
|
||||
</layout>
|
||||
</layout>
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.topjohnwu.magisk.redesign.superuser.SuperuserViewModel" />
|
||||
type="com.topjohnwu.magisk.ui.superuser.SuperuserViewModel" />
|
||||
|
||||
</data>
|
||||
|
||||
@ -180,4 +180,4 @@
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
</layout>
|
||||
</layout>
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.topjohnwu.magisk.redesign.module.ModuleViewModel" />
|
||||
type="com.topjohnwu.magisk.ui.module.ModuleViewModel" />
|
||||
|
||||
</data>
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.topjohnwu.magisk.redesign.module.ModuleViewModel" />
|
||||
type="com.topjohnwu.magisk.ui.module.ModuleViewModel" />
|
||||
|
||||
</data>
|
||||
|
||||
@ -53,4 +53,4 @@
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</layout>
|
||||
</layout>
|
||||
|
@ -7,11 +7,11 @@
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.topjohnwu.magisk.redesign.theme.ThemeViewModel" />
|
||||
type="com.topjohnwu.magisk.ui.theme.ThemeViewModel" />
|
||||
|
||||
<variable
|
||||
name="theme"
|
||||
type="com.topjohnwu.magisk.redesign.theme.Theme" />
|
||||
type="com.topjohnwu.magisk.ui.theme.Theme" />
|
||||
|
||||
</data>
|
||||
|
||||
@ -179,4 +179,4 @@
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
</layout>
|
||||
</layout>
|
||||
|
Loading…
Reference in New Issue
Block a user