mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-02-19 19:08:29 +00:00
Move denylist fragment to its own section
This commit is contained in:
parent
136d8c39d9
commit
fc6b02f607
@ -11,7 +11,6 @@ import android.view.View
|
||||
import android.view.WindowManager
|
||||
import androidx.core.content.pm.ShortcutManagerCompat
|
||||
import androidx.core.view.forEach
|
||||
import androidx.core.view.isGone
|
||||
import androidx.interpolator.view.animation.FastOutLinearInInterpolator
|
||||
import androidx.interpolator.view.animation.LinearOutSlowInInterpolator
|
||||
import androidx.navigation.NavDirections
|
||||
@ -61,6 +60,7 @@ open class MainActivity : BaseUIActivity<MainViewModel, ActivityMainMd2Binding>(
|
||||
R.id.homeFragment,
|
||||
R.id.modulesFragment,
|
||||
R.id.superuserFragment,
|
||||
R.id.hideFragment,
|
||||
R.id.logFragment -> true
|
||||
else -> false
|
||||
}
|
||||
@ -77,11 +77,11 @@ open class MainActivity : BaseUIActivity<MainViewModel, ActivityMainMd2Binding>(
|
||||
|
||||
setSupportActionBar(binding.mainToolbar)
|
||||
|
||||
binding.mainNavigation.setOnNavigationItemSelectedListener {
|
||||
binding.mainNavigation.setOnItemSelectedListener {
|
||||
getScreen(it.itemId)?.navigate()
|
||||
true
|
||||
}
|
||||
binding.mainNavigation.setOnNavigationItemReselectedListener {
|
||||
binding.mainNavigation.setOnItemReselectedListener {
|
||||
(currentFragment as? ReselectionTarget)?.onReselected()
|
||||
}
|
||||
|
||||
@ -183,6 +183,7 @@ open class MainActivity : BaseUIActivity<MainViewModel, ActivityMainMd2Binding>(
|
||||
R.id.modulesFragment -> MainDirections.actionModuleFragment()
|
||||
R.id.superuserFragment -> MainDirections.actionSuperuserFragment()
|
||||
R.id.logFragment -> MainDirections.actionLogFragment()
|
||||
R.id.hideFragment -> MainDirections.actionHideFragment()
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import androidx.lifecycle.viewModelScope
|
||||
import com.topjohnwu.magisk.BR
|
||||
import com.topjohnwu.magisk.R
|
||||
import com.topjohnwu.magisk.arch.BaseViewModel
|
||||
import com.topjohnwu.magisk.core.Config
|
||||
import com.topjohnwu.magisk.core.magiskdb.PolicyDao
|
||||
import com.topjohnwu.magisk.core.model.su.SuPolicy
|
||||
import com.topjohnwu.magisk.core.utils.BiometricHelper
|
||||
@ -19,7 +18,6 @@ import com.topjohnwu.magisk.events.dialog.BiometricEvent
|
||||
import com.topjohnwu.magisk.events.dialog.SuperuserRevokeDialog
|
||||
import com.topjohnwu.magisk.utils.Utils
|
||||
import com.topjohnwu.magisk.utils.asText
|
||||
import com.topjohnwu.magisk.view.TappableHeadlineItem
|
||||
import com.topjohnwu.magisk.view.TextItem
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
@ -28,7 +26,7 @@ import me.tatarka.bindingcollectionadapter2.collections.MergeObservableList
|
||||
|
||||
class SuperuserViewModel(
|
||||
private val db: PolicyDao
|
||||
) : BaseViewModel(), TappableHeadlineItem.Listener {
|
||||
) : BaseViewModel() {
|
||||
|
||||
private val itemNoData = TextItem(R.string.superuser_policy_none)
|
||||
|
||||
@ -36,10 +34,8 @@ class SuperuserViewModel(
|
||||
private val itemsHelpers = ObservableArrayList<TextItem>()
|
||||
|
||||
val adapter = adapterOf<AnyDiffRvItem>()
|
||||
val items = MergeObservableList<AnyDiffRvItem>().apply {
|
||||
if (Config.magiskHide)
|
||||
insertItem(TappableHeadlineItem.Hide)
|
||||
}.insertList(itemsHelpers)
|
||||
val items = MergeObservableList<AnyDiffRvItem>()
|
||||
.insertList(itemsHelpers)
|
||||
.insertList(itemsPolicies)
|
||||
val itemBinding = itemBindingOf<AnyDiffRvItem> {
|
||||
it.bindExtra(BR.listener, this)
|
||||
@ -73,14 +69,6 @@ class SuperuserViewModel(
|
||||
|
||||
// ---
|
||||
|
||||
override fun onItemPressed(item: TappableHeadlineItem) = when (item) {
|
||||
TappableHeadlineItem.Hide -> hidePressed()
|
||||
else -> Unit
|
||||
}
|
||||
|
||||
private fun hidePressed() =
|
||||
SuperuserFragmentDirections.actionSuperuserFragmentToHideFragment().navigate()
|
||||
|
||||
fun deletePressed(item: PolicyRvItem) {
|
||||
fun updateState() = viewModelScope.launch {
|
||||
db.delete(item.item.uid)
|
||||
|
@ -38,7 +38,7 @@
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_marginStart="@dimen/l1"
|
||||
android:layout_marginEnd="@dimen/l1"
|
||||
android:layout_marginBottom="@dimen/l1"
|
||||
android:layout_marginBottom="72dp"
|
||||
app:backgroundTint="?colorSurfaceSurfaceVariant"
|
||||
app:layout_fitsSystemWindowsInsets="bottom"
|
||||
app:srcCompat="@drawable/ic_search_md2"
|
||||
@ -52,6 +52,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:visibility="invisible"
|
||||
app:layout_fitsSystemWindowsInsets="bottom"
|
||||
app:cardCornerRadius="0dp">
|
||||
|
||||
<include
|
||||
|
@ -14,6 +14,12 @@
|
||||
android:title="@string/superuser"
|
||||
tools:showAsAction="always" />
|
||||
|
||||
<item
|
||||
android:id="@+id/hideFragment"
|
||||
android:icon="@drawable/ic_hide_md2"
|
||||
android:title="@string/magiskhide"
|
||||
tools:showAsAction="always" />
|
||||
|
||||
<item
|
||||
android:id="@+id/logFragment"
|
||||
android:icon="@drawable/ic_bug_md2"
|
||||
|
@ -110,17 +110,7 @@
|
||||
android:id="@+id/superuserFragment"
|
||||
android:name="com.topjohnwu.magisk.ui.superuser.SuperuserFragment"
|
||||
android:label="SuperuserFragment"
|
||||
tools:layout="@layout/fragment_superuser_md2">
|
||||
|
||||
<action
|
||||
android:id="@+id/action_superuserFragment_to_hideFragment"
|
||||
app:destination="@id/hideFragment"
|
||||
app:enterAnim="@anim/fragment_enter"
|
||||
app:exitAnim="@anim/fragment_exit"
|
||||
app:popEnterAnim="@anim/fragment_enter_pop"
|
||||
app:popExitAnim="@anim/fragment_exit_pop" />
|
||||
|
||||
</fragment>
|
||||
tools:layout="@layout/fragment_superuser_md2" />
|
||||
|
||||
<fragment
|
||||
android:id="@+id/themeFragment"
|
||||
@ -180,6 +170,7 @@
|
||||
app:enterAnim="@anim/fragment_enter"
|
||||
app:exitAnim="@anim/fragment_exit"
|
||||
app:popEnterAnim="@anim/fragment_enter_pop"
|
||||
app:popExitAnim="@anim/fragment_exit_pop" />
|
||||
app:popExitAnim="@anim/fragment_exit_pop"
|
||||
app:popUpTo="@id/homeFragment"/>
|
||||
|
||||
</navigation>
|
||||
|
Loading…
x
Reference in New Issue
Block a user