Updated layout of NumpadTimePickerDialog
This commit is contained in:
parent
3732246bb7
commit
abd1551bc3
@ -64,7 +64,7 @@ public class ExpandedAlarmViewHolder extends BaseAlarmViewHolder {
|
||||
super.bindLabel(true, label);
|
||||
}
|
||||
|
||||
@OnClick(R.id.save)
|
||||
@OnClick(R.id.ok)
|
||||
void save() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@ -4,13 +4,12 @@ import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.philliphsu.clock2.R;
|
||||
|
||||
import butterknife.Bind;
|
||||
import butterknife.OnClick;
|
||||
import butterknife.OnTouch;
|
||||
|
||||
/**
|
||||
* Created by Phillip Hsu on 7/12/2016.
|
||||
@ -39,9 +38,9 @@ public class NumpadTimePickerDialog extends BaseTimePickerDialog
|
||||
private int[] mInputtedDigits;
|
||||
|
||||
// Don't need to keep a reference to the dismiss ImageButton
|
||||
@Bind(R.id.input_time) EditText mInputField;
|
||||
@Bind(R.id.input_time) TextView mInputField;
|
||||
@Bind(R.id.number_grid) NumpadTimePicker mNumpad;
|
||||
@Bind(R.id.focus_grabber) View mFocusGrabber;
|
||||
// @Bind(R.id.focus_grabber) View mFocusGrabber;
|
||||
|
||||
// TODO: We don't need to pass in an initial hour and minute for a new instance.
|
||||
@Deprecated
|
||||
@ -84,7 +83,7 @@ public class NumpadTimePickerDialog extends BaseTimePickerDialog
|
||||
mNumpad.setOnInputChangeListener(this);
|
||||
mNumpad.insertDigits(mInputtedDigits); // TOneverDO: before mNumpad.setOnInputChangeListener(this);
|
||||
// Show the cursor immediately
|
||||
mInputField.requestFocus();
|
||||
// mInputField.requestFocus();
|
||||
// TODO: Disabled color
|
||||
//updateInputText(""); // Primarily to disable 'OK'
|
||||
return view;
|
||||
@ -122,14 +121,14 @@ public class NumpadTimePickerDialog extends BaseTimePickerDialog
|
||||
@Override
|
||||
public void onInputDisabled() {
|
||||
// Steals the focus from the EditText
|
||||
mFocusGrabber.requestFocus();
|
||||
// mFocusGrabber.requestFocus();
|
||||
}
|
||||
|
||||
@OnTouch(R.id.input_time)
|
||||
boolean captureTouchOnEditText() {
|
||||
// Capture touch events on the EditText field, because we want it to do nothing.
|
||||
return true;
|
||||
}
|
||||
// @OnTouch(R.id.input_time)
|
||||
// boolean captureTouchOnEditText() {
|
||||
// // Capture touch events on the EditText field, because we want it to do nothing.
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// The FAB is not defined directly in this dialog's layout, but rather in the layout
|
||||
// of the NumpadTimePicker. We can always reference a child of a ViewGroup that is
|
||||
@ -144,11 +143,11 @@ public class NumpadTimePickerDialog extends BaseTimePickerDialog
|
||||
|
||||
private void updateInputText(String inputText) {
|
||||
TimeTextUtils.setText(inputText, mInputField);
|
||||
// Move the cursor
|
||||
mInputField.setSelection(mInputField.length());
|
||||
if (mFocusGrabber.isFocused()) {
|
||||
// Return focus to the EditText
|
||||
mInputField.requestFocus();
|
||||
}
|
||||
// // Move the cursor
|
||||
// mInputField.setSelection(mInputField.length());
|
||||
// if (mFocusGrabber.isFocused()) {
|
||||
// // Return focus to the EditText
|
||||
// mInputField.requestFocus();
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,11 +20,13 @@
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_gravity="center"
|
||||
app:layout_column="1"
|
||||
android:src="@drawable/ic_done_24dp"/>
|
||||
android:src="@drawable/ic_done_24dp"
|
||||
android:layout_marginBottom="@dimen/numeric_keypad_fab_bottom_margin"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/backspace"
|
||||
android:src="@drawable/ic_backspace_24dp"
|
||||
android:layout_height="@dimen/numeric_keypad_backspace_height"
|
||||
style="@style/GridLayoutNumpadElement"
|
||||
app:layout_column="2"/>
|
||||
|
||||
|
||||
@ -7,30 +7,29 @@ doesn't work. -->
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<EditText
|
||||
<TextView
|
||||
android:id="@+id/input_time"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="@dimen/numeric_keypad_output_box_height"
|
||||
android:gravity="center"
|
||||
android:textSize="@dimen/time_input_text_size"
|
||||
android:background="@android:color/transparent"/>
|
||||
android:textSize="@dimen/text_size_display_3"
|
||||
android:fontFamily="sans-serif-light"
|
||||
style="@style/TextAppearance.AppCompat"/>
|
||||
|
||||
<View style="@style/FocusGrabber"
|
||||
android:id="@+id/focus_grabber"/>
|
||||
<!--<View style="@style/FocusGrabber"
|
||||
android:id="@+id/focus_grabber"/>-->
|
||||
|
||||
<View style="@style/Divider.Horizontal"
|
||||
android:id="@+id/header_divider"
|
||||
android:layout_below="@id/input_time"/>
|
||||
|
||||
<!-- TODO: Adjust margins -->
|
||||
<com.philliphsu.clock2.editalarm.NumpadTimePicker
|
||||
android:id="@+id/number_grid"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="310dp"
|
||||
android:layout_height="@dimen/numeric_keypad_height"
|
||||
android:layout_below="@id/header_divider"
|
||||
android:layout_marginTop="@dimen/bottom_sheet_vertical_space"
|
||||
android:layout_marginStart="@dimen/bottom_sheet_edge_margin"
|
||||
android:layout_marginEnd="@dimen/bottom_sheet_edge_margin"
|
||||
android:paddingBottom="@dimen/bottom_sheet_edge_margin"/>
|
||||
android:layout_marginEnd="@dimen/bottom_sheet_edge_margin"/>
|
||||
|
||||
</RelativeLayout>
|
||||
7
app/src/main/res/values-v21/dimens.xml
Normal file
7
app/src/main/res/values-v21/dimens.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- 4 x (numeric_keypad_cell_height) + 56dp FAB height + 16dp FAB bottom margin -->
|
||||
<dimen name="numeric_keypad_height">328dp</dimen>
|
||||
<dimen name="numeric_keypad_backspace_height">56dp</dimen> <!-- Same as FAB height -->
|
||||
<dimen name="numeric_keypad_fab_bottom_margin">16dp</dimen>
|
||||
</resources>
|
||||
@ -17,10 +17,12 @@
|
||||
<dimen name="half_day_text_size">17sp</dimen>
|
||||
|
||||
<!-- NumpadTimePickerDialog -->
|
||||
<dimen name="numpad_height">300dp</dimen>
|
||||
<dimen name="time_input_text_size">45sp</dimen>
|
||||
<dimen name="viewpager_bottom_padding">88dp
|
||||
</dimen> <!-- 56dp fab size + 16dp top margin + 16dp bottom margin -->
|
||||
<dimen name="numpad_height">300dp</dimen> <!-- TODO: Deprecated -->
|
||||
<dimen name="numeric_keypad_cell_height">64dp</dimen>
|
||||
<dimen name="numeric_keypad_output_box_height">80dp</dimen>
|
||||
<dimen name="numeric_keypad_height">344dp</dimen> <!-- 4 x (numeric_keypad_cell_height) + 88dp pre-21 FAB height -->
|
||||
<dimen name="numeric_keypad_backspace_height">88dp</dimen> <!-- Same as pre-21 FAB height -->
|
||||
<dimen name="numeric_keypad_fab_bottom_margin">0dp</dimen> <!-- 88dp height already big enough -->
|
||||
|
||||
<!-- Bottom sheet specs -->
|
||||
<dimen name="bottom_sheet_edge_margin">24dp</dimen>
|
||||
|
||||
@ -35,14 +35,16 @@
|
||||
Leave off the namespace to reference a custom attribute.
|
||||
Here, we are referencing the "grid:" namespace -->
|
||||
<item name="layout_columnWeight">1</item>
|
||||
<item name="layout_rowWeight">1</item>
|
||||
<!--<item name="layout_rowWeight">1</item>-->
|
||||
<item name="android:layout_height">@dimen/numeric_keypad_cell_height</item>
|
||||
<item name="android:background">?android:attr/selectableItemBackground</item>
|
||||
<item name="android:gravity">center</item>
|
||||
</style>
|
||||
|
||||
<!-- TODO: Rename to GridLayout[Text/Button/TextView]? -->
|
||||
<style name="GridLayoutNumpadButton" parent="GridLayoutNumpadElement">
|
||||
<item name="android:textSize">@dimen/grid_element_text_size</item>
|
||||
<item name="android:textSize">@dimen/text_size_display_1</item>
|
||||
<item name="android:fontFamily">sans-serif-light</item>
|
||||
</style>
|
||||
|
||||
<!-- TODO: Replace and Delete -->
|
||||
|
||||
Loading…
Reference in New Issue
Block a user