Added hiding of UI elements when no root access is detected
This commit is contained in:
parent
36e83edddc
commit
b2fa5b551e
@ -66,6 +66,8 @@ class HomeViewModel(
|
||||
""
|
||||
}
|
||||
|
||||
val hasRoot = KObservableField(false)
|
||||
|
||||
private var shownDialog = false
|
||||
private val current = resources.getString(R.string.current_installed)
|
||||
private val latest = resources.getString(R.string.latest_version)
|
||||
@ -110,6 +112,8 @@ class HomeViewModel(
|
||||
Config.remoteMagiskVersionString = null
|
||||
Config.remoteMagiskVersionCode = -1
|
||||
|
||||
hasRoot.value = Shell.rootAccess()
|
||||
|
||||
if (Networking.checkNetworkStatus(app)) {
|
||||
CheckUpdates.check()
|
||||
} else {
|
||||
|
@ -5,7 +5,6 @@ import com.topjohnwu.magisk.BuildConfig
|
||||
import com.topjohnwu.magisk.Config
|
||||
import com.topjohnwu.magisk.R
|
||||
import com.topjohnwu.magisk.model.events.*
|
||||
import com.topjohnwu.magisk.utils.Event
|
||||
import com.topjohnwu.magisk.view.MarkDownWindow
|
||||
import com.topjohnwu.magisk.view.dialogs.EnvFixDialog
|
||||
import com.topjohnwu.magisk.view.dialogs.ManagerInstallDialog
|
||||
@ -125,14 +124,6 @@ class MagiskFragment : NewMagiskFragment<HomeViewModel, com.topjohnwu.magisk.dat
|
||||
}*/
|
||||
}
|
||||
|
||||
private fun getListeningEvents(): IntArray {
|
||||
return intArrayOf(Event.UPDATE_CHECK_DONE)
|
||||
}
|
||||
|
||||
private fun onEvent(event: Int) {
|
||||
updateCheckUI()
|
||||
}
|
||||
|
||||
private fun updateUI() {
|
||||
/*(requireActivity() as MainActivity).checkHideSection()
|
||||
val image: Int
|
||||
|
@ -103,10 +103,12 @@
|
||||
|
||||
<View
|
||||
style="@style/Widget.Divider.Horizontal"
|
||||
gone="@{!viewModel.hasRoot}"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_margin="@dimen/margin_generic" />
|
||||
|
||||
<LinearLayout
|
||||
gone="@{!viewModel.hasRoot}"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:animateLayoutChanges="true"
|
||||
@ -184,10 +186,12 @@
|
||||
|
||||
<View
|
||||
style="@style/Widget.Divider.Horizontal"
|
||||
gone="@{!viewModel.hasRoot}"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_margin="@dimen/margin_generic" />
|
||||
|
||||
<LinearLayout
|
||||
gone="@{!viewModel.hasRoot}"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
@ -460,11 +464,13 @@
|
||||
|
||||
<View
|
||||
style="@style/Widget.Divider.Horizontal"
|
||||
gone="@{!viewModel.hasRoot}"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_margin="@dimen/margin_generic" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
style="@style/Widget.Button.Text"
|
||||
gone="@{!viewModel.hasRoot}"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="@{() -> viewModel.uninstallPressed()}"
|
||||
|
Loading…
Reference in New Issue
Block a user