Skip to content

Commit f8f2ec9

Browse files
BrayanDSOdavid-allison
authored andcommitted
refactor: use Android's minTouchTargetSize
It replaces @dimen/touch_target with a Material standard attribute It uses @dimen/mtrl_min_touch_target_size by default, which is the same `48dp` of before
1 parent 3c181ef commit f8f2ec9

File tree

6 files changed

+11
-12
lines changed

6 files changed

+11
-12
lines changed

AnkiDroid/src/main/res/layout/browser_columns_selection_entry.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@
6666

6767
<androidx.appcompat.widget.AppCompatImageButton
6868
android:id="@+id/button_toggle_column"
69-
android:layout_width="@dimen/touch_target"
70-
android:layout_height="@dimen/touch_target"
69+
android:layout_width="?minTouchTargetSize"
70+
android:layout_height="?minTouchTargetSize"
7171
style="@android:style/Widget.ActionButton"
7272
android:padding="8dp"
7373
tools:srcCompat="@drawable/ic_add"

AnkiDroid/src/main/res/layout/note_editor.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
<Spinner
4949
android:id="@+id/note_type_spinner"
5050
android:layout_width="match_parent"
51-
android:layout_height="@dimen/touch_target"
51+
android:layout_height="?minTouchTargetSize"
5252
/>
5353
</LinearLayout>
5454

AnkiDroid/src/main/res/layout/reviewer2.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
android:id="@+id/buttons_area"
121121
android:layout_width="match_parent"
122122
android:layout_height="wrap_content"
123-
android:minHeight="@dimen/touch_target"
123+
android:minHeight="?minTouchTargetSize"
124124
android:layout_marginTop="2dp"
125125
android:layout_marginHorizontal="@dimen/reviewer_side_margin"
126126
>

AnkiDroid/src/main/res/layout/reviewer_answer_buttons.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
android:id="@+id/flashcard_layout_ease1"
6666
android:nextFocusRight="@id/flashcard_layout_ease2"
6767
android:layout_width="0dip"
68-
android:layout_height="@dimen/touch_target"
68+
android:layout_height="?minTouchTargetSize"
6969
android:layout_weight="1"
7070
android:orientation="vertical"
7171
android:theme="@style/AgainButton"
@@ -89,7 +89,7 @@
8989
android:nextFocusRight="@id/flashcard_layout_ease3"
9090
android:nextFocusLeft="@id/flashcard_layout_ease1"
9191
android:layout_width="0dip"
92-
android:layout_height="@dimen/touch_target"
92+
android:layout_height="?minTouchTargetSize"
9393
android:layout_weight="1"
9494
android:orientation="vertical"
9595
android:theme="@style/HardButton"
@@ -113,7 +113,7 @@
113113
android:nextFocusRight="@id/flashcard_layout_ease4"
114114
android:nextFocusLeft="@id/flashcard_layout_ease2"
115115
android:layout_width="0dip"
116-
android:layout_height="@dimen/touch_target"
116+
android:layout_height="?minTouchTargetSize"
117117
android:layout_weight="1"
118118
android:orientation="vertical"
119119
android:theme="@style/GoodButton"
@@ -136,7 +136,7 @@
136136
android:id="@+id/flashcard_layout_ease4"
137137
android:nextFocusLeft="@id/flashcard_layout_ease3"
138138
android:layout_width="0dip"
139-
android:layout_height="@dimen/touch_target"
139+
android:layout_height="?minTouchTargetSize"
140140
android:layout_weight="1"
141141
android:orientation="vertical"
142142
android:theme="@style/EasyButton"
@@ -157,7 +157,7 @@
157157
<FrameLayout
158158
android:id="@+id/flashcard_layout_flip"
159159
android:layout_width="match_parent"
160-
android:layout_height="@dimen/touch_target"
160+
android:layout_height="?minTouchTargetSize"
161161
android:orientation="vertical"
162162
android:focusable="true"
163163
android:background="?attr/hardButtonRef"

AnkiDroid/src/main/res/layout/sync_progress_layout.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
<androidx.appcompat.widget.AppCompatImageButton
1010
android:id="@+id/button"
11-
android:layout_width="@dimen/touch_target"
12-
android:layout_height="@dimen/touch_target"
11+
android:layout_width="?minTouchTargetSize"
12+
android:layout_height="?minTouchTargetSize"
1313
app:srcCompat="@drawable/ic_sync"
1414
style="@android:style/Widget.ActionButton"
1515
android:tooltipText="@string/button_sync"

AnkiDroid/src/main/res/values/dimens.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="UnusedResources,DuplicateCrowdInStrings">
33
<!-- Material UI side margin: http://web.archive.org/web/20180105203433if_/https://material.io/guidelines/layout/metrics-keylines.html#metrics-keylines-keylines-spacing -->
44
<dimen name="side_margin">16dp</dimen>
5-
<dimen name="touch_target">48dp</dimen>
65
<dimen name="default_width">56dp</dimen>
76
<dimen name="keyline_1">16dp</dimen>
87
<dimen name="study_options_padding">8dp</dimen>

0 commit comments

Comments
 (0)