mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-22 16:07:39 +00:00
Don't do layered cards
This commit is contained in:
parent
0ce7da1bf6
commit
b90e0430f8
@ -31,6 +31,8 @@ class HomeFragment : BaseUIFragment<HomeViewModel, FragmentHomeMd2Binding>() {
|
||||
// Set barrier reference IDs in code, since resource IDs will be stripped in release mode
|
||||
binding.homeMagiskWrapper.homeMagiskTitleBarrier.referencedIds =
|
||||
intArrayOf(R.id.home_magisk_action, R.id.home_magisk_title, R.id.home_magisk_icon)
|
||||
binding.homeMagiskWrapper.homeMagiskBarrier.referencedIds =
|
||||
intArrayOf(R.id.home_magisk_latest_version, R.id.home_magisk_installed_version, R.id.home_magisk_mode)
|
||||
binding.homeManagerWrapper.homeManagerTitleBarrier.referencedIds =
|
||||
intArrayOf(R.id.home_manager_action, R.id.home_manager_title, R.id.home_manager_icon)
|
||||
|
||||
|
@ -13,7 +13,6 @@ import com.topjohnwu.magisk.core.model.ManagerJson
|
||||
import com.topjohnwu.magisk.core.model.UpdateInfo
|
||||
import com.topjohnwu.magisk.data.repository.MagiskRepository
|
||||
import com.topjohnwu.magisk.extensions.*
|
||||
import com.topjohnwu.magisk.model.entity.internal.DownloadSubject.Magisk
|
||||
import com.topjohnwu.magisk.model.entity.internal.DownloadSubject.Manager
|
||||
import com.topjohnwu.magisk.model.entity.recycler.DeveloperItem
|
||||
import com.topjohnwu.magisk.model.entity.recycler.HomeItem
|
||||
@ -48,7 +47,6 @@ class HomeViewModel(
|
||||
val stateMagiskInstalledVersion get() =
|
||||
"${Info.env.magiskVersionString} (${Info.env.magiskVersionCode})"
|
||||
val stateMagiskMode get() = (if (Config.coreOnly) R.string.home_status_safe else R.string.home_status_normal).res()
|
||||
val stateMagiskProgress = KObservableField(0)
|
||||
|
||||
val stateManagerRemoteVersion = KObservableField(R.string.loading.res())
|
||||
val stateManagerInstalledVersion = Info.stub?.let {
|
||||
@ -70,8 +68,6 @@ class HomeViewModel(
|
||||
init {
|
||||
RemoteFileService.progressBroadcast.observeForever {
|
||||
when (it?.second) {
|
||||
is Magisk.Download,
|
||||
is Magisk.Flash -> stateMagiskProgress.value = it.first.times(100f).roundToInt()
|
||||
is Manager -> stateManagerProgress.value = it.first.times(100f).roundToInt()
|
||||
}
|
||||
}
|
||||
|
@ -76,7 +76,6 @@
|
||||
<com.google.android.material.button.MaterialButton
|
||||
style="@style/WidgetFoundation.Button"
|
||||
gone="@{viewModel.stateMagisk != MagiskState.OBSOLETE}"
|
||||
isEnabled="@{viewModel.stateManager == MagiskState.UP_TO_DATE && (viewModel.stateMagiskProgress == 0 || viewModel.stateMagiskProgress == 100)}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="@{() -> viewModel.onMagiskPressed()}"
|
||||
@ -87,7 +86,6 @@
|
||||
<com.google.android.material.button.MaterialButton
|
||||
style="@style/WidgetFoundation.Button.Text"
|
||||
gone="@{viewModel.stateMagisk == MagiskState.OBSOLETE}"
|
||||
isEnabled="@{viewModel.stateManager == MagiskState.UP_TO_DATE && (viewModel.stateMagiskProgress == 0 || viewModel.stateMagiskProgress == 100)}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="@{() -> viewModel.onMagiskPressed()}"
|
||||
@ -102,7 +100,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:barrierDirection="bottom"
|
||||
app:constraint_referenced_ids="home_magisk_action,home_magisk_title,home_magisk_icon" />
|
||||
tools:constraint_referenced_ids="home_magisk_action,home_magisk_title,home_magisk_icon" />
|
||||
|
||||
<HorizontalScrollView
|
||||
android:layout_width="match_parent"
|
||||
@ -118,155 +116,120 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
style="@style/W.Home.Card.First"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content" >
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<View
|
||||
style="@style/W.Home.Section"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/home_magisk_latest_version"
|
||||
style="@style/W.Home.Item.Top"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" >
|
||||
|
||||
<TextView
|
||||
style="@style/W.Home.ItemContent"
|
||||
android:text="@string/module_section_remote" />
|
||||
|
||||
<TextView
|
||||
style="@style/W.Home.ItemContent.Right"
|
||||
android:text="@{viewModel.isConnected ? viewModel.stateMagiskRemoteVersion : @string/not_available}"
|
||||
tools:text="20.1 (12345)" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/home_magisk_installed_version"
|
||||
style="@style/W.Home.Item"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/home_magisk_latest_version">
|
||||
|
||||
<TextView
|
||||
style="@style/W.Home.ItemContent"
|
||||
android:text="@string/installed" />
|
||||
|
||||
<TextView
|
||||
style="@style/W.Home.ItemContent.Right"
|
||||
android:text="@{Info.env.isActive ? viewModel.stateMagiskInstalledVersion : @string/not_available}"
|
||||
tools:text="20.1 (12345)" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/home_magisk_mode"
|
||||
style="@style/W.Home.Item.Bottom"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/home_magisk_installed_version">
|
||||
|
||||
<TextView
|
||||
style="@style/W.Home.ItemContent"
|
||||
android:text="@string/status" />
|
||||
|
||||
<TextView
|
||||
style="@style/W.Home.ItemContent.Right"
|
||||
android:text="@{Info.env.isActive ? viewModel.stateMagiskMode : @string/not_available}"
|
||||
tools:text="Normal" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<ProgressBar
|
||||
style="@style/WidgetFoundation.ProgressBar"
|
||||
gone="@{viewModel.stateMagiskProgress == 0 || viewModel.stateMagiskProgress == 100}"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_gravity="bottom"
|
||||
android:max="100"
|
||||
android:progress="@{viewModel.stateMagiskProgress}" />
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
style="@style/W.Home.Card"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
<LinearLayout
|
||||
android:id="@+id/home_magisk_latest_version"
|
||||
style="@style/W.Home.Item.Top"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" >
|
||||
|
||||
<TextView
|
||||
style="@style/W.Home.ItemContent"
|
||||
android:text="@string/module_section_remote" />
|
||||
|
||||
<TextView
|
||||
style="@style/W.Home.ItemContent.Right"
|
||||
android:text="@{viewModel.isConnected ? viewModel.stateMagiskRemoteVersion : @string/not_available}"
|
||||
tools:text="20.1 (12345)" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/home_magisk_installed_version"
|
||||
style="@style/W.Home.Item"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/home_magisk_latest_version">
|
||||
|
||||
<TextView
|
||||
style="@style/W.Home.ItemContent"
|
||||
android:text="@string/installed" />
|
||||
|
||||
<TextView
|
||||
style="@style/W.Home.ItemContent.Right"
|
||||
android:text="@{Info.env.isActive ? viewModel.stateMagiskInstalledVersion : @string/not_available}"
|
||||
tools:text="20.1 (12345)" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/home_magisk_mode"
|
||||
style="@style/W.Home.Item.Bottom"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/home_magisk_installed_version">
|
||||
|
||||
<TextView
|
||||
style="@style/W.Home.ItemContent"
|
||||
android:text="@string/status" />
|
||||
|
||||
<TextView
|
||||
style="@style/W.Home.ItemContent.Right"
|
||||
android:text="@{Info.env.isActive ? viewModel.stateMagiskMode : @string/not_available}"
|
||||
tools:text="Normal" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.Barrier
|
||||
android:id="@+id/home_magisk_barrier"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
app:barrierDirection="end"
|
||||
tools:constraint_referenced_ids="home_magisk_latest_version,home_magisk_installed_version,home_magisk_mode"/>
|
||||
|
||||
<View
|
||||
style="@style/W.Home.Section"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
<LinearLayout
|
||||
android:id="@+id/home_device_details_ab"
|
||||
style="@style/W.Home.Item.Top"
|
||||
app:layout_constraintStart_toStartOf="@id/home_magisk_barrier"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/home_device_details_ab"
|
||||
style="@style/W.Home.Item.Top"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
<TextView
|
||||
style="@style/W.Home.ItemContent"
|
||||
android:text="A/B" />
|
||||
|
||||
<TextView
|
||||
style="@style/W.Home.ItemContent"
|
||||
android:text="A/B" />
|
||||
<TextView
|
||||
style="@style/W.Home.ItemContent.Right"
|
||||
android:text="@{Info.isAB ? @string/yes : @string/no}"
|
||||
tools:text="Yes" />
|
||||
|
||||
<TextView
|
||||
style="@style/W.Home.ItemContent.Right"
|
||||
android:text="@{Info.isAB ? @string/yes : @string/no}"
|
||||
tools:text="Yes" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/home_device_details_sar"
|
||||
style="@style/W.Home.Item"
|
||||
app:layout_constraintStart_toStartOf="@+id/home_device_details_ab"
|
||||
app:layout_constraintTop_toBottomOf="@+id/home_device_details_ab">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/home_device_details_sar"
|
||||
style="@style/W.Home.Item"
|
||||
app:layout_constraintStart_toStartOf="@+id/home_device_details_ab"
|
||||
app:layout_constraintTop_toBottomOf="@+id/home_device_details_ab">
|
||||
<TextView
|
||||
style="@style/W.Home.ItemContent"
|
||||
android:text="SAR" />
|
||||
|
||||
<TextView
|
||||
style="@style/W.Home.ItemContent"
|
||||
android:text="SAR" />
|
||||
<TextView
|
||||
style="@style/W.Home.ItemContent.Right"
|
||||
android:text="@{Info.isSAR ? @string/yes : @string/no}"
|
||||
tools:text="Yes" />
|
||||
|
||||
<TextView
|
||||
style="@style/W.Home.ItemContent.Right"
|
||||
android:text="@{Info.isSAR ? @string/yes : @string/no}"
|
||||
tools:text="Yes" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/home_device_details_recovery"
|
||||
style="@style/W.Home.Item.Bottom"
|
||||
app:layout_constraintStart_toStartOf="@+id/home_device_details_sar"
|
||||
app:layout_constraintTop_toBottomOf="@+id/home_device_details_sar">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/home_device_details_recovery"
|
||||
style="@style/W.Home.Item.Bottom"
|
||||
app:layout_constraintStart_toStartOf="@+id/home_device_details_sar"
|
||||
app:layout_constraintTop_toBottomOf="@+id/home_device_details_sar">
|
||||
<TextView
|
||||
style="@style/W.Home.ItemContent"
|
||||
android:text="Ramdisk" />
|
||||
|
||||
<TextView
|
||||
style="@style/W.Home.ItemContent"
|
||||
android:text="Ramdisk" />
|
||||
<TextView
|
||||
style="@style/W.Home.ItemContent.Right"
|
||||
android:text="@{Info.ramdisk ? @string/yes : @string/no }"
|
||||
tools:text="Yes" />
|
||||
|
||||
<TextView
|
||||
style="@style/W.Home.ItemContent.Right"
|
||||
android:text="@{Info.ramdisk ? @string/yes : @string/no }"
|
||||
tools:text="Yes" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -89,7 +89,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:barrierDirection="bottom"
|
||||
app:constraint_referenced_ids="home_manager_action,home_manager_title,home_manager_icon" />
|
||||
tools:constraint_referenced_ids="home_manager_action,home_manager_title,home_manager_icon" />
|
||||
|
||||
<HorizontalScrollView
|
||||
android:layout_width="match_parent"
|
||||
@ -103,104 +103,90 @@
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
style="@style/W.Home.Card.First"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
<LinearLayout
|
||||
android:id="@+id/home_manager_latest_version"
|
||||
style="@style/W.Home.Item.Top"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" >
|
||||
|
||||
<View
|
||||
style="@style/W.Home.Section"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
<TextView
|
||||
style="@style/W.Home.ItemContent"
|
||||
android:text="@string/module_section_remote" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/home_manager_latest_version"
|
||||
style="@style/W.Home.Item.Top"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" >
|
||||
<TextView
|
||||
style="@style/W.Home.ItemContent.Right"
|
||||
android:text="@{viewModel.isConnected ? viewModel.stateManagerRemoteVersion : @string/not_available}"
|
||||
tools:text="8.0.0 (123) (10)" />
|
||||
|
||||
<TextView
|
||||
style="@style/W.Home.ItemContent"
|
||||
android:text="@string/module_section_remote" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
style="@style/W.Home.ItemContent.Right"
|
||||
android:text="@{viewModel.isConnected ? viewModel.stateManagerRemoteVersion : @string/not_available}"
|
||||
tools:text="8.0.0 (123) (10)" />
|
||||
<LinearLayout
|
||||
android:id="@+id/home_manager_installed_version"
|
||||
style="@style/W.Home.Item"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/home_manager_latest_version">
|
||||
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
style="@style/W.Home.ItemContent"
|
||||
android:text="@string/installed" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/home_manager_installed_version"
|
||||
style="@style/W.Home.Item"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/home_manager_latest_version">
|
||||
<TextView
|
||||
style="@style/W.Home.ItemContent.Right"
|
||||
android:text="@{viewModel.stateManagerInstalledVersion}"
|
||||
tools:text="8.0.0 (123) (10)" />
|
||||
|
||||
<TextView
|
||||
style="@style/W.Home.ItemContent"
|
||||
android:text="@string/installed" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
style="@style/W.Home.ItemContent.Right"
|
||||
android:text="@{viewModel.stateManagerInstalledVersion}"
|
||||
tools:text="8.0.0 (123) (10)" />
|
||||
<LinearLayout
|
||||
android:id="@+id/home_manager_internal_mode"
|
||||
style="@style/W.Home.Item"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/home_manager_installed_version">
|
||||
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
style="@style/W.Home.ItemContent"
|
||||
android:text="@string/status" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/home_manager_internal_mode"
|
||||
style="@style/W.Home.Item"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/home_manager_installed_version">
|
||||
<TextView
|
||||
style="@style/W.Home.ItemContent.Right"
|
||||
android:text="@{InfoKt.isRunningAsStub ? @string/home_status_stub : @string/home_status_normal}"
|
||||
tools:text="Normal" />
|
||||
|
||||
<TextView
|
||||
style="@style/W.Home.ItemContent"
|
||||
android:text="@string/status" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
style="@style/W.Home.ItemContent.Right"
|
||||
android:text="@{InfoKt.isRunningAsStub ? @string/home_status_stub : @string/home_status_normal}"
|
||||
tools:text="Normal" />
|
||||
<LinearLayout
|
||||
android:id="@+id/home_manager_internal_connection"
|
||||
style="@style/W.Home.Item.Bottom"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/home_manager_internal_mode">
|
||||
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
style="@style/W.Home.ItemContent"
|
||||
android:text="@string/home_package" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/home_manager_internal_connection"
|
||||
style="@style/W.Home.Item.Bottom"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/home_manager_internal_mode">
|
||||
<TextView
|
||||
android:id="@+id/home_manager_extra_connection_value"
|
||||
style="@style/W.Home.ItemContent.Right"
|
||||
android:text="@{viewModel.statePackageName}"
|
||||
tools:text="com.topjohnwu.magisk" />
|
||||
|
||||
<TextView
|
||||
style="@style/W.Home.ItemContent"
|
||||
android:text="@string/home_package" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/home_manager_extra_connection_value"
|
||||
style="@style/W.Home.ItemContent.Right"
|
||||
android:text="@{viewModel.statePackageName}"
|
||||
tools:text="com.topjohnwu.magisk" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<ProgressBar
|
||||
style="@style/WidgetFoundation.ProgressBar"
|
||||
gone="@{viewModel.stateManagerProgress == 0 || viewModel.stateManagerProgress == 100}"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_gravity="bottom"
|
||||
android:max="100"
|
||||
android:progress="@{viewModel.stateManagerProgress}" />
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
<ProgressBar
|
||||
style="@style/WidgetFoundation.ProgressBar"
|
||||
gone="@{viewModel.stateManagerProgress == 0 || viewModel.stateManagerProgress == 100}"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_gravity="bottom"
|
||||
android:max="100"
|
||||
android:progress="@{viewModel.stateManagerProgress}" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user