Added post-merge fixes

This commit is contained in:
Viktor De Pasquale 2019-10-29 16:52:42 +01:00
parent 7d6eebdae3
commit 93c422dce6
20 changed files with 102 additions and 50 deletions

View File

@ -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'

View File

@ -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) {
@ -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() }

View File

@ -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)
}

View File

@ -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()

View File

@ -42,7 +42,7 @@ class EnvFixDialog : DialogEvent() {
}
}
.applyButton(MagiskDialog.ButtonType.NEGATIVE) {
titleRes = R.string.no_thanks
titleRes = android.R.string.no
}
.let { Unit }

View File

@ -95,7 +95,7 @@ class MagiskInstallDialog : DialogEvent() {
}
}
.applyButton(MagiskDialog.ButtonType.NEGATIVE) {
titleRes = R.string.no_thanks
titleRes = android.R.string.no
}
}

View File

@ -17,7 +17,7 @@ class SuperuserRevokeDialog(
onClick { callbacks.listenerOnSuccess() }
}
.applyButton(MagiskDialog.ButtonType.NEGATIVE) {
titleRes = R.string.no_thanks
titleRes = android.R.string.no
}
}

View File

@ -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,

View File

@ -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)
}
})

View File

@ -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)
}
})

View File

@ -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
)
}
}

View File

@ -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

View 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>

View 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>

View 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>

View 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>

View File

@ -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"

View File

@ -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 &lt; 0}"
gone="@{Info.env.magiskVersionCode &lt; 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"

View File

@ -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"

View File

@ -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>