Commit 373092af authored by Viktor De Pasquale's avatar Viktor De Pasquale Committed by John Wu

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.
parent 1a2e157c
...@@ -21,6 +21,7 @@ object Info { ...@@ -21,6 +21,7 @@ object Info {
@JvmStatic @JvmStatic
val env by envRef // Local val env by envRef // Local
var remote = UpdateInfo() // Remote var remote = UpdateInfo() // Remote
@JvmStatic
var stub: DynAPK.Data? = null // Stub var stub: DynAPK.Data? = null // Stub
@JvmStatic @JvmStatic
......
...@@ -41,6 +41,11 @@ class HomeViewModel( ...@@ -41,6 +41,11 @@ class HomeViewModel(
val stateMagisk = KObservableField(MagiskState.LOADING) val stateMagisk = KObservableField(MagiskState.LOADING)
val stateManager = 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) { val stateTextMagisk = Observer(stateMagisk) {
when (stateMagisk.value) { when (stateMagisk.value) {
MagiskState.NOT_INSTALLED -> R.string.installed_error.res() MagiskState.NOT_INSTALLED -> R.string.installed_error.res()
...@@ -59,8 +64,6 @@ class HomeViewModel( ...@@ -59,8 +64,6 @@ class HomeViewModel(
} }
val statePackageManager = packageName val statePackageManager = packageName
val statePackageOriginal = statePackageManager == BuildConfig.APPLICATION_ID val statePackageOriginal = statePackageManager == BuildConfig.APPLICATION_ID
val stateVersionUpdateMagisk = KObservableField("")
val stateVersionUpdateManager = KObservableField("")
val stateMagiskProgress = KObservableField(0) val stateMagiskProgress = KObservableField(0)
val stateManagerProgress = KObservableField(0) val stateManagerProgress = KObservableField(0)
...@@ -110,21 +113,12 @@ class HomeViewModel( ...@@ -110,21 +113,12 @@ class HomeViewModel(
else -> MagiskState.UP_TO_DATE else -> MagiskState.UP_TO_DATE
} }
stateVersionUpdateMagisk.value = when { stateVersionMagisk.value = info.magisk.version
info.magisk.isObsolete -> "%s > %s".format( stateVersionManager.value = info.app.version
Info.env.magiskVersionString.clipVersion(info.magisk.version),
info.magisk.version.clipVersion(Info.env.magiskVersionString)
)
else -> ""
}
stateVersionUpdateManager.value = when { stateCodeMagisk.value = info.magisk.versionCode
info.app.isObsolete -> "%s > %s".format( stateCodeManager.value = info.app.versionCode
BuildConfig.VERSION_NAME.clipVersion(info.app.version), stateCodeStub.value = info.stub.versionCode
info.app.version.clipVersion(BuildConfig.VERSION_NAME)
)
else -> ""
}
ensureEnv() ensureEnv()
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -15,10 +15,11 @@ ...@@ -15,10 +15,11 @@
</data> </data>
<androidx.constraintlayout.widget.ConstraintLayout <FrameLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?selectableItemBackground" android:background="?selectableItemBackgroundBorderless"
android:minWidth="60dp"
android:onClick="@{() -> viewModel.onLinkPressed(item.link)}" android:onClick="@{() -> viewModel.onLinkPressed(item.link)}"
android:padding="@dimen/l_50" android:padding="@dimen/l_50"
tools:layout_gravity="center"> tools:layout_gravity="center">
...@@ -26,25 +27,11 @@ ...@@ -26,25 +27,11 @@
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/developer_link" android:id="@+id/developer_link"
style="@style/WidgetFoundation.Image.Small" style="@style/WidgetFoundation.Image.Small"
app:layout_constraintEnd_toStartOf="@+id/developer_more" android:layout_gravity="center"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:srcCompat="@{item.icon}" app:srcCompat="@{item.icon}"
app:tint="?colorOnPrimary" app:tint="?colorOnPrimary"
tools:srcCompat="@drawable/ic_paypal" /> tools:srcCompat="@drawable/ic_paypal" />
<androidx.appcompat.widget.AppCompatImageView </FrameLayout>
android:id="@+id/developer_more"
style="@style/WidgetFoundation.Image.Small"
android:layout_height="14sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="@+id/developer_link"
app:layout_constraintStart_toEndOf="@+id/developer_link"
app:layout_constraintTop_toTopOf="@+id/developer_link"
app:srcCompat="@drawable/ic_more"
app:tint="?colorOnPrimary" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout> </layout>
...@@ -28,6 +28,12 @@ ...@@ -28,6 +28,12 @@
<string name="home_item_source">Source</string> <string name="home_item_source">Source</string>
<string name="home_support_content">Magisk is, and always will be, free and open-source. You can however show us that you care by sending a small donation.</string> <string name="home_support_content">Magisk is, and always will be, free and open-source. You can however show us that you care by sending a small donation.</string>
<string name="home_device_title">Your device</string>
<string name="home_device_info_title">Info</string>
<string name="home_device_extra_manufacturer">Manufacturer</string>
<string name="home_device_extra_model">Model</string>
<string name="home_device_extra_board">Board</string>
<string name="home_device_security">Security</string> <string name="home_device_security">Security</string>
<string name="home_device_system">System</string> <string name="home_device_system">System</string>
<string name="home_device_build_style">A/B</string> <string name="home_device_build_style">A/B</string>
...@@ -45,6 +51,10 @@ ...@@ -45,6 +51,10 @@
<string name="home_extra_mode_normal">Normal</string> <string name="home_extra_mode_normal">Normal</string>
<string name="home_extra_mode_safe">Safe</string> <string name="home_extra_mode_safe">Safe</string>
<string name="home_extra_mode_stub">Dynamic</string> <string name="home_extra_mode_stub">Dynamic</string>
<string name="home_extra_stub">Stub</string>
<string name="home_extra_stub_na">N/A</string>
<string name="home_details_title">Details</string>
<string name="invalid_update_channel">Invalid Update Channel</string> <string name="invalid_update_channel">Invalid Update Channel</string>
<string name="safetyNet_api_error">SafetyNet API Error</string> <string name="safetyNet_api_error">SafetyNet API Error</string>
......
...@@ -7,8 +7,10 @@ ...@@ -7,8 +7,10 @@
<style name="W.Home" /> <style name="W.Home" />
<!--remove-->
<style name="W.Home.Extra" /> <style name="W.Home.Extra" />
<!--remove-->
<style name="W.Home.Extra.Title"> <style name="W.Home.Extra.Title">
<item name="android:layout_width">wrap_content</item> <item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item> <item name="android:layout_height">wrap_content</item>
...@@ -16,6 +18,7 @@ ...@@ -16,6 +18,7 @@
<item name="android:singleLine">true</item> <item name="android:singleLine">true</item>
</style> </style>
<!--remove-->
<style name="W.Home.Extra.Value"> <style name="W.Home.Extra.Value">
<item name="android:layout_width">wrap_content</item> <item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item> <item name="android:layout_height">wrap_content</item>
...@@ -28,6 +31,61 @@ ...@@ -28,6 +31,61 @@
<item name="android:singleLine">true</item> <item name="android:singleLine">true</item>
</style> </style>
<style name="W.Home.Card" parent="WidgetFoundation.Card">
<item name="android:layout_marginStart">@dimen/l1</item>
<item name="android:focusable">true</item>
</style>
<style name="W.Home.Card.First">
<item name="android:layout_marginStart">0dp</item>
</style>
<style name="W.Home.Title">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:paddingStart">@dimen/l1</item>
<item name="android:paddingEnd">@dimen/l1</item>
<item name="android:textAppearance">@style/AppearanceFoundation.Body</item>
<item name="android:textStyle">bold</item>
<item name="android:paddingTop">@dimen/l_50</item>
<item name="android:paddingBottom">@dimen/l_50</item>
</style>
<style name="W.Home.Section">
<item name="android:layout_width">0dp</item>
<item name="android:layout_height">0dp</item>
<item name="android:background">?colorSurface</item>
<item name="android:alpha">.5</item>
</style>
<style name="W.Home.Item">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:orientation">horizontal</item>
<item name="android:paddingStart">@dimen/l1</item>
<item name="android:paddingEnd">@dimen/l1</item>
</style>
<style name="W.Home.Item.Top">
<item name="android:paddingTop">@dimen/l_75</item>
</style>
<style name="W.Home.Item.Bottom">
<item name="android:paddingBottom">@dimen/l_75</item>
</style>
<style name="W.Home.ItemContent">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:includeFontPadding">false</item>
<item name="android:textAppearance">@style/AppearanceFoundation.Caption</item>
</style>
<style name="W.Home.ItemContent.Right">
<item name="android:layout_marginStart">@dimen/l_50</item>
<item name="android:textStyle">bold</item>
</style>
<!--endregion--> <!--endregion-->
<!--region Themes--> <!--region Themes-->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment