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

Commit

Permalink
Merge pull request #25 from coderbunker/issue#23-clear_button
Browse files Browse the repository at this point in the history
Added clear button functionality #23
  • Loading branch information
julianschmuckli authored Aug 10, 2018
2 parents 18c8bea + 6fb84a8 commit 9ef5404
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 29 deletions.
14 changes: 14 additions & 0 deletions app/src/main/java/com/coderbunker/kioskapp/KioskActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class KioskActivity extends Activity {

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

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

c = dialog.findViewById(R.id.clear);

numbers.add(n0);
numbers.add(n1);
numbers.add(n2);
Expand All @@ -381,6 +384,17 @@ public void onClick(View view) {
});
}

c.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (cptPwd > 0) {
cptPwd--;
enterNumber("");
cptPwd--;
}
}
});

dialog.show();
}

Expand Down
65 changes: 36 additions & 29 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,42 @@
tools:context=".MainActivity">



<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">

<Button
android:id="@+id/button_kioskmode"
android:layout_width="150dp"
android:layout_height="100dp"
android:layout_centerInParent="true"
android:text="Kiosk mode" />

</RelativeLayout>


<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">

<Button
android:id="@+id/button_settings"
android:layout_width="150dp"
android:layout_height="100dp"
android:layout_centerInParent="true"
android:text="Settings" />

</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#FFF">

<Button
android:id="@+id/button_kioskmode"
android:layout_width="150dp"
android:layout_height="100dp"
android:layout_centerInParent="true"
android:background="#fff"
android:elevation="4dp"
android:text="Kiosk mode"
android:textColor="#000" />

</RelativeLayout>


<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#FFF">

<Button
android:id="@+id/button_settings"
android:layout_width="150dp"
android:layout_height="100dp"
android:layout_centerInParent="true"
android:background="#fff"
android:elevation="4dp"
android:text="Settings"
android:textColor="#000" />

</RelativeLayout>



Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/activity_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
android:id="@+id/btnSave"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:background="#FFF"
android:elevation="4dp"
android:text="Save"
Expand Down
13 changes: 13 additions & 0 deletions app/src/main/res/layout/password_dialog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,19 @@
android:text="0"
android:textColor="#000" />

<Button
android:id="@+id/clear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_columnWeight="1"
android:layout_margin="3dp"
android:background="#FFF"
android:elevation="4dp"
android:onClick=""
android:tag="C"
android:text="C"
android:textColor="#000" />

</GridLayout>

</RelativeLayout>

0 comments on commit 9ef5404

Please sign in to comment.