Skip to content
This repository was archived by the owner on Sep 13, 2024. It is now read-only.

Commit 9ef5404

Browse files
Merge pull request #25 from coderbunker/issue#23-clear_button
Added clear button functionality #23
2 parents 18c8bea + 6fb84a8 commit 9ef5404

File tree

4 files changed

+64
-29
lines changed

4 files changed

+64
-29
lines changed

app/src/main/java/com/coderbunker/kioskapp/KioskActivity.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public class KioskActivity extends Activity {
4646

4747
private Button b1, b2, b3, b4, b5, b6;
4848
private Button n0, n1, n2, n3, n4, n5, n6, n7, n8, n9;
49+
private Button c;
4950
private ArrayList<Button> numbers;
5051

5152
private int cptPwd, clicks = 0;
@@ -360,6 +361,8 @@ public void onDismiss(DialogInterface dialogInterface) {
360361
n8 = dialog.findViewById(R.id.number8);
361362
n9 = dialog.findViewById(R.id.number9);
362363

364+
c = dialog.findViewById(R.id.clear);
365+
363366
numbers.add(n0);
364367
numbers.add(n1);
365368
numbers.add(n2);
@@ -381,6 +384,17 @@ public void onClick(View view) {
381384
});
382385
}
383386

387+
c.setOnClickListener(new View.OnClickListener() {
388+
@Override
389+
public void onClick(View v) {
390+
if (cptPwd > 0) {
391+
cptPwd--;
392+
enterNumber("");
393+
cptPwd--;
394+
}
395+
}
396+
});
397+
384398
dialog.show();
385399
}
386400

app/src/main/res/layout/activity_main.xml

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,42 @@
77
tools:context=".MainActivity">
88

99

10-
11-
<RelativeLayout
12-
android:layout_width="match_parent"
13-
android:layout_height="match_parent"
14-
android:layout_weight="1">
15-
16-
<Button
17-
android:id="@+id/button_kioskmode"
18-
android:layout_width="150dp"
19-
android:layout_height="100dp"
20-
android:layout_centerInParent="true"
21-
android:text="Kiosk mode" />
22-
23-
</RelativeLayout>
24-
25-
26-
<RelativeLayout
27-
android:layout_width="match_parent"
28-
android:layout_height="match_parent"
29-
android:layout_weight="1">
30-
31-
<Button
32-
android:id="@+id/button_settings"
33-
android:layout_width="150dp"
34-
android:layout_height="100dp"
35-
android:layout_centerInParent="true"
36-
android:text="Settings" />
37-
38-
</RelativeLayout>
10+
<RelativeLayout
11+
android:layout_width="match_parent"
12+
android:layout_height="match_parent"
13+
android:layout_weight="1"
14+
android:background="#FFF">
15+
16+
<Button
17+
android:id="@+id/button_kioskmode"
18+
android:layout_width="150dp"
19+
android:layout_height="100dp"
20+
android:layout_centerInParent="true"
21+
android:background="#fff"
22+
android:elevation="4dp"
23+
android:text="Kiosk mode"
24+
android:textColor="#000" />
25+
26+
</RelativeLayout>
27+
28+
29+
<RelativeLayout
30+
android:layout_width="match_parent"
31+
android:layout_height="match_parent"
32+
android:layout_weight="1"
33+
android:background="#FFF">
34+
35+
<Button
36+
android:id="@+id/button_settings"
37+
android:layout_width="150dp"
38+
android:layout_height="100dp"
39+
android:layout_centerInParent="true"
40+
android:background="#fff"
41+
android:elevation="4dp"
42+
android:text="Settings"
43+
android:textColor="#000" />
44+
45+
</RelativeLayout>
3946

4047

4148

app/src/main/res/layout/activity_settings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@
116116
android:id="@+id/btnSave"
117117
android:layout_width="match_parent"
118118
android:layout_height="wrap_content"
119+
android:layout_marginBottom="20dp"
119120
android:background="#FFF"
120121
android:elevation="4dp"
121122
android:text="Save"

app/src/main/res/layout/password_dialog.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,19 @@
209209
android:text="0"
210210
android:textColor="#000" />
211211

212+
<Button
213+
android:id="@+id/clear"
214+
android:layout_width="wrap_content"
215+
android:layout_height="wrap_content"
216+
android:layout_columnWeight="1"
217+
android:layout_margin="3dp"
218+
android:background="#FFF"
219+
android:elevation="4dp"
220+
android:onClick=""
221+
android:tag="C"
222+
android:text="C"
223+
android:textColor="#000" />
224+
212225
</GridLayout>
213226

214227
</RelativeLayout>

0 commit comments

Comments
 (0)