Created focus grabber for time input field
This commit is contained in:
@@ -66,7 +66,7 @@ public abstract class GridLayoutNumpad extends GridLayout implements View.OnClic
|
||||
/**
|
||||
* @return the number of digits we can input
|
||||
*/
|
||||
protected abstract int capacity();
|
||||
public abstract int capacity();
|
||||
|
||||
/**
|
||||
* @return the layout resource that defines the children for this numpad
|
||||
@@ -102,7 +102,7 @@ public abstract class GridLayoutNumpad extends GridLayout implements View.OnClic
|
||||
/**
|
||||
* @return the number of digits inputted
|
||||
*/
|
||||
protected final int count() {
|
||||
public final int count() {
|
||||
return mCount;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ public class NumpadTimePicker extends GridLayoutNumpad implements TimePicker {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int capacity() {
|
||||
public int capacity() {
|
||||
return MAX_DIGITS;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ public class NumpadTimePickerDialog extends DialogFragment implements NumpadTime
|
||||
// Don't need to keep a reference to the dismiss ImageButton
|
||||
@Bind(R.id.input_time) EditText mInputField;
|
||||
@Bind(R.id.number_grid) NumpadTimePicker mNumpad;
|
||||
@Bind(R.id.focus_grabber) View mFocusGrabber;
|
||||
|
||||
public NumpadTimePickerDialog() {
|
||||
// Empty constructor required for dialog fragment.
|
||||
@@ -156,5 +157,8 @@ public class NumpadTimePickerDialog extends DialogFragment implements NumpadTime
|
||||
mInputField.setText(inputText);
|
||||
// Move the cursor
|
||||
mInputField.setSelection(mInputField.length());
|
||||
if (mNumpad.count() == mNumpad.capacity()) {
|
||||
mFocusGrabber.requestFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user