From 373092af16ae3a08e4acd0ed23cbec7072a724c0 Mon Sep 17 00:00:00 2001 From: Viktor De Pasquale Date: Fri, 31 Jan 2020 19:37:45 +0100 Subject: [PATCH] Updated homepage layout The updated layout has extended features such as reboot (not implemented yet), more details with not text ellipsis and easy extendability with further parameters, detail or whatever More improvements to homescreen to come in upcoming commits. --- .../java/com/topjohnwu/magisk/core/Info.kt | 1 + .../topjohnwu/magisk/ui/home/HomeViewModel.kt | 26 +- app/src/main/res/layout/fragment_home_md2.xml | 672 +----------------- .../main/res/layout/include_home_device.xml | 246 +++++++ .../main/res/layout/include_home_magisk.xml | 308 ++++++++ .../main/res/layout/include_home_manager.xml | 337 +++++++++ .../main/res/layout/item_developer_link.xml | 23 +- app/src/main/res/values/strings.xml | 10 + app/src/main/res/values/styles_view_md2.xml | 58 ++ 9 files changed, 998 insertions(+), 683 deletions(-) create mode 100644 app/src/main/res/layout/include_home_device.xml create mode 100644 app/src/main/res/layout/include_home_magisk.xml create mode 100644 app/src/main/res/layout/include_home_manager.xml diff --git a/app/src/main/java/com/topjohnwu/magisk/core/Info.kt b/app/src/main/java/com/topjohnwu/magisk/core/Info.kt index c4a9c7061..7b28983e7 100644 --- a/app/src/main/java/com/topjohnwu/magisk/core/Info.kt +++ b/app/src/main/java/com/topjohnwu/magisk/core/Info.kt @@ -21,6 +21,7 @@ object Info { @JvmStatic val env by envRef // Local var remote = UpdateInfo() // Remote + @JvmStatic var stub: DynAPK.Data? = null // Stub @JvmStatic diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt index 1fd23463a..e06e63274 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt @@ -41,6 +41,11 @@ class HomeViewModel( val stateMagisk = KObservableField(MagiskState.LOADING) val stateManager = KObservableField(MagiskState.LOADING) + val stateVersionMagisk = KObservableField("") + val stateCodeMagisk = KObservableField(0) + val stateVersionManager = KObservableField("") + val stateCodeManager = KObservableField(0) + val stateCodeStub = KObservableField(0) val stateTextMagisk = Observer(stateMagisk) { when (stateMagisk.value) { MagiskState.NOT_INSTALLED -> R.string.installed_error.res() @@ -59,8 +64,6 @@ class HomeViewModel( } val statePackageManager = packageName val statePackageOriginal = statePackageManager == BuildConfig.APPLICATION_ID - val stateVersionUpdateMagisk = KObservableField("") - val stateVersionUpdateManager = KObservableField("") val stateMagiskProgress = KObservableField(0) val stateManagerProgress = KObservableField(0) @@ -110,21 +113,12 @@ class HomeViewModel( else -> MagiskState.UP_TO_DATE } - stateVersionUpdateMagisk.value = when { - info.magisk.isObsolete -> "%s > %s".format( - Info.env.magiskVersionString.clipVersion(info.magisk.version), - info.magisk.version.clipVersion(Info.env.magiskVersionString) - ) - else -> "" - } + stateVersionMagisk.value = info.magisk.version + stateVersionManager.value = info.app.version - stateVersionUpdateManager.value = when { - info.app.isObsolete -> "%s > %s".format( - BuildConfig.VERSION_NAME.clipVersion(info.app.version), - info.app.version.clipVersion(BuildConfig.VERSION_NAME) - ) - else -> "" - } + stateCodeMagisk.value = info.magisk.versionCode + stateCodeManager.value = info.app.versionCode + stateCodeStub.value = info.stub.versionCode ensureEnv() } diff --git a/app/src/main/res/layout/fragment_home_md2.xml b/app/src/main/res/layout/fragment_home_md2.xml index ae16d4c06..7baf550ab 100644 --- a/app/src/main/res/layout/fragment_home_md2.xml +++ b/app/src/main/res/layout/fragment_home_md2.xml @@ -5,22 +5,6 @@ - - - - - - - - - - - - - - - - @@ -83,641 +67,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + app:layout_constraintTop_toTopOf="parent" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/include_home_magisk.xml b/app/src/main/res/layout/include_home_magisk.xml new file mode 100644 index 000000000..665136729 --- /dev/null +++ b/app/src/main/res/layout/include_home_magisk.xml @@ -0,0 +1,308 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/include_home_manager.xml b/app/src/main/res/layout/include_home_manager.xml new file mode 100644 index 000000000..e06839c3d --- /dev/null +++ b/app/src/main/res/layout/include_home_manager.xml @@ -0,0 +1,337 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_developer_link.xml b/app/src/main/res/layout/item_developer_link.xml index 41c6cee0a..09c66dba1 100644 --- a/app/src/main/res/layout/item_developer_link.xml +++ b/app/src/main/res/layout/item_developer_link.xml @@ -15,10 +15,11 @@ - @@ -26,25 +27,11 @@ - - - + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e0e2cbd0f..c00bbcb01 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -28,6 +28,12 @@ Source Magisk is, and always will be, free and open-source. You can however show us that you care by sending a small donation. + Your device + Info + Manufacturer + Model + Board + Security System A/B @@ -45,6 +51,10 @@ Normal Safe Dynamic + Stub + N/A + + Details Invalid Update Channel SafetyNet API Error diff --git a/app/src/main/res/values/styles_view_md2.xml b/app/src/main/res/values/styles_view_md2.xml index 040e369e6..585552bd2 100644 --- a/app/src/main/res/values/styles_view_md2.xml +++ b/app/src/main/res/values/styles_view_md2.xml @@ -7,8 +7,10 @@ + + + + + + + + + + + + + + + + + + +