summaryrefslogtreecommitdiffstats
path: root/src/com/cyanogenmod/setupwizard/setup/DateTimePage.java
diff options
context:
space:
mode:
authorDanesh M <daneshm90@gmail.com>2015-02-05 19:26:42 -0800
committerGerrit Code Review <gerrit@cyanogenmod.org>2015-02-06 19:29:47 +0000
commit8e52f6cac7314297b756550ce6b56ba2fe0530e1 (patch)
tree1fc3ab1b4cf7eeeae8204c0a5d2d5fb031bfa644 /src/com/cyanogenmod/setupwizard/setup/DateTimePage.java
parentcb291e170cdf977dbbac14af03a13d8fecfa9f48 (diff)
downloadpackages_apps_SetupWizard-8e52f6cac7314297b756550ce6b56ba2fe0530e1.zip
packages_apps_SetupWizard-8e52f6cac7314297b756550ce6b56ba2fe0530e1.tar.gz
packages_apps_SetupWizard-8e52f6cac7314297b756550ce6b56ba2fe0530e1.tar.bz2
SetupWizard : Support rotation for date/time picker
Fix crashes Change-Id: I7d0a7088f2c65949ee15f4f0d05c74ffce45ba64
Diffstat (limited to 'src/com/cyanogenmod/setupwizard/setup/DateTimePage.java')
-rw-r--r--src/com/cyanogenmod/setupwizard/setup/DateTimePage.java29
1 files changed, 7 insertions, 22 deletions
diff --git a/src/com/cyanogenmod/setupwizard/setup/DateTimePage.java b/src/com/cyanogenmod/setupwizard/setup/DateTimePage.java
index 14b8e82..39d3f85 100644
--- a/src/com/cyanogenmod/setupwizard/setup/DateTimePage.java
+++ b/src/com/cyanogenmod/setupwizard/setup/DateTimePage.java
@@ -181,13 +181,13 @@ public class DateTimePage extends SetupPage {
private void showDatePicker() {
DatePickerFragment datePickerFragment = DatePickerFragment.newInstance();
- datePickerFragment.setOnDateSetListener(this);
+ datePickerFragment.setTargetFragment(this, 0);
datePickerFragment.show(getFragmentManager(), DatePickerFragment.TAG);
}
private void showTimePicker() {
TimePickerFragment timePickerFragment = TimePickerFragment.newInstance();
- timePickerFragment.setOnTimeSetListener(this);
+ timePickerFragment.setTargetFragment(this, 0);
timePickerFragment.show(getFragmentManager(), TimePickerFragment.TAG);
}
@@ -395,26 +395,18 @@ public class DateTimePage extends SetupPage {
}
}
- private static class TimePickerFragment extends DialogFragment implements TimePickerDialog.OnTimeSetListener {
+ public static class TimePickerFragment extends DialogFragment implements TimePickerDialog.OnTimeSetListener {
private static String TAG = TimePickerFragment.class.getSimpleName();
- private TimePickerDialog.OnTimeSetListener mOnTimeSetListener;
-
public static TimePickerFragment newInstance() {
TimePickerFragment frag = new TimePickerFragment();
return frag;
}
- private void setOnTimeSetListener(TimePickerDialog.OnTimeSetListener onTimeSetListener) {
- mOnTimeSetListener = onTimeSetListener;
- }
-
@Override
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
- if (mOnTimeSetListener != null) {
- mOnTimeSetListener.onTimeSet(view, hourOfDay, minute);
- }
+ ((DateTimeFragment) getTargetFragment()).onTimeSet(view, hourOfDay, minute);
}
@Override
@@ -428,28 +420,21 @@ public class DateTimePage extends SetupPage {
DateFormat.is24HourFormat(getActivity()));
}
+
}
- private static class DatePickerFragment extends DialogFragment implements DatePickerDialog.OnDateSetListener {
+ public static class DatePickerFragment extends DialogFragment implements DatePickerDialog.OnDateSetListener {
private static String TAG = DatePickerFragment.class.getSimpleName();
- private DatePickerDialog.OnDateSetListener mOnDateSetListener;
-
public static DatePickerFragment newInstance() {
DatePickerFragment frag = new DatePickerFragment();
return frag;
}
- private void setOnDateSetListener(DatePickerDialog.OnDateSetListener onDateSetListener) {
- mOnDateSetListener = onDateSetListener;
- }
-
@Override
public void onDateSet(DatePicker view, int year, int month, int day) {
- if (mOnDateSetListener != null) {
- mOnDateSetListener.onDateSet(view, year, month, day);
- }
+ ((DateTimeFragment) getTargetFragment()).onDateSet(view, year, month, day);
}
@Override