Time picker style preference implemented
This commit is contained in:
parent
6f2adb6eb1
commit
6585cca738
@ -5,6 +5,7 @@ import android.media.RingtoneManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.annotation.StringRes;
|
||||
import android.support.design.widget.CoordinatorLayout;
|
||||
import android.support.v4.app.LoaderManager;
|
||||
@ -321,14 +322,23 @@ 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.
|
||||
// TODO: Read preferences to see what time picker style to show.
|
||||
BaseTimePickerDialog dialog;
|
||||
dialog = NumberGridTimePickerDialog.newInstance(
|
||||
this, // OnTimeSetListener
|
||||
0, // Initial hour of day
|
||||
0, // Initial minute
|
||||
DateFormat.is24HourFormat(this));
|
||||
// dialog = NumpadTimePickerDialog.newInstance(this);
|
||||
BaseTimePickerDialog dialog = null;
|
||||
String numpadStyle = getString(R.string.number_pad);
|
||||
String gridStyle = getString(R.string.grid_selector);
|
||||
String prefTimePickerStyle = PreferenceManager.getDefaultSharedPreferences(this).getString(
|
||||
// key for the preference value to retrieve
|
||||
getString(R.string.key_time_picker_style),
|
||||
// default value
|
||||
numpadStyle);
|
||||
if (prefTimePickerStyle.equals(numpadStyle)) {
|
||||
dialog = NumpadTimePickerDialog.newInstance(this);
|
||||
} else if (prefTimePickerStyle.equals(gridStyle)) {
|
||||
dialog = NumberGridTimePickerDialog.newInstance(
|
||||
this, // OnTimeSetListener
|
||||
0, // Initial hour of day
|
||||
0, // Initial minute
|
||||
DateFormat.is24HourFormat(this));
|
||||
}
|
||||
dialog.show(getSupportFragmentManager(), TAG_TIME_PICKER);
|
||||
}
|
||||
|
||||
|
||||
@ -5,11 +5,15 @@
|
||||
<!-- Time picker style -->
|
||||
<string name="key_time_picker_style">key_time_picker_style</string>
|
||||
<string name="title_time_picker_style">Time picker style</string>
|
||||
<string name="number_pad">Number pad</string>
|
||||
<string name="radial_clock">Radial clock</string>
|
||||
<!-- Internally, we refer to this picker as a numpad because it's concise.
|
||||
However, "numeric keypad" is more descriptive when describing the style to users. -->
|
||||
<string name="number_pad">Numeric keypad</string>
|
||||
<!--<string name="radial_clock">Radial clock</string>-->
|
||||
<string name="grid_selector">Grid selector</string>
|
||||
<string-array name="array_time_picker_styles">
|
||||
<item>@string/number_pad</item>
|
||||
<item>@string/radial_clock</item>
|
||||
<!--<item>@string/radial_clock</item>-->
|
||||
<item>@string/grid_selector</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Silence after -->
|
||||
|
||||
Loading…
Reference in New Issue
Block a user