Updated design of the front page (with removed cards and added dividers)

Also updated material library and injected backported styles which were incompatible with the current UI for the most part and as it was over-carded all cards were removed and replaced with flat UI components.
This change is temporary and *will* be redone to the final redesign, in other words this is sufficient for the transition period.

All themers should refrain from trying to theme the app until the redesign is done. It will break your efforts with every other release.
This commit is contained in:
Viktor De Pasquale 2019-04-14 11:51:47 +02:00
parent 3101c538e9
commit 861ad9881c
6 changed files with 487 additions and 534 deletions

View File

@ -56,7 +56,7 @@ dependencies {
implementation "androidx.preference:preference:${androidXVersion}" implementation "androidx.preference:preference:${androidXVersion}"
implementation "androidx.recyclerview:recyclerview:${androidXVersion}" implementation "androidx.recyclerview:recyclerview:${androidXVersion}"
implementation "androidx.cardview:cardview:${androidXVersion}" implementation "androidx.cardview:cardview:${androidXVersion}"
implementation "com.google.android.material:material:${androidXVersion}" implementation "com.google.android.material:material:1.1.0-alpha05"
implementation 'androidx.work:work-runtime:2.0.1' implementation 'androidx.work:work-runtime:2.0.1'
implementation 'androidx.transition:transition:1.1.0-beta01' implementation 'androidx.transition:transition:1.1.0-beta01'

View File

@ -11,7 +11,7 @@
<application <application
android:allowBackup="true" android:allowBackup="true"
android:name="a.e" android:name="a.e"
android:theme="@style/AppTheme" android:theme="@style/MagiskTheme"
android:usesCleartextTraffic="true" android:usesCleartextTraffic="true"
tools:ignore="UnusedAttribute,GoogleAppIndexingWarning"> tools:ignore="UnusedAttribute,GoogleAppIndexingWarning">

View File

@ -9,7 +9,12 @@ import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.StringRes;
import androidx.cardview.widget.CardView;
import butterknife.BindColor;
import butterknife.BindView;
import butterknife.OnClick;
import butterknife.Unbinder;
import com.topjohnwu.magisk.App; import com.topjohnwu.magisk.App;
import com.topjohnwu.magisk.Const; import com.topjohnwu.magisk.Const;
import com.topjohnwu.magisk.R; import com.topjohnwu.magisk.R;
@ -17,23 +22,16 @@ import com.topjohnwu.magisk.utils.ISafetyNetHelper;
import com.topjohnwu.magisk.view.dialogs.CustomAlertDialog; import com.topjohnwu.magisk.view.dialogs.CustomAlertDialog;
import com.topjohnwu.net.Networking; import com.topjohnwu.net.Networking;
import com.topjohnwu.superuser.Shell; import com.topjohnwu.superuser.Shell;
import dalvik.system.DexClassLoader;
import java.io.File; import java.io.File;
import androidx.annotation.StringRes;
import androidx.cardview.widget.CardView;
import butterknife.BindColor;
import butterknife.BindView;
import butterknife.OnClick;
import butterknife.Unbinder;
import dalvik.system.DexClassLoader;
public class SafetyNet implements ISafetyNetHelper.Callback { public class SafetyNet implements ISafetyNetHelper.Callback {
private static final File EXT_APK = private static final File EXT_APK =
new File(App.self.getFilesDir().getParent() + "/snet", "snet.apk"); new File(App.self.getFilesDir().getParent() + "/snet", "snet.apk");
@BindView(R.id.safetyNet_card) CardView safetyNetCard; /*@BindView(R.id.safetyNet_card) */ CardView safetyNetCard;
@BindView(R.id.safetyNet_refresh) ImageView safetyNetRefreshIcon; @BindView(R.id.safetyNet_refresh) ImageView safetyNetRefreshIcon;
@BindView(R.id.safetyNet_status) TextView safetyNetStatusText; @BindView(R.id.safetyNet_status) TextView safetyNetStatusText;
@BindView(R.id.safetyNet_check_progress) ProgressBar safetyNetProgress; @BindView(R.id.safetyNet_check_progress) ProgressBar safetyNetProgress;

View File

@ -32,19 +32,8 @@
android:id="@+id/linearLayout" android:id="@+id/linearLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical"
android:padding="@dimen/margin_generic">
<androidx.cardview.widget.CardView
style="?attr/cardStyle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="5dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="4dp"
app:cardCornerRadius="@dimen/card_corner_radius"
app:cardElevation="@dimen/card_elevation">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -82,7 +71,10 @@
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView> <View
style="@style/Widget.Divider.Horizontal"
android:layout_width="match_parent"
android:layout_margin="@dimen/margin_generic" />
<include <include
android:id="@+id/home_magisk_version" android:id="@+id/home_magisk_version"
@ -102,24 +94,20 @@
latestVersion="@{viewModel.managerLatestVersion}" latestVersion="@{viewModel.managerLatestVersion}"
layout="@layout/include_update_card" layout="@layout/include_update_card"
state="@{viewModel.managerState}" state="@{viewModel.managerState}"
text="@{viewModel.managerStateText}" /> text="@{viewModel.managerStateText}"
<androidx.cardview.widget.CardView
android:id="@+id/install_option_card"
style="?attr/cardStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_marginTop="@dimen/margin_generic" />
android:layout_marginStart="5dp"
android:layout_marginTop="4dp" <View
android:layout_marginEnd="5dp" style="@style/Widget.Divider.Horizontal"
android:layout_marginBottom="4dp" android:layout_width="match_parent"
app:cardCornerRadius="@dimen/card_corner_radius" android:layout_margin="@dimen/margin_generic" />
app:cardElevation="@dimen/card_elevation">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:animateLayoutChanges="true"
android:onClick="@{() -> viewModel.advancedPressed()}" android:onClick="@{() -> viewModel.advancedPressed()}"
android:orientation="vertical" android:orientation="vertical"
android:paddingTop="10dp" android:paddingTop="10dp"
@ -127,19 +115,21 @@
<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"
android:background="?attr/selectableItemBackground"
android:minHeight="48dp">
<ImageView <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/arrow" android:id="@+id/arrow"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:rotation="@{viewModel.isAdvancedExpanded ? 180 : 0}" android:rotation="@{viewModel.isAdvancedExpanded ? 180 : 0}"
android:tint="?attr/imageColorTint"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/title" app:layout_constraintStart_toEndOf="@+id/title"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_arrow" /> app:srcCompat="@drawable/ic_arrow"
app:tint="?attr/imageColorTint" />
<TextView <TextView
android:id="@+id/title" android:id="@+id/title"
@ -155,7 +145,7 @@
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/install_option_expand" android:id="@+id/install_option_expand"
gone="@{!viewModel.isAdvancedExpanded}" gone="@{!viewModel.isAdvancedExpanded}"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -164,39 +154,36 @@
<CheckBox <CheckBox
android:id="@+id/keep_force_enc" android:id="@+id/keep_force_enc"
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="50dp"
android:layout_marginEnd="50dp"
android:checked="@={viewModel.isForceEncryption}" android:checked="@={viewModel.isForceEncryption}"
android:text="@string/keep_force_encryption" /> android:text="@string/keep_force_encryption"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_default="wrap"
app:layout_constraintWidth_min="300dp" />
<CheckBox <CheckBox
android:id="@+id/keep_verity" android:id="@+id/keep_verity"
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="50dp"
android:layout_marginEnd="50dp"
android:checked="@={viewModel.isKeepVerity}" android:checked="@={viewModel.isKeepVerity}"
android:text="@string/keep_dm_verity" /> android:text="@string/keep_dm_verity"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/keep_force_enc"
app:layout_constraintWidth_default="wrap"
app:layout_constraintWidth_min="300dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> <View
</androidx.cardview.widget.CardView> style="@style/Widget.Divider.Horizontal"
<androidx.cardview.widget.CardView
android:id="@+id/safetyNet_card"
style="?attr/cardStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_margin="@dimen/margin_generic" />
android:layout_gravity="center_horizontal"
android:layout_marginStart="5dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="4dp"
app:cardCornerRadius="@dimen/card_corner_radius"
app:cardElevation="@dimen/card_elevation">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -327,18 +314,10 @@
</LinearLayout> </LinearLayout>
</androidx.cardview.widget.CardView> <View
style="@style/Widget.Divider.Horizontal"
<androidx.cardview.widget.CardView
style="?attr/cardStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_margin="@dimen/margin_generic" />
android:layout_marginStart="5dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="4dp"
app:cardCornerRadius="@dimen/card_corner_radius"
app:cardElevation="@dimen/card_elevation">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -477,39 +456,17 @@
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView> <View
style="@style/Widget.Divider.Horizontal"
<androidx.cardview.widget.CardView
android:id="@+id/uninstall_button"
style="?attr/cardStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_margin="@dimen/margin_generic" />
android:layout_gravity="center"
android:layout_marginStart="5dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="4dp"
android:clickable="true"
android:focusable="true"
android:foreground="?android:attr/selectableItemBackground"
android:onClick="@{() -> viewModel.uninstallPressed()}"
app:cardCornerRadius="@dimen/card_corner_radius"
app:cardElevation="@dimen/card_elevation">
<TextView <com.google.android.material.button.MaterialButton
style="@style/Widget.Button.Text"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="10dp" android:onClick="@{() -> viewModel.uninstallPressed()}"
android:layout_marginBottom="10dp" android:text="@string/uninstall" />
android:ems="10"
android:fontFamily="sans-serif"
android:gravity="center"
android:text="@string/uninstall"
android:textAllCaps="false"
android:textSize="20sp"
android:textStyle="bold" />
</androidx.cardview.widget.CardView>
</LinearLayout> </LinearLayout>

View File

@ -39,27 +39,16 @@
</data> </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 <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:paddingTop="12dp" android:animateLayoutChanges="true"
android:paddingBottom="12dp"> android:background="?android:attr/selectableItemBackground"
android:onClick="@{() -> viewModel.cardPressed(item)}">
<androidx.appcompat.widget.AppCompatButton <com.google.android.material.button.MaterialButton
android:id="@+id/install" android:id="@+id/install"
style="@style/Widget.Button.Text"
gone="@{state == MagiskState.LOADING}" gone="@{state == MagiskState.LOADING}"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -79,14 +68,15 @@
android:layout_height="25dp" android:layout_height="25dp"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
app:tint="@{state == MagiskState.UP_TO_DATE ? @color/colorCorrect : (state == MagiskState.OBSOLETE ? @color/colorUpdate : @color/colorError)}"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/status" app:layout_constraintEnd_toStartOf="@+id/status"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent"
app:tint="@{state == MagiskState.UP_TO_DATE ? @color/colorCorrect : (state == MagiskState.OBSOLETE ? @color/colorUpdate : @color/colorError)}" />
<ProgressBar <ProgressBar
android:id="@+id/progress" android:id="@+id/progress"
style="@style/Widget.Progress"
gone="@{state != MagiskState.LOADING}" gone="@{state != MagiskState.LOADING}"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
@ -95,6 +85,25 @@
app:layout_constraintStart_toStartOf="@+id/status_icon" app:layout_constraintStart_toStartOf="@+id/status_icon"
app:layout_constraintTop_toTopOf="@+id/status_icon" /> app:layout_constraintTop_toTopOf="@+id/status_icon" />
<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_constraintBottom_toTopOf="@+id/current_version"
app:layout_constraintEnd_toStartOf="@+id/install"
app:layout_constraintStart_toEndOf="@+id/status_icon"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed"
tools:text="Magisk is up to date" />
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
android:id="@+id/current_version" android:id="@+id/current_version"
android:layout_width="0dp" android:layout_width="0dp"
@ -103,6 +112,7 @@
android:text="@{state != MagiskState.LOADING ? currentVersion : @string/checking_for_updates}" android:text="@{state != MagiskState.LOADING ? currentVersion : @string/checking_for_updates}"
app:autoSizeMinTextSize="1sp" app:autoSizeMinTextSize="1sp"
app:autoSizeTextType="uniform" app:autoSizeTextType="uniform"
app:layout_constraintBottom_toTopOf="@+id/latest_version"
app:layout_constraintEnd_toEndOf="@+id/status" app:layout_constraintEnd_toEndOf="@+id/status"
app:layout_constraintStart_toStartOf="@+id/status" app:layout_constraintStart_toStartOf="@+id/status"
app:layout_constraintTop_toBottomOf="@+id/status" app:layout_constraintTop_toBottomOf="@+id/status"
@ -117,6 +127,7 @@
android:text="@{state != MagiskState.LOADING ? latestVersion : @string/checking_for_updates}" android:text="@{state != MagiskState.LOADING ? latestVersion : @string/checking_for_updates}"
app:autoSizeMinTextSize="1sp" app:autoSizeMinTextSize="1sp"
app:autoSizeTextType="uniform" app:autoSizeTextType="uniform"
app:layout_constraintBottom_toTopOf="@+id/additional"
app:layout_constraintEnd_toEndOf="@+id/status" app:layout_constraintEnd_toEndOf="@+id/status"
app:layout_constraintStart_toStartOf="@+id/status" app:layout_constraintStart_toStartOf="@+id/status"
app:layout_constraintTop_toBottomOf="@+id/current_version" app:layout_constraintTop_toBottomOf="@+id/current_version"
@ -131,31 +142,12 @@
android:text="@{additionalInfo}" android:text="@{additionalInfo}"
app:autoSizeMinTextSize="1sp" app:autoSizeMinTextSize="1sp"
app:autoSizeTextType="uniform" app:autoSizeTextType="uniform"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/status" app:layout_constraintEnd_toEndOf="@+id/status"
app:layout_constraintStart_toStartOf="@+id/status" app:layout_constraintStart_toStartOf="@+id/status"
app:layout_constraintTop_toBottomOf="@+id/latest_version" app:layout_constraintTop_toBottomOf="@+id/latest_version"
tools:text="@string/checking_for_updates" /> 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.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
</layout> </layout>

View File

@ -14,7 +14,13 @@
<style name="ThemeFoundation.Colored.ExtraProps" /> <style name="ThemeFoundation.Colored.ExtraProps" />
<style name="MagiskTheme" parent="ThemeFoundation.Colored.ExtraProps" /> <style name="MagiskTheme" parent="ThemeFoundation.Colored.ExtraProps">
<!--All of these attributes are deprecated and will be removed-->
<item name="cardStyle">@style/CardViewStyle.Light</item>
<item name="imageColorTint">@color/icon_grey</item>
<item name="colorControl">?android:attr/textColorSecondary</item>
<item name="colorAccentFallback">@color/accentFallback</item>
</style>
<style name="MagiskTheme.Flashing" parent="Theme.MaterialComponents.NoActionBar"> <style name="MagiskTheme.Flashing" parent="Theme.MaterialComponents.NoActionBar">
<item name="colorPrimary">@android:color/black</item> <item name="colorPrimary">@android:color/black</item>