Skip to content

Commit 4b075c8

Browse files
committed
Changed style of numeric button
1 parent f4f2a81 commit 4b075c8

3 files changed

Lines changed: 81 additions & 94 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<selector xmlns:android="http://schemas.android.com/apk/res/android">
3+
<item android:state_pressed="true" >
4+
<shape>
5+
<solid
6+
android:color="@color/default_line_indicator_selected_color" />
7+
<corners
8+
android:radius="200dp" />
9+
<stroke
10+
android:width="1dp"
11+
android:color="@color/abs__bright_foreground_disabled_holo_light" />
12+
</shape>
13+
</item>
14+
<item android:state_enabled="false" >
15+
<shape>
16+
<solid
17+
android:color="@color/abs__primary_text_disable_only_holo_dark" />
18+
<corners
19+
android:radius="200dp" />
20+
<stroke
21+
android:width="1dp"
22+
android:color="@color/abs__bright_foreground_disabled_holo_light" />
23+
</shape>
24+
</item>
25+
<item>
26+
<shape>
27+
<solid android:color="@android:color/transparent" />
28+
<corners
29+
android:radius="200dp" />
30+
<stroke
31+
android:width="1dp"
32+
android:color="@color/abs__bright_foreground_disabled_holo_light" />
33+
</shape>
34+
</item>
35+
</selector>

app/res/layout/fragment_numeric_keyboard.xml

Lines changed: 25 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -53,58 +53,25 @@
5353

5454
<EditText
5555
android:id="@+id/passcode1"
56-
android:layout_width="wrap_content"
57-
android:layout_height="match_parent"
58-
android:cursorVisible="false"
59-
android:focusableInTouchMode="false"
60-
android:hint="*"
61-
android:inputType="textPassword|number"
62-
android:password="true"
63-
android:maxLength="1"
64-
android:textSize="33sp" />
56+
style="@style/PasscodeEditText" />
6557

6658
<EditText
6759
android:id="@+id/passcode2"
68-
android:layout_width="wrap_content"
69-
android:layout_height="match_parent"
70-
android:cursorVisible="false"
71-
android:focusableInTouchMode="false"
72-
android:hint="*"
73-
android:inputType="textPassword|number"
74-
android:password="true"
75-
android:maxLength="1"
76-
android:textSize="33sp" />
60+
style="@style/PasscodeEditText" />
7761

7862
<EditText
7963
android:id="@+id/passcode3"
80-
android:layout_width="wrap_content"
81-
android:layout_height="match_parent"
82-
android:cursorVisible="false"
83-
android:focusableInTouchMode="false"
84-
android:hint="*"
85-
android:inputType="textPassword|number"
86-
android:password="true"
87-
android:maxLength="1"
88-
android:textSize="33sp" />
64+
style="@style/PasscodeEditText" />
8965

9066
<EditText
9167
android:id="@+id/passcode4"
92-
android:layout_width="wrap_content"
93-
android:layout_height="match_parent"
94-
android:cursorVisible="false"
95-
android:focusableInTouchMode="false"
96-
android:hint="*"
97-
android:inputType="textPassword|number"
98-
android:password="true"
99-
android:maxLength="1"
100-
android:textSize="33sp" />
68+
style="@style/PasscodeEditText" />
10169

10270
</LinearLayout>
10371

10472
</LinearLayout>
10573

106-
<LinearLayout android:id="@+id/keypad"
107-
android:layout_width="fill_parent"
74+
<LinearLayout android:layout_width="fill_parent"
10875
android:layout_height="fill_parent"
10976
android:orientation="vertical"
11077
android:layout_weight="1.2"
@@ -119,27 +86,18 @@
11986

12087
<Button
12188
android:id="@+id/one_btn"
122-
android:layout_width="0dp"
123-
android:layout_height="match_parent"
124-
android:layout_weight="1"
12589
android:text="1"
126-
android:textSize="25sp" />
90+
style="@style/NumericButton" />
12791

12892
<Button
12993
android:id="@+id/two_btn"
130-
android:layout_width="0dp"
131-
android:layout_height="match_parent"
132-
android:layout_weight="1"
13394
android:text="2"
134-
android:textSize="25sp" />
95+
style="@style/NumericButton" />
13596

13697
<Button
13798
android:id="@+id/three_btn"
138-
android:layout_width="0dp"
139-
android:layout_height="match_parent"
140-
android:layout_weight="1"
14199
android:text="3"
142-
android:textSize="25sp" />
100+
style="@style/NumericButton" />
143101
</LinearLayout>
144102

145103
<LinearLayout android:id="@+id/four_to_six"
@@ -151,27 +109,18 @@
151109

152110
<Button
153111
android:id="@+id/four_btn"
154-
android:layout_width="0dp"
155-
android:layout_height="match_parent"
156-
android:layout_weight="1"
157112
android:text="4"
158-
android:textSize="25sp" />
113+
style="@style/NumericButton" />
159114

160115
<Button
161116
android:id="@+id/five_btn"
162-
android:layout_width="0dp"
163-
android:layout_height="match_parent"
164-
android:layout_weight="1"
165117
android:text="5"
166-
android:textSize="25sp" />
118+
style="@style/NumericButton" />
167119

168120
<Button
169121
android:id="@+id/six_btn"
170-
android:layout_width="0dp"
171-
android:layout_height="match_parent"
172-
android:layout_weight="1"
173122
android:text="6"
174-
android:textSize="25sp" />
123+
style="@style/NumericButton" />
175124
</LinearLayout>
176125

177126
<LinearLayout android:id="@+id/seven_to_nine"
@@ -183,60 +132,42 @@
183132

184133
<Button
185134
android:id="@+id/seven_btn"
186-
android:layout_width="0dp"
187-
android:layout_height="match_parent"
188-
android:layout_weight="1"
189135
android:text="7"
190-
android:textSize="25sp" />
136+
style="@style/NumericButton" />
191137

192138
<Button
193139
android:id="@+id/eight_btn"
194-
android:layout_width="0dp"
195-
android:layout_height="match_parent"
196-
android:layout_weight="1"
197140
android:text="8"
198-
android:textSize="25sp" />
141+
style="@style/NumericButton" />
199142

200143
<Button
201144
android:id="@+id/nine_btn"
202-
android:layout_width="0dp"
203-
android:layout_height="match_parent"
204-
android:layout_weight="1"
205145
android:text="9"
206-
android:textSize="25sp" />
146+
style="@style/NumericButton" />
207147
</LinearLayout>
208148

209-
<LinearLayout
210-
android:id="@+id/zero"
211-
android:layout_width="match_parent"
212-
android:layout_height="fill_parent"
213-
android:orientation="horizontal"
214-
android:weightSum="3"
215-
android:layout_weight="1">
149+
<LinearLayout android:id="@+id/zero"
150+
android:layout_width="match_parent"
151+
android:layout_height="fill_parent"
152+
android:orientation="horizontal"
153+
android:weightSum="3"
154+
android:layout_weight="1">
216155

217156
<Button
218157
android:id="@+id/empty_btn"
219-
android:layout_width="0dp"
220-
android:layout_height="match_parent"
221-
android:layout_weight="1"
222158
android:text=""
223-
android:textSize="25sp"
224-
android:enabled="false" />
159+
android:enabled="false"
160+
style="@style/NumericButton" />
225161

226162
<Button
227163
android:id="@+id/zero_btn"
228-
android:layout_width="0dp"
229-
android:layout_height="match_parent"
230-
android:layout_weight="1"
231164
android:text="0"
232-
android:textSize="25sp"/>
165+
style="@style/NumericButton" />
233166

234167
<ImageButton
235168
android:id="@+id/delete_btn"
236-
android:layout_width="0dp"
237-
android:layout_height="match_parent"
238-
android:layout_weight="1"
239-
android:src="@drawable/clear_btn" />
169+
android:src="@drawable/clear_btn"
170+
style="@style/NumericButton" />
240171
</LinearLayout>
241172

242173
</LinearLayout>

app/res/values/styles.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,25 @@
9090
<item name="android:orientation">vertical</item>
9191
<item name="android:layout_marginBottom">@dimen/form_row_bottom_margin</item>
9292
</style>
93+
94+
<style name="NumericButton" parent="@android:style/Widget.Button">
95+
<item name="android:layout_width">0dp</item>
96+
<item name="android:layout_height">match_parent</item>
97+
<item name="android:layout_weight">1</item>
98+
<item name="android:layout_margin">1dp</item>
99+
<item name="android:textSize">25sp</item>
100+
<item name="android:background">@drawable/numeric_button</item>
101+
</style>
102+
103+
<style name="PasscodeEditText" parent="@android:style/Widget.EditText">
104+
<item name="android:layout_width">wrap_content</item>
105+
<item name="android:layout_height">match_parent</item>
106+
<item name="android:cursorVisible">false</item>
107+
<item name="android:focusableInTouchMode">false</item>
108+
<item name="android:inputType">textPassword|number</item>
109+
<item name="android:password">true</item>
110+
<item name="android:maxLength">1</item>
111+
<item name="android:hint">*</item>
112+
<item name="android:textSize">33sp</item>
113+
</style>
93114
</resources>

0 commit comments

Comments
 (0)