mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-26 19:45:26 +00:00
bd00ae8ede
Exported old update card to special xml include where binding takes care of everything that had to be done in code beforehand. Added several easing functions and enums. Backported some classes and functions from the old fork Expect major breakage. Literally nothing works as the functionality needs to be implemented
161 lines
6.7 KiB
XML
161 lines
6.7 KiB
XML
<?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.ui.home.MagiskState" />
|
|
|
|
<import type="com.topjohnwu.magisk.R" />
|
|
|
|
<variable
|
|
name="item"
|
|
type="com.topjohnwu.magisk.ui.home.MagiskItem" />
|
|
|
|
<variable
|
|
name="state"
|
|
type="com.topjohnwu.magisk.ui.home.MagiskState" />
|
|
|
|
<variable
|
|
name="text"
|
|
type="String" />
|
|
|
|
<variable
|
|
name="currentVersion"
|
|
type="String" />
|
|
|
|
<variable
|
|
name="latestVersion"
|
|
type="String" />
|
|
|
|
<variable
|
|
name="additionalInfo"
|
|
type="String" />
|
|
|
|
<variable
|
|
name="viewModel"
|
|
type="com.topjohnwu.magisk.ui.home.HomeViewModel" />
|
|
|
|
</data>
|
|
|
|
<androidx.cardview.widget.CardView
|
|
style="?attr/cardStyle"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:layout_marginStart="5dp"
|
|
android:layout_marginTop="4dp"
|
|
android:layout_marginEnd="5dp"
|
|
android:layout_marginBottom="4dp"
|
|
android:foreground="?android:attr/selectableItemBackground"
|
|
android:onClick="@{() -> viewModel.cardPressed(item)}"
|
|
app:cardCornerRadius="@dimen/card_corner_radius"
|
|
app:cardElevation="@dimen/card_elevation">
|
|
|
|
<androidx.constraintlayout.widget.ConstraintLayout
|
|
android:layout_width="match_parent"
|
|
android:layout_height="match_parent"
|
|
android:paddingTop="12dp"
|
|
android:paddingBottom="12dp">
|
|
|
|
<androidx.appcompat.widget.AppCompatButton
|
|
android:id="@+id/install"
|
|
gone="@{state == MagiskState.LOADING}"
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
android:layout_marginEnd="8dp"
|
|
android:onClick="@{() -> viewModel.installPressed(item)}"
|
|
android:text="@{state != MagiskState.OBSOLETE ? @string/install : @string/update}"
|
|
app:layout_constraintBottom_toBottomOf="parent"
|
|
app:layout_constraintEnd_toEndOf="parent"
|
|
app:layout_constraintTop_toTopOf="parent"
|
|
tools:text="@string/install" />
|
|
|
|
<androidx.appcompat.widget.AppCompatImageView
|
|
android:id="@+id/status_icon"
|
|
invisible="@{state == MagiskState.LOADING}"
|
|
srcCompat="@{state == MagiskState.UP_TO_DATE ? R.drawable.ic_check_circle : (state == MagiskState.OBSOLETE ? R.drawable.ic_update : R.drawable.ic_help)}"
|
|
android:layout_width="25dp"
|
|
android:layout_height="25dp"
|
|
android:layout_marginStart="16dp"
|
|
android:layout_marginEnd="16dp"
|
|
app:layout_constraintBottom_toBottomOf="parent"
|
|
app:layout_constraintEnd_toStartOf="@+id/status"
|
|
app:layout_constraintStart_toStartOf="parent"
|
|
app:layout_constraintTop_toTopOf="parent" />
|
|
|
|
<ProgressBar
|
|
android:id="@+id/progress"
|
|
gone="state != MagiskState.LOADING"
|
|
android:layout_width="0dp"
|
|
android:layout_height="0dp"
|
|
app:layout_constraintBottom_toBottomOf="@+id/status_icon"
|
|
app:layout_constraintEnd_toEndOf="@+id/status_icon"
|
|
app:layout_constraintStart_toStartOf="@+id/status_icon"
|
|
app:layout_constraintTop_toTopOf="@+id/status_icon" />
|
|
|
|
<androidx.appcompat.widget.AppCompatTextView
|
|
android:id="@+id/current_version"
|
|
android:layout_width="0dp"
|
|
android:layout_height="wrap_content"
|
|
android:maxLines="1"
|
|
android:text="@{state != MagiskState.LOADING ? currentVersion : @string/checking_for_updates}"
|
|
app:autoSizeMinTextSize="1sp"
|
|
app:autoSizeTextType="uniform"
|
|
app:layout_constraintEnd_toEndOf="@+id/status"
|
|
app:layout_constraintStart_toStartOf="@+id/status"
|
|
app:layout_constraintTop_toBottomOf="@+id/status"
|
|
tools:text="@string/checking_for_updates" />
|
|
|
|
<androidx.appcompat.widget.AppCompatTextView
|
|
android:id="@+id/latest_version"
|
|
gone="@{currentVersion == latestVersion}"
|
|
android:layout_width="0dp"
|
|
android:layout_height="wrap_content"
|
|
android:maxLines="1"
|
|
android:text="@{state != MagiskState.LOADING ? latestVersion : @string/checking_for_updates}"
|
|
app:autoSizeMinTextSize="1sp"
|
|
app:autoSizeTextType="uniform"
|
|
app:layout_constraintEnd_toEndOf="@+id/status"
|
|
app:layout_constraintStart_toStartOf="@+id/status"
|
|
app:layout_constraintTop_toBottomOf="@+id/current_version"
|
|
tools:text="@string/checking_for_updates" />
|
|
|
|
<androidx.appcompat.widget.AppCompatTextView
|
|
android:id="@+id/additional"
|
|
gone="@{additionalInfo.length == 0}"
|
|
android:layout_width="0dp"
|
|
android:layout_height="wrap_content"
|
|
android:maxLines="1"
|
|
android:text="@{additionalInfo}"
|
|
app:autoSizeMinTextSize="1sp"
|
|
app:autoSizeTextType="uniform"
|
|
app:layout_constraintEnd_toEndOf="@+id/status"
|
|
app:layout_constraintStart_toStartOf="@+id/status"
|
|
app:layout_constraintTop_toBottomOf="@+id/latest_version"
|
|
tools:text="@string/checking_for_updates" />
|
|
|
|
<androidx.appcompat.widget.AppCompatTextView
|
|
android:id="@+id/status"
|
|
android:layout_width="0dp"
|
|
android:layout_height="wrap_content"
|
|
android:layout_marginEnd="8dp"
|
|
android:maxLines="1"
|
|
android:paddingTop="3dp"
|
|
android:paddingBottom="3dp"
|
|
android:text="@{text}"
|
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
|
app:autoSizeMinTextSize="1sp"
|
|
app:autoSizeTextType="uniform"
|
|
app:layout_constraintEnd_toStartOf="@+id/install"
|
|
app:layout_constraintStart_toEndOf="@+id/status_icon"
|
|
app:layout_constraintTop_toTopOf="parent"
|
|
tools:text="Magisk is up to date" />
|
|
|
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
|
|
</androidx.cardview.widget.CardView>
|
|
|
|
|
|
</layout>
|