Added more information to magisk/manager cards

This commit is contained in:
Viktor De Pasquale 2019-10-26 17:33:27 +02:00
parent d0b817381e
commit a41597431c
4 changed files with 345 additions and 139 deletions

View File

@ -60,6 +60,9 @@ class HomeViewModel(
val stateMagiskProgress = KObservableField(0) val stateMagiskProgress = KObservableField(0)
val stateManagerProgress = KObservableField(0) val stateManagerProgress = KObservableField(0)
val stateMagiskExpanded = KObservableField(false)
val stateManagerExpanded = KObservableField(false)
val stateHideManagerName = R.string.manager.res().let { val stateHideManagerName = R.string.manager.res().let {
if (!statePackageOriginal) { if (!statePackageOriginal) {
it.replaceRandomWithSpecial(3) it.replaceRandomWithSpecial(3)
@ -137,6 +140,8 @@ class HomeViewModel(
.subscribeK { Navigation.install().publish() } .subscribeK { Navigation.install().publish() }
.add() .add()
fun toggle(kof: KObservableField<Boolean>) = kof.toggle()
private fun ensureEnv() { private fun ensureEnv() {
val invalidStates = listOf( val invalidStates = listOf(
MagiskState.NOT_INSTALLED, MagiskState.NOT_INSTALLED,

View File

@ -46,11 +46,17 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/l1" android:layout_marginStart="@dimen/l1"
android:maxWidth="200dp" android:maxWidth="200dp"
android:onClick="@{() -> viewModel.toggle(viewModel.stateMagiskExpanded)}"
app:layout_constrainedWidth="true" app:layout_constrainedWidth="true"
app:layout_constraintEnd_toStartOf="@+id/home_manager_wrapper" app:layout_constraintEnd_toStartOf="@+id/home_manager_wrapper"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -118,6 +124,94 @@
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
goneUnless="@{viewModel.stateMagiskExpanded}"
android:layout_width="match_parent"
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 <ProgressBar
style="?styleProgressDeterminate" style="?styleProgressDeterminate"
gone="@{viewModel.stateMagiskProgress == 0 || viewModel.stateMagiskProgress == 100}" gone="@{viewModel.stateMagiskProgress == 0 || viewModel.stateMagiskProgress == 100}"
@ -175,6 +269,7 @@
style="?styleCardVariant" style="?styleCardVariant"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:onClick="@{() -> viewModel.toggle(viewModel.stateManagerExpanded)}"
android:layout_marginStart="@dimen/l1" android:layout_marginStart="@dimen/l1"
android:layout_marginEnd="@dimen/l1" android:layout_marginEnd="@dimen/l1"
android:maxWidth="200dp" android:maxWidth="200dp"
@ -183,6 +278,11 @@
app:layout_constraintStart_toEndOf="@+id/home_magisk_wrapper" app:layout_constraintStart_toEndOf="@+id/home_magisk_wrapper"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -198,6 +298,7 @@
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/home_manager_icon" android:id="@+id/home_manager_icon"
style="?styleIconPrimary" style="?styleIconPrimary"
android:background="@null"
android:padding="@dimen/l_50" android:padding="@dimen/l_50"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@ -246,6 +347,95 @@
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
goneUnless="@{viewModel.stateManagerExpanded}"
android:layout_width="match_parent"
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>
<ProgressBar <ProgressBar
style="?styleProgressDeterminate" style="?styleProgressDeterminate"
gone="@{viewModel.stateManagerProgress == 0 || viewModel.stateManagerProgress == 100}" gone="@{viewModel.stateManagerProgress == 0 || viewModel.stateManagerProgress == 100}"
@ -304,41 +494,13 @@
items="@{viewModel.items}" items="@{viewModel.items}"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/l2" android:layout_marginTop="@dimen/l1"
android:clipToPadding="false" android:clipToPadding="false"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingStart="@dimen/l1" android:paddingStart="@dimen/l1"
android:paddingEnd="@dimen/l1"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/item_developer" /> tools:listitem="@layout/item_developer" />
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/l2"
android:gravity="center"
android:text="@{String.format(`%s (%s)`, BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE)}"
android:textAppearance="?appearanceTextCaptionVariant"
tools:text="7.3.4 (12345)" />
<androidx.appcompat.widget.AppCompatTextView
gone="@{Info.magiskVersionCode &lt; 0}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@{String.format(`%s (%s)`, Info.magiskVersionString, Info.magiskVersionCode)}"
android:textAppearance="?appearanceTextCaptionVariant"
tools:text="19.5 (12345)" />
<androidx.appcompat.widget.AppCompatTextView
gone="@{viewModel.statePackageOriginal}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@{viewModel.statePackageManager}"
android:textAppearance="?appearanceTextCaptionVariant"
tools:text="com.soqspa.xmclaeixl" />
</LinearLayout> </LinearLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>

View File

@ -28,6 +28,16 @@
<string name="home_item_source">Source</string> <string name="home_item_source">Source</string>
<string name="home_item_xda">XDA</string> <string name="home_item_xda">XDA</string>
<string name="home_extra_version">Version</string>
<string name="home_extra_code">Code</string>
<string name="home_extra_mode">Mode</string>
<string name="home_extra_connection">Connection</string>
<string name="home_extra_package">Package</string>
<string name="home_extra_mode_normal">Normal</string>
<string name="home_extra_mode_safe">Safe</string>
<string name="home_extra_mode_stub">Dynamic</string>
<string name="safetyNet">SafetyNet</string> <string name="safetyNet">SafetyNet</string>
<!--ref. Magisk Hide--> <!--ref. Magisk Hide-->
<string name="magisk_hide_md2">Hide</string> <string name="magisk_hide_md2">Hide</string>

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="W" parent="Widget" />
<style name="W.Home" />
<style name="W.Home.Extra" />
<style name="W.Home.Extra.Title">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textAppearance">?appearanceTextCaptionVariant</item>
<item name="android:singleLine">true</item>
</style>
<style name="W.Home.Extra.Value">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textAppearance">?appearanceTextCaptionNormal</item>
<item name="android:textStyle">bold</item>
<item name="android:layout_marginStart">@dimen/l_50</item>
<item name="layout_constrainedWidth">true</item>
<item name="layout_constraintHorizontal_bias">0</item>
<item name="android:ellipsize">middle</item>
<item name="android:singleLine">true</item>
</style>
</resources>