diff options
author | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2019-11-10 13:42:01 +0100 |
---|---|---|
committer | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2019-11-10 14:13:17 +0100 |
commit | 6b9e93e072f6c72fb5f5166700a17f48390255b5 (patch) | |
tree | b354db12dbcf12abc10dbc69f692440658d61644 | |
parent | e7d69f5153dec00db7e5febf7c6a22b287d4571d (diff) |
fix timer
while you could set a timer, it never was started, and thus also never
displayed as subtitle in the Actionbar....
Change-Id: I167404a2b4cf830f6b8e6ba37786cbb86dc7fc3d
-rw-r--r-- | android/sdremote/mobile/src/main/java/org/libreoffice/impressremote/fragment/TimerSettingDialog.java | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/android/sdremote/mobile/src/main/java/org/libreoffice/impressremote/fragment/TimerSettingDialog.java b/android/sdremote/mobile/src/main/java/org/libreoffice/impressremote/fragment/TimerSettingDialog.java index 785a8b3..519d3b6 100644 --- a/android/sdremote/mobile/src/main/java/org/libreoffice/impressremote/fragment/TimerSettingDialog.java +++ b/android/sdremote/mobile/src/main/java/org/libreoffice/impressremote/fragment/TimerSettingDialog.java @@ -15,14 +15,14 @@ import android.app.TimePickerDialog; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; -import android.support.v4.app.DialogFragment; +import android.support.v7.app.AppCompatDialogFragment; import android.support.v4.content.LocalBroadcastManager; import android.widget.TimePicker; import org.libreoffice.impressremote.R; import org.libreoffice.impressremote.util.Intents; -public class TimerSettingDialog extends DialogFragment implements TimePickerDialog.OnTimeSetListener, DialogInterface.OnClickListener { +public class TimerSettingDialog extends AppCompatDialogFragment implements TimePickerDialog.OnTimeSetListener { public static final String TAG = "TIMER_SETTING"; private static final int INITIAL_HOUR = 0; @@ -42,33 +42,14 @@ public class TimerSettingDialog extends DialogFragment implements TimePickerDial INITIAL_HOUR, INITIAL_MINUTE, IS_24_HOUR_VIEW); aDialog.setTitle(R.string.title_timer); - - aDialog.setButton(DialogInterface.BUTTON_POSITIVE, getString(R.string.button_start), this); + aDialog.setButton(TimePickerDialog.BUTTON_POSITIVE, getString(R.string.button_start), (DialogInterface.OnClickListener)null); return aDialog; } @Override public void onTimeSet(TimePicker aTimePicker, int aHour, int aMinute) { - mMinutes = getMinutes(aHour, aMinute); - } - - private int getMinutes(int aHours, int aMinutes) { - return (int) (TimeUnit.HOURS.toMinutes(aHours) + aMinutes); - } - - @Override - public void onClick(DialogInterface aDialogInterface, int aButtonId) { - getTimePickerDialog().onClick(aDialogInterface, aButtonId); - - startTimer(); - } - - private TimePickerDialog getTimePickerDialog() { - return (TimePickerDialog) getDialog(); - } - - private void startTimer() { + mMinutes = (int) (TimeUnit.HOURS.toMinutes(aHour) + aMinute); Intent aIntent = Intents.buildTimerStartedIntent(mMinutes); LocalBroadcastManager.getInstance(getActivity()).sendBroadcast(aIntent); } |