diff --git a/app/src/main/java/com/philliphsu/clock2/editalarm/EditAlarmActivity.java b/app/src/main/java/com/philliphsu/clock2/editalarm/EditAlarmActivity.java
index 7f8f807..08d5663 100644
--- a/app/src/main/java/com/philliphsu/clock2/editalarm/EditAlarmActivity.java
+++ b/app/src/main/java/com/philliphsu/clock2/editalarm/EditAlarmActivity.java
@@ -321,7 +321,8 @@ public class EditAlarmActivity extends BaseActivity implements
// If we keep a reference to the dialog, we keep its previous state as well.
// So the next time we call show() on it, the input field will show the
// last inputted time.
- NumpadTimePickerDialog.newInstance(this).show(getSupportFragmentManager(), TAG_TIME_PICKER);
+// NumpadTimePickerDialog.newInstance(this).show(getSupportFragmentManager(), TAG_TIME_PICKER);
+ NumberGridTimePickerDialog.newInstance().show(getSupportFragmentManager(), TAG_TIME_PICKER);
}
private void setWeekDaysText() {
diff --git a/app/src/main/java/com/philliphsu/clock2/editalarm/NumberGrid.java b/app/src/main/java/com/philliphsu/clock2/editalarm/NumberGrid.java
new file mode 100644
index 0000000..b493a34
--- /dev/null
+++ b/app/src/main/java/com/philliphsu/clock2/editalarm/NumberGrid.java
@@ -0,0 +1,112 @@
+package com.philliphsu.clock2.editalarm;
+
+import android.content.Context;
+import android.support.v7.widget.GridLayout;
+import android.text.format.DateFormat;
+import android.util.AttributeSet;
+
+import com.philliphsu.clock2.R;
+
+/**
+ * Created by Phillip Hsu on 7/21/2016.
+ */
+public class NumberGrid extends GridLayout {
+ private static final String TAG = "NumberGrid";
+ private static final int COLUMNS = 3;
+
+// private CircularIndicatorSetter mIndicatorSetter;
+ private OnNumberSelectedListener mSelectionListener;
+ // TODO: Since we plan to dynamically clear and inflate children into this
+ // parent to represent "pages", this seems useless? Since each page has at
+ // most one selection, and at any given time, this GridLayout can only show
+ // one page at a time. Instead, when the onNumberSelected() is fired, the
+ // hosting dialog should keep a reference to the returned number. It is up
+ // to the dialog to deduce what time field the number represents, probably
+ // with an int flag that indicates what "page" this GridLayout is displaying.
+ private int mSelection;
+
+ public interface OnNumberSelectedListener {
+ void onNumberSelected(int number);
+ }
+
+ public NumberGrid(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ init();
+ }
+
+ public NumberGrid(Context context) {
+ super(context);
+ init();
+ }
+
+ public void setOnNumberSelectedListener(OnNumberSelectedListener onNumberSelectedListener) {
+ mSelectionListener = onNumberSelectedListener;
+ }
+
+// /*package*/ void setTheme(Context context, boolean themeDark) {
+// for (int i = 0; i < getChildCount(); i++) {
+// View view = getChildAt(i);
+// if (view instanceof TextViewWithCircularIndicator) {
+// TextViewWithCircularIndicator text = (TextViewWithCircularIndicator) getChildAt(i);
+// text.setTheme(context, themeDark);
+// }
+// }
+// }
+
+ public int getSelection() {
+ return mSelection;
+ }
+
+ public void setSelection(int value) {
+ mSelection = value;
+// for (int i = 0; i < getChildCount(); i++) {
+// View v = getChildAt(i);
+// if (v instanceof TextViewWithCircularIndicator) {
+// TextViewWithCircularIndicator text = (TextViewWithCircularIndicator) v;
+// // parseInt() strips out leading zeroes
+// int num = Integer.parseInt(text.getText().toString());
+// if (value == num) {
+// mIndicatorSetter.setIndicator(text);
+// break;
+// }
+// } else {
+// // We have reached a non-numeric button, i.e. the minute tuners, unless you have
+// // other non-numeric buttons as well. This means we iterated through all numeric
+// // buttons, but this value is not one of the preset values.
+// // Clear the indicator from the default selection.
+// mIndicatorSetter.setIndicator(null);
+// break;
+// }
+// }
+ }
+
+ /**
+ * Final because this is implemented for the grid of numbers. If subclasses need their own
+ * click listeners for non-numeric buttons, they should set new OnClickListeners on those buttons.
+ */
+// @Override
+// public final void onClick(View v) {
+// TextViewWithCircularIndicator view = (TextViewWithCircularIndicator) v;
+// String text = view.getText().toString();
+// int number = Integer.parseInt(text);
+// mSelection = number;
+// fireOnNumberSelectedEvent(number);
+// mIndicatorSetter.setIndicator(view);
+// }
+
+ protected void fireOnNumberSelectedEvent(int number) {
+ if (mSelectionListener != null)
+ mSelectionListener.onNumberSelected(number);
+ }
+
+ private void init() {
+// setAlignmentMode(ALIGN_BOUNDS);
+ setColumnCount(COLUMNS);
+ // When we initialize, display the hour values "page".
+ int layout = DateFormat.is24HourFormat(getContext())
+ ? R.layout.content_24h_number_grid
+ : R.layout.content_12h_number_grid;
+ inflate(getContext(), layout, this);
+// ButterKnife.bind(this);
+ }
+}
diff --git a/app/src/main/java/com/philliphsu/clock2/editalarm/NumberGridTimePickerDialog.java b/app/src/main/java/com/philliphsu/clock2/editalarm/NumberGridTimePickerDialog.java
new file mode 100644
index 0000000..ea24948
--- /dev/null
+++ b/app/src/main/java/com/philliphsu/clock2/editalarm/NumberGridTimePickerDialog.java
@@ -0,0 +1,46 @@
+package com.philliphsu.clock2.editalarm;
+
+import android.app.Dialog;
+import android.content.DialogInterface;
+import android.os.Bundle;
+import android.support.v4.app.DialogFragment;
+import android.support.v7.app.AlertDialog;
+
+import com.philliphsu.clock2.R;
+
+/**
+ * Created by Phillip Hsu on 7/21/2016.
+ *
+ * AppCompat-themed AlertDialog.
+ */
+public class NumberGridTimePickerDialog extends DialogFragment {
+
+ public static NumberGridTimePickerDialog newInstance() {
+ return new NumberGridTimePickerDialog();
+ }
+
+ @Override
+ public Dialog onCreateDialog(Bundle savedInstanceState) {
+ // Use an AlertDialog to display footer buttons, rather than
+ // re-invent them in our layout.
+ AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
+ builder.setView(R.layout.dialog_time_picker_number_grid)
+ // The action strings are already defined and localized by the system!
+ .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+
+ }
+ })
+ .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+
+ }
+ });
+ return builder.create();
+// return super.onCreateDialog(savedInstanceState);
+ }
+
+
+}
diff --git a/app/src/main/java/com/philliphsu/clock2/editalarm/TwentyFourHourGridItem.java b/app/src/main/java/com/philliphsu/clock2/editalarm/TwentyFourHourGridItem.java
new file mode 100644
index 0000000..02c46c0
--- /dev/null
+++ b/app/src/main/java/com/philliphsu/clock2/editalarm/TwentyFourHourGridItem.java
@@ -0,0 +1,61 @@
+package com.philliphsu.clock2.editalarm;
+
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.util.AttributeSet;
+import android.view.Gravity;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import com.philliphsu.clock2.R;
+
+import butterknife.Bind;
+import butterknife.ButterKnife;
+
+/**
+ * Created by Phillip Hsu on 7/21/2016.
+ */
+public class TwentyFourHourGridItem extends LinearLayout {
+
+ @Bind(R.id.primary) TextView mPrimaryText;
+ @Bind(R.id.secondary) TextView mSecondaryText;
+
+ public TwentyFourHourGridItem(Context context) {
+ super(context);
+ init();
+ }
+
+ public TwentyFourHourGridItem(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ init();
+ TypedArray a = context.getTheme().obtainStyledAttributes(attrs,
+ R.styleable.TwentyFourHourGridItem, 0, 0);
+ try {
+ setPrimaryText(a.getString(R.styleable.TwentyFourHourGridItem_primaryText));
+ setSecondaryText(a.getString(R.styleable.TwentyFourHourGridItem_secondaryText));
+ } finally {
+ a.recycle();
+ }
+ }
+
+ public void setPrimaryText(CharSequence text) {
+ mPrimaryText.setText(text);
+ }
+
+ public void setSecondaryText(CharSequence text) {
+ mSecondaryText.setText(text);
+ }
+
+ public void swapTexts() {
+ CharSequence primary = mPrimaryText.getText();
+ setPrimaryText(mSecondaryText.getText());
+ setSecondaryText(primary);
+ }
+
+ private void init() {
+ setOrientation(VERTICAL);
+ setGravity(Gravity.CENTER);
+ inflate(getContext(), R.layout.element_24h_number_grid, this);
+ ButterKnife.bind(this);
+ }
+}
diff --git a/app/src/main/res/drawable/ic_add_circle_24dp.xml b/app/src/main/res/drawable/ic_add_circle_24dp.xml
new file mode 100644
index 0000000..520b71c
--- /dev/null
+++ b/app/src/main/res/drawable/ic_add_circle_24dp.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_add_circle_dark_24dp.xml b/app/src/main/res/drawable/ic_add_circle_dark_24dp.xml
new file mode 100644
index 0000000..7588c59
--- /dev/null
+++ b/app/src/main/res/drawable/ic_add_circle_dark_24dp.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_minus_circle_24dp.xml b/app/src/main/res/drawable/ic_minus_circle_24dp.xml
new file mode 100644
index 0000000..30a5f06
--- /dev/null
+++ b/app/src/main/res/drawable/ic_minus_circle_24dp.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_minus_circle_dark_24dp.xml b/app/src/main/res/drawable/ic_minus_circle_dark_24dp.xml
new file mode 100644
index 0000000..073883f
--- /dev/null
+++ b/app/src/main/res/drawable/ic_minus_circle_dark_24dp.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/layout/content_12h_number_grid.xml b/app/src/main/res/layout/content_12h_number_grid.xml
new file mode 100644
index 0000000..c856d7f
--- /dev/null
+++ b/app/src/main/res/layout/content_12h_number_grid.xml
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/content_24h_number_grid.xml b/app/src/main/res/layout/content_24h_number_grid.xml
new file mode 100644
index 0000000..f307e8d
--- /dev/null
+++ b/app/src/main/res/layout/content_24h_number_grid.xml
@@ -0,0 +1,91 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/content_minutes_number_grid.xml b/app/src/main/res/layout/content_minutes_number_grid.xml
new file mode 100644
index 0000000..caa3dbf
--- /dev/null
+++ b/app/src/main/res/layout/content_minutes_number_grid.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/dialog_time_picker_number_grid.xml b/app/src/main/res/layout/dialog_time_picker_number_grid.xml
new file mode 100644
index 0000000..0bd9493
--- /dev/null
+++ b/app/src/main/res/layout/dialog_time_picker_number_grid.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/element_24h_number_grid.xml b/app/src/main/res/layout/element_24h_number_grid.xml
new file mode 100644
index 0000000..00c37b3
--- /dev/null
+++ b/app/src/main/res/layout/element_24h_number_grid.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/element_number_grid.xml b/app/src/main/res/layout/element_number_grid.xml
new file mode 100644
index 0000000..2f3cfc2
--- /dev/null
+++ b/app/src/main/res/layout/element_number_grid.xml
@@ -0,0 +1,7 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml
index be15d56..7fbb160 100644
--- a/app/src/main/res/values/attrs.xml
+++ b/app/src/main/res/values/attrs.xml
@@ -9,4 +9,9 @@
+
+
+
+
+
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 3c61454..41904f0 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -26,6 +26,7 @@
- @dimen/grid_element_text_size
+
+