Updated su request dialog to match overall app theme

This commit is contained in:
Viktor De Pasquale 2020-02-01 16:55:22 +01:00 committed by John Wu
parent 555e7cc907
commit 6812f9d202
3 changed files with 117 additions and 104 deletions

View File

@ -11,132 +11,142 @@
</data> </data>
<LinearLayout <com.google.android.material.card.MaterialCardView
android:id="@+id/su_popup" style="@style/WidgetFoundation.Card.Elevated"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center">
android:background="?attr/colorBackgroundFloating"
android:minWidth="350dp"
android:orientation="vertical">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/request_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
android:layout_marginBottom="5dp"
android:gravity="center_horizontal"
android:text="@string/su_request_title"
android:textAppearance="?android:attr/textAppearanceLarge" />
<LinearLayout <LinearLayout
android:id="@+id/su_popup"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:minWidth="350dp"
android:layout_marginTop="10dp" android:orientation="vertical">
android:layout_marginBottom="10dp"
android:orientation="horizontal"
android:paddingStart="10dp"
android:paddingEnd="10dp">
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatTextView
android:id="@+id/app_icon" android:id="@+id/request_title"
android:layout_width="50dp" android:layout_width="wrap_content"
android:layout_height="50dp" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_horizontal"
android:layout_marginStart="5dp" android:layout_marginTop="@dimen/l1"
android:layout_marginEnd="10dp" android:layout_marginBottom="@dimen/l_50"
android:layout_weight="0" android:gravity="center_horizontal"
android:src="@{viewModel.icon}" android:text="@string/su_request_title"
tools:src="@drawable/ic_delete" /> android:textAppearance="@style/AppearanceFoundation.Title" />
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_horizontal"
android:layout_weight="1" android:layout_marginTop="@dimen/l_50"
android:gravity="center_vertical" android:layout_marginBottom="@dimen/l_50"
android:orientation="vertical"> android:orientation="horizontal"
android:paddingStart="10dp"
android:paddingEnd="10dp">
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/app_name" android:id="@+id/app_icon"
style="@style/WidgetFoundation.Icon"
android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/l_50"
android:layout_marginEnd="@dimen/l1"
android:layout_weight="0"
android:padding="0dp"
android:src="@{viewModel.icon}"
app:tint="@null"
tools:src="@drawable/ic_delete_md2" />
<LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ellipsize="end" android:layout_gravity="center_vertical"
android:maxWidth="300dp" android:layout_weight="1"
android:maxLines="1" android:gravity="center_vertical"
android:minWidth="200dp" android:orientation="vertical">
android:text="@{viewModel.title}"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="?android:textColorPrimary"
tools:text="Magisk" />
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
android:id="@+id/package_name" android:id="@+id/app_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ellipsize="end" android:ellipsize="end"
android:maxWidth="300dp" android:maxWidth="300dp"
android:maxLines="1" android:maxLines="1"
android:minWidth="200dp" android:minWidth="200dp"
android:text="@{viewModel.packageName}" android:text="@{viewModel.title}"
android:textColor="?android:textColorSecondary" android:textAppearance="@style/AppearanceFoundation.Body"
tools:text="com.topjohnwu.magisk" /> android:textStyle="bold"
tools:text="Magisk" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/package_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxWidth="300dp"
android:maxLines="1"
android:minWidth="200dp"
android:text="@{viewModel.packageName}"
android:textAppearance="@style/AppearanceFoundation.Caption.Variant"
tools:text="com.topjohnwu.magisk" />
</LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout>
<androidx.appcompat.widget.AppCompatSpinner <androidx.appcompat.widget.AppCompatSpinner
android:id="@+id/timeout" android:id="@+id/timeout"
onTouch="@{() -> viewModel.spinnerTouched()}" onTouch="@{() -> viewModel.spinnerTouched()}"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:adapter="@{viewModel.adapter}"
android:selection="@={viewModel.selectedItemPosition}" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/warning"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="5dp"
android:drawablePadding="10dp"
android:text="@{viewModel.warningText}"
android:textColor="?android:textColorSecondary"
tools:text="@string/su_warning" />
<LinearLayout
style="?android:buttonBarStyle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom"
android:orientation="horizontal"
android:paddingStart="30dp"
android:paddingEnd="30dp">
<com.google.android.material.button.MaterialButton
android:id="@+id/deny_btn"
style="@style/Widget.Button.Text"
android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_gravity="center_horizontal"
android:onClick="@{() -> viewModel.denyPressed()}" android:adapter="@{viewModel.adapter}"
android:text="@{viewModel.denyText}" android:selection="@={viewModel.selectedItemPosition}" />
tools:text="@string/deny" />
<com.google.android.material.button.MaterialButton <androidx.appcompat.widget.AppCompatTextView
android:id="@+id/grant_btn" android:id="@+id/warning"
style="@style/Widget.Button.Text" android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_gravity="center_horizontal"
android:onClick="@{() -> viewModel.grantPressed()}" android:layout_margin="@dimen/l1"
android:text="@string/grant" /> android:gravity="center"
android:text="@{viewModel.warningText}"
android:textAppearance="@style/AppearanceFoundation.Body"
android:textColor="?colorError"
android:textStyle="bold"
tools:text="@string/su_warning" />
<LinearLayout
style="?android:buttonBarStyle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom"
android:orientation="horizontal"
android:paddingStart="@dimen/l2"
android:paddingEnd="@dimen/l2">
<com.google.android.material.button.MaterialButton
android:id="@+id/deny_btn"
style="@style/WidgetFoundation.Button.Text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="@{() -> viewModel.denyPressed()}"
android:text="@{viewModel.denyText}"
android:textColor="?colorOnSurfaceVariant"
tools:text="@string/deny" />
<com.google.android.material.button.MaterialButton
android:id="@+id/grant_btn"
style="@style/WidgetFoundation.Button.Text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="@{() -> viewModel.grantPressed()}"
android:text="@string/grant" />
</LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </com.google.android.material.card.MaterialCardView>
</layout> </layout>

View File

@ -16,6 +16,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ellipsize="marquee" android:ellipsize="marquee"
android:background="?colorSurfaceVariant"
android:textAppearance="@style/AppearanceFoundation.Caption"
android:gravity="center_vertical" android:gravity="center_vertical"
android:minHeight="?attr/listPreferredItemHeightSmall" android:minHeight="?attr/listPreferredItemHeightSmall"
android:singleLine="true" android:singleLine="true"

View File

@ -41,6 +41,7 @@
<style name="Foundation.Floating" parent="Empty"> <style name="Foundation.Floating" parent="Empty">
<item name="android:windowIsFloating">true</item> <item name="android:windowIsFloating">true</item>
<item name="android:windowIsTranslucent">true</item> <item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
</style> </style>
</resources> </resources>