Added missing german texts and added automatic timer updates, when the set time is bigger than the chosen time

This commit is contained in:
Christopher Beckmann 2018-08-07 14:00:08 +02:00
commit c955b3fe98
5 changed files with 22 additions and 7 deletions

View file

@ -11,6 +11,7 @@ import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.content.SharedPreferences;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.IBinder;
import android.preference.PreferenceManager;
import android.support.v4.app.ActivityCompat;
@ -204,6 +205,7 @@ public class TimerActivity extends BaseActivity implements android.support.v4.ap
Toast toast = Toast.makeText(TimerActivity.this, R.string.toast_not_enough_exercise_time, Toast.LENGTH_SHORT);
toast.setGravity(toast.getGravity(), 0, 250);
toast.show();
saveCurrentSetBreakTime();
}
}
}
@ -322,10 +324,19 @@ public class TimerActivity extends BaseActivity implements android.support.v4.ap
private void saveCurrentSetBreakTime() {
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this);
pref.edit()
SharedPreferences.Editor editor = pref.edit()
.putInt(FirstLaunchManager.PREF_BREAK_PICKER_SECONDS, secondsBreakPicker.getValue())
.putInt(FirstLaunchManager.PREF_BREAK_PICKER_MINUTES, minutesBreakPicker.getValue())
.putLong(PAUSE_TIME, getCurrentSetBreakTime()).apply();
.putInt(FirstLaunchManager.PREF_BREAK_PICKER_MINUTES, minutesBreakPicker.getValue());
ExerciseSet set = getCurrentSelectedExerciseSet();
long seconds = set.getExerciseSetTime(this);
if(seconds * 1000 > getCurrentSetBreakTime()) {
editor.putLong(PAUSE_TIME, seconds * 1000).apply();
} else {
editor.putLong(PAUSE_TIME, getCurrentSetBreakTime()).apply();
}
}
private void saveCurrentSetDuration() {

View file

@ -74,7 +74,7 @@ public class FirstLaunchManager {
.putLong(DEFAULT_EXERCISE_SET, 0L)
.putLong(PAUSE_TIME, 5 * 60 * 1000) // 5 minutes
.putBoolean(REPEAT_STATUS, false)
.putBoolean(REPEAT_EXERCISES, false)
.putBoolean(REPEAT_EXERCISES, true)
.putBoolean(PREF_HIDE_DEFAULT_SETS, false)
.putInt(PREF_BREAK_PICKER_SECONDS, 0)
.putInt(PREF_BREAK_PICKER_MINUTES, 5)

View file

@ -51,7 +51,7 @@ public class TimerService extends Service {
public static final String ACTION_STOP_TIMER = TAG + "ACTION_STOP_TIMER";
public static final String ACTION_SNOOZE_TIMER = TAG + "ACTION_SNOOZE_TIMER";
private static final int UPDATE_INTERVAL = 100;
private static final int UPDATE_INTERVAL = 125;
public static final int NOTIFICATION_ID = 31337;
private TimerServiceBinder mBinder = new TimerServiceBinder();

View file

@ -159,5 +159,9 @@
<string name="activity_exercise_button_repeat_off">Übungen nicht wiederholen</string>
<string name="activity_exercise_button_continuous_on">Zeit automatisch starten</string>
<string name="activity_exercise_button_continuous_off">Zeit manuell starten</string>
<string name="exercise_time">Übungszeit: %s</string>
<string name="dialog_warning_not_enough_exercise_time">Die ausgewählte Übungszeit ist zu kurz, um das gewählte Übungsset abzuschließen. Die Übungszeit wird automatisch angepasst. Möchten Sie den Timer starten?</string>
<string name="warning">Achtung</string>
<string name="toast_not_enough_exercise_time">Die gewählte Übungszeit ist nicht ausreichend, um das gewählte Übungsset abzuschließen. Die Zeit wurde automatisch angepasst.</string>
</resources>

View file

@ -153,9 +153,9 @@
<string name="activity_exercise_button_continuous_on">start timers automatically</string>
<string name="activity_exercise_button_continuous_off">start timers manually</string>
<string name="exercise_time">Execise Time:\n%s</string>
<string name="dialog_warning_not_enough_exercise_time">The chosen exercise time is too short to finish the selected exercise set. Are you sure you want to start the timer?</string>
<string name="dialog_warning_not_enough_exercise_time">The chosen exercise time is too short to finish the selected exercise set. The time will automatically be adjusted. Are you sure you want to start the timer?</string>
<string name="warning">Warning</string>
<string name="toast_not_enough_exercise_time">The currently selected exercise time is not sufficient to complete the chosen exercise set.</string>
<string name="toast_not_enough_exercise_time">The currently selected exercise time is not sufficient to complete the chosen exercise set. The time has been adjusted.</string>
</resources>