Magisk/app/src/main/res/layout/fragment_home_md2.xml

508 lines
30 KiB
XML
Raw Normal View History

2019-10-03 15:31:45 +00:00
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data>
<import type="com.topjohnwu.magisk.R" />
<import type="com.topjohnwu.magisk.Info" />
<import type="com.topjohnwu.magisk.BuildConfig" />
<import type="com.topjohnwu.magisk.ui.home.MagiskState" />
2019-10-03 15:31:45 +00:00
<variable
name="viewModel"
type="com.topjohnwu.magisk.redesign.home.HomeViewModel" />
</data>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:paddingTop="@{viewModel.insets.top + (int) @dimen/internal_action_bar_size}"
android:paddingBottom="@{viewModel.insets.bottom + (int) @dimen/l2}"
2019-10-03 15:31:45 +00:00
tools:layout_marginTop="24dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:orientation="vertical">
2019-10-03 15:31:45 +00:00
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:paddingTop="@dimen/l1">
2019-10-03 15:31:45 +00:00
2019-10-12 14:10:44 +00:00
<com.google.android.material.card.MaterialCardView
2019-10-03 15:31:45 +00:00
android:id="@+id/home_magisk_wrapper"
2019-10-12 14:10:44 +00:00
style="?styleCardVariant"
android:layout_width="0dp"
2019-10-03 15:31:45 +00:00
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/l1"
2019-10-12 14:10:44 +00:00
android:maxWidth="200dp"
android:onClick="@{() -> viewModel.toggle(viewModel.stateMagiskExpanded)}"
2019-10-12 14:10:44 +00:00
app:layout_constrainedWidth="true"
2019-10-03 15:31:45 +00:00
app:layout_constraintEnd_toStartOf="@+id/home_manager_wrapper"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="match_parent"
2019-10-03 15:31:45 +00:00
android:layout_height="wrap_content"
android:orientation="vertical">
2019-10-03 15:31:45 +00:00
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
2019-10-12 14:10:44 +00:00
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:background="@drawable/bg_card"
android:paddingStart="@dimen/l_50"
android:paddingTop="@dimen/l1"
android:paddingEnd="@dimen/l1"
android:paddingBottom="@dimen/l1"
app:layout_constraintEnd_toStartOf="@+id/home_manager_wrapper"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/home_magisk_icon"
style="?styleIconPrimary"
isEnabled="@{viewModel.stateMagisk != MagiskState.LOADING}"
onSelectClick="@{() -> viewModel.onDeletePressed()}"
onSelectReset="@{7000L}"
android:padding="@dimen/l_25"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_magisk_delete"
app:tint="@color/color_primary_error_transient" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/home_magisk_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/l_50"
android:gravity="start|center_vertical"
android:text="@string/magisk"
android:textAppearance="?appearanceTextTitleNormal"
app:layout_constrainedWidth="true"
app:layout_constraintBottom_toTopOf="@+id/home_magisk_status"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/home_magisk_icon"
app:layout_constraintTop_toTopOf="@+id/home_magisk_icon"
app:layout_constraintVertical_chainStyle="packed" />
<TextSwitcher
android:id="@+id/home_magisk_status"
gone="@{viewModel.stateTextMagisk.empty}"
textCaptionVariant="@{viewModel.stateTextMagisk}"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constrainedWidth="true"
app:layout_constraintBottom_toTopOf="@+id/home_magisk_version"
app:layout_constraintEnd_toEndOf="@+id/home_magisk_title"
app:layout_constraintStart_toStartOf="@+id/home_magisk_title"
app:layout_constraintTop_toBottomOf="@+id/home_magisk_title" />
<TextSwitcher
android:id="@+id/home_magisk_version"
gone="@{viewModel.stateVersionUpdateMagisk.empty}"
textCaptionVariant="@{viewModel.stateVersionUpdateMagisk}"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constrainedWidth="true"
app:layout_constraintBottom_toBottomOf="@+id/home_magisk_icon"
app:layout_constraintEnd_toEndOf="@+id/home_magisk_title"
app:layout_constraintStart_toStartOf="@+id/home_magisk_title"
app:layout_constraintTop_toBottomOf="@+id/home_magisk_status" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
goneUnless="@{viewModel.stateMagiskExpanded}"
android:layout_width="match_parent"
2019-10-12 14:10:44 +00:00
android:layout_height="wrap_content"
android:clipToPadding="false"
android:paddingStart="@dimen/l1"
android:paddingEnd="@dimen/l1"
android:paddingBottom="@dimen/l1"
android:visibility="gone"
tools:visibility="visible">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/home_magisk_extra_version_title"
style="@style/W.Home.Extra.Title"
android:layout_marginTop="@dimen/l1"
android:text="@string/home_extra_version"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/home_magisk_extra_version_value"
style="@style/W.Home.Extra.Value"
android:text="@{Info.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"
app:layout_constraintTop_toTopOf="@+id/home_magisk_extra_version_title"
tools:text="20.1" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/home_magisk_extra_code_title"
style="@style/W.Home.Extra.Title"
android:text="@string/home_extra_code"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/home_magisk_extra_version_title" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/home_magisk_extra_code_value"
style="@style/W.Home.Extra.Value"
android:text="@{Integer.toString(Info.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"
app:layout_constraintTop_toTopOf="@+id/home_magisk_extra_code_title"
tools:text="12345" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/home_magisk_extra_mode_title"
style="@style/W.Home.Extra.Title"
android:text="@string/home_extra_mode"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/home_magisk_extra_code_title" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/home_magisk_extra_mode_value"
style="@style/W.Home.Extra.Value"
app:layout_constraintBottom_toBottomOf="@+id/home_magisk_extra_mode_title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/home_magisk_extra_mode_title"
app:layout_constraintTop_toTopOf="@+id/home_magisk_extra_mode_title"
tools:text="Normal" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/home_magisk_extra_connection_title"
style="@style/W.Home.Extra.Title"
android:text="@string/home_extra_connection"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/home_magisk_extra_mode_title" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/home_magisk_extra_connection_value"
style="@style/W.Home.Extra.Value"
app:layout_constraintBottom_toBottomOf="@+id/home_magisk_extra_connection_title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/home_magisk_extra_connection_title"
app:layout_constraintTop_toTopOf="@+id/home_magisk_extra_connection_title"
tools:text="Normal" />
<androidx.constraintlayout.widget.Group
gone="@{Info.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" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
<ProgressBar
style="?styleProgressDeterminate"
gone="@{viewModel.stateMagiskProgress == 0 || viewModel.stateMagiskProgress == 100}"
android:layout_width="match_parent"
android:layout_gravity="bottom"
android:max="100"
android:progress="@{viewModel.stateMagiskProgress}" />
2019-10-12 14:10:44 +00:00
</com.google.android.material.card.MaterialCardView>
<FrameLayout
gone="@{viewModel.stateMagisk == MagiskState.LOADING || !viewModel.isConnected}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/l_50"
android:animateLayoutChanges="true"
app:layout_constraintEnd_toEndOf="@+id/home_magisk_wrapper"
app:layout_constraintHorizontal_bias="1"
app:layout_constraintStart_toStartOf="@+id/home_magisk_wrapper"
app:layout_constraintTop_toBottomOf="@+id/home_magisk_wrapper">
<com.google.android.material.button.MaterialButton
style="?styleButtonDefault"
gone="@{viewModel.stateMagisk != MagiskState.OBSOLETE}"
isEnabled="@{viewModel.stateManager == MagiskState.UP_TO_DATE &amp;&amp; (viewModel.stateMagiskProgress == 0 || viewModel.stateMagiskProgress == 100)}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:onClick="@{() -> viewModel.onMagiskPressed()}"
android:text="@string/update"
app:icon="@drawable/ic_update_md2"
app:iconGravity="textEnd"
app:iconPadding="@dimen/l_50"
app:iconSize="18dp"
tools:visibility="gone" />
<com.google.android.material.button.MaterialButton
style="?styleButtonText"
gone="@{viewModel.stateMagisk == MagiskState.OBSOLETE}"
isEnabled="@{viewModel.stateManager == MagiskState.UP_TO_DATE &amp;&amp; (viewModel.stateMagiskProgress == 0 || viewModel.stateMagiskProgress == 100)}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:onClick="@{() -> viewModel.onMagiskPressed()}"
android:text="@string/install"
app:icon="@drawable/ic_install"
app:iconGravity="textEnd"
app:iconPadding="@dimen/l_50"
app:iconSize="18dp" />
</FrameLayout>
2019-10-12 14:10:44 +00:00
<com.google.android.material.card.MaterialCardView
2019-10-03 15:31:45 +00:00
android:id="@+id/home_manager_wrapper"
2019-10-12 14:10:44 +00:00
style="?styleCardVariant"
android:layout_width="0dp"
2019-10-03 15:31:45 +00:00
android:layout_height="wrap_content"
android:onClick="@{() -> viewModel.toggle(viewModel.stateManagerExpanded)}"
2019-10-03 15:31:45 +00:00
android:layout_marginStart="@dimen/l1"
android:layout_marginEnd="@dimen/l1"
2019-10-12 14:10:44 +00:00
android:maxWidth="200dp"
app:layout_constrainedWidth="true"
2019-10-03 15:31:45 +00:00
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/home_magisk_wrapper"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="match_parent"
2019-10-03 15:31:45 +00:00
android:layout_height="wrap_content"
android:orientation="vertical">
2019-10-03 15:31:45 +00:00
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
2019-10-03 15:31:45 +00:00
android:layout_height="wrap_content"
android:background="@drawable/bg_card"
android:paddingStart="@dimen/l_50"
android:paddingTop="@dimen/l1"
android:paddingEnd="@dimen/l1"
android:paddingBottom="@dimen/l1"
2019-10-12 14:10:44 +00:00
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/home_magisk_wrapper"
app:layout_constraintTop_toTopOf="parent">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/home_manager_icon"
style="?styleIconPrimary"
android:background="@null"
android:padding="@dimen/l_50"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_manager" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/home_manager_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/l_50"
android:gravity="start|center_vertical"
android:text="@{viewModel.stateHideManagerName}"
android:textAppearance="?appearanceTextTitleNormal"
app:layout_constrainedWidth="true"
app:layout_constraintBottom_toTopOf="@+id/home_manager_status"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/home_manager_icon"
app:layout_constraintTop_toTopOf="@+id/home_manager_icon"
app:layout_constraintVertical_chainStyle="packed"
tools:text="@string/manager" />
<TextSwitcher
android:id="@+id/home_manager_status"
gone="@{viewModel.stateTextManager.empty}"
textCaptionVariant="@{viewModel.stateTextManager}"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constrainedWidth="true"
app:layout_constraintBottom_toTopOf="@+id/home_manager_version"
app:layout_constraintEnd_toEndOf="@+id/home_manager_title"
app:layout_constraintStart_toStartOf="@+id/home_manager_title"
app:layout_constraintTop_toBottomOf="@+id/home_manager_title" />
<TextSwitcher
android:id="@+id/home_manager_version"
gone="@{viewModel.stateVersionUpdateManager.empty}"
textCaptionVariant="@{viewModel.stateVersionUpdateManager}"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constrainedWidth="true"
app:layout_constraintBottom_toBottomOf="@+id/home_manager_icon"
app:layout_constraintEnd_toEndOf="@+id/home_manager_title"
app:layout_constraintStart_toStartOf="@+id/home_manager_title"
app:layout_constraintTop_toBottomOf="@+id/home_manager_status" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
goneUnless="@{viewModel.stateManagerExpanded}"
android:layout_width="match_parent"
2019-10-12 14:10:44 +00:00
android:layout_height="wrap_content"
android:clipToPadding="false"
android:paddingStart="@dimen/l1"
android:paddingEnd="@dimen/l1"
android:paddingBottom="@dimen/l1"
android:visibility="gone"
tools:visibility="visible">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/home_manager_extra_version_title"
style="@style/W.Home.Extra.Title"
android:layout_marginTop="@dimen/l1"
android:text="@string/home_extra_version"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/home_manager_extra_version_value"
style="@style/W.Home.Extra.Value"
android:text="@{BuildConfig.VERSION_NAME}"
app:layout_constraintBottom_toBottomOf="@+id/home_manager_extra_version_title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/home_manager_extra_version_title"
app:layout_constraintTop_toTopOf="@+id/home_manager_extra_version_title"
tools:text="8.0.0" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/home_manager_extra_code_title"
style="@style/W.Home.Extra.Title"
android:text="@string/home_extra_code"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/home_manager_extra_version_title" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/home_manager_extra_code_value"
style="@style/W.Home.Extra.Value"
android:text="@{Integer.toString(BuildConfig.VERSION_CODE)}"
app:layout_constraintBottom_toBottomOf="@+id/home_manager_extra_code_title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/home_manager_extra_code_title"
app:layout_constraintTop_toTopOf="@+id/home_manager_extra_code_title"
tools:text="12345" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/home_manager_extra_mode_title"
style="@style/W.Home.Extra.Title"
android:text="@string/home_extra_mode"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/home_manager_extra_code_title" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/home_manager_extra_mode_value"
style="@style/W.Home.Extra.Value"
app:layout_constraintBottom_toBottomOf="@+id/home_manager_extra_mode_title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/home_manager_extra_mode_title"
app:layout_constraintTop_toTopOf="@+id/home_manager_extra_mode_title"
tools:text="@string/home_extra_mode_stub" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/home_manager_extra_package_title"
style="@style/W.Home.Extra.Title"
android:text="@string/home_extra_package"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/home_manager_extra_mode_title" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/home_manager_extra_package_value"
style="@style/W.Home.Extra.Value"
android:text="@{viewModel.statePackageManager}"
app:layout_constraintBottom_toBottomOf="@+id/home_manager_extra_package_title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/home_manager_extra_package_title"
app:layout_constraintTop_toTopOf="@+id/home_manager_extra_package_title"
tools:text="com.soqspa.xmclaeixl" />
<androidx.constraintlayout.widget.Group
gone="@{viewModel.statePackageOriginal}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:constraint_referenced_ids="home_manager_extra_package_title,home_manager_extra_package_value" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
2019-10-03 15:31:45 +00:00
<ProgressBar
style="?styleProgressDeterminate"
gone="@{viewModel.stateManagerProgress == 0 || viewModel.stateManagerProgress == 100}"
android:layout_width="match_parent"
android:layout_gravity="bottom"
android:max="100"
android:progress="@{viewModel.stateManagerProgress}" />
2019-10-03 15:31:45 +00:00
</com.google.android.material.card.MaterialCardView>
2019-10-03 15:31:45 +00:00
<FrameLayout
gone="@{viewModel.stateManager == MagiskState.LOADING || !viewModel.isConnected}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/l_50"
app:layout_constraintEnd_toEndOf="@+id/home_manager_wrapper"
app:layout_constraintHorizontal_bias="1"
app:layout_constraintStart_toStartOf="@+id/home_manager_wrapper"
app:layout_constraintTop_toBottomOf="@+id/home_manager_wrapper">
<com.google.android.material.button.MaterialButton
style="?styleButtonDefault"
gone="@{viewModel.stateManager != MagiskState.OBSOLETE}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:onClick="@{() -> viewModel.onManagerPressed()}"
android:text="@string/update"
app:icon="@drawable/ic_update_md2"
app:iconGravity="textEnd"
app:iconPadding="@dimen/l_50"
app:iconSize="18dp" />
<com.google.android.material.button.MaterialButton
style="?styleButtonText"
gone="@{viewModel.stateManager == MagiskState.OBSOLETE}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:onClick="@{() -> viewModel.onManagerPressed()}"
android:text="@string/install"
app:icon="@drawable/ic_install"
app:iconGravity="textEnd"
app:iconPadding="@dimen/l_50"
app:iconSize="18dp"
tools:visibility="gone" />
</FrameLayout>
2019-10-12 14:10:44 +00:00
</androidx.constraintlayout.widget.ConstraintLayout>
2019-10-03 15:31:45 +00:00
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/home_support_list"
dividerHorizontal="@{R.drawable.divider_l1}"
itemBinding="@{viewModel.itemDeveloperBinding}"
items="@{viewModel.items}"
2019-10-03 15:31:45 +00:00
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/l1"
android:clipToPadding="false"
android:orientation="horizontal"
android:paddingStart="@dimen/l1"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/item_developer" />
2019-10-03 15:31:45 +00:00
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</layout>