Fixed the FAB position in the EditExerciseSetActivity
This commit is contained in:
parent
cd04770bc7
commit
a95b02c009
12 changed files with 87 additions and 83 deletions
|
|
@ -104,10 +104,12 @@ public class EditExerciseSetActivity extends AppCompatActivity implements androi
|
|||
exerciseSetNameText.setText(exerciseSetName);
|
||||
exerciseSetNameText.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { }
|
||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { }
|
||||
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable editable) {
|
||||
|
|
|
|||
|
|
@ -214,6 +214,9 @@ public class ExerciseActivity extends AppCompatActivity implements android.suppo
|
|||
startService(timerServiceIntent);
|
||||
}
|
||||
|
||||
if(breakTimer != null) breakTimer.cancel();
|
||||
if(exerciseTimer != null) exerciseTimer.cancel();
|
||||
|
||||
super.finish();
|
||||
|
||||
if(isActivityVisible) {
|
||||
|
|
|
|||
|
|
@ -69,6 +69,9 @@ public class TimerActivity extends BaseActivity implements android.support.v4.ap
|
|||
private Spinner exerciseSetSpinner;
|
||||
private ExerciseSetSpinnerAdapter exerciseSetAdapter;
|
||||
|
||||
|
||||
private boolean isActivityVisible = false;
|
||||
|
||||
// animation
|
||||
private int mShortAnimationDuration;
|
||||
private boolean currentStatusIsPickerVisible = false;
|
||||
|
|
@ -103,6 +106,10 @@ public class TimerActivity extends BaseActivity implements android.support.v4.ap
|
|||
boolean isRunning = intent.getBooleanExtra("isRunning", false);
|
||||
boolean isPaused = intent.getBooleanExtra("isPaused", false);
|
||||
|
||||
//if(intent.getBooleanExtra("done" ,false)) {
|
||||
// TODO: show a dialog here to start the exercise?
|
||||
//}
|
||||
|
||||
//Log.d(TAG, millisUntilDone + "/" + initialDuration + " (" + (isRunning ? "Running" : "") + (isPaused ? "Paused" : "") + (!isRunning && !isPaused ? "Stopped" : "") + ")");
|
||||
|
||||
updateUI(isRunning, isPaused, initialDuration, millisUntilDone);
|
||||
|
|
@ -134,6 +141,8 @@ public class TimerActivity extends BaseActivity implements android.support.v4.ap
|
|||
protected void onPause() {
|
||||
super.onPause();
|
||||
|
||||
isActivityVisible = false;
|
||||
|
||||
unregisterReceiver(timerReceiver);
|
||||
}
|
||||
|
||||
|
|
@ -141,6 +150,8 @@ public class TimerActivity extends BaseActivity implements android.support.v4.ap
|
|||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
isActivityVisible = true;
|
||||
|
||||
registerReceiver(timerReceiver, new IntentFilter(TimerService.TIMER_BROADCAST));
|
||||
|
||||
if(mTimerService != null && !mTimerService.isRunning()) {
|
||||
|
|
|
|||
|
|
@ -19,27 +19,12 @@ import static org.secuso.privacyfriendlybreakreminder.activities.tutorial.PrefMa
|
|||
* created 02.11.2017
|
||||
*/
|
||||
|
||||
public class NotificationPreferenceChangedReceiver extends BroadcastReceiver {
|
||||
public class NotificationCancelReceiver extends BroadcastReceiver {
|
||||
|
||||
public static final String ACTION_PREF_CHANGE = "org.secuso.privacyfriendlybreakreminder.ACTION_PREF_CHANGE";
|
||||
public static final String EXTRA_DISABLE_CONTINUOUS = "EXTRA_DISABLE_CONTINUOUS";
|
||||
public static final String ACTION_NOTIFICATION_CANCELED = "org.secuso.privacyfriendlybreakreminder.ACTION_NOTIFICATION_CANCELED";
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (intent == null) return;
|
||||
|
||||
Bundle bundle = intent.getExtras();
|
||||
|
||||
if (bundle == null) return;
|
||||
|
||||
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
|
||||
for (String key : intent.getExtras().keySet()) {
|
||||
if (EXTRA_DISABLE_CONTINUOUS.equals(key)) {
|
||||
pref.edit().putBoolean(PREF_EXERCISE_CONTINUOUS, false).apply();
|
||||
}
|
||||
}
|
||||
|
||||
NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
if (manager != null) {
|
||||
manager.cancel(TimerService.NOTIFICATION_ID);
|
||||
|
|
@ -22,6 +22,9 @@ public class NotificationDeletedReceiver extends BroadcastReceiver {
|
|||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
|
||||
//boolean disableContinuous = intent.getBooleanExtra(EXTRA_DISABLE_CONTINUOUS, false);
|
||||
|
||||
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
|
||||
if(pref.getBoolean(PREF_EXERCISE_CONTINUOUS, false)) {
|
||||
|
|
|
|||
|
|
@ -10,12 +10,8 @@ import android.content.Intent;
|
|||
import android.content.IntentFilter;
|
||||
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;
|
||||
|
|
@ -24,8 +20,8 @@ import android.support.v4.content.ContextCompat;
|
|||
import org.secuso.privacyfriendlybreakreminder.R;
|
||||
import org.secuso.privacyfriendlybreakreminder.activities.ExerciseActivity;
|
||||
import org.secuso.privacyfriendlybreakreminder.activities.TimerActivity;
|
||||
import org.secuso.privacyfriendlybreakreminder.receivers.NotificationCancelReceiver;
|
||||
import org.secuso.privacyfriendlybreakreminder.receivers.NotificationDeletedReceiver;
|
||||
import org.secuso.privacyfriendlybreakreminder.receivers.NotificationPreferenceChangedReceiver;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
|
|
@ -34,9 +30,8 @@ import static android.app.PendingIntent.FLAG_UPDATE_CURRENT;
|
|||
import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP;
|
||||
import static org.secuso.privacyfriendlybreakreminder.activities.tutorial.PrefManager.PREF_EXERCISE_CONTINUOUS;
|
||||
import static org.secuso.privacyfriendlybreakreminder.activities.tutorial.PrefManager.WORK_TIME;
|
||||
import static org.secuso.privacyfriendlybreakreminder.receivers.NotificationCancelReceiver.ACTION_NOTIFICATION_CANCELED;
|
||||
import static org.secuso.privacyfriendlybreakreminder.receivers.NotificationDeletedReceiver.ACTION_NOTIFICATION_DELETED;
|
||||
import static org.secuso.privacyfriendlybreakreminder.receivers.NotificationPreferenceChangedReceiver.ACTION_PREF_CHANGE;
|
||||
import static org.secuso.privacyfriendlybreakreminder.receivers.NotificationPreferenceChangedReceiver.EXTRA_DISABLE_CONTINUOUS;
|
||||
|
||||
/**
|
||||
* The main timer service. It handles the work timer and sends updates to the notification and the {@link TimerActivity}.
|
||||
|
|
@ -96,7 +91,7 @@ public class TimerService extends Service {
|
|||
}
|
||||
};
|
||||
private BroadcastReceiver notificationDeletedReceiver = new NotificationDeletedReceiver();
|
||||
private BroadcastReceiver notificationPreferenceChangedReceiver = new NotificationPreferenceChangedReceiver();
|
||||
private BroadcastReceiver notificationPreferenceChangedReceiver = new NotificationCancelReceiver();
|
||||
|
||||
private void onTimerDone() {
|
||||
|
||||
|
|
@ -127,9 +122,7 @@ public class TimerService extends Service {
|
|||
|
||||
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
if(pref.getBoolean(PREF_EXERCISE_CONTINUOUS, false)) {
|
||||
Intent prefIntent = new Intent(ACTION_PREF_CHANGE);
|
||||
prefIntent.putExtra(EXTRA_DISABLE_CONTINUOUS, false);
|
||||
builder.addAction(0, getString(R.string.dismiss_and_dont_repeat), PendingIntent.getBroadcast(getApplicationContext(), 0, prefIntent, FLAG_UPDATE_CURRENT));
|
||||
builder.addAction(0, getString(R.string.dismiss_and_dont_repeat), PendingIntent.getBroadcast(getApplicationContext(), 0, new Intent(ACTION_NOTIFICATION_CANCELED), FLAG_UPDATE_CURRENT));
|
||||
}
|
||||
|
||||
builder.addAction(R.drawable.ic_replay_black_48dp, getString(R.string.snooze), snoozeExercise);
|
||||
|
|
@ -144,7 +137,7 @@ public class TimerService extends Service {
|
|||
|
||||
registerReceiver(timerReceiver, new IntentFilter(TIMER_BROADCAST));
|
||||
registerReceiver(notificationDeletedReceiver, new IntentFilter(ACTION_NOTIFICATION_DELETED));
|
||||
registerReceiver(notificationPreferenceChangedReceiver, new IntentFilter(ACTION_PREF_CHANGE));
|
||||
registerReceiver(notificationPreferenceChangedReceiver, new IntentFilter(ACTION_NOTIFICATION_CANCELED));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -5,6 +5,11 @@
|
|||
<solid android:color="@color/colorAccent" />
|
||||
<corners android:radius="12dp" />
|
||||
<stroke android:width="1dp" android:color="@color/colorPrimary"/>
|
||||
<padding
|
||||
android:bottom="10dp"
|
||||
android:left="10dp"
|
||||
android:right="10dp"
|
||||
android:top="10dp"/>
|
||||
</shape>
|
||||
</item>
|
||||
<item android:state_checked="false" android:color="@color/colorPrimary">
|
||||
|
|
@ -12,6 +17,11 @@
|
|||
<solid android:color="@color/white" />
|
||||
<corners android:radius="12dp" />
|
||||
<stroke android:width="1dp" android:color="@color/colorAccent"/>
|
||||
<padding
|
||||
android:bottom="-20dp"
|
||||
android:left="-20dp"
|
||||
android:right="-20dp"
|
||||
android:top="-20dp"/>
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
|
|
@ -1,66 +1,65 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:theme="@style/AppTheme.AppBarOverlay" >
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimary"
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay">
|
||||
</android.support.v7.widget.Toolbar>
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/exercise_set_name"
|
||||
android:layout_marginStart="@dimen/activity_horizontal_margin"
|
||||
android:layout_marginEnd="@dimen/activity_horizontal_margin"
|
||||
android:layout_marginBottom="@dimen/activity_vertical_margin"
|
||||
android:layout_marginTop="@dimen/activity_vertical_margin"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/white"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/activity_vertical_margin"
|
||||
android:layout_marginEnd="@dimen/activity_horizontal_margin"
|
||||
android:layout_marginStart="@dimen/activity_horizontal_margin"
|
||||
android:layout_marginTop="@dimen/activity_vertical_margin"
|
||||
android:background="@color/transparent"
|
||||
android:hint="@string/activity_edit_exercise_set_name_hint"
|
||||
android:maxLines="1"
|
||||
android:inputType="textAutoCorrect"
|
||||
android:maxLength="40"
|
||||
android:background="@color/transparent" />
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/white"/>
|
||||
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
<android.support.constraint.ConstraintLayout
|
||||
android:id="@+id/constraintLayout2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clickable="false"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
tools:context="org.secuso.privacyfriendlybreakreminder.activities.ManageExerciseSetsActivity"
|
||||
android:id="@+id/constraintLayout2">
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/exercise_list"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginRight="4dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
android:clickable="false"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="4dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.0">
|
||||
|
||||
</android.support.v7.widget.RecyclerView>
|
||||
|
|
@ -70,16 +69,11 @@
|
|||
style="?android:attr/progressBarStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="8dp" />
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
||||
|
|
@ -87,14 +81,16 @@
|
|||
android:id="@+id/add_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:onClick="onClick"
|
||||
app:fabSize="normal"
|
||||
app:layout_anchor="@id/constraintLayout2"
|
||||
app:layout_anchorGravity="bottom|end"
|
||||
app:srcCompat="@drawable/ic_edit_white_24dp" />
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
|
@ -36,6 +36,8 @@
|
|||
android:id="@+id/no_exercise_sets_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textAlignment="center"
|
||||
android:text="@string/no_exercise_sets"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
|
|
|||
|
|
@ -7,21 +7,20 @@
|
|||
|
||||
<ToggleButton
|
||||
android:id="@+id/button"
|
||||
android:textColor="@drawable/button_section_textcolor"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="0dp"
|
||||
android:padding="0dp"
|
||||
android:background="@drawable/button_section"
|
||||
android:paddingLeft="1dp"
|
||||
android:paddingRight="1dp"
|
||||
android:layout_margin="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:background="@drawable/button_section"
|
||||
android:text="Section"
|
||||
android:layout_marginRight="0dp"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_marginLeft="0dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
android:minWidth="65dp"
|
||||
android:minHeight="45dp"
|
||||
android:textColor="@drawable/button_section_textcolor"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginBottom="0dp" />
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
|
@ -82,8 +82,8 @@
|
|||
<string name="pref_schedule_exercise_time">Zeit auswählen</string>
|
||||
<string name="pref_header_schedule">Zeitpläne</string>
|
||||
<string name="pref_header_exercises">Übungseinstellungen</string>
|
||||
<string name="pref_exercise_continuous">Fortlaufende Intervalle</string>
|
||||
<string name="pref_exercise_continuous_summary">Starte das nächste Arbeitsinterval automatisch</string>
|
||||
<string name="pref_exercise_continuous">Fortlaufende Arbeitsintervalle</string>
|
||||
<string name="pref_exercise_continuous_summary">Starte das nächste Arbeitsintervall automatisch</string>
|
||||
<string name="pref_schedule_exercise_days">Tage auswählen</string>
|
||||
<string name="pref_schedule_exercise_daystrigger">Nur an bestimmten Tagen auslösen</string>
|
||||
<string name="pref_schedule_exercise_days_defaultsummary">Keine Tage ausgewählt</string>
|
||||
|
|
@ -134,7 +134,7 @@
|
|||
<string name="snooze">Später</string>
|
||||
<string name="start_break">Pause starten</string>
|
||||
<string name="okay">Okay</string>
|
||||
<string name="next">Nächste</string>
|
||||
<string name="next">Weiter</string>
|
||||
<string name="skip">Überspringen</string>
|
||||
<string name="help">Hilfe</string>
|
||||
<string name="save">Speichern</string>
|
||||
|
|
|
|||
|
|
@ -71,8 +71,8 @@
|
|||
<string name="pref_schedule_exercise_time">Schedule time</string>
|
||||
<string name="pref_header_schedule">Schedule Times</string>
|
||||
<string name="pref_header_exercises">Exercise Settings</string>
|
||||
<string name="pref_exercise_continuous">Continuous exercises</string>
|
||||
<string name="pref_exercise_continuous_summary">Start the next timer automatically</string>
|
||||
<string name="pref_exercise_continuous">Continuous work intervals</string>
|
||||
<string name="pref_exercise_continuous_summary">Start the next work timer automatically</string>
|
||||
<string name="pref_schedule_exercise_days">Choose days</string>
|
||||
<string name="pref_schedule_exercise_daystrigger">Only trigger on certain days</string>
|
||||
<string name="pref_schedule_exercise_days_defaultsummary">No days selected.</string>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue