Added the tutorial texts en/de. Major progress towards Issue #4. and Issue #6. Continuous mode already works when swiping away the notification.

This commit is contained in:
Christopher Beckmann 2017-11-03 03:39:39 +01:00
commit 2bf53e9200
3 changed files with 38 additions and 24 deletions

View file

@ -3,6 +3,8 @@
package="org.secuso.privacyfriendlybreakreminder">
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application
android:allowBackup="true"
@ -111,6 +113,14 @@
android:enabled="true"
android:exported="false" />
<receiver android:name=".receivers.OnBootCompletedReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<receiver android:name=".receivers.TimerSchedulerReceiver"/>
</application>
</manifest>

View file

@ -139,23 +139,23 @@ public class ExerciseActivity extends AppCompatActivity implements android.suppo
private void initResources() {
dbHelper = new SQLiteHelper(this);
playButton = findViewById(R.id.button_playPause);
progressBar = findViewById(R.id.progressBar);
timerText = findViewById(R.id.timerText);
executionText = findViewById(R.id.execution);
descriptionText = findViewById(R.id.description);
exerciseImage = findViewById(R.id.exercise_image);
sectionText = findViewById(R.id.section);
repeatButton = findViewById(R.id.button_repeat);
exerciseContent = findViewById(R.id.exercise_layout);
continuousButton = findViewById(R.id.button_continuous);
prevButton = findViewById(R.id.button_prev);
nextButton = findViewById(R.id.button_next);
exerciseInfoButton = findViewById(R.id.exercise_info_button);
playButton = (ImageButton) findViewById(R.id.button_playPause);
progressBar = (ProgressBar) findViewById(R.id.progressBar);
timerText = (TextView) findViewById(R.id.timerText);
executionText = (TextView) findViewById(R.id.execution);
descriptionText = (TextView) findViewById(R.id.description);
exerciseImage = (ImageView) findViewById(R.id.exercise_image);
sectionText = (TextView) findViewById(R.id.section);
repeatButton = (ImageButton) findViewById(R.id.button_repeat);
exerciseContent = (ConstraintLayout) findViewById(R.id.exercise_layout);
continuousButton = (ImageButton) findViewById(R.id.button_continuous);
prevButton = (ImageButton) findViewById(R.id.button_prev);
nextButton = (ImageButton) findViewById(R.id.button_next);
exerciseInfoButton = (ImageButton) findViewById(R.id.exercise_info_button);
progressBarBig = findViewById(R.id.progressBarBig);
breakTimerTextBig = findViewById(R.id.breakTimerTextBig);
bigProgressBarLayout = findViewById(R.id.bigProgressBarLayout);
progressBarBig = (ProgressBar) findViewById(R.id.progressBarBig);
breakTimerTextBig = (TextView) findViewById(R.id.breakTimerTextBig);
bigProgressBarLayout = (ConstraintLayout) findViewById(R.id.bigProgressBarLayout);
setRepeatButtonStatus(repeatStatus);
setContinuousButtonStatus(continuousStatus);

View file

@ -12,7 +12,10 @@ import android.content.SharedPreferences;
import android.os.Binder;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.IBinder;
import android.os.Looper;
import android.preference.PreferenceManager;
import android.provider.Settings;
import android.support.v4.app.NotificationCompat;
@ -115,7 +118,7 @@ public class TimerService extends Service {
.setWhen(0)
.setOngoing(false)
.setAutoCancel(true)
.setSmallIcon(R.mipmap.ic_launcher)
.setSmallIcon(R.mipmap.ic_notification)
.setDefaults(Notification.DEFAULT_LIGHTS)
.setVibrate(new long[] { 0, 1000, 1000, 1000, 1000, 1000, 1000 })
.setSound(Settings.System.DEFAULT_NOTIFICATION_URI)
@ -153,7 +156,7 @@ public class TimerService extends Service {
unregisterReceiver(notificationPreferenceChangedReceiver);
}
public synchronized void startTimer(long duration) {
public synchronized void startTimer(final long duration) {
if(!isRunning) {
initialDuration = duration;
@ -170,10 +173,11 @@ public class TimerService extends Service {
sendBroadcast(broadcast);
}
}
}
public synchronized void pauseTimer() {
if(isRunning) {
if (isRunning) {
mTimer.cancel();
isRunning = false;
@ -192,7 +196,7 @@ public class TimerService extends Service {
}
public synchronized void resetTimer() {
if(isRunning) {
if (isRunning) {
mTimer.cancel();
mTimer = createTimer(initialDuration);
mTimer.start();
@ -203,7 +207,7 @@ public class TimerService extends Service {
}
public synchronized void stopAndResetTimer() {
if(isRunning) mTimer.cancel();
if (isRunning) mTimer.cancel();
isRunning = false;
remainingDuration = initialDuration;
@ -263,7 +267,7 @@ public class TimerService extends Service {
if (intent != null) {
String action = intent.getAction();
final String action = intent.getAction();
if (ACTION_START_TIMER.equals(action)) handleRestartTimer();
else if (ACTION_PAUSE_TIMER.equals(action)) pauseTimer();
@ -314,7 +318,7 @@ public class TimerService extends Service {
builder.setPriority(NotificationCompat.PRIORITY_DEFAULT);
builder.setWhen(0);
builder.setProgress((int) initialDuration, (int) (initialDuration - remainingDuration), false);
builder.setSmallIcon(R.mipmap.ic_launcher);
builder.setSmallIcon(R.mipmap.ic_notification);
builder.setOngoing(isRunning() || isPaused());
Intent intent = new Intent(this, TimerActivity.class);