New numpad time picker layout

This commit is contained in:
Phillip Hsu
2016-07-15 23:43:55 -07:00
parent 69d8812c4a
commit 231aa9a280
6 changed files with 110 additions and 100 deletions
@@ -17,4 +17,31 @@
grid:layout_rowWeight="1"
grid:layout_columnWeight="1"
grid:layout_column="2"/>
<!-- Used to properly position the FAB -->
<FrameLayout
android:layout_width="0dp"
android:layout_height="0dp"
grid:layout_rowWeight="1"
grid:layout_columnWeight="1"
grid:layout_column="1">
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_done_24dp"
android:layout_gravity="center"/>
</FrameLayout>
<ImageButton
android:id="@+id/backspace"
android:layout_width="0dp"
android:layout_height="0dp"
android:src="@drawable/ic_backspace_24dp"
android:background="?selectableItemBackground"
grid:layout_rowWeight="1"
grid:layout_columnWeight="1"
grid:layout_column="2"/>
</merge>
@@ -1,70 +1,43 @@
<?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">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageButton
android:id="@+id/backspace"
android:layout_width="@dimen/header_height"
android:layout_height="@dimen/header_height"
android:src="@drawable/ic_backspace_24dp"
android:background="?selectableItemBackground"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"/>
<!-- TODO: Consider changing to TextView if you don't
want the cursor after all. A reason you may want to do
so is the cursor is getting cut off, most likely because
of the text size being larger than the view bounds. You can
probably solve this by adding some padding. Another reason is
the cursor looks ugly with it blinking. -->
<EditText
android:id="@+id/input"
android:layout_width="wrap_content"
android:layout_height="@dimen/header_height"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="true"
android:background="@android:color/transparent"
android:textSize="@dimen/time_input_text_size"
android:focusable="false"
android:focusableInTouchMode="false"/>
<View
android:id="@+id/divider"
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?android:listDivider"
android:layout_below="@id/input"/>
android:layout_height="@dimen/header_height"
android:background="@color/colorPrimary">
<ImageButton
android:id="@+id/cancel_icon"
android:layout_width="@dimen/cancel_icon_size"
android:layout_height="match_parent"
android:src="@android:drawable/ic_menu_close_clear_cancel"
android:background="?selectableItemBackground"
android:layout_alignParentStart="true"/>
<!-- We want this to be an EditText because the cursor indicates
where the user's input will go. Otherwise, when the dialog first
opens, the user sees the header view as just an appbar that has
a single navigation icon, with no indication that the dialog
actually displays input. -->
<EditText
android:id="@+id/input_time"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toEndOf="@id/cancel_icon"
android:layout_centerInParent="true"
android:textSize="@dimen/time_input_text_size"
android:text="12:00 AM"
android:background="@null"
style="@style/TextAppearance.AppCompat.Inverse"/>
</RelativeLayout>
<com.philliphsu.clock2.editalarm.NumpadTimePicker
android:id="@+id/number_grid"
android:layout_width="match_parent"
android:layout_height="@dimen/numpad_height"
android:layout_below="@id/divider"/>
android:layout_height="@dimen/numpad_height"/>
<LinearLayout
android:id="@+id/actions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_below="@id/number_grid">
<Button
android:id="@+id/cancel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="CANCEL"
style="@style/Widget.AppCompat.Button.Borderless.Colored"/>
<Button
android:id="@+id/ok"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="OK"
style="@style/Widget.AppCompat.Button.Borderless.Colored"/>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
+2 -1
View File
@@ -15,5 +15,6 @@
<!-- NumpadTimePickerDialog -->
<dimen name="header_height">72dp</dimen>
<dimen name="numpad_height">270dp</dimen>
<dimen name="time_input_text_size">40sp</dimen>
<dimen name="time_input_text_size">45sp</dimen>
<dimen name="cancel_icon_size">56dp</dimen>
</resources>