mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-24 02:25:28 +00:00
Added post-merge fixes
This commit is contained in:
parent
6ccbc272c6
commit
974cb1167f
@ -122,6 +122,7 @@ dependencies {
|
||||
|
||||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha03'
|
||||
implementation 'androidx.browser:browser:1.0.0'
|
||||
implementation 'androidx.preference:preference:1.1.0'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.0.0'
|
||||
implementation 'androidx.work:work-runtime:2.2.0'
|
||||
@ -129,4 +130,5 @@ dependencies {
|
||||
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'
|
||||
implementation 'com.karumi:dexter:6.0.0'
|
||||
}
|
||||
|
@ -56,8 +56,7 @@
|
||||
|
||||
<activity
|
||||
android:name="a.i"
|
||||
android:exported="true"
|
||||
android:theme="@style/Foundation.Default" />
|
||||
android:exported="true" />
|
||||
|
||||
<activity-alias
|
||||
android:name="a.s"
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.topjohnwu.magisk.model.entity.recycler
|
||||
|
||||
import com.skoumal.teanity.databinding.ComparableRvItem
|
||||
import com.topjohnwu.magisk.Const
|
||||
import com.topjohnwu.magisk.R
|
||||
import com.topjohnwu.magisk.databinding.ComparableRvItem
|
||||
|
||||
sealed class HomeItem : ComparableRvItem<HomeItem>() {
|
||||
|
||||
|
@ -6,7 +6,6 @@ import android.util.TypedValue
|
||||
import androidx.annotation.AttrRes
|
||||
import androidx.browser.customtabs.CustomTabsIntent
|
||||
import androidx.core.net.toUri
|
||||
import com.skoumal.teanity.viewevents.ViewEvent
|
||||
import com.topjohnwu.magisk.R
|
||||
|
||||
data class OpenInappLinkEvent(
|
||||
|
@ -7,7 +7,6 @@ import com.karumi.dexter.MultiplePermissionsReport
|
||||
import com.karumi.dexter.PermissionToken
|
||||
import com.karumi.dexter.listener.PermissionRequest
|
||||
import com.karumi.dexter.listener.multi.MultiplePermissionsListener
|
||||
import com.skoumal.teanity.viewevents.ViewEvent
|
||||
import com.topjohnwu.magisk.model.entity.module.Repo
|
||||
import com.topjohnwu.magisk.model.permissions.PermissionRequestBuilder
|
||||
import io.reactivex.subjects.PublishSubject
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.topjohnwu.magisk.model.events.dialog
|
||||
|
||||
import android.content.Context
|
||||
import com.skoumal.teanity.viewevents.ViewEvent
|
||||
import com.topjohnwu.magisk.model.events.ContextExecutor
|
||||
import com.topjohnwu.magisk.model.events.ViewEvent
|
||||
import com.topjohnwu.magisk.view.MagiskDialog
|
||||
|
||||
abstract class DialogEvent : ViewEvent(), ContextExecutor {
|
||||
|
@ -5,8 +5,8 @@ import androidx.annotation.AnimRes
|
||||
import androidx.annotation.AnimatorRes
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.topjohnwu.magisk.model.events.ViewEvent
|
||||
import com.topjohnwu.magisk.model.events.ActivityExecutor
|
||||
import com.topjohnwu.magisk.model.events.ViewEvent
|
||||
import com.topjohnwu.magisk.redesign.compat.CompatActivity
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
@ -25,7 +25,7 @@ class MagiskNavigationEvent(
|
||||
|
||||
override fun invoke(activity: AppCompatActivity) {
|
||||
if (activity !is CompatActivity<*, *>) return
|
||||
activity.navigation.navigateTo(this)
|
||||
activity.navigation?.navigateTo(this)
|
||||
}
|
||||
|
||||
@NavigationDslMarker
|
||||
|
@ -14,6 +14,7 @@ import com.topjohnwu.magisk.R
|
||||
import com.topjohnwu.magisk.databinding.ActivityMainMd2Binding
|
||||
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.ui.log.LogFragment
|
||||
import com.topjohnwu.magisk.ui.module.ModulesFragment
|
||||
@ -24,13 +25,14 @@ import com.topjohnwu.superuser.Shell
|
||||
import org.koin.androidx.viewmodel.ext.android.viewModel
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
open class MainActivity : CompatActivity<MainViewModel, ActivityMainMd2Binding>() {
|
||||
open class MainActivity : CompatActivity<MainViewModel, ActivityMainMd2Binding>(),
|
||||
FragNavController.TransactionListener {
|
||||
|
||||
override val layoutRes = R.layout.activity_main_md2
|
||||
override val viewModel by viewModel<MainViewModel>()
|
||||
override val navHostId: Int = R.id.main_nav_host
|
||||
override val navHost: Int = R.id.main_nav_host
|
||||
override val defaultPosition: Int = 0
|
||||
|
||||
override val navigation by lazy { CompatNavigationDelegate(this, this) }
|
||||
|
||||
override val baseFragments: List<KClass<out Fragment>> = listOf(
|
||||
HomeFragment::class,
|
||||
@ -39,6 +41,7 @@ open class MainActivity : CompatActivity<MainViewModel, ActivityMainMd2Binding>(
|
||||
LogFragment::class,
|
||||
SettingsFragment::class
|
||||
)
|
||||
|
||||
//This temporarily fixes unwanted feature of BottomNavigationView - where the view applies
|
||||
//padding on itself given insets are not consumed beforehand. Unfortunately the listener
|
||||
//implementation doesn't favor us against the design library, so on re-create it's often given
|
||||
@ -90,21 +93,15 @@ open class MainActivity : CompatActivity<MainViewModel, ActivityMainMd2Binding>(
|
||||
}
|
||||
|
||||
override fun onTabTransaction(fragment: Fragment?, index: Int) {
|
||||
super.onTabTransaction(fragment, index)
|
||||
|
||||
setDisplayHomeAsUpEnabled(false)
|
||||
}
|
||||
|
||||
override fun onFragmentTransaction(
|
||||
fragment: Fragment?,
|
||||
transactionType: FragNavController.TransactionType
|
||||
) {
|
||||
super.onFragmentTransaction(fragment, transactionType)
|
||||
|
||||
when (transactionType) {
|
||||
FragNavController.TransactionType.PUSH -> setDisplayHomeAsUpEnabled(true)
|
||||
else -> Unit //dunno might be useful
|
||||
}
|
||||
) = when (transactionType) {
|
||||
FragNavController.TransactionType.PUSH -> setDisplayHomeAsUpEnabled(true)
|
||||
else -> Unit //dunno might be useful
|
||||
}
|
||||
|
||||
override fun peekSystemWindowInsets(insets: Insets) {
|
||||
|
@ -3,17 +3,23 @@ package com.topjohnwu.magisk.redesign.compat
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.databinding.ViewDataBinding
|
||||
import com.skoumal.teanity.viewevents.ViewEvent
|
||||
import com.topjohnwu.magisk.ui.base.MagiskActivity
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.topjohnwu.magisk.R
|
||||
import com.topjohnwu.magisk.base.BaseActivity
|
||||
import com.topjohnwu.magisk.model.events.ViewEvent
|
||||
import com.topjohnwu.magisk.model.navigation.MagiskNavigationEvent
|
||||
import com.topjohnwu.magisk.model.navigation.Navigator
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
abstract class CompatActivity<ViewModel : CompatViewModel, Binding : ViewDataBinding> :
|
||||
MagiskActivity<ViewModel, Binding>(), CompatView<ViewModel> {
|
||||
BaseActivity<ViewModel, Binding>(), CompatView<ViewModel>, Navigator {
|
||||
|
||||
override val themeRes = R.style.Foundation_Default
|
||||
override val viewRoot: View get() = binding.root
|
||||
override val navigation: CompatNavigationDelegate<CompatActivity<ViewModel, Binding>>? by lazy {
|
||||
CompatNavigationDelegate(this)
|
||||
}
|
||||
|
||||
override val baseFragments = listOf<KClass<out Fragment>>()
|
||||
private val delegate by lazy { CompatDelegate(this) }
|
||||
|
||||
internal abstract val navHost: Int
|
||||
@ -48,6 +54,9 @@ abstract class CompatActivity<ViewModel : CompatViewModel, Binding : ViewDataBin
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("The event is self handled.")
|
||||
override fun navigateTo(event: MagiskNavigationEvent) = Unit
|
||||
|
||||
protected fun ViewEvent.dispatchOnSelf() = onEventDispatched(this)
|
||||
|
||||
}
|
@ -5,10 +5,10 @@ import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.skoumal.teanity.viewevents.ViewEvent
|
||||
import com.topjohnwu.magisk.model.events.ActivityExecutor
|
||||
import com.topjohnwu.magisk.model.events.ContextExecutor
|
||||
import com.topjohnwu.magisk.model.events.FragmentExecutor
|
||||
import com.topjohnwu.magisk.model.events.ViewEvent
|
||||
import timber.log.Timber
|
||||
|
||||
class CompatDelegate internal constructor(
|
||||
|
@ -3,11 +3,11 @@ package com.topjohnwu.magisk.redesign.compat
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.databinding.ViewDataBinding
|
||||
import com.skoumal.teanity.viewevents.ViewEvent
|
||||
import com.topjohnwu.magisk.ui.base.MagiskFragment
|
||||
import com.topjohnwu.magisk.base.BaseFragment
|
||||
import com.topjohnwu.magisk.model.events.ViewEvent
|
||||
|
||||
abstract class CompatFragment<ViewModel : CompatViewModel, Binding : ViewDataBinding>
|
||||
: MagiskFragment<ViewModel, Binding>(), CompatView<ViewModel> {
|
||||
: BaseFragment<ViewModel, Binding>(), CompatView<ViewModel> {
|
||||
|
||||
override val viewRoot: View get() = binding.root
|
||||
override val navigation by lazy { compatActivity.navigation }
|
||||
|
@ -10,7 +10,7 @@ import com.topjohnwu.magisk.model.navigation.MagiskNavigationEvent
|
||||
import com.topjohnwu.magisk.model.navigation.Navigator
|
||||
import timber.log.Timber
|
||||
|
||||
class CompatNavigationDelegate<Source>(
|
||||
class CompatNavigationDelegate<out Source>(
|
||||
private val source: Source,
|
||||
private val listener: FragNavController.TransactionListener? = null
|
||||
) : FragNavController.RootFragmentListener where Source : CompatActivity<*, *>, Source : Navigator {
|
||||
@ -33,7 +33,7 @@ class CompatNavigationDelegate<Source>(
|
||||
|
||||
|
||||
fun onCreate(savedInstanceState: Bundle?) = controller.run {
|
||||
rootFragmentListener = source
|
||||
rootFragmentListener = this@CompatNavigationDelegate
|
||||
transactionListener = listener
|
||||
initialize(0, savedInstanceState)
|
||||
}
|
||||
|
@ -3,11 +3,11 @@ package com.topjohnwu.magisk.redesign.compat
|
||||
import android.graphics.Insets
|
||||
import androidx.annotation.CallSuper
|
||||
import androidx.databinding.Observable
|
||||
import com.skoumal.teanity.util.KObservableField
|
||||
import com.topjohnwu.magisk.ui.base.MagiskViewModel
|
||||
import com.topjohnwu.magisk.base.viewmodel.BaseViewModel
|
||||
import com.topjohnwu.magisk.utils.KObservableField
|
||||
import io.reactivex.disposables.Disposable
|
||||
|
||||
abstract class CompatViewModel : MagiskViewModel() {
|
||||
abstract class CompatViewModel : BaseViewModel() {
|
||||
|
||||
val insets = KObservableField(Insets.NONE)
|
||||
|
||||
|
@ -1,15 +1,14 @@
|
||||
package com.topjohnwu.magisk.redesign.home
|
||||
|
||||
import com.skoumal.teanity.databinding.ComparableRvItem
|
||||
import com.skoumal.teanity.extensions.subscribeK
|
||||
import com.skoumal.teanity.util.KObservableField
|
||||
import com.topjohnwu.magisk.BuildConfig
|
||||
import com.topjohnwu.magisk.Info
|
||||
import com.topjohnwu.magisk.R
|
||||
import com.topjohnwu.magisk.data.repository.MagiskRepository
|
||||
import com.topjohnwu.magisk.databinding.ComparableRvItem
|
||||
import com.topjohnwu.magisk.extensions.packageName
|
||||
import com.topjohnwu.magisk.extensions.replaceRandomWithSpecial
|
||||
import com.topjohnwu.magisk.extensions.res
|
||||
import com.topjohnwu.magisk.extensions.subscribeK
|
||||
import com.topjohnwu.magisk.model.entity.MagiskJson
|
||||
import com.topjohnwu.magisk.model.entity.ManagerJson
|
||||
import com.topjohnwu.magisk.model.entity.UpdateInfo
|
||||
@ -20,6 +19,7 @@ import com.topjohnwu.magisk.model.events.dialog.ManagerInstallDialog
|
||||
import com.topjohnwu.magisk.model.observer.Observer
|
||||
import com.topjohnwu.magisk.redesign.compat.CompatViewModel
|
||||
import com.topjohnwu.magisk.ui.home.MagiskState
|
||||
import com.topjohnwu.magisk.utils.KObservableField
|
||||
import me.tatarka.bindingcollectionadapter2.BR
|
||||
import me.tatarka.bindingcollectionadapter2.ItemBinding
|
||||
import me.tatarka.bindingcollectionadapter2.OnItemBind
|
||||
|
@ -12,10 +12,10 @@ import androidx.annotation.StringRes
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.databinding.ViewDataBinding
|
||||
import com.skoumal.teanity.util.KObservableField
|
||||
import com.topjohnwu.magisk.BR
|
||||
import com.topjohnwu.magisk.R
|
||||
import com.topjohnwu.magisk.databinding.DialogMagiskBaseBinding
|
||||
import com.topjohnwu.magisk.utils.KObservableField
|
||||
|
||||
class MagiskDialog @JvmOverloads constructor(
|
||||
context: Context, theme: Int = 0
|
||||
|
Loading…
Reference in New Issue
Block a user