mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-27 20:15:29 +00:00
Added post-merge fixes
This commit is contained in:
parent
7d6eebdae3
commit
93c422dce6
@ -127,7 +127,7 @@ dependencies {
|
||||
implementation 'androidx.recyclerview:recyclerview:1.1.0-rc01'
|
||||
implementation 'androidx.fragment:fragment-ktx:1.2.0-rc01'
|
||||
implementation 'androidx.work:work-runtime:2.2.0'
|
||||
implementation 'androidx.transition:transition:1.3.0-rc01'
|
||||
implementation 'androidx.transition:transition:1.2.0'
|
||||
implementation 'androidx.multidex:multidex:2.0.1'
|
||||
implementation 'androidx.core:core-ktx:1.1.0'
|
||||
implementation 'com.google.android.material:material:1.1.0-beta01'
|
||||
|
@ -26,13 +26,14 @@ import com.topjohnwu.magisk.ui.surequest.SuRequestActivity
|
||||
import com.topjohnwu.magisk.utils.currentLocale
|
||||
import com.topjohnwu.magisk.utils.defaultLocale
|
||||
import java.util.*
|
||||
import com.topjohnwu.magisk.redesign.MainActivity as RedesignActivity
|
||||
|
||||
fun AssetManager.addAssetPath(path: String) {
|
||||
DynAPK.addAssetPath(this, path)
|
||||
}
|
||||
|
||||
fun Context.wrap(global: Boolean = true): Context
|
||||
= if (global) GlobalResContext(this) else ResContext(this)
|
||||
fun Context.wrap(global: Boolean = true): Context =
|
||||
if (global) GlobalResContext(this) else ResContext(this)
|
||||
|
||||
fun Context.wrapJob(): Context = object : GlobalResContext(this) {
|
||||
|
||||
@ -74,7 +75,7 @@ fun Context.intent(c: Class<*>): Intent {
|
||||
}
|
||||
|
||||
fun resolveRes(idx: Int): Int {
|
||||
return Info.stub?.resourceMap?.get(idx) ?: when(idx) {
|
||||
return Info.stub?.resourceMap?.get(idx) ?: when (idx) {
|
||||
DynAPK.NOTIFICATION -> R.drawable.ic_magisk_outline
|
||||
DynAPK.DOWNLOAD -> R.drawable.sc_cloud_download
|
||||
DynAPK.SUPERUSER -> R.drawable.sc_superuser
|
||||
@ -167,7 +168,8 @@ private class JobSchedulerWrapper(private val base: JobScheduler) : JobScheduler
|
||||
val name = service.className
|
||||
val component = ComponentName(
|
||||
service.packageName,
|
||||
Info.stub!!.componentMap[name] ?: name)
|
||||
Info.stub!!.componentMap[name] ?: name
|
||||
)
|
||||
|
||||
// Clone the JobInfo except component
|
||||
val builder = JobInfo.Builder(id, component)
|
||||
@ -217,7 +219,8 @@ object ClassMap {
|
||||
UpdateCheckService::class.java to a.g::class.java,
|
||||
GeneralReceiver::class.java to a.h::class.java,
|
||||
DownloadService::class.java to a.j::class.java,
|
||||
SuRequestActivity::class.java to a.m::class.java
|
||||
SuRequestActivity::class.java to a.m::class.java,
|
||||
RedesignActivity::class.java to a.i::class.java
|
||||
)
|
||||
|
||||
operator fun get(c: Class<*>) = map.getOrElse(c) { throw IllegalArgumentException() }
|
||||
|
@ -18,6 +18,6 @@ fun View.addOnGlobalLayoutListener(oneShot: Boolean = false, callback: () -> Uni
|
||||
})
|
||||
|
||||
fun ViewGroup.startAnimations() {
|
||||
val transition = AutoTransition().setInterpolator(FastOutSlowInInterpolator())
|
||||
val transition = AutoTransition().setInterpolator(FastOutSlowInInterpolator()).setDuration(400)
|
||||
TransitionManager.beginDelayedTransition(this, transition)
|
||||
}
|
@ -123,7 +123,7 @@ class UpdateSafetyNetEvent : ViewEvent(), ContextExecutor, KoinComponent, Safety
|
||||
onClick { downloadInternal() }
|
||||
}
|
||||
.applyButton(MagiskDialog.ButtonType.NEGATIVE) {
|
||||
titleRes = R.string.no_thanks
|
||||
titleRes = android.R.string.no
|
||||
onClick { rxBus.post(SafetyNetResult(-2)) }
|
||||
}
|
||||
.reveal()
|
||||
|
@ -42,7 +42,7 @@ class EnvFixDialog : DialogEvent() {
|
||||
}
|
||||
}
|
||||
.applyButton(MagiskDialog.ButtonType.NEGATIVE) {
|
||||
titleRes = R.string.no_thanks
|
||||
titleRes = android.R.string.no
|
||||
}
|
||||
.let { Unit }
|
||||
|
||||
|
@ -95,7 +95,7 @@ class MagiskInstallDialog : DialogEvent() {
|
||||
}
|
||||
}
|
||||
.applyButton(MagiskDialog.ButtonType.NEGATIVE) {
|
||||
titleRes = R.string.no_thanks
|
||||
titleRes = android.R.string.no
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ class SuperuserRevokeDialog(
|
||||
onClick { callbacks.listenerOnSuccess() }
|
||||
}
|
||||
.applyButton(MagiskDialog.ButtonType.NEGATIVE) {
|
||||
titleRes = R.string.no_thanks
|
||||
titleRes = android.R.string.no
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,9 +3,9 @@ package com.topjohnwu.magisk.model.navigation
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import com.topjohnwu.magisk.ClassMap
|
||||
import com.topjohnwu.magisk.Config
|
||||
import com.topjohnwu.magisk.Const
|
||||
import com.topjohnwu.magisk.intent
|
||||
import com.topjohnwu.magisk.redesign.install.InstallFragment
|
||||
import com.topjohnwu.magisk.redesign.safetynet.SafetynetFragment
|
||||
import com.topjohnwu.magisk.ui.MainActivity
|
||||
@ -115,7 +115,7 @@ object Navigation {
|
||||
Config.redesign -> RedesignActivity::class.java
|
||||
else -> MainActivity::class.java
|
||||
}
|
||||
Intent(context, ClassMap[destination])
|
||||
context.intent(destination)
|
||||
.putExtra(Const.Key.OPEN_SECTION, launchIntent.getStringExtra(Const.Key.OPEN_SECTION))
|
||||
.putExtra(
|
||||
Const.Key.OPEN_SETTINGS,
|
||||
|
@ -7,10 +7,10 @@ import android.view.ViewGroup
|
||||
import androidx.databinding.OnRebindCallback
|
||||
import androidx.databinding.ViewDataBinding
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.transition.TransitionManager
|
||||
import com.topjohnwu.magisk.R
|
||||
import com.topjohnwu.magisk.base.BaseActivity
|
||||
import com.topjohnwu.magisk.extensions.snackbar
|
||||
import com.topjohnwu.magisk.extensions.startAnimations
|
||||
import com.topjohnwu.magisk.model.events.SnackbarEvent
|
||||
import com.topjohnwu.magisk.model.events.ViewEvent
|
||||
import com.topjohnwu.magisk.model.navigation.MagiskNavigationEvent
|
||||
@ -40,7 +40,7 @@ abstract class CompatActivity<ViewModel : CompatViewModel, Binding : ViewDataBin
|
||||
|
||||
binding.addOnRebindCallback(object : OnRebindCallback<Binding>() {
|
||||
override fun onPreBind(binding: Binding): Boolean {
|
||||
TransitionManager.beginDelayedTransition(binding.root as ViewGroup)
|
||||
(binding.root as? ViewGroup)?.startAnimations()
|
||||
return super.onPreBind(binding)
|
||||
}
|
||||
})
|
||||
|
@ -5,8 +5,8 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.databinding.OnRebindCallback
|
||||
import androidx.databinding.ViewDataBinding
|
||||
import androidx.transition.TransitionManager
|
||||
import com.topjohnwu.magisk.base.BaseFragment
|
||||
import com.topjohnwu.magisk.extensions.startAnimations
|
||||
import com.topjohnwu.magisk.model.events.ViewEvent
|
||||
|
||||
abstract class CompatFragment<ViewModel : CompatViewModel, Binding : ViewDataBinding>
|
||||
@ -24,7 +24,7 @@ abstract class CompatFragment<ViewModel : CompatViewModel, Binding : ViewDataBin
|
||||
|
||||
binding.addOnRebindCallback(object : OnRebindCallback<Binding>() {
|
||||
override fun onPreBind(binding: Binding): Boolean {
|
||||
TransitionManager.beginDelayedTransition(binding.root as ViewGroup)
|
||||
(binding.root as? ViewGroup)?.startAnimations()
|
||||
return super.onPreBind(binding)
|
||||
}
|
||||
})
|
||||
|
@ -2,9 +2,9 @@ package com.topjohnwu.magisk.redesign.compat
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.FragmentTransaction
|
||||
import com.ncapdevi.fragnav.FragNavController
|
||||
import com.ncapdevi.fragnav.FragNavTransactionOptions
|
||||
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
|
||||
@ -106,10 +106,18 @@ class CompatNavigationDelegate<out Source>(
|
||||
}
|
||||
|
||||
private fun FragNavTransactionOptions.Builder.customAnimations(options: MagiskAnimBuilder) =
|
||||
customAnimations(options.enter, options.exit, options.popEnter, options.popExit).apply {
|
||||
if (!options.anySet) {
|
||||
transition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
|
||||
}
|
||||
apply {
|
||||
if (!options.anySet) customAnimations(
|
||||
R.anim.fragment_enter,
|
||||
R.anim.fragment_exit,
|
||||
R.anim.fragment_enter_pop,
|
||||
R.anim.fragment_exit_pop
|
||||
) else customAnimations(
|
||||
options.enter,
|
||||
options.exit,
|
||||
options.popEnter,
|
||||
options.popExit
|
||||
)
|
||||
}
|
||||
|
||||
}
|
@ -111,7 +111,7 @@ class HomeViewModel(
|
||||
|
||||
stateVersionUpdateMagisk.value = when {
|
||||
info.magisk.isObsolete -> "%s > %s".format(
|
||||
Info.magiskVersionString.clipVersion(),
|
||||
Info.env.magiskVersionString.clipVersion(),
|
||||
info.magisk.version.clipVersion()
|
||||
)
|
||||
else -> ""
|
||||
@ -168,9 +168,9 @@ class HomeViewModel(
|
||||
|
||||
@Suppress("unused")
|
||||
val MagiskJson.isInstalled
|
||||
get() = Info.magiskVersionCode > 0
|
||||
get() = Info.env.magiskVersionCode > 0
|
||||
val MagiskJson.isObsolete
|
||||
get() = Info.magiskVersionCode < versionCode && isInstalled
|
||||
get() = Info.env.magiskVersionCode < versionCode && isInstalled
|
||||
val ManagerJson.isUpdateChannelCorrect
|
||||
get() = versionCode > 0
|
||||
val ManagerJson.isObsolete
|
||||
|
15
app/src/main/res/anim/fragment_enter.xml
Normal file
15
app/src/main/res/anim/fragment_enter.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<alpha
|
||||
android:duration="@android:integer/config_shortAnimTime"
|
||||
android:fromAlpha="0"
|
||||
android:toAlpha="1" />
|
||||
<scale
|
||||
android:duration="@android:integer/config_shortAnimTime"
|
||||
android:fromXScale="0.9"
|
||||
android:fromYScale="0.9"
|
||||
android:pivotX="50%p"
|
||||
android:pivotY="50%p"
|
||||
android:toXScale="1"
|
||||
android:toYScale="1" />
|
||||
</set>
|
15
app/src/main/res/anim/fragment_enter_pop.xml
Normal file
15
app/src/main/res/anim/fragment_enter_pop.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<alpha
|
||||
android:duration="@android:integer/config_shortAnimTime"
|
||||
android:fromAlpha="0"
|
||||
android:toAlpha="1" />
|
||||
<scale
|
||||
android:duration="@android:integer/config_shortAnimTime"
|
||||
android:fromXScale="1.1"
|
||||
android:fromYScale="1.1"
|
||||
android:pivotX="50%p"
|
||||
android:pivotY="50%p"
|
||||
android:toXScale="1"
|
||||
android:toYScale="1" />
|
||||
</set>
|
15
app/src/main/res/anim/fragment_exit.xml
Normal file
15
app/src/main/res/anim/fragment_exit.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<alpha
|
||||
android:duration="@android:integer/config_shortAnimTime"
|
||||
android:fromAlpha="1"
|
||||
android:toAlpha="0" />
|
||||
<scale
|
||||
android:duration="@android:integer/config_shortAnimTime"
|
||||
android:fromXScale="1"
|
||||
android:fromYScale="1"
|
||||
android:pivotX="50%p"
|
||||
android:pivotY="50%p"
|
||||
android:toXScale="1.1"
|
||||
android:toYScale="1.1" />
|
||||
</set>
|
15
app/src/main/res/anim/fragment_exit_pop.xml
Normal file
15
app/src/main/res/anim/fragment_exit_pop.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<alpha
|
||||
android:duration="@android:integer/config_shortAnimTime"
|
||||
android:fromAlpha="1"
|
||||
android:toAlpha="0" />
|
||||
<scale
|
||||
android:duration="@android:integer/config_shortAnimTime"
|
||||
android:fromXScale="1"
|
||||
android:fromYScale="1"
|
||||
android:pivotX="50%p"
|
||||
android:pivotY="50%p"
|
||||
android:toXScale="0.9"
|
||||
android:toYScale="0.9" />
|
||||
</set>
|
@ -42,24 +42,6 @@
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<!--<com.google.android.material.card.MaterialCardView
|
||||
style="?styleCardElevated"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/main_toolbar_wrapper"
|
||||
android:layout_marginStart="@dimen/l1"
|
||||
android:layout_marginEnd="@dimen/l1">
|
||||
|
||||
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="3dp"
|
||||
android:layout_gravity="start|bottom"
|
||||
android:background="@drawable/bg_accent" />
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>-->
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/main_bottom_bar"
|
||||
style="?styleCardElevated"
|
||||
|
@ -250,7 +250,7 @@
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/home_magisk_wrapper"
|
||||
style="?styleCardVariant"
|
||||
isEnabled="@{Info.magiskVersionCode >= 0}"
|
||||
isEnabled="@{Info.env.magiskVersionCode >= 0}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/l1"
|
||||
@ -355,7 +355,7 @@
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/home_magisk_extra_version_value"
|
||||
style="@style/W.Home.Extra.Value"
|
||||
android:text="@{Info.magiskVersionString}"
|
||||
android:text="@{Info.env.magiskVersionString}"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/home_magisk_extra_version_title"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/home_magisk_extra_version_title"
|
||||
@ -372,7 +372,7 @@
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/home_magisk_extra_code_value"
|
||||
style="@style/W.Home.Extra.Value"
|
||||
android:text="@{Integer.toString(Info.magiskVersionCode)}"
|
||||
android:text="@{Integer.toString(Info.env.magiskVersionCode)}"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/home_magisk_extra_code_title"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/home_magisk_extra_code_title"
|
||||
@ -416,7 +416,7 @@
|
||||
tools:text="Normal" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
gone="@{Info.magiskVersionCode < 0}"
|
||||
gone="@{Info.env.magiskVersionCode < 0}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:constraint_referenced_ids="home_magisk_extra_version_title,home_magisk_extra_version_value,home_magisk_extra_code_title,home_magisk_extra_code_value,home_magisk_extra_mode_title,home_magisk_extra_mode_value,home_magisk_extra_connection_title,home_magisk_extra_connection_value" />
|
||||
@ -613,7 +613,7 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/home_manager_extra_code_title" />
|
||||
|
||||
<!--todo(diareuse) Info.isRunningAsStub ? @string/home_extra_mode_stub : @string/home_extra_mode_normal-->
|
||||
<!--todo(diareuse) Info.env.isRunningAsStub ? @string/home_extra_mode_stub : @string/home_extra_mode_normal-->
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/home_manager_extra_mode_value"
|
||||
|
@ -77,7 +77,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/l_50"
|
||||
android:text="@{Info.magiskVersionString}"
|
||||
android:text="@{Info.env.magiskVersionString}"
|
||||
android:textAppearance="?appearanceTextCaptionNormal"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/safetynet_magisk_title"
|
||||
|
@ -2,7 +2,6 @@
|
||||
<resources>
|
||||
|
||||
<string name="manager">Manager</string>
|
||||
<string name="magisk">Magisk</string>
|
||||
<string name="system">System</string>
|
||||
|
||||
<string name="yes">Yes</string>
|
||||
|
Loading…
Reference in New Issue
Block a user