Replace material-dialogs usage with Material Components' (#5423)
* Use Material Components' dialogs For all dialogs that has direct replacement. * Convert text input dialogs * Convert quad-state multi choices dialogs * Convert date picker dialogs This also changes the flow to remove selected start/finish tracking date and the track item itself * Remove material-dialogs dependencies
This commit is contained in:
10
app/src/main/res/drawable/ic_more_vert_24.xml
Normal file
10
app/src/main/res/drawable/ic_more_vert_24.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M12,8c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM12,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM12,16c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2z"/>
|
||||
</vector>
|
||||
@@ -2,7 +2,9 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:paddingHorizontal="24dp"
|
||||
android:paddingTop="16dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/description"
|
||||
@@ -15,7 +17,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="-5dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginEnd="0dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
18
app/src/main/res/layout/dialog_quadstatemultichoice_item.xml
Normal file
18
app/src/main/res/layout/dialog_quadstatemultichoice_item.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<eu.kanade.tachiyomi.widget.materialdialogs.QuadStateTextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
style="?attr/materialAlertDialogBodyTextStyle"
|
||||
android:id="@+id/quad_state_control"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:minHeight="?attr/listPreferredItemHeightSmall"
|
||||
android:gravity="start|center_vertical"
|
||||
android:textAlignment="viewStart"
|
||||
android:paddingStart="@dimen/abc_select_dialog_padding_start_material"
|
||||
android:paddingEnd="?attr/dialogPreferredPadding"
|
||||
android:drawablePadding="20dp"
|
||||
android:ellipsize="marquee"
|
||||
app:drawableStartCompat="@drawable/ic_check_box_outline_blank_24dp"
|
||||
tools:text="Quad-state item" />
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="8dp"
|
||||
android:scrollIndicators="none"
|
||||
tools:listitem="@layout/dialog_quadstatemultichoice_item" />
|
||||
20
app/src/main/res/layout/dialog_stub_textinput.xml
Normal file
20
app/src/main/res/layout/dialog_stub_textinput.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingHorizontal="24dp"
|
||||
android:paddingVertical="16dp">
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||
android:id="@+id/text_field"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
</FrameLayout>
|
||||
@@ -4,7 +4,8 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="horizontal"
|
||||
android:paddingVertical="8dp">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageButton
|
||||
android:id="@+id/btn_decrease_10"
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
style="@style/MD_ListItem.Choice">
|
||||
|
||||
<eu.kanade.tachiyomi.widget.materialdialogs.QuadStateCheckBox
|
||||
android:id="@+id/md_quad_state_control"
|
||||
style="@style/MD_ListItem_Control" />
|
||||
|
||||
<com.afollestad.materialdialogs.internal.rtl.RtlTextView
|
||||
android:id="@+id/md_quad_state_title"
|
||||
style="@style/MD_ListItemText.Choice"
|
||||
tools:text="Item" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -20,9 +20,6 @@
|
||||
android:id="@+id/logo_container"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:foreground="?attr/selectableItemBackground"
|
||||
app:cardBackgroundColor="#2E51A2"
|
||||
app:cardElevation="0dp"
|
||||
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.MaterialCardView.Tracker">
|
||||
@@ -54,8 +51,9 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/track_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:foreground="?attr/selectableItemBackgroundBorderless"
|
||||
android:gravity="center_vertical"
|
||||
@@ -64,6 +62,16 @@
|
||||
android:textAppearance="?attr/textAppearanceSubtitle1"
|
||||
tools:text="Title" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/more"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="?selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/label_more"
|
||||
android:padding="8dp"
|
||||
android:src="@drawable/ic_more_vert_24" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -100,11 +108,11 @@
|
||||
android:textAppearance="?attr/textAppearanceBody2"
|
||||
tools:text="Reading" />
|
||||
|
||||
<View
|
||||
android:id="@+id/vert_divider_1"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:divider" />
|
||||
<View
|
||||
android:id="@+id/vert_divider_1"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:divider" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/track_chapters"
|
||||
@@ -119,11 +127,11 @@
|
||||
android:textAppearance="?attr/textAppearanceBody2"
|
||||
tools:text="12/24" />
|
||||
|
||||
<View
|
||||
android:id="@+id/vert_divider_2"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:divider"/>
|
||||
<View
|
||||
android:id="@+id/vert_divider_2"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:divider" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/track_score"
|
||||
@@ -165,11 +173,11 @@
|
||||
android:textAppearance="?attr/textAppearanceBody2"
|
||||
tools:text="4/16/2020" />
|
||||
|
||||
<View
|
||||
android:id="@+id/vert_divider_3"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:divider" />
|
||||
<View
|
||||
android:id="@+id/vert_divider_3"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:divider" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/track_finish_date"
|
||||
|
||||
15
app/src/main/res/menu/track_item.xml
Normal file
15
app/src/main/res/menu/track_item.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/action_open_in_browser"
|
||||
android:title="@string/action_open_in_browser"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_remove"
|
||||
android:title="@string/action_remove"
|
||||
app:showAsAction="never" />
|
||||
|
||||
</menu>
|
||||
15
app/src/main/res/menu/track_item_date.xml
Normal file
15
app/src/main/res/menu/track_item_date.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/action_edit"
|
||||
android:title="@string/action_edit"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_remove"
|
||||
android:title="@string/action_remove"
|
||||
app:showAsAction="never" />
|
||||
|
||||
</menu>
|
||||
@@ -2,14 +2,6 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/remove"
|
||||
android:icon="@drawable/ic_delete_24dp"
|
||||
android:title="@string/action_remove"
|
||||
android:visible="false"
|
||||
app:iconTint="?attr/colorOnToolbar"
|
||||
app:showAsAction="ifRoom" />
|
||||
|
||||
<item
|
||||
android:id="@+id/done"
|
||||
android:enabled="false"
|
||||
|
||||
@@ -17,7 +17,4 @@
|
||||
<dimen name="screen_edge_margin">16dp</dimen>
|
||||
|
||||
<dimen name="tablet_horizontal_cover_margin">128dp</dimen>
|
||||
|
||||
<!-- material-dialogs button radius -->
|
||||
<dimen name="md_action_button_corner_radius">4dp</dimen>
|
||||
</resources>
|
||||
|
||||
@@ -300,21 +300,6 @@
|
||||
<item name="android:textSize">15sp</item>
|
||||
</style>
|
||||
|
||||
<!--================================-->
|
||||
<!--material-dialogs style overrides-->
|
||||
<!--================================-->
|
||||
<style name="MD_Light" parent="ThemeOverlay.MaterialComponents.Dialog.Alert">
|
||||
<item name="md_divider_color">@color/md_divider_light_theme</item>
|
||||
<item name="md_item_selector">@drawable/md_item_selector</item>
|
||||
<item name="md_button_selector">@drawable/md_btn_selector</item>
|
||||
</style>
|
||||
|
||||
<style name="MD_Dark" parent="ThemeOverlay.MaterialComponents.Dialog.Alert">
|
||||
<item name="md_divider_color">@color/md_divider_dark_theme</item>
|
||||
<item name="md_item_selector">@drawable/md_item_selector_dark</item>
|
||||
<item name="md_button_selector">@drawable/md_btn_selector_dark</item>
|
||||
</style>
|
||||
|
||||
<!--================-->
|
||||
<!--Shape Appearance-->
|
||||
<!--================-->
|
||||
|
||||
@@ -67,14 +67,6 @@
|
||||
<item name="elevationOverlayEnabled">false</item>
|
||||
<item name="lightSystemBarsOnPrimary">false</item>
|
||||
|
||||
<!-- Material Dialogs -->
|
||||
<item name="md_background_color">?attr/colorSurface</item>
|
||||
<item name="md_color_title">?attr/colorOnSurface</item>
|
||||
<item name="md_color_content">?attr/colorOnSurface</item>
|
||||
<item name="md_color_button_text">?attr/colorPrimary</item>
|
||||
<item name="md_button_casing">literal</item>
|
||||
<item name="md_corner_radius">@dimen/dialog_radius</item>
|
||||
|
||||
<!-- Custom Attributes-->
|
||||
<item name="colorFilterActive">@color/filter_light</item>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user