Created NumberGrid time picker
This commit is contained in:
parent
886f10b06c
commit
cf17ba5014
@ -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.
|
// 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
|
// So the next time we call show() on it, the input field will show the
|
||||||
// last inputted time.
|
// 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() {
|
private void setWeekDaysText() {
|
||||||
|
|||||||
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
9
app/src/main/res/drawable/ic_add_circle_24dp.xml
Normal file
9
app/src/main/res/drawable/ic_add_circle_24dp.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#8c8c8c"
|
||||||
|
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM17,13h-4v4h-2v-4L7,13v-2h4L11,7h2v4h4v2z"/>
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/ic_add_circle_dark_24dp.xml
Normal file
9
app/src/main/res/drawable/ic_add_circle_dark_24dp.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFF"
|
||||||
|
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM17,13h-4v4h-2v-4L7,13v-2h4L11,7h2v4h4v2z"/>
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/ic_minus_circle_24dp.xml
Normal file
9
app/src/main/res/drawable/ic_minus_circle_24dp.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#8c8c8c"
|
||||||
|
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM17,13L7,13v-2h10v2z"/>
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/ic_minus_circle_dark_24dp.xml
Normal file
9
app/src/main/res/drawable/ic_minus_circle_dark_24dp.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFF"
|
||||||
|
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM17,13L7,13v-2h10v2z"/>
|
||||||
|
</vector>
|
||||||
80
app/src/main/res/layout/content_12h_number_grid.xml
Normal file
80
app/src/main/res/layout/content_12h_number_grid.xml
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
|
<!-- TODO: Define another style with LWW and LHW -->
|
||||||
|
<!-- TODO: Use a fixed height so the circular indicator doesn't stretch into an oval. -->
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/GridLayoutNumpadButton"
|
||||||
|
app:layout_gravity="center"
|
||||||
|
android:text="1"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/GridLayoutNumpadButton"
|
||||||
|
app:layout_gravity="center"
|
||||||
|
android:text="2"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/GridLayoutNumpadButton"
|
||||||
|
app:layout_gravity="center"
|
||||||
|
android:text="3"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/GridLayoutNumpadButton"
|
||||||
|
app:layout_gravity="center"
|
||||||
|
android:text="4"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/GridLayoutNumpadButton"
|
||||||
|
app:layout_gravity="center"
|
||||||
|
android:text="5"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/GridLayoutNumpadButton"
|
||||||
|
app:layout_gravity="center"
|
||||||
|
android:text="6"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/GridLayoutNumpadButton"
|
||||||
|
app:layout_gravity="center"
|
||||||
|
android:text="7"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/GridLayoutNumpadButton"
|
||||||
|
app:layout_gravity="center"
|
||||||
|
android:text="8"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/GridLayoutNumpadButton"
|
||||||
|
app:layout_gravity="center"
|
||||||
|
android:text="9"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/GridLayoutNumpadButton"
|
||||||
|
app:layout_gravity="center"
|
||||||
|
android:text="10"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/GridLayoutNumpadButton"
|
||||||
|
app:layout_gravity="center"
|
||||||
|
android:text="11"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/GridLayoutNumpadButton"
|
||||||
|
app:layout_gravity="center"
|
||||||
|
android:text="12"/>
|
||||||
|
|
||||||
|
</merge>
|
||||||
91
app/src/main/res/layout/content_24h_number_grid.xml
Normal file
91
app/src/main/res/layout/content_24h_number_grid.xml
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
|
<!-- TODO: Define a grid item style with the first 3 attrs-->
|
||||||
|
<com.philliphsu.clock2.editalarm.TwentyFourHourGridItem
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_gravity="center"
|
||||||
|
style="@style/GridLayoutNumpadElement"
|
||||||
|
app:primaryText="00"
|
||||||
|
app:secondaryText="12"/>
|
||||||
|
<com.philliphsu.clock2.editalarm.TwentyFourHourGridItem
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_gravity="center"
|
||||||
|
style="@style/GridLayoutNumpadElement"
|
||||||
|
app:primaryText="01"
|
||||||
|
app:secondaryText="13"/>
|
||||||
|
<com.philliphsu.clock2.editalarm.TwentyFourHourGridItem
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_gravity="center"
|
||||||
|
style="@style/GridLayoutNumpadElement"
|
||||||
|
app:primaryText="02"
|
||||||
|
app:secondaryText="14"/>
|
||||||
|
<com.philliphsu.clock2.editalarm.TwentyFourHourGridItem
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_gravity="center"
|
||||||
|
style="@style/GridLayoutNumpadElement"
|
||||||
|
app:primaryText="03"
|
||||||
|
app:secondaryText="15"/>
|
||||||
|
<com.philliphsu.clock2.editalarm.TwentyFourHourGridItem
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_gravity="center"
|
||||||
|
style="@style/GridLayoutNumpadElement"
|
||||||
|
app:primaryText="04"
|
||||||
|
app:secondaryText="16"/>
|
||||||
|
<com.philliphsu.clock2.editalarm.TwentyFourHourGridItem
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_gravity="center"
|
||||||
|
style="@style/GridLayoutNumpadElement"
|
||||||
|
app:primaryText="05"
|
||||||
|
app:secondaryText="17"/>
|
||||||
|
<com.philliphsu.clock2.editalarm.TwentyFourHourGridItem
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_gravity="center"
|
||||||
|
style="@style/GridLayoutNumpadElement"
|
||||||
|
app:primaryText="06"
|
||||||
|
app:secondaryText="18"/>
|
||||||
|
<com.philliphsu.clock2.editalarm.TwentyFourHourGridItem
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_gravity="center"
|
||||||
|
style="@style/GridLayoutNumpadElement"
|
||||||
|
app:primaryText="07"
|
||||||
|
app:secondaryText="19"/>
|
||||||
|
<com.philliphsu.clock2.editalarm.TwentyFourHourGridItem
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_gravity="center"
|
||||||
|
style="@style/GridLayoutNumpadElement"
|
||||||
|
app:primaryText="08"
|
||||||
|
app:secondaryText="20"/>
|
||||||
|
<com.philliphsu.clock2.editalarm.TwentyFourHourGridItem
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_gravity="center"
|
||||||
|
style="@style/GridLayoutNumpadElement"
|
||||||
|
app:primaryText="09"
|
||||||
|
app:secondaryText="21"/>
|
||||||
|
<com.philliphsu.clock2.editalarm.TwentyFourHourGridItem
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_gravity="center"
|
||||||
|
style="@style/GridLayoutNumpadElement"
|
||||||
|
app:primaryText="10"
|
||||||
|
app:secondaryText="22"/>
|
||||||
|
<com.philliphsu.clock2.editalarm.TwentyFourHourGridItem
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_gravity="center"
|
||||||
|
style="@style/GridLayoutNumpadElement"
|
||||||
|
app:primaryText="11"
|
||||||
|
app:secondaryText="23"/>
|
||||||
|
|
||||||
|
</merge>
|
||||||
32
app/src/main/res/layout/content_minutes_number_grid.xml
Normal file
32
app/src/main/res/layout/content_minutes_number_grid.xml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
|
<include layout="@layout/element_number_grid"/>
|
||||||
|
<include layout="@layout/element_number_grid"/>
|
||||||
|
<include layout="@layout/element_number_grid"/>
|
||||||
|
<include layout="@layout/element_number_grid"/>
|
||||||
|
<include layout="@layout/element_number_grid"/>
|
||||||
|
<include layout="@layout/element_number_grid"/>
|
||||||
|
<include layout="@layout/element_number_grid"/>
|
||||||
|
<include layout="@layout/element_number_grid"/>
|
||||||
|
<include layout="@layout/element_number_grid"/>
|
||||||
|
<include layout="@layout/element_number_grid"/>
|
||||||
|
<include layout="@layout/element_number_grid"/>
|
||||||
|
<include layout="@layout/element_number_grid"/>
|
||||||
|
|
||||||
|
<!-- TODO: Use fixed width and height -->
|
||||||
|
<ImageButton
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/GridLayoutNumpadElement"
|
||||||
|
android:src="@drawable/ic_minus_circle_24dp"
|
||||||
|
app:layout_column="1"/>
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/GridLayoutNumpadElement"
|
||||||
|
android:src="@drawable/ic_add_circle_24dp"
|
||||||
|
app:layout_column="2"/>
|
||||||
|
</merge>
|
||||||
31
app/src/main/res/layout/dialog_time_picker_number_grid.xml
Normal file
31
app/src/main/res/layout/dialog_time_picker_number_grid.xml
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<com.philliphsu.clock2.editalarm.NumberGrid
|
||||||
|
android:id="@+id/grid"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/numpad_height"/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_below="@id/grid">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="AM"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="PM"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
16
app/src/main/res/layout/element_24h_number_grid.xml
Normal file
16
app/src/main/res/layout/element_24h_number_grid.xml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<merge xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/primary"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="@color/colorPrimary"
|
||||||
|
android:textSize="@dimen/grid_element_text_size"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/secondary"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
</merge>
|
||||||
7
app/src/main/res/layout/element_number_grid.xml
Normal file
7
app/src/main/res/layout/element_number_grid.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/GridLayoutNumpadButton"
|
||||||
|
android:text="1"
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"/>
|
||||||
@ -9,4 +9,9 @@
|
|||||||
<attr name="metaButtonBarButtonStyle" format="reference"/>
|
<attr name="metaButtonBarButtonStyle" format="reference"/>
|
||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
|
|
||||||
|
<declare-styleable name="TwentyFourHourGridItem">
|
||||||
|
<attr name="primaryText" format="string"/>
|
||||||
|
<attr name="secondaryText" format="string"/>
|
||||||
|
</declare-styleable>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@ -26,6 +26,7 @@
|
|||||||
<item name="android:textSize">@dimen/grid_element_text_size</item>
|
<item name="android:textSize">@dimen/grid_element_text_size</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<!-- TODO: Rename to GridLayoutElement -->
|
||||||
<style name="GridLayoutNumpadElement">
|
<style name="GridLayoutNumpadElement">
|
||||||
<!-- http://stackoverflow.com/a/6868308/5055032
|
<!-- http://stackoverflow.com/a/6868308/5055032
|
||||||
Leave off the namespace to reference a custom attribute.
|
Leave off the namespace to reference a custom attribute.
|
||||||
@ -35,6 +36,7 @@
|
|||||||
<item name="android:background">?android:attr/selectableItemBackground</item>
|
<item name="android:background">?android:attr/selectableItemBackground</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<!-- TODO: Rename to GridLayout[Text/Button/TextView]? -->
|
||||||
<style name="GridLayoutNumpadButton" parent="GridLayoutNumpadElement">
|
<style name="GridLayoutNumpadButton" parent="GridLayoutNumpadElement">
|
||||||
<item name="android:textSize">@dimen/grid_element_text_size</item>
|
<item name="android:textSize">@dimen/grid_element_text_size</item>
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user