First changes after second feedback

New break - Red Countdown timer in the break periods
first layout for the new help site
This commit is contained in:
Jannik 2016-09-13 10:47:21 +02:00
commit 19bd41a28d
3 changed files with 121 additions and 17 deletions

View file

@ -45,6 +45,8 @@ public class BreakActivity extends AppCompatActivity implements View.OnClickList
private boolean exerciseSide = false;
private AlertDialog.Builder builder;
private AlertDialog ad;
private TextView SecBreak;
private int breakTimeLeft = 10;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -93,9 +95,10 @@ public class BreakActivity extends AppCompatActivity implements View.OnClickList
setRandomExercises();
view = (View) findViewById(R.id.textViewBreak);
// Creates a dialog showing the duration of the break between exercises
builder = new AlertDialog.Builder(this);
builder.setMessage("10sec " + getResources().getText(R.string.exercise_break).toString());
ad = builder.show();
breakTimeLeft = 10;
SecBreak = (TextView) findViewById(R.id.textViewBreakTime);
SecBreak.setText("" + breakTimeLeft);
}
//Keep screen on while on break
@ -110,8 +113,6 @@ public class BreakActivity extends AppCompatActivity implements View.OnClickList
protected void onPause() {
super.onPause();
//ct.cancel();
if (ad != null)
ad.cancel();
}
public void onClick(View v) {
@ -170,8 +171,11 @@ public class BreakActivity extends AppCompatActivity implements View.OnClickList
// FIXME Set additional 10 Sek Countdown
builder = new AlertDialog.Builder(v.getContext());
breakTimeLeft = 10;
SecBreak = (TextView) findViewById(R.id.textViewBreakTime);
SecBreak.setText("" + breakTimeLeft);
builder.setMessage("10sec " + getResources().getText(R.string.exercise_break).toString());
ad = builder.show();
//ad = builder.show();
if (currentExercise > exerciseList.size() - 1) {
currentExercise = 0;
@ -317,18 +321,32 @@ public class BreakActivity extends AppCompatActivity implements View.OnClickList
private void update() {
//After 10 seconds first side/repetition, then after 20 seconds break for 10 seconds, afterwards second side/repetition and after 20 seconds break and new exercise
breakTime++;
if((breakTime >= 0 && breakTime <= 10) || (breakTime >= 30 && breakTime <= 40)) {
breakTimeLeft--;
SecBreak = (TextView) findViewById(R.id.textViewBreakTime);
SecBreak.setText("" + breakTimeLeft);
}
switch (breakTime) {
case 10:
side_repetition.setText(sideRepetition + " 1");
// Cancel dialog
ad.cancel();
SecBreak = (TextView) findViewById(R.id.textViewBreakTime);
SecBreak.setText("");
break;
case 30:
// Set additional 10 seconds countdown
ad.show();
breakTimeLeft = 10;
SecBreak = (TextView) findViewById(R.id.textViewBreakTime);
SecBreak.setText(""+ breakTimeLeft);
side_repetition.setText(R.string.exercise_break);
//If exercise contains 2 images, set ImageView to the second image
@ -339,7 +357,8 @@ public class BreakActivity extends AppCompatActivity implements View.OnClickList
break;
case 40:
// Cancel dialog
ad.cancel();
SecBreak = (TextView) findViewById(R.id.textViewBreakTime);
SecBreak.setText("");
side_repetition.setText(sideRepetition + " 2");
break;
@ -368,7 +387,9 @@ public class BreakActivity extends AppCompatActivity implements View.OnClickList
execution.setText(exerciseList.get(currentExercise).getExecution());
// FIXME Set additional 10 Sek Countdown
ad.show();
breakTimeLeft = 10;
SecBreak = (TextView) findViewById(R.id.textViewBreakTime);
SecBreak.setText(""+ breakTimeLeft);
side_repetition.setText(R.string.exercise_break);

View file

@ -18,28 +18,44 @@
<TextView
android:id="@+id/textViewBreak"
android:layout_width="160dp"
android:layout_height="80dp"
android:layout_height="70dp"
android:layout_below="@+id/break_exercise_type"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:clickable="true"
android:enabled="true"
android:gravity="center"
android:gravity="center|bottom"
android:text="@string/_10_00"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textIsSelectable="false"
android:textSize="50sp"
android:textStyle="bold" />
<TextView
android:id="@+id/textViewBreakTime"
android:layout_width="160dp"
android:layout_height="35dp"
android:layout_below="@+id/textViewBreak"
android:layout_centerHorizontal="true"
android:clickable="true"
android:enabled="true"
android:gravity="center|top"
android:text="10"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textIsSelectable="false"
android:textColor="@color/red"
android:textSize="25sp"
android:textStyle="bold" />
<TextView
android:id="@+id/textSideRepetition"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignEnd="@+id/textViewBreak"
android:layout_alignLeft="@+id/textViewBreak"
android:layout_alignRight="@+id/textViewBreak"
android:layout_alignStart="@+id/textViewBreak"
android:layout_below="@+id/textViewBreak"
android:layout_alignEnd="@+id/textViewBreakTime"
android:layout_alignLeft="@+id/textViewBreakTime"
android:layout_alignRight="@+id/textViewBreakTime"
android:layout_alignStart="@+id/textViewBreakTime"
android:layout_below="@+id/textViewBreakTime"
android:layout_marginTop="10dp"
android:gravity="center"
android:text="@string/exercise_break"

View file

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="General">
<Preference
android:summary="The privacy friendly break reminder helps you to make more regularly breaks and to exercise and get fit!" />
<Preference
android:summary="You can work out at the breaks, but you don't have to! Just create a new profile and select no exercises to take a simple break." />
<Preference
android:summary="Alternatively the break profiles and there exercises can be changed in the profile-settings" />
</PreferenceCategory>
<PreferenceCategory android:title="Tipps">
<Preference
android:summary="Pomodoro: Scientific studies have shown, that after a 30 minute work-time we start to lose concentration. To optimize your workflow take a 5 minute break every 30 minutes!" />
<Preference
android:summary="Basic Rest Activity Circle: Other scientific studies have shown, that after 70 minute of work most people have a down time of 20 minutes. To cut of this effect, try to make a 10 minute break after 60 minute of work, to be more efficient." />
</PreferenceCategory>
<!--
<PreferenceCategory android:title="@string/help_shape_heading">
<Preference
android:icon="@drawable/one_help"
android:summary="@string/help_one_highlighted" />
<Preference
android:icon="@drawable/two_help"
android:summary="@string/help_two_highlighted" />
<Preference
android:icon="@drawable/three_help"
android:summary="@string/help_three_highlighted" />
<Preference
android:icon="@drawable/four_help"
android:summary="@string/help_four_highlighted" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/help_story_heading">
<Preference
android:icon="@drawable/story_two"
android:summary="@string/help_story_description" />
<Preference
android:icon="@drawable/help_story"
android:summary="@string/help_story_example" />
<Preference
android:summary="@string/help_story_additional"
/>
</PreferenceCategory>
-->
<PreferenceCategory android:title="@string/disclaimer_title">
<Preference
android:icon="@drawable/ic_law"
android:summary="@string/disclaimer" />
</PreferenceCategory>
<PreferenceCategory android:title="Information for data protection">
<Preference
android:title="Permissions"
android:summery="The Privacy Friendly Break Reminder uses only the permission for vibration" />
</PreferenceCategory>
</PreferenceScreen>