Cleanup of old code and Bugfixing.
This commit is contained in:
parent
6e25bf1155
commit
cc83286330
36 changed files with 3 additions and 3090 deletions
|
|
@ -24,10 +24,6 @@
|
|||
android:value="org.secuso.privacyfriendlybreakreminder.activities.TimerActivity" />
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".activities.old.BreakDeciderActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<receiver
|
||||
android:name=".widget.AppWidget"
|
||||
android:label="Resizable Widget">
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ public class ExerciseSetListAdapter extends RecyclerView.Adapter<RecyclerView.Vi
|
|||
|
||||
public void disableDeleteMode() {
|
||||
deleteMode = false;
|
||||
deleteIds.clear();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,461 +0,0 @@
|
|||
package org.secuso.privacyfriendlybreakreminder.activities.old;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.CountDownTimer;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.secuso.privacyfriendlybreakreminder.database.SQLiteHelper;
|
||||
import org.secuso.privacyfriendlybreakreminder.database.data.*;
|
||||
import org.secuso.privacyfriendlybreakreminder.R;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Random;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BreakActivity extends AppCompatActivity implements View.OnClickListener {
|
||||
|
||||
private TextView ct_text;
|
||||
private CountDownTimer ct;
|
||||
private String stopTime = "", sideRepetition = "";
|
||||
String image1, image2;
|
||||
private boolean isRunning = false, noExercises = false;
|
||||
private List<Exercise> exerciseList;
|
||||
private SharedPreferences sharedPrefs;
|
||||
private TextView description, side_repetition, break_exercise_type, execution;
|
||||
private int currentExercise, breakTime = 0, currentExerciseSection;
|
||||
private ImageView image;
|
||||
private String[] exercises;
|
||||
private SQLiteHelper SQLiteHelper;
|
||||
private List<List<Exercise>> allAvailableExercises;
|
||||
private List<Integer> sections;
|
||||
private Random random;
|
||||
private boolean exerciseSide = false;
|
||||
private AlertDialog.Builder builder;
|
||||
private AlertDialog ad;
|
||||
private TextView SecBreak;
|
||||
private int breakTimeLeft = 10;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
currentExercise = 0;
|
||||
currentExerciseSection = 0;
|
||||
sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
int mins = sharedPrefs.getInt("break_value", 5) + 1;
|
||||
String bufferZeroMinute = "";
|
||||
|
||||
if (mins < 10)
|
||||
bufferZeroMinute = "0";
|
||||
|
||||
String[] allProfiles = sharedPrefs.getString("profiles", "").split(";");
|
||||
String currentProfile = sharedPrefs.getString("name_text", "");
|
||||
|
||||
for (int i = 0; i < allProfiles.length; i++) {
|
||||
if (allProfiles[i].split(",")[0].equals(currentProfile) && !allProfiles[i].split(",")[4].equals("-1")) {
|
||||
exercises = allProfiles[i].split(",")[4].split("\\.");
|
||||
}
|
||||
}
|
||||
View view;
|
||||
if (exercises == null) {
|
||||
setContentView(R.layout.activity_break_no_exercises);
|
||||
Button cancelButton = (Button) findViewById(R.id.button_cancel);
|
||||
cancelButton.setOnClickListener(this);
|
||||
ct_text = (TextView) findViewById(R.id.textViewBreak1);
|
||||
|
||||
ct_text.setText(bufferZeroMinute + mins + ":00");
|
||||
ct_text.setOnClickListener(this);
|
||||
|
||||
view = (View) findViewById(R.id.textViewBreak1);
|
||||
noExercises = true;
|
||||
} else {
|
||||
setContentView(R.layout.activity_break);
|
||||
Button nextButton = (Button) findViewById(R.id.button_next);
|
||||
nextButton.setOnClickListener(this);
|
||||
ct_text = (TextView) findViewById(R.id.textViewBreak);
|
||||
ct_text.setText(bufferZeroMinute + mins + ":00");
|
||||
ct_text.setOnClickListener(this);
|
||||
|
||||
SQLiteHelper = new SQLiteHelper(this);
|
||||
random = new Random();
|
||||
sections = new ArrayList<>();
|
||||
setRandomExercises();
|
||||
view = (View) findViewById(R.id.textViewBreak);
|
||||
// Creates a dialog showing the duration of the break between exercises
|
||||
|
||||
breakTimeLeft = 10;
|
||||
SecBreak = (TextView) findViewById(R.id.textViewBreakTime);
|
||||
SecBreak.setText("" + breakTimeLeft);
|
||||
SecBreak.setTextColor(getResources().getColor(R.color.red));
|
||||
}
|
||||
|
||||
//Keep screen on while on break
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
|
||||
// Start timer
|
||||
onClick(view);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
//ct.cancel();
|
||||
}
|
||||
|
||||
public void onClick(View v) {
|
||||
int mins = sharedPrefs.getInt("break_value", 10) + 1;
|
||||
String bufferZeroMinute = "";
|
||||
String bufferZeroSecond = "";
|
||||
int time = mins * 60 * 1000;
|
||||
|
||||
if (stopTime == "" && !isRunning) {
|
||||
if (time / 1000 / 60 < 10)
|
||||
bufferZeroMinute = "0";
|
||||
|
||||
ct_text.setText(bufferZeroMinute + time / 1000 / 60 + ":00");
|
||||
} else if (!isRunning) {
|
||||
ct_text.setText(stopTime);
|
||||
String stringTime = (String) ct_text.getText();
|
||||
String[] timef = stringTime.split(":");
|
||||
int minute = Integer.parseInt(timef[0]);
|
||||
int second = Integer.parseInt(timef[1]);
|
||||
time = (1000 * (minute * 60)) + (1000 * second);
|
||||
|
||||
if (minute < 10)
|
||||
bufferZeroMinute = "0";
|
||||
if (second < 10)
|
||||
bufferZeroSecond = "0";
|
||||
|
||||
ct_text.setText(bufferZeroMinute + minute + ":" + bufferZeroSecond + second);
|
||||
|
||||
}
|
||||
|
||||
switch (v.getId()) {
|
||||
|
||||
case R.id.textViewBreak1:
|
||||
case R.id.textViewBreak:
|
||||
if (isRunning) {
|
||||
ct.cancel();
|
||||
stopTime = (String) ct_text.getText();
|
||||
isRunning = false;
|
||||
} else {
|
||||
startTimer(time);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case R.id.button_cancel:
|
||||
if (ct != null)
|
||||
ct.cancel();
|
||||
finish();
|
||||
break;
|
||||
|
||||
case R.id.button_next:
|
||||
|
||||
// Next Exercise
|
||||
currentExercise++;
|
||||
side_repetition.setText(R.string.exercise_break);
|
||||
|
||||
// FIXME Set additional 10 Sek Countdown
|
||||
builder = new AlertDialog.Builder(v.getContext());
|
||||
breakTimeLeft = 10;
|
||||
SecBreak = (TextView) findViewById(R.id.textViewBreakTime);
|
||||
SecBreak.setText("" + breakTimeLeft);
|
||||
SecBreak.setTextColor(getResources().getColor(R.color.red));
|
||||
builder.setMessage("10sec " + getResources().getText(R.string.exercise_break).toString());
|
||||
//ad = builder.show();
|
||||
|
||||
if (currentExercise > exerciseList.size() - 1) {
|
||||
currentExercise = 0;
|
||||
if (sections.size() == allAvailableExercises.size()) {
|
||||
System.out.println("Did all exercises, restart!");
|
||||
sections = new ArrayList<>();
|
||||
}
|
||||
while (true) {
|
||||
|
||||
currentExerciseSection = currentExerciseSection + 1 % allAvailableExercises.size();
|
||||
if (!sections.contains(currentExerciseSection)) {
|
||||
sections.add(currentExerciseSection);
|
||||
exerciseList = allAvailableExercises.get(currentExerciseSection);
|
||||
System.out.println("Random id for section election: " + currentExerciseSection);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//Set description and execution text of current exercise
|
||||
description.setText(exerciseList.get(currentExercise).getDescription());
|
||||
execution.setText(exerciseList.get(currentExercise).getExecution());
|
||||
|
||||
setExerciseImage();
|
||||
|
||||
//Update Timer
|
||||
String[] currentTime = ((String) ct_text.getText()).split(":");
|
||||
int minute = Integer.parseInt(currentTime[0]);
|
||||
int second = Integer.parseInt(currentTime[1]);
|
||||
|
||||
if (second != 0) {
|
||||
ct.cancel();
|
||||
breakTime = 0;
|
||||
if (minute == 0 && second > 0) {
|
||||
minute = 1;
|
||||
second = 0;
|
||||
} else if (minute > 0 && second > 0) {
|
||||
minute++;
|
||||
second = 0;
|
||||
}
|
||||
if (minute < 10)
|
||||
bufferZeroMinute = "0";
|
||||
if (second < 10)
|
||||
bufferZeroSecond = "0";
|
||||
|
||||
if (isRunning) {
|
||||
time = minute * 60 * 1000;
|
||||
startTimer(time);
|
||||
} else {
|
||||
stopTime = bufferZeroMinute + minute + ":" + bufferZeroSecond + second;
|
||||
ct_text.setText(stopTime);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void setRandomExercises() {
|
||||
|
||||
allAvailableExercises = new ArrayList<>();
|
||||
|
||||
String usedSectionsString = sharedPrefs.getString("currently_done_exercises", "");
|
||||
System.out.println("Number of used sections " + usedSectionsString.split("\\.").length + " " + usedSectionsString);
|
||||
SharedPreferences.Editor editor = sharedPrefs.edit();
|
||||
|
||||
if (exercises.length <= usedSectionsString.split("\\.").length) {
|
||||
usedSectionsString = "";
|
||||
}
|
||||
|
||||
//Selection of the Section
|
||||
boolean notFoundYet = true;
|
||||
|
||||
while (notFoundYet) {
|
||||
currentExerciseSection = random.nextInt(exercises.length);
|
||||
if (!usedSectionsString.contains(exercises[currentExerciseSection])) {
|
||||
List<Exercise> list = SQLiteHelper.getExercisesFromSection("de",exercises[currentExerciseSection]);
|
||||
allAvailableExercises.add(list);
|
||||
usedSectionsString += exercises[currentExerciseSection] + ".";
|
||||
editor.putString("currently_done_exercises", usedSectionsString);
|
||||
notFoundYet = false;
|
||||
System.out.println("Section: " + exercises[currentExerciseSection] + " and number of ex for it: " + list.size());
|
||||
}
|
||||
}
|
||||
|
||||
editor.apply();
|
||||
|
||||
currentExerciseSection = 0;
|
||||
Collections.shuffle(allAvailableExercises.get(currentExerciseSection));
|
||||
|
||||
String allExe = "";
|
||||
for (int i = 0; i < allAvailableExercises.get(currentExerciseSection).size(); i++)
|
||||
allExe += allAvailableExercises.get(currentExerciseSection).get(i).getImageID() + " ";
|
||||
|
||||
System.out.println("Random list for section election: " + allExe);
|
||||
|
||||
// Set exercise list to current section
|
||||
exerciseList = allAvailableExercises.get(currentExerciseSection);
|
||||
sections.add(currentExerciseSection);
|
||||
|
||||
description = (TextView) findViewById(R.id.textViewDescription);
|
||||
description.setText(exerciseList.get(currentExercise).getDescription());
|
||||
|
||||
execution = (TextView) findViewById(R.id.textViewExecution);
|
||||
execution.setText(exerciseList.get(currentExercise).getExecution());
|
||||
|
||||
side_repetition = (TextView) findViewById(R.id.textSideRepetition);
|
||||
side_repetition.setText(R.string.exercise_break);
|
||||
|
||||
break_exercise_type = (TextView) findViewById(R.id.break_exercise_type);
|
||||
break_exercise_type.setText(exerciseList.get(currentExercise).getSection(this));
|
||||
|
||||
setExerciseImage();
|
||||
}
|
||||
|
||||
private void setExerciseImage() {
|
||||
String imageID = exerciseList.get(currentExercise).getImageID();
|
||||
image = (ImageView) findViewById(R.id.imageMid);
|
||||
if (imageID.split(",").length == 1) {
|
||||
sideRepetition = getResources().getText(R.string.exercise_repetition).toString();
|
||||
|
||||
image1 = imageID;
|
||||
exerciseSide = false;
|
||||
int imageResID = getResources().getIdentifier("exercise_" + image1, "drawable", getPackageName());
|
||||
image.setImageResource(imageResID);
|
||||
} else {
|
||||
// There are 2 sides for an exercise
|
||||
exerciseSide = true;
|
||||
sideRepetition = getResources().getText(R.string.exercise_side).toString();
|
||||
image1 = imageID.split(",")[0];
|
||||
image2 = imageID.split(",")[1];
|
||||
|
||||
//image ID from Resource
|
||||
int imageResID = getResources().getIdentifier("exercise_" + image1, "drawable", getPackageName());
|
||||
image.setImageResource(imageResID);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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++;
|
||||
|
||||
|
||||
|
||||
|
||||
breakTimeLeft--;
|
||||
|
||||
SecBreak = (TextView) findViewById(R.id.textViewBreakTime);
|
||||
SecBreak.setText("" + breakTimeLeft);
|
||||
|
||||
|
||||
switch (breakTime) {
|
||||
case 10:
|
||||
side_repetition.setText(sideRepetition + " 1");
|
||||
|
||||
// Cancel dialog
|
||||
breakTimeLeft = 20;
|
||||
SecBreak = (TextView) findViewById(R.id.textViewBreakTime);
|
||||
SecBreak.setText("" + breakTimeLeft);
|
||||
SecBreak.setTextColor(getResources().getColor(R.color.black));
|
||||
|
||||
break;
|
||||
case 30:
|
||||
|
||||
// Set additional 10 seconds countdown
|
||||
breakTimeLeft = 10;
|
||||
SecBreak = (TextView) findViewById(R.id.textViewBreakTime);
|
||||
SecBreak.setText(""+ breakTimeLeft);
|
||||
SecBreak.setTextColor(getResources().getColor(R.color.red));
|
||||
|
||||
side_repetition.setText(R.string.exercise_break);
|
||||
//If exercise contains 2 images, set ImageView to the second image
|
||||
if (exerciseSide) {
|
||||
int imageResID = getResources().getIdentifier("exercise_" + image2, "drawable", getPackageName());
|
||||
image.setImageResource(imageResID);
|
||||
}
|
||||
break;
|
||||
case 40:
|
||||
// Cancel dialog
|
||||
breakTimeLeft = 20;
|
||||
SecBreak = (TextView) findViewById(R.id.textViewBreakTime);
|
||||
SecBreak.setText("" + breakTimeLeft);
|
||||
SecBreak.setTextColor(getResources().getColor(R.color.black));
|
||||
|
||||
side_repetition.setText(sideRepetition + " 2");
|
||||
break;
|
||||
case 60:
|
||||
breakTime = 0;
|
||||
currentExercise++;
|
||||
if (currentExercise > exerciseList.size() - 1) {
|
||||
currentExercise = 0;
|
||||
if (sections.size() == allAvailableExercises.size()) {
|
||||
System.out.println("Did all exercises, restart!");
|
||||
sections = new ArrayList<>();
|
||||
}
|
||||
while (true) {
|
||||
|
||||
currentExerciseSection = currentExerciseSection + 1 % allAvailableExercises.size();
|
||||
if (!sections.contains(currentExerciseSection)) {
|
||||
sections.add(currentExerciseSection);
|
||||
exerciseList = allAvailableExercises.get(currentExerciseSection);
|
||||
System.out.println("Random id for section election: " + currentExerciseSection);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
description.setText(exerciseList.get(currentExercise).getDescription());
|
||||
execution.setText(exerciseList.get(currentExercise).getExecution());
|
||||
|
||||
breakTimeLeft = 10;
|
||||
SecBreak = (TextView) findViewById(R.id.textViewBreakTime);
|
||||
SecBreak.setText(""+ breakTimeLeft);
|
||||
SecBreak.setTextColor(getResources().getColor(R.color.red));
|
||||
|
||||
side_repetition.setText(R.string.exercise_break);
|
||||
|
||||
setExerciseImage();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void startTimer(int time) {
|
||||
|
||||
ct = new CountDownTimer(time, 1000) {
|
||||
boolean timeLeft = false;
|
||||
|
||||
public void onTick(long millisUntilFinished) {
|
||||
String bufferZeroMinute = "";
|
||||
String bufferZeroSecond = "";
|
||||
|
||||
if ((millisUntilFinished / 1000) / 60 < 10)
|
||||
bufferZeroMinute = "0";
|
||||
|
||||
if (millisUntilFinished / 1000 % 60 < 10)
|
||||
bufferZeroSecond = "0";
|
||||
|
||||
ct_text.setText(bufferZeroMinute + (millisUntilFinished / 1000) / 60 + ":" + bufferZeroSecond + millisUntilFinished / 1000 % 60);
|
||||
|
||||
|
||||
// Update image and description of the exercise if available
|
||||
if (!noExercises)
|
||||
update();
|
||||
}
|
||||
|
||||
public void onFinish() {
|
||||
isRunning = false;
|
||||
ct_text.setText("00:00");
|
||||
//Trigger the alarm
|
||||
//String ringPref = sharedPrefs.getString("notifications_new_message_ringtone", "");
|
||||
|
||||
//if (!ringPref.equals("")) {
|
||||
//Ringtone r = RingtoneManager.getRingtone(getApplicationContext(), Uri.parse(ringPref));
|
||||
//r.play();
|
||||
//}
|
||||
|
||||
//Vibration
|
||||
//boolean vibrateChecked = sharedPrefs.getBoolean("notifications_new_message_vibrate", false);
|
||||
//if (vibrateChecked) {
|
||||
// Get instance of Vibrator from current Context
|
||||
//Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
|
||||
|
||||
//if (v != null) {
|
||||
// Vibrate for 1500 milliseconds
|
||||
//v.vibrate(1500);
|
||||
//}
|
||||
//}
|
||||
|
||||
//Remove lag to keep screen on when the break ends
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
|
||||
//Close database connection
|
||||
if (!noExercises)
|
||||
SQLiteHelper.close();
|
||||
finish();
|
||||
}
|
||||
}.start();
|
||||
isRunning = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
package org.secuso.privacyfriendlybreakreminder.activities.old;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
||||
import org.secuso.privacyfriendlybreakreminder.R;
|
||||
import org.secuso.privacyfriendlybreakreminder.activities.old.BreakActivity;
|
||||
|
||||
public class BreakDeciderActivity extends AppCompatActivity implements View.OnClickListener {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_break_decider);
|
||||
|
||||
Button skipButton = (Button)findViewById(R.id.button_skip);
|
||||
skipButton.setOnClickListener(this);
|
||||
Button breakButton = (Button)findViewById(R.id.button_break);
|
||||
breakButton.setOnClickListener(this);
|
||||
}
|
||||
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.button_skip:
|
||||
finish();
|
||||
break;
|
||||
case R.id.button_break:
|
||||
finish();
|
||||
Intent intent = new Intent(this, BreakActivity.class);
|
||||
this.startActivity(intent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,561 +0,0 @@
|
|||
package org.secuso.privacyfriendlybreakreminder.activities.old;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.app.DialogFragment;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
import android.appwidget.AppWidgetManager;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.media.Ringtone;
|
||||
import android.media.RingtoneManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.CountDownTimer;
|
||||
import android.os.Vibrator;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.support.design.widget.NavigationView;
|
||||
import android.support.v4.view.GravityCompat;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.support.v7.app.ActionBarDrawerToggle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.MenuItem;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.secuso.privacyfriendlybreakreminder.R;
|
||||
import org.secuso.privacyfriendlybreakreminder.activities.AboutActivity;
|
||||
import org.secuso.privacyfriendlybreakreminder.activities.HelpActivity;
|
||||
import org.secuso.privacyfriendlybreakreminder.widget.*;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
|
||||
public class BreakReminder extends AppCompatActivity
|
||||
implements NavigationView.OnNavigationItemSelectedListener, View.OnClickListener {
|
||||
|
||||
private boolean isRunning = false;
|
||||
private TextView ct_text;
|
||||
private CountDownTimer ct;
|
||||
private String stopTime = "";
|
||||
private int oldTime = 0;
|
||||
private Spinner profileSpinner;
|
||||
private SharedPreferences sharedPrefs;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
SharedPreferences.Editor editor = sharedPrefs.edit();
|
||||
|
||||
setContentView(R.layout.activity_break_reminder);
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
String allProfiles = sharedPrefs.getString("profiles", "");
|
||||
if (allProfiles.equals("")) {
|
||||
allProfiles = this.getResources().getText(R.string.standard_profile).toString();
|
||||
String exercises = this.getResources().getText(R.string.all_exercises).toString();
|
||||
editor.putString("exercise_value", exercises);
|
||||
editor.putString("profiles", allProfiles);
|
||||
editor.putString("current_language", Locale.getDefault().getLanguage());
|
||||
editor.putBoolean("notifications_stayOn", true);
|
||||
editor.apply();
|
||||
|
||||
WelcomeDialog welcomeDialog = new WelcomeDialog();
|
||||
welcomeDialog.show(getFragmentManager(), "WelcomeDialog");
|
||||
} else if (!sharedPrefs.getString("current_language", "en").equals(Locale.getDefault().getLanguage())) {
|
||||
//FIXME could be nice to translate the body parts hear... but it would be a complex function
|
||||
editor.putString("current_language", Locale.getDefault().getLanguage());
|
||||
String[] profiles = allProfiles.split(";");
|
||||
allProfiles = "";
|
||||
|
||||
for (int j = 0; j < profiles.length; j++) {
|
||||
String[] profile = profiles[j].split(",");
|
||||
profile[4] = "-1";
|
||||
profiles[j] = "";
|
||||
for (int i = 0; i < profile.length; i++) {
|
||||
profiles[j] += profile[i] + ",";
|
||||
}
|
||||
allProfiles += profiles[j] + ";";
|
||||
}
|
||||
|
||||
editor.putString("profiles", allProfiles);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
// If chosen, set screen to "stay on"
|
||||
boolean stayOn = sharedPrefs.getBoolean("notifications_stayOn", false);
|
||||
|
||||
if (stayOn)
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
else
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
|
||||
int mins = sharedPrefs.getInt("work_value", 5) + 1;
|
||||
String bufferZeroMinute = "";
|
||||
|
||||
if (mins < 10)
|
||||
bufferZeroMinute = "0";
|
||||
|
||||
ct_text = (TextView)
|
||||
findViewById(R.id.textView);
|
||||
|
||||
ct_text.setText(bufferZeroMinute + mins + ":00");
|
||||
|
||||
Button playStopButton = (Button) findViewById(R.id.button_playStop);
|
||||
playStopButton.setOnClickListener(this);
|
||||
Button resetButton = (Button) findViewById(R.id.button_reset);
|
||||
resetButton.setOnClickListener(this);
|
||||
ct_text.setOnClickListener(this);
|
||||
|
||||
profileSpinner = (Spinner) findViewById(R.id.spinner);
|
||||
|
||||
String[] profileNames = new String[allProfiles.split(";").length + 1];
|
||||
String[] fillProfileNames = allProfiles.split(";");
|
||||
for (int i = 0; i < profileNames.length - 1; i++) {
|
||||
profileNames[i] = fillProfileNames[i].split(",")[0];
|
||||
}
|
||||
profileNames[profileNames.length - 1] = this.getResources().getText(R.string.new_profile).toString();
|
||||
ArrayAdapter<String> adapter = new
|
||||
ArrayAdapter<String>(this, R.layout.spinner_layout, profileNames);
|
||||
profileSpinner.setAdapter(adapter);
|
||||
|
||||
//Set the ClickListener for Spinner
|
||||
profileSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
String profileSelected = (String) parent.getItemAtPosition(position);
|
||||
if (profileSelected.equals(getResources().getText(R.string.new_profile).toString())) {
|
||||
createNewProfile();
|
||||
} else {
|
||||
updatePreference(profileSelected);
|
||||
}
|
||||
}
|
||||
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
|
||||
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
|
||||
drawer.setDrawerListener(toggle);
|
||||
toggle.syncState();
|
||||
|
||||
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
|
||||
navigationView.setNavigationItemSelectedListener(this);
|
||||
|
||||
}
|
||||
|
||||
private void updatePreference(String profileSelected) {
|
||||
|
||||
String allProfiles = sharedPrefs.getString("profiles", "");
|
||||
|
||||
String currentProfile = sharedPrefs.getString("name_text", "") + "," + sharedPrefs.getInt("work_value", -1) + "," + sharedPrefs.getInt("break_value", -1) + "," + sharedPrefs.getBoolean("cont_value", false) + "," + sharedPrefs.getString("exercise_value", "-1");
|
||||
|
||||
if (!(allProfiles.contains(currentProfile) && profileSelected.equals(sharedPrefs.getString("name_text", "")))) {
|
||||
if (ct != null) {
|
||||
ct.cancel();
|
||||
isRunning = false;
|
||||
}
|
||||
|
||||
String[] profileNames = allProfiles.split(";");
|
||||
for (int i = 0; i < profileNames.length; i++) {
|
||||
String profileName = profileNames[i].split(",")[0];
|
||||
int interval = Integer.parseInt(profileNames[i].split(",")[1]);
|
||||
int break_time = Integer.parseInt(profileNames[i].split(",")[2]);
|
||||
boolean cont = Boolean.parseBoolean(profileNames[i].split(",")[3]);
|
||||
String exercises = profileNames[i].split(",")[4];
|
||||
if (profileName.equals(profileSelected)) {
|
||||
SharedPreferences.Editor editor = sharedPrefs.edit();
|
||||
editor.putString("current_profile", "" + i);
|
||||
editor.putString("name_text", profileName);
|
||||
editor.putInt("work_value", interval - 1);
|
||||
editor.putInt("break_value", break_time - 1);
|
||||
editor.putBoolean("cont_value", cont);
|
||||
editor.putString("exercise_value", exercises);
|
||||
editor.apply();
|
||||
|
||||
//Update tutorial_clock
|
||||
String bufferZeroMinute = "";
|
||||
int time = interval * 60 * 1000;
|
||||
if (time / 1000 / 60 < 10)
|
||||
bufferZeroMinute = "0";
|
||||
|
||||
ct_text.setText(bufferZeroMinute + time / 1000 / 60 + ":00");
|
||||
|
||||
updateWidgets(bufferZeroMinute + time / 1000 / 60 + ":00");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void fillProfiles() {
|
||||
|
||||
if (ct != null) {
|
||||
ct.cancel();
|
||||
isRunning = false;
|
||||
}
|
||||
|
||||
String allProfiles = sharedPrefs.getString("profiles", "");
|
||||
|
||||
String[] profileNames = new String[allProfiles.split(";").length + 1];
|
||||
String[] fillProfileNames = allProfiles.split(";");
|
||||
for (int i = 0; i < profileNames.length - 1; i++) {
|
||||
profileNames[i] = fillProfileNames[i].split(",")[0];
|
||||
}
|
||||
profileNames[profileNames.length - 1] = getResources().getText(R.string.new_profile).toString();
|
||||
ArrayAdapter<String> adapter = new
|
||||
ArrayAdapter<String>(this, R.layout.spinner_layout, profileNames);
|
||||
profileSpinner.setAdapter(adapter);
|
||||
|
||||
//Set Spinner on the current Profile
|
||||
//String currentProfile = sharedPrefs.getString("name_text", "Sport");
|
||||
int interval = sharedPrefs.getInt("work_value", 1);
|
||||
//profileSpinner.setSelection(Arrays.asList(profileNames).indexOf(currentProfile));
|
||||
profileSpinner.setSelection(Integer.parseInt(sharedPrefs.getString("current_profile", "-1")));
|
||||
|
||||
//Update tutorial_clock
|
||||
String bufferZeroMinute = "";
|
||||
int time = interval * 60 * 1000;
|
||||
if (time / 1000 / 60 < 10)
|
||||
bufferZeroMinute = "0";
|
||||
|
||||
ct_text.setText(bufferZeroMinute + time / 1000 / 60 + ":00");
|
||||
|
||||
//Set the ClickListener for Spinner
|
||||
profileSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
String profileSelected = (String) parent.getItemAtPosition(position);
|
||||
if (profileSelected.equals(getResources().getText(R.string.new_profile).toString())) {
|
||||
createNewProfile();
|
||||
} else {
|
||||
updatePreference(profileSelected);
|
||||
}
|
||||
}
|
||||
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
NotificationManager nManager = ((NotificationManager) getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE));
|
||||
nManager.cancelAll();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
// If chosen, set screen to "stay on"
|
||||
boolean stayOn = sharedPrefs.getBoolean("notifications_stayOn", false);
|
||||
|
||||
if (stayOn)
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
else
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
|
||||
//FIXME Add flag if New Profile or Resume
|
||||
if (sharedPrefs.getBoolean("change_profiles", false)) {
|
||||
fillProfiles();
|
||||
|
||||
SharedPreferences.Editor editor = sharedPrefs.edit();
|
||||
editor.putBoolean("change_profiles", false);
|
||||
editor.apply();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||
if (drawer.isDrawerOpen(GravityCompat.START)) {
|
||||
drawer.closeDrawer(GravityCompat.START);
|
||||
} else {
|
||||
super.onBackPressed();
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("StatementWithEmptyBody")
|
||||
@Override
|
||||
public boolean onNavigationItemSelected(MenuItem item) {
|
||||
// Handle navigation view item clicks here.
|
||||
int id = item.getItemId();
|
||||
|
||||
/*if (id == R.id.nav_settings) {
|
||||
// Handle the profile action
|
||||
Intent intent = new Intent(this, SettingsActivity.class);
|
||||
this.startActivity(intent);
|
||||
//} else if (id == R.id.nav_statistics) {
|
||||
// Show statistics
|
||||
//Intent intent = new Intent(this, StatisticsActivity.class);
|
||||
//this.startActivity(intent);
|
||||
} else if (id == R.id.nav_help) {
|
||||
// Show help
|
||||
Intent intent = new Intent(this, HelpActivity.class);
|
||||
this.startActivity(intent);
|
||||
} else if (id == R.id.nav_about) {
|
||||
// Show about page
|
||||
Intent intent = new Intent(this, AboutActivity.class);
|
||||
this.startActivity(intent);
|
||||
}*/
|
||||
|
||||
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||
drawer.closeDrawer(GravityCompat.START);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void onClick(View v) {
|
||||
int mins = sharedPrefs.getInt("work_value", 50);
|
||||
String bufferZeroMinute = "";
|
||||
String bufferZeroSecond = "";
|
||||
int time = mins * 60 * 1000;
|
||||
|
||||
stopTime = (String) ct_text.getText();
|
||||
oldTime = time;
|
||||
|
||||
if (stopTime.equals("") && !isRunning) {
|
||||
if (time / 1000 / 60 < 10)
|
||||
bufferZeroMinute = "0";
|
||||
|
||||
ct_text.setText(bufferZeroMinute + time / 1000 / 60 + ":00");
|
||||
} else if (!isRunning) {
|
||||
ct_text.setText(stopTime);
|
||||
String stringTime = (String) ct_text.getText();
|
||||
String[] timef = stringTime.split(":");
|
||||
int minute = Integer.parseInt(timef[0]);
|
||||
int second = Integer.parseInt(timef[1]);
|
||||
time = (1000 * (minute * 60)) + (1000 * second);
|
||||
|
||||
if (minute < 10)
|
||||
bufferZeroMinute = "0";
|
||||
if (second < 10)
|
||||
bufferZeroSecond = "0";
|
||||
|
||||
ct_text.setText(bufferZeroMinute + minute + ":" + bufferZeroSecond + second);
|
||||
}
|
||||
|
||||
|
||||
switch (v.getId()) {
|
||||
|
||||
case R.id.textView:
|
||||
case R.id.button_playStop:
|
||||
if (isRunning) {
|
||||
ct.cancel();
|
||||
stopTime = (String) ct_text.getText();
|
||||
isRunning = false;
|
||||
} else {
|
||||
startTimer(time);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case R.id.button_reset:
|
||||
if (ct != null) {
|
||||
//Reset tutorial_clock
|
||||
ct.cancel();
|
||||
int interval = sharedPrefs.getInt("work_value", 1) + 1;
|
||||
|
||||
bufferZeroMinute = "";
|
||||
time = interval * 60 * 1000;
|
||||
if (time / 1000 / 60 < 10)
|
||||
bufferZeroMinute = "0";
|
||||
|
||||
ct_text.setText(bufferZeroMinute + time / 1000 / 60 + ":00");
|
||||
stopTime = (String) ct_text.getText();
|
||||
isRunning = false;
|
||||
|
||||
updateWidgets(stopTime);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (oldTime / 1000 / 60 < 10)
|
||||
bufferZeroMinute = "0";
|
||||
|
||||
ct_text.setText(bufferZeroMinute + oldTime / 1000 / 60 + ":00");
|
||||
stopTime = oldTime / 1000 / 60 + ":00";
|
||||
isRunning = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void startTimer(int time) {
|
||||
ct = new CountDownTimer(time, 1000) {
|
||||
boolean timeLeft = false;
|
||||
|
||||
public void onTick(long millisUntilFinished) {
|
||||
String bufferZeroMinute = "";
|
||||
String bufferZeroSecond = "";
|
||||
|
||||
if ((millisUntilFinished / 1000) / 60 < 10)
|
||||
bufferZeroMinute = "0";
|
||||
|
||||
if (millisUntilFinished / 1000 % 60 < 10)
|
||||
bufferZeroSecond = "0";
|
||||
|
||||
ct_text.setText(bufferZeroMinute + (millisUntilFinished / 1000) / 60 + ":" + bufferZeroSecond + millisUntilFinished / 1000 % 60);
|
||||
|
||||
updateWidgets(bufferZeroMinute + (millisUntilFinished / 1000) / 60 + ":" + bufferZeroSecond + millisUntilFinished / 1000 % 60);
|
||||
|
||||
//Show how much time is left
|
||||
|
||||
timeLeft = sharedPrefs.getBoolean("notifications_new_message_timeLeft", false);
|
||||
if (timeLeft) {
|
||||
Notification notification = new NotificationCompat.Builder(getApplicationContext()).setCategory(Notification.CATEGORY_MESSAGE)
|
||||
.setSmallIcon(R.drawable.ic_notifications_black_24dp)
|
||||
.setContentTitle("Break Reminder: ")
|
||||
.setContentText("Take a break in " + ((millisUntilFinished / 1000) / 60) + " minutes and " + ((millisUntilFinished / 1000) % 60) + " seconds")
|
||||
.setAutoCancel(true)
|
||||
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC).build();
|
||||
NotificationManager notificationManager =
|
||||
(NotificationManager) getSystemService(NOTIFICATION_SERVICE);
|
||||
notificationManager.notify(1000, notification);
|
||||
}
|
||||
}
|
||||
|
||||
public void onFinish() {
|
||||
isRunning = false;
|
||||
ct_text.setText("00:00");
|
||||
|
||||
updateWidgets("00:00");
|
||||
|
||||
//trigger the alarm
|
||||
String ringPref = sharedPrefs.getString("notifications_new_message_ringtone", "");
|
||||
|
||||
if (!ringPref.equals("")) {
|
||||
// Get the current ringtone
|
||||
Ringtone r = RingtoneManager.getRingtone(getApplicationContext(), Uri.parse(ringPref));
|
||||
|
||||
// Play ringtone
|
||||
r.play();
|
||||
}
|
||||
|
||||
boolean vibrateChecked = sharedPrefs.getBoolean("notifications_new_message_vibrate", false);
|
||||
if (vibrateChecked) {
|
||||
// Get instance of Vibrator from current Context
|
||||
Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
|
||||
|
||||
if (v != null) {
|
||||
// Vibrate for 1500 milliseconds
|
||||
v.vibrate(1500);
|
||||
}
|
||||
}
|
||||
|
||||
//Cancel the notification
|
||||
if (timeLeft) {
|
||||
Notification notification = new NotificationCompat.Builder(getApplicationContext()).setCategory(Notification.CATEGORY_MESSAGE)
|
||||
.setSmallIcon(R.drawable.ic_notifications_black_24dp)
|
||||
.setContentTitle("Break Reminder: ")
|
||||
.setContentText("Take your break now!!")
|
||||
.setAutoCancel(true)
|
||||
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC).build();
|
||||
NotificationManager notificationManager =
|
||||
(NotificationManager) getSystemService(NOTIFICATION_SERVICE);
|
||||
notificationManager.notify(1000, notification);
|
||||
}
|
||||
startBreak();
|
||||
|
||||
String workTime = "" + sharedPrefs.getInt("work_value", 0) + 1;
|
||||
if (workTime.length() == 1)
|
||||
workTime = "0" + workTime;
|
||||
|
||||
ct_text.setText(workTime + ":00");
|
||||
updateWidgets(workTime + ":00");
|
||||
}
|
||||
}.start();
|
||||
isRunning = true;
|
||||
}
|
||||
|
||||
private void createNewProfile() {
|
||||
SharedPreferences.Editor editor = sharedPrefs.edit();
|
||||
editor.putBoolean("change_profiles", true);
|
||||
editor.apply();
|
||||
Intent intent = new Intent(this, ProfileActivity.class);
|
||||
this.startActivity(intent);
|
||||
}
|
||||
|
||||
private void updateWidgets(String time) {
|
||||
Intent intent = new Intent(this, AppWidget.class);
|
||||
intent.putExtra("time", time);
|
||||
int ids[] = AppWidgetManager.getInstance(getApplication()).getAppWidgetIds(new ComponentName(this.getApplicationContext(), AppWidget.class));
|
||||
if (ids.length != 0) {
|
||||
intent.setAction(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
|
||||
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, ids);
|
||||
sendBroadcast(intent);
|
||||
}
|
||||
}
|
||||
|
||||
public void startBreak() {
|
||||
String allProfiles = sharedPrefs.getString("profiles", "");
|
||||
String[] profiles = allProfiles.split(";");
|
||||
String currentProfile = sharedPrefs.getString("name_text", "");
|
||||
|
||||
for (int i = 0; i < profiles.length; i++) {
|
||||
if (profiles[i].split(",")[0].equals(currentProfile) && profiles[i].split(",")[3].equals("true")) {
|
||||
Intent intent = new Intent(this, BreakActivity.class);
|
||||
this.startActivity(intent);
|
||||
return;
|
||||
}
|
||||
}
|
||||
Intent intent = new Intent(this, BreakDeciderActivity.class);
|
||||
this.startActivity(intent);
|
||||
}
|
||||
|
||||
public static class WelcomeDialog extends DialogFragment {
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
|
||||
LayoutInflater i = getActivity().getLayoutInflater();
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
|
||||
builder.setView(i.inflate(R.layout.first_dialog, null));
|
||||
builder.setIcon(R.mipmap.ic_app);
|
||||
builder.setTitle(getActivity().getString(R.string.app_name_long));
|
||||
|
||||
builder.setPositiveButton(getActivity().getString(R.string.dialog_positive), null);
|
||||
builder.setNegativeButton(getActivity().getString(R.string.tutorial_help), new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
// FIXME need api 21
|
||||
// Context context = getContext();
|
||||
Activity act = getActivity();
|
||||
Intent intent = new Intent(act, HelpActivity.class);
|
||||
act.startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
package org.secuso.privacyfriendlybreakreminder.activities.old;
|
||||
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.View;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.ListView;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.secuso.privacyfriendlybreakreminder.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ExerciseTypeActivity extends AppCompatActivity implements View.OnClickListener {
|
||||
|
||||
Spinner typeSpinner;
|
||||
ListView listView;
|
||||
ArrayList<String> adapter;
|
||||
private SharedPreferences sharedPrefs;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.exercise_type);
|
||||
|
||||
Button addButton = (Button) findViewById(R.id.button_et_add);
|
||||
addButton.setOnClickListener(this);
|
||||
|
||||
Button saveButton = (Button) findViewById(R.id.button_et_save);
|
||||
saveButton.setOnClickListener(this);
|
||||
|
||||
Button cancelButton = (Button) findViewById(R.id.button_et_cancel);
|
||||
cancelButton.setOnClickListener(this);
|
||||
|
||||
typeSpinner = (Spinner) findViewById(R.id.type_spinner);
|
||||
listView = (ListView) findViewById(R.id.listView);
|
||||
|
||||
adapter = new ArrayList<String>();
|
||||
listView.setAdapter(new ArrayAdapter<String>(this, R.layout.spinner_layout, adapter));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
switch (v.getId()) {
|
||||
case R.id.button_et_add:
|
||||
if(!adapter.contains((String)typeSpinner.getSelectedItem())){
|
||||
adapter.add((String)typeSpinner.getSelectedItem());
|
||||
listView.setAdapter(new ArrayAdapter<String>(this, R.layout.spinner_layout, adapter));
|
||||
}
|
||||
break;
|
||||
|
||||
case R.id.button_et_save:
|
||||
sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
SharedPreferences.Editor editor = sharedPrefs.edit();
|
||||
|
||||
String exerciseTypes = "";
|
||||
for (int i = 0;i<adapter.size();i++){
|
||||
exerciseTypes += adapter.get(i) + ".";
|
||||
}
|
||||
editor.putString("exercise_value",exerciseTypes);
|
||||
editor.apply();
|
||||
|
||||
finish();
|
||||
|
||||
Toast.makeText(this, R.string.new_profile_success, Toast.LENGTH_LONG).show();
|
||||
|
||||
break;
|
||||
|
||||
case R.id.button_et_cancel:
|
||||
finish();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,153 +0,0 @@
|
|||
package org.secuso.privacyfriendlybreakreminder.activities.old;
|
||||
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.EditText;
|
||||
import android.widget.SeekBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.secuso.privacyfriendlybreakreminder.R;
|
||||
import org.secuso.privacyfriendlybreakreminder.activities.old.ExerciseTypeActivity;
|
||||
|
||||
public class ProfileActivity extends AppCompatActivity implements View.OnClickListener {
|
||||
|
||||
private SeekBar interval_seekbar, break_seekbar;
|
||||
private TextView interval_text, break_text;
|
||||
private String oldExerciseValue = "";
|
||||
SharedPreferences sharedPrefs;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.new_profile);
|
||||
|
||||
sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
oldExerciseValue = sharedPrefs.getString("exercise_value", "-1");
|
||||
|
||||
SharedPreferences.Editor editor = sharedPrefs.edit();
|
||||
editor.putString("exercise_value", "-1");
|
||||
editor.apply();
|
||||
|
||||
interval_seekbar = (SeekBar) findViewById(R.id.new_profile_interval);
|
||||
interval_seekbar.setProgress(0);
|
||||
break_seekbar = (SeekBar) findViewById(R.id.new_profile_break);
|
||||
break_seekbar.setProgress(0);
|
||||
|
||||
interval_text = (TextView) findViewById(R.id.interval_text);
|
||||
interval_text.setText("1 " + getResources().getText(R.string.settings_unit));
|
||||
break_text = (TextView) findViewById(R.id.break_text);
|
||||
break_text.setText("1 " + getResources().getText(R.string.settings_unit));
|
||||
|
||||
interval_seekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
interval_text.setText((progress + 1) + " " + getResources().getText(R.string.settings_unit));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
}
|
||||
});
|
||||
|
||||
break_seekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
break_text.setText((progress + 1) + " " + getResources().getText(R.string.settings_unit));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Button cancelButton = (Button) findViewById(R.id.button_profile_cancel);
|
||||
cancelButton.setOnClickListener(this);
|
||||
|
||||
Button saveButton = (Button) findViewById(R.id.button_profile_save);
|
||||
saveButton.setOnClickListener(this);
|
||||
|
||||
Button selectButton = (Button) findViewById(R.id.button_profile_select);
|
||||
selectButton.setOnClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.button_profile_save:
|
||||
EditText profileName =
|
||||
(EditText) findViewById(R.id.editProfileName);
|
||||
String name = profileName.getText().toString();
|
||||
|
||||
if (name.equals("")) {
|
||||
Toast.makeText(this, R.string.new_profile_emptyName, Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else if (prefContainsName(name)) {
|
||||
Toast.makeText(this, R.string.new_profile_doubleName, Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
CheckBox cb_Cont = (CheckBox) findViewById(R.id.continuouslyCB);
|
||||
Boolean cont = cb_Cont.isChecked();
|
||||
// Add to preferences
|
||||
|
||||
SharedPreferences.Editor editor = sharedPrefs.edit();
|
||||
editor.putString("name_text", name);
|
||||
editor.putInt("work_value", interval_seekbar.getProgress());
|
||||
editor.putInt("break_value", break_seekbar.getProgress());
|
||||
editor.putString("current_profile", "" + (sharedPrefs.getString("profiles", "").split(";").length));
|
||||
editor.putString("profiles", sharedPrefs.getString("profiles", "") + name + "," + (interval_seekbar.getProgress() + 1) + "," + (break_seekbar.getProgress() + 1) + "," + cont + "," + sharedPrefs.getString("exercise_value", "-1") + ";");
|
||||
editor.apply();
|
||||
finish();
|
||||
|
||||
break;
|
||||
}
|
||||
case R.id.button_profile_cancel:
|
||||
SharedPreferences.Editor editor = sharedPrefs.edit();
|
||||
editor.putString("exercise_value", oldExerciseValue);
|
||||
editor.apply();
|
||||
finish();
|
||||
break;
|
||||
|
||||
case R.id.button_profile_select:
|
||||
createExerciseType();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private boolean prefContainsName(String profileName) {
|
||||
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
String allProfiles = sharedPrefs.getString("profiles", "");
|
||||
String[] profiles = allProfiles.split(";");
|
||||
for (String profile : profiles) {
|
||||
if (profile.split(",")[0].equalsIgnoreCase(profileName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void createExerciseType() {
|
||||
Intent intent = new Intent(this, ExerciseTypeActivity.class);
|
||||
this.startActivity(intent);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
package org.secuso.privacyfriendlybreakreminder.preferences;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ListAdapter;
|
||||
import android.widget.ListView;
|
||||
|
||||
import org.secuso.privacyfriendlybreakreminder.R;
|
||||
|
||||
|
||||
public class DynamicListPreference extends ListPreference implements DialogInterface.OnClickListener {
|
||||
|
||||
Context mContext;
|
||||
SharedPreferences sharedPreferences;
|
||||
|
||||
public DynamicListPreference(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected View onCreateDialogView() {
|
||||
ListView view = new ListView(getContext());
|
||||
view.setAdapter(adapter());
|
||||
setEntries(entries());
|
||||
setEntryValues(entryValues());
|
||||
setValueIndex(Integer.parseInt(sharedPreferences.getString("current_profile", "1")));
|
||||
setPositiveButtonText(mContext.getString(R.string.dialog_positive));
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
private ListAdapter adapter() {
|
||||
return new ArrayAdapter(getContext(), android.R.layout.select_dialog_singlechoice);
|
||||
}
|
||||
|
||||
private CharSequence[] entries() {
|
||||
//action to provide entry data in char sequence array for list
|
||||
|
||||
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(mContext);
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
|
||||
String[] allProfiles = sharedPreferences.getString("profiles", "").split(";");
|
||||
CharSequence[] entries = new CharSequence[allProfiles.length];
|
||||
|
||||
for (int i = 0; i < allProfiles.length; i++) {
|
||||
String profileName = allProfiles[i].split(",")[0];
|
||||
entries[i] = profileName;
|
||||
if (profileName.equals(sharedPreferences.getString("name_text", ""))) {
|
||||
editor.putString("current_profile", "" + i);
|
||||
System.out.println("My current index: "+i);
|
||||
}
|
||||
}
|
||||
editor.apply();
|
||||
return entries;
|
||||
}
|
||||
|
||||
private CharSequence[] entryValues() {
|
||||
//action to provide entry data in char sequence array for list
|
||||
|
||||
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(mContext);
|
||||
String[] allProfiles = sharedPreferences.getString("profiles", "").split(";");
|
||||
CharSequence[] entries = new CharSequence[allProfiles.length];
|
||||
for (int i = 0; i < allProfiles.length; i++) {
|
||||
String profileName = allProfiles[i].split(",")[0];
|
||||
entries[i] = "" + i;
|
||||
}
|
||||
return entries;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,107 +0,0 @@
|
|||
package org.secuso.privacyfriendlybreakreminder.preferences;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.ListPreference;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ListAdapter;
|
||||
import android.widget.ListView;
|
||||
|
||||
/**
|
||||
* Created by badri_000 on 23.08.2016.
|
||||
*/
|
||||
public class ExerciseListPreference extends ListPreference implements DialogInterface.OnClickListener {
|
||||
|
||||
Context mContext;
|
||||
SharedPreferences sharedPreferences;
|
||||
private boolean[] mClickedDialogEntryIndices;
|
||||
String[] exercises;
|
||||
|
||||
public ExerciseListPreference(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
mContext = context;
|
||||
mClickedDialogEntryIndices = new boolean[getEntries().length];
|
||||
}
|
||||
|
||||
@Override
|
||||
protected View onCreateDialogView() {
|
||||
|
||||
ListView view = new ListView(getContext());
|
||||
view.setAdapter(adapter());
|
||||
|
||||
sharedPreferences = getSharedPreferences();
|
||||
String exercise = sharedPreferences.getString("exercise_value", "-1");
|
||||
|
||||
exercises = exercise.split("\\.");
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPrepareDialogBuilder(AlertDialog.Builder builder) {
|
||||
CharSequence[] entries = getEntries();
|
||||
CharSequence[] entryValues = getEntryValues();
|
||||
|
||||
if (entries == null || entryValues == null || entries.length != entryValues.length) {
|
||||
throw new IllegalStateException(
|
||||
"ListPreference requires an entries array and an entryValues array which are both the same length");
|
||||
}
|
||||
|
||||
restoreCheckedEntries();
|
||||
builder.setMultiChoiceItems(entries, mClickedDialogEntryIndices,
|
||||
new DialogInterface.OnMultiChoiceClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which, boolean val) {
|
||||
mClickedDialogEntryIndices[which] = val;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void restoreCheckedEntries() {
|
||||
CharSequence[] entryValues = getEntries();
|
||||
|
||||
for (int j = 0; j < exercises.length; j++) {
|
||||
String val = exercises[j].trim();
|
||||
for (int i = 0; i < entryValues.length; i++) {
|
||||
CharSequence entry = entryValues[i];
|
||||
if (entry.equals(val)) {
|
||||
mClickedDialogEntryIndices[i] = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private ListAdapter adapter() {
|
||||
return new ArrayAdapter(getContext(), android.R.layout.select_dialog_multichoice);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDialogClosed(boolean positiveResult) {
|
||||
CharSequence[] entryValues = getEntries();
|
||||
String exs = "";
|
||||
if (positiveResult && entryValues != null) {
|
||||
for (int i = 0; i < entryValues.length; i++) {
|
||||
if (mClickedDialogEntryIndices[i]) {
|
||||
exs += entryValues[i] + ".";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (exs.equals("") && positiveResult)
|
||||
exs = "-1";
|
||||
|
||||
if(positiveResult) {
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putString("exercise_value", exs);
|
||||
editor.apply();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,180 +0,0 @@
|
|||
package org.secuso.privacyfriendlybreakreminder.preferences;
|
||||
|
||||
/**
|
||||
* Created by badri_000 on 29.05.2016.
|
||||
*/
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.preference.DialogPreference;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Button;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.SeekBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.secuso.privacyfriendlybreakreminder.R;
|
||||
|
||||
|
||||
public class SeekBarPreference extends DialogPreference implements SeekBar.OnSeekBarChangeListener, OnClickListener {
|
||||
// ------------------------------------------------------------------------------------------
|
||||
// Private attributes :
|
||||
private static final String androidns = "http://schemas.android.com/apk/res/android";
|
||||
|
||||
private SeekBar mSeekBar;
|
||||
private TextView mSplashText, mValueText;
|
||||
private Context mContext;
|
||||
|
||||
private String mDialogMessage, mSuffix;
|
||||
private int mDefault, mMax, mValue = 0;
|
||||
// ------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------
|
||||
// Constructor :
|
||||
public SeekBarPreference(Context context, AttributeSet attrs) {
|
||||
|
||||
super(context, attrs);
|
||||
mContext = context;
|
||||
|
||||
// Get string value for dialogMessage :
|
||||
int mDialogMessageId = attrs.getAttributeResourceValue(androidns, "dialogMessage", 0);
|
||||
if (mDialogMessageId == 0)
|
||||
mDialogMessage = attrs.getAttributeValue(androidns, "dialogMessage");
|
||||
else mDialogMessage = mContext.getString(mDialogMessageId);
|
||||
|
||||
// Get string value for suffix (text attribute in xml file) :
|
||||
int mSuffixId = attrs.getAttributeResourceValue(androidns, "text", 0);
|
||||
if (mSuffixId == 0) mSuffix = attrs.getAttributeValue(androidns, "text");
|
||||
else mSuffix = mContext.getString(mSuffixId);
|
||||
|
||||
// Get default and max seekbar values :
|
||||
mDefault = attrs.getAttributeIntValue(androidns, "defaultValue", 1);
|
||||
mMax = attrs.getAttributeIntValue(androidns, "max", 100);
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------
|
||||
// DialogPreference methods :
|
||||
@Override
|
||||
protected View onCreateDialogView() {
|
||||
System.out.println("Created Dialog!!!!");
|
||||
LinearLayout.LayoutParams params;
|
||||
LinearLayout layout = new LinearLayout(mContext);
|
||||
layout.setOrientation(LinearLayout.VERTICAL);
|
||||
layout.setPadding(6, 6, 6, 6);
|
||||
|
||||
mSplashText = new TextView(mContext);
|
||||
mSplashText.setPadding(30, 10, 30, 10);
|
||||
if (mDialogMessage != null)
|
||||
mSplashText.setText(mDialogMessage);
|
||||
layout.addView(mSplashText);
|
||||
|
||||
mValueText = new TextView(mContext);
|
||||
mValueText.setGravity(Gravity.CENTER_HORIZONTAL);
|
||||
mValueText.setTextSize(32);
|
||||
params = new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.FILL_PARENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||
layout.addView(mValueText, params);
|
||||
|
||||
mSeekBar = new SeekBar(mContext);
|
||||
mSeekBar.setOnSeekBarChangeListener(this);
|
||||
layout.addView(mSeekBar, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
|
||||
|
||||
if (shouldPersist())
|
||||
mValue = getPersistedInt(mDefault);
|
||||
|
||||
mSeekBar.setMax(mMax);
|
||||
mSeekBar.setProgress(mValue);
|
||||
|
||||
return layout;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onBindDialogView(View v) {
|
||||
super.onBindDialogView(v);
|
||||
mSeekBar.setMax(mMax);
|
||||
mSeekBar.setProgress(mValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSetInitialValue(boolean restore, Object defaultValue) {
|
||||
super.onSetInitialValue(restore, defaultValue);
|
||||
if (restore)
|
||||
mValue = shouldPersist() ? getPersistedInt(mDefault) : 1;
|
||||
else
|
||||
mValue = (Integer) defaultValue;
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------
|
||||
// OnSeekBarChangeListener methods :
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seek, int value, boolean fromTouch) {
|
||||
System.out.println("Value: " + value);
|
||||
String t = String.valueOf(value + 1);
|
||||
mValueText.setText(mSuffix == null ? t : t.concat(" " + mSuffix));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seek) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seek) {
|
||||
}
|
||||
|
||||
public void setMax(int max) {
|
||||
mMax = max;
|
||||
}
|
||||
|
||||
public int getMax() {
|
||||
return mMax;
|
||||
}
|
||||
|
||||
public void setProgress(int progress) {
|
||||
mValue = progress;
|
||||
if (mSeekBar != null)
|
||||
mSeekBar.setProgress(progress);
|
||||
}
|
||||
|
||||
public int getProgress() {
|
||||
return mValue;
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------
|
||||
// Set the positive button listener and onClick action :
|
||||
@Override
|
||||
public void showDialog(Bundle state) {
|
||||
|
||||
super.showDialog(state);
|
||||
|
||||
Button positiveButton = ((AlertDialog) getDialog()).getButton(AlertDialog.BUTTON_POSITIVE);
|
||||
positiveButton.setText(mContext.getString(R.string.dialog_positive));
|
||||
positiveButton.setOnClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
if (shouldPersist()) {
|
||||
|
||||
System.out.println("Progress: " + mSeekBar.getProgress());
|
||||
mValue = mSeekBar.getProgress();
|
||||
persistInt(mSeekBar.getProgress());
|
||||
callChangeListener(Integer.valueOf(mSeekBar.getProgress()));
|
||||
}
|
||||
|
||||
getDialog().dismiss();
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------
|
||||
}
|
||||
|
|
@ -1,177 +0,0 @@
|
|||
package org.secuso.privacyfriendlybreakreminder.widget;
|
||||
|
||||
import android.app.PendingIntent;
|
||||
import android.appwidget.AppWidgetManager;
|
||||
import android.appwidget.AppWidgetProvider;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.widget.RemoteViews;
|
||||
|
||||
import org.secuso.privacyfriendlybreakreminder.activities.old.BreakReminder;
|
||||
import org.secuso.privacyfriendlybreakreminder.R;
|
||||
|
||||
/**
|
||||
* Implementation of App Widget functionality.
|
||||
*/
|
||||
public class AppWidget extends AppWidgetProvider {
|
||||
|
||||
static String time = "";
|
||||
static RemoteViews views = null;
|
||||
|
||||
static void updateAppWidget(Context context, AppWidgetManager appWidgetManager,
|
||||
int appWidgetId) {
|
||||
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
CharSequence widgetText = prefs.getString("name_text", "Help");
|
||||
int workTime = prefs.getInt("work_value", 0);
|
||||
String clockTime = "";
|
||||
|
||||
if(workTime<10)
|
||||
clockTime = "0" + workTime + ":00";
|
||||
else
|
||||
clockTime = workTime + ":00";
|
||||
|
||||
// Construct the RemoteViews object
|
||||
|
||||
int minWidth = appWidgetManager.getAppWidgetOptions(appWidgetId).getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH);
|
||||
int minHeight = appWidgetManager.getAppWidgetOptions(appWidgetId).getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT);
|
||||
|
||||
getRemoteViews(context, minWidth, minHeight);
|
||||
|
||||
|
||||
views.setTextViewText(R.id.appwidget_text, widgetText);
|
||||
if (time.equals(""))
|
||||
views.setTextViewText(R.id.time, clockTime);
|
||||
else
|
||||
views.setTextViewText(R.id.time, time);
|
||||
|
||||
|
||||
//Open App if clicked
|
||||
Intent openApp = new Intent(context, BreakReminder.class);
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, openApp, 0);
|
||||
views.setOnClickPendingIntent(R.id.appwidget_text, pendingIntent);
|
||||
views.setOnClickPendingIntent(R.id.time, pendingIntent);
|
||||
|
||||
// Instruct the widget_preview manager to update the widget_preview
|
||||
appWidgetManager.updateAppWidget(appWidgetId, views);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
|
||||
// There may be multiple widgets active, so update all of them
|
||||
|
||||
for (int appWidgetId : appWidgetIds) {
|
||||
updateAppWidget(context, appWidgetManager, appWidgetId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnabled(Context context) {
|
||||
// Enter relevant functionality for when the first widget_preview is created
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisabled(Context context) {
|
||||
// Enter relevant functionality for when the last widget_preview is disabled
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
|
||||
String data = "";
|
||||
Bundle getPrevData = intent.getExtras();
|
||||
if (getPrevData != null) {
|
||||
data = getPrevData.getString("time");
|
||||
if (data != null)
|
||||
time = data;
|
||||
}
|
||||
super.onReceive(context, intent);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onAppWidgetOptionsChanged(Context context, AppWidgetManager appWidgetManager, int appWidgetId, Bundle newOptions) {
|
||||
|
||||
|
||||
System.out.println("Minimal width: " + newOptions.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH) + " minimal height: " + newOptions.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT));
|
||||
|
||||
// Get min width and height.
|
||||
int minWidth = newOptions.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH);
|
||||
int minHeight = newOptions.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT);
|
||||
|
||||
|
||||
getRemoteViews(context, minWidth, minHeight);
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
CharSequence widgetText = prefs.getString("name_text", "Help");
|
||||
views.setTextViewText(R.id.appwidget_text, widgetText);
|
||||
views.setTextViewText(R.id.time, time);
|
||||
|
||||
//Open App if clicked
|
||||
Intent openApp = new Intent(context, BreakReminder.class);
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, openApp, PendingIntent.FLAG_NO_CREATE);
|
||||
views.setOnClickPendingIntent(R.id.appwidget_text, pendingIntent);
|
||||
views.setOnClickPendingIntent(R.id.time, pendingIntent);
|
||||
|
||||
// Obtain appropriate widget_preview and update it.
|
||||
appWidgetManager.updateAppWidget(appWidgetId, views);
|
||||
|
||||
updateAppWidget(context,appWidgetManager,appWidgetId);
|
||||
|
||||
super.onAppWidgetOptionsChanged(context, appWidgetManager, appWidgetId, newOptions);
|
||||
}
|
||||
|
||||
private static RemoteViews getRemoteViews(Context context, int minWidth, int minHeight) {
|
||||
// First find out rows and columns based on width provided.
|
||||
int rows = getCellsForSize(minHeight);
|
||||
int columns = getCellsForSize(minWidth);
|
||||
|
||||
|
||||
int minValue = 0;
|
||||
if (columns < rows) {
|
||||
minValue = columns;
|
||||
} else {
|
||||
minValue = rows;
|
||||
}
|
||||
// Now you changing layout base on you column count
|
||||
// In this code from 1 column to 4
|
||||
// you can make code for more columns on your own.
|
||||
switch (minValue) {
|
||||
case 1:
|
||||
views = new RemoteViews(context.getPackageName(), R.layout.app_widget2x1);
|
||||
return views;
|
||||
case 2:
|
||||
views = new RemoteViews(context.getPackageName(), R.layout.app_widget2x2);
|
||||
return views;
|
||||
case 3:
|
||||
views = new RemoteViews(context.getPackageName(), R.layout.app_widget3x3);
|
||||
return views;
|
||||
case 4:
|
||||
views = new RemoteViews(context.getPackageName(), R.layout.app_widget4x4);
|
||||
return views;
|
||||
default:
|
||||
views = new RemoteViews(context.getPackageName(), R.layout.app_widget4x4);
|
||||
return views;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns number of cells needed for given size of the widget_preview.
|
||||
*
|
||||
* @param size Widget size in dp.
|
||||
* @return Size in number of cells.
|
||||
*/
|
||||
private static int getCellsForSize(int size) {
|
||||
int n = 2;
|
||||
while (70 * n - 30 < size) {
|
||||
++n;
|
||||
}
|
||||
return n - 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,108 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout 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="100dp"
|
||||
android:layout_margin="0dp"
|
||||
android:padding="0dp">
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:id="@+id/exercise_set_card"
|
||||
android:longClickable="true"
|
||||
android:clickable="true"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="88dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:padding="0dp"
|
||||
android:visibility="visible"
|
||||
app:cardCornerRadius="2dp"
|
||||
app:cardElevation="4dp"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<android.support.constraint.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/delete_check_box"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/edit_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="?android:selectableItemBackgroundBorderless"
|
||||
android:hapticFeedbackEnabled="true"
|
||||
android:tint="@color/colorAccent"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/ic_mode_edit_black_24dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/exercise_set_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="Exercise Set Name"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/exercise_none_available"
|
||||
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:text="@string/set_contains_no_exercises"
|
||||
android:textColor="@color/black"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/exercise_set_name" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/exercise_list"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/exercise_set_name"
|
||||
app:layout_constraintRight_toLeftOf="@+id/delete_check_box"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintVertical_bias="0.521">
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
|
@ -1,132 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="15dp"
|
||||
tools:context="org.secuso.privacyfriendlybreakreminder.activities.old.BreakActivity">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/break_exercise_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:text="@string/exercise_type"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewBreak"
|
||||
android:layout_width="160dp"
|
||||
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|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/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"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textColor="@color/red"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageMid"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="120dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignWithParentIfMissing="false"
|
||||
android:layout_below="@+id/textSideRepetition" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_next"
|
||||
style="?android:attr/buttonStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:minWidth="110dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:background="@drawable/button_normal"
|
||||
android:text="@string/break_next"
|
||||
android:textColor="@color/white" />
|
||||
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@+id/button_next"
|
||||
android:layout_below="@+id/imageMid">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/break_execution"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewExecution"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/break_ex"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="@string/break_description"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewDescription"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="left|center"
|
||||
android:text="@string/break_explanation"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="10dp"
|
||||
tools:context=".activities.old.BreakDeciderActivity">
|
||||
|
||||
<Button
|
||||
style="?android:attr/buttonStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:minWidth="140dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/take_the_break"
|
||||
android:id="@+id/button_break"
|
||||
android:textColor="@color/white"
|
||||
android:background="@drawable/button_normal"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentEnd="true" />
|
||||
|
||||
<Button
|
||||
style="?android:attr/buttonStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:minWidth="140dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/skip_the_break"
|
||||
android:id="@+id/button_skip"
|
||||
android:background="@drawable/button_normal"
|
||||
android:textColor="@color/white"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentStart="true" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:text="@string/do_you_want_to_take_the_break"
|
||||
android:id="@+id/textView2"
|
||||
android:textSize="24sp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="97dp" />
|
||||
|
||||
<HorizontalScrollView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/horizontalScrollView"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_centerHorizontal="true" />
|
||||
</RelativeLayout>
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:text="@string/new_profile_break"
|
||||
android:id="@+id/textView21"
|
||||
android:layout_marginTop="50dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignRight="@+id/textViewBreak"
|
||||
android:layout_alignEnd="@+id/textViewBreak"
|
||||
android:layout_alignLeft="@+id/textViewBreak"
|
||||
android:layout_alignStart="@+id/textViewBreak"
|
||||
android:gravity="center" />
|
||||
<TextView
|
||||
android:id="@+id/textViewBreak1"
|
||||
android:layout_width="250dp"
|
||||
android:layout_height="250dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:background="@drawable/circle_black"
|
||||
android:clickable="true"
|
||||
android:enabled="true"
|
||||
android:gravity="center"
|
||||
android:text="@string/_10_00"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textIsSelectable="false"
|
||||
android:textSize="80sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_cancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:minWidth="110dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:textColor="@color/white"
|
||||
android:background="@drawable/button_normal"
|
||||
android:text="@string/cancel" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v4.widget.DrawerLayout 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:id="@+id/drawer_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:openDrawer="start">
|
||||
|
||||
<include
|
||||
layout="@layout/app_bar_break_reminder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<android.support.design.widget.NavigationView
|
||||
android:id="@+id/nav_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
android:fitsSystemWindows="true"
|
||||
app:headerLayout="@layout/nav_header"
|
||||
app:menu="@menu/nav_drawer" />
|
||||
|
||||
</android.support.v4.widget.DrawerLayout>
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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"
|
||||
tools:context="org.secuso.privacyfriendlybreakreminder.activities.old.BreakReminder">
|
||||
|
||||
<android.support.design.widget.AppBarLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
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>
|
||||
|
||||
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
|
||||
<include layout="@layout/content_break_reminder" />
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="16dp"
|
||||
android:weightSum="1"
|
||||
android:gravity="center|center_horizontal|center_vertical"
|
||||
android:background="@color/colorPrimary">
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="110dp"
|
||||
android:layout_height="48dp"
|
||||
android:background="@drawable/circle_white">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/appwidget_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/profile_name"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="10sp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:gravity="center" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/appwidget_text"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:text="@string/break_reminder_time"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="20sp"
|
||||
android:gravity="center" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="16dp"
|
||||
android:weightSum="1"
|
||||
android:gravity="center|center_horizontal|center_vertical"
|
||||
android:background="@color/colorPrimary">
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="110dp"
|
||||
android:layout_height="110dp"
|
||||
android:background="@drawable/circle_white">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/appwidget_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/profile_name"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14dp"
|
||||
android:gravity="center"
|
||||
android:layout_above="@+id/time"
|
||||
android:layout_centerHorizontal="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/break_reminder_time"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="30dp"
|
||||
android:textIsSelectable="false"
|
||||
android:gravity="center"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_centerHorizontal="true" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="16dp"
|
||||
android:weightSum="1"
|
||||
android:gravity="center|center_horizontal|center_vertical"
|
||||
android:background="@color/colorPrimary">
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="180dp"
|
||||
android:background="@drawable/circle_white">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/appwidget_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/profile_name"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="22dp"
|
||||
android:gravity="center"
|
||||
android:layout_above="@+id/time"
|
||||
android:layout_centerHorizontal="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/break_reminder_time"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="60dp"
|
||||
android:textIsSelectable="false"
|
||||
android:gravity="bottom"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_centerHorizontal="true" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="16dp"
|
||||
android:weightSum="1"
|
||||
android:gravity="center|center_horizontal|center_vertical"
|
||||
android:background="@color/colorPrimary">
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="250dp"
|
||||
android:layout_height="250dp"
|
||||
android:background="@drawable/circle_white">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/appwidget_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/profile_name"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="30dp"
|
||||
android:gravity="center"
|
||||
android:layout_above="@+id/time"
|
||||
android:layout_centerHorizontal="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/break_reminder_time"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="90dp"
|
||||
android:textIsSelectable="false"
|
||||
android:gravity="center"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_centerHorizontal="true" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout 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:background="@color/white"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
tools:context="org.secuso.privacyfriendlybreakreminder.activities.old.BreakReminder"
|
||||
tools:showIn="@layout/app_bar_break_reminder">
|
||||
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spinner"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:popupBackground="@color/white"
|
||||
android:spinnerMode="dropdown"
|
||||
android:layout_marginTop="49dp" />
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_playStop"
|
||||
style="?android:attr/buttonStyleSmall"
|
||||
android:layout_width="90dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/button_normal"
|
||||
android:text="@string/play_stop"
|
||||
android:textColor="@color/white"
|
||||
|
||||
android:layout_below="@+id/textView"
|
||||
android:layout_alignLeft="@+id/textView"
|
||||
android:layout_alignStart="@+id/textView"
|
||||
android:layout_marginTop="39dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_reset"
|
||||
style="?android:attr/buttonStyleSmall"
|
||||
android:layout_width="90dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/button_normal"
|
||||
android:text="@string/reset"
|
||||
android:textColor="@color/white"
|
||||
android:layout_alignTop="@+id/button_playStop"
|
||||
android:layout_alignRight="@+id/textView"
|
||||
android:layout_alignEnd="@+id/textView" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="200dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:background="@drawable/circle_black"
|
||||
android:clickable="true"
|
||||
android:enabled="true"
|
||||
android:gravity="center"
|
||||
android:text="@string/break_reminder_time"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textIsSelectable="false"
|
||||
android:textSize="60sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
@ -1,88 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:weightSum="1">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_margin="10dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="@string/type"
|
||||
android:id="@+id/textView11"
|
||||
android:textSize="24sp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/add"
|
||||
android:id="@+id/button_et_add"
|
||||
android:background="@drawable/button_normal"
|
||||
android:textColor="@color/white"
|
||||
android:layout_below="@+id/type_spinner"
|
||||
android:layout_alignLeft="@+id/button_et_save"
|
||||
android:layout_alignStart="@+id/button_et_save"
|
||||
android:layout_marginTop="44dp" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/cancel"
|
||||
android:id="@+id/button_et_cancel"
|
||||
android:background="@drawable/button_normal"
|
||||
android:textColor="@color/white"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/save"
|
||||
android:id="@+id/button_et_save"
|
||||
android:background="@drawable/button_normal"
|
||||
android:textColor="@color/white"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true" />
|
||||
|
||||
<Spinner
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/type_spinner"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_toEndOf="@+id/textView11"
|
||||
android:layout_toRightOf="@+id/textView11"
|
||||
android:entries="@array/type_spinner"/>
|
||||
|
||||
<ListView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/listView"
|
||||
android:layout_below="@+id/textView8"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:scrollbarAlwaysDrawVerticalTrack="true"
|
||||
android:layout_above="@+id/button_et_save" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="@string/exercise_summary"
|
||||
android:id="@+id/textView8"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true" />
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
|
@ -1,92 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/white">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/tutorial_description" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/tutorial_profiles"
|
||||
android:layout_marginTop="20dp"
|
||||
style="@style/Base.DialogWindowTitle.AppCompat"/>
|
||||
<ImageView
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="120dp"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/tutorial_spinner"/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="@string/tutorial_profile_description"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/tutorial_clock"
|
||||
android:layout_marginTop="20dp"
|
||||
style="@style/Base.DialogWindowTitle.AppCompat"/>
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layoutDirection="ltr"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center">
|
||||
<ImageView
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/tutorial_clock"/>
|
||||
<TextView
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="100dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:text="@string/tutorial_or"/>
|
||||
<ImageView
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/tutorial_play_button"/>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="@string/tutorial_clock_description"/>
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="@string/disclaimer"
|
||||
android:layout_marginTop="20dp"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text=""
|
||||
android:layout_marginTop="20dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/titleText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/help_start_screen_title"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textSize="12pt" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/img"
|
||||
android:clickable="true"
|
||||
android:layout_marginTop="5dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/descriptionText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/help_break_screen"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textSize="6pt"
|
||||
android:layout_marginTop="5dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/voidText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text=""
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textSize="6pt"
|
||||
android:layout_marginTop="5dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ListView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/listView2"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:entries="@array/help_overview_strings" />
|
||||
|
||||
</LinearLayout>
|
||||
|
|
@ -37,6 +37,7 @@
|
|||
android:layout_marginRight="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:visibility="gone"
|
||||
android:clickable="false"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
|
@ -47,7 +48,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:background="?android:selectableItemBackgroundBorderless"
|
||||
android:hapticFeedbackEnabled="true"
|
||||
android:tint="@color/colorAccent"
|
||||
android:visibility="gone"
|
||||
|
|
|
|||
|
|
@ -1,189 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:weightSum="1"
|
||||
android:layout_margin="10dp">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/profile_name"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textSize="24sp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editProfileName"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="text"
|
||||
android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-"
|
||||
android:maxLength="12"
|
||||
android:textSize="25sp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_toEndOf="@+id/textView6"
|
||||
android:layout_marginLeft="15dp"/>
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/new_profile_interval"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:max="119"
|
||||
android:layout_toRightOf="@+id/button_profile_cancel"
|
||||
android:layout_below="@+id/textView4"
|
||||
android:layout_alignRight="@+id/button_profile_select"
|
||||
android:layout_alignEnd="@+id/button_profile_select" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/interval"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_below="@+id/editProfileName"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginTop="10dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView6"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_below="@+id/new_profile_break"
|
||||
android:layout_marginTop="40dp"
|
||||
android:text="@string/exercise_type"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textSize="24sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/new_profile_break"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_below="@+id/new_profile_interval"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginTop="5dp"/>
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/new_profile_break"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:max="29"
|
||||
android:layout_alignLeft="@+id/new_profile_interval"
|
||||
android:layout_alignStart="@+id/new_profile_interval"
|
||||
android:layout_below="@+id/break_text"
|
||||
android:layout_alignRight="@+id/new_profile_interval"
|
||||
android:layout_alignEnd="@+id/new_profile_interval" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_profile_select"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/button_normal"
|
||||
android:textColor="@color/white"
|
||||
android:text="@string/new_profile_select"
|
||||
android:layout_above="@+id/textView16"
|
||||
android:layout_alignParentEnd="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView7"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/new_profile_continuously"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textSize="24sp"
|
||||
android:layout_below="@+id/textView16"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginTop="25dp"/>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/continuouslyCB"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:checked="false"
|
||||
android:layout_alignTop="@+id/textView7"
|
||||
android:layout_alignRight="@+id/button_profile_select"
|
||||
android:layout_alignEnd="@+id/button_profile_select"
|
||||
android:layout_marginRight="25dp"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_profile_save"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/save"
|
||||
android:background="@drawable/button_normal"
|
||||
android:textColor="@color/white"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignEnd="@+id/editProfileName" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_profile_cancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/cancel"
|
||||
android:background="@drawable/button_normal"
|
||||
android:textColor="@color/white"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentStart="true" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="@string/_0"
|
||||
android:id="@+id/interval_text"
|
||||
android:layout_above="@+id/new_profile_interval"
|
||||
android:layout_alignLeft="@+id/editProfileName"
|
||||
android:layout_alignStart="@+id/editProfileName" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:id="@+id/break_text"
|
||||
android:text="@string/_0"
|
||||
android:layout_alignTop="@+id/textView5"
|
||||
android:layout_alignLeft="@+id/interval_text"
|
||||
android:layout_alignStart="@+id/interval_text" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:text="@string/continuously"
|
||||
android:id="@+id/textView15"
|
||||
android:layout_below="@+id/textView7"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:text="@string/exercise_description"
|
||||
android:id="@+id/textView16"
|
||||
android:layout_below="@+id/textView6"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:padding="5dip"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="26sp"
|
||||
android:layout_centerHorizontal="true"/>
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:weightSum="1">
|
||||
|
||||
<TextView
|
||||
android:layout_width="292dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:text="To be done...."
|
||||
android:id="@+id/textView13"
|
||||
android:layout_weight="0.36"
|
||||
android:gravity="center" />
|
||||
</LinearLayout>
|
||||
|
|
@ -8,32 +8,6 @@
|
|||
<string name="information">Information</string>
|
||||
<string name="help">Help</string>
|
||||
|
||||
<!-- General settings -->
|
||||
<!-- Strings for the Interval-Slider -->
|
||||
<string name="settings_dialog_message">Select your work time</string>
|
||||
<string name="settings_summary">Current value is $1</string>
|
||||
<string name="settings_unit">Minutes</string>
|
||||
<string name="settings_title">Select your work time</string>
|
||||
|
||||
<!-- Strings for the Break-Slider -->
|
||||
<string name="settings_break_summary">Current value is $1</string>
|
||||
<string name="settings_break_title">Select your break time</string>
|
||||
|
||||
<!-- Strings for Name -->
|
||||
<string name="pref_header_general">Edit Profiles</string>
|
||||
<string name="pref_title_display_name">Profile name</string>
|
||||
<string name="pref_default_display_name">Random</string>
|
||||
<string name="pref_current_profile">Select profile</string>
|
||||
<string name="pref_current_exercises">Select exercises</string>
|
||||
|
||||
|
||||
<!-- settings for BreakReminder -->
|
||||
<string name="new_profile">New Profile…</string>
|
||||
<string name="play_stop" translatable="false">Play/Stop</string>
|
||||
<string name="reset" translatable="false">Reset</string>
|
||||
<string name="break_reminder_time" translatable="false">30:00</string>
|
||||
<string name="standard_profile">Random,90,5,false,Arms.Legs.Head.Neck.Pelvis.Spinal Column.Torso.;Upper-Body,90,15,true,Arms.Neck.Head.;Torso,30,5,true,Spinal Column.Torso.;Lower-Body,30,5,true,Legs.Pelvis.;</string>
|
||||
|
||||
<!-- settings for Notifications -->
|
||||
<string name="pref_header_notifications">Notifications</string>
|
||||
<string name="pref_title_ringtone">Ringtone</string>
|
||||
|
|
@ -42,33 +16,9 @@
|
|||
<string name="pref_title_timeLeft">Time left</string>
|
||||
<string name="pref_title_vibrate">Vibration</string>
|
||||
|
||||
<!-- settings for ProfileActivity -->
|
||||
<string name="_0" translatable="false">0</string>
|
||||
<string name="type">Type</string>
|
||||
<string name="add">Add</string>
|
||||
<string name="save">Save</string>
|
||||
<string name="cancel">Cancel</string>
|
||||
<string name="profile_name">Profile Name</string>
|
||||
<string name="interval">Work-Time</string>
|
||||
|
||||
<!-- settings for BreakDeciderActivity -->
|
||||
<string name="take_the_break">Take the Break</string>
|
||||
<string name="skip_the_break">Skip the Break</string>
|
||||
<string name="do_you_want_to_take_the_break">Do you want to take the break?</string>
|
||||
|
||||
<!--settings for SettingsActivity -->
|
||||
<string name="settings_emptyName">The changes could not be applied because the name for the profile was empty!</string>
|
||||
<string name="settings_doubleName">The changes could not be applied because there is already a profile with the same name!</string>
|
||||
<string name="settings_exercise_summary">Choose the body parts, you want to exercise</string>
|
||||
|
||||
<!--settings for ProfileActivity -->
|
||||
<string name="new_profile_break">Break</string>
|
||||
<string name="new_profile_select">Select</string>
|
||||
<string name="new_profile_continuously">Start pause automatically</string>
|
||||
<string name="new_profile_emptyName">Please enter a name for the profile!</string>
|
||||
<string name="new_profile_doubleName">Enter another name, there is already a profile with the same name!</string>
|
||||
<string name="continuously">If checked, there will be no possibility to skip the break</string>
|
||||
<string name="exercise_description">Make sure to select some exercises! If nothing is selected, there will be no exercises in the break!</string>
|
||||
|
||||
<!-- settings for AboutActivity -->
|
||||
<string name="about">About</string>
|
||||
|
|
@ -82,26 +32,6 @@
|
|||
<string name="github" translatable="false"><a href="https://github.com/SecUSo/privacy-friendly-break-reminder">Github-Repo</a></string>
|
||||
<string name="url" translatable="false"><a href="https://www.secuso.org/pfa">SECUSO-Website</a></string>
|
||||
|
||||
<!-- settings for ExerciseTypeActivity -->
|
||||
<string name="exercise_summary">Your break will contain exercises for the following body sections:</string>
|
||||
<string-array name="type_spinner">
|
||||
<item>Head</item>
|
||||
<item>Neck</item>
|
||||
<item>Arms</item>
|
||||
<item>Torso</item>
|
||||
<item>Spinal Column</item>
|
||||
<item>Pelvis</item>
|
||||
<item>Legs</item>
|
||||
</string-array>
|
||||
<string-array name="value_spinner" translatable="false">
|
||||
<item>0</item>
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
<item>3</item>
|
||||
<item>4</item>
|
||||
<item>5</item>
|
||||
<item>6</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="help_overview_strings">
|
||||
<item>Main Screen</item>
|
||||
|
|
@ -114,16 +44,8 @@
|
|||
</string-array>
|
||||
|
||||
<!-- settings for BreakActivity -->
|
||||
<string name="_10_00" translatable="false">10:00</string>
|
||||
<string name="break_next" translatable="false">Next</string>
|
||||
<string name="break_description">Description:</string>
|
||||
<string name="break_explanation">Description of the Exercise</string>
|
||||
<string name="break_ex">Execution of the Exercise</string>
|
||||
<string name="break_execution">Execution:</string>
|
||||
<string name="exercise_type">Exercise Type</string>
|
||||
<string name="exercise_break">Break</string>
|
||||
<string name="exercise_side">Side</string>
|
||||
<string name="exercise_repetition">Repetition</string>
|
||||
|
||||
<!-- settings for HelpActivity -->
|
||||
<string name="help_start_screen">1. Spinner to select the profile \n2. Clock shows time and is clickable. Can starts and stop the time. \n3. Button starts and stops the time. \n4. Resets the time</string>
|
||||
|
|
@ -178,7 +100,6 @@
|
|||
<string name="activity_title_manage_exercise_sets">Exercise Sets</string>
|
||||
<string name="activity_title_edit_exercise_set">Edit Exercise Set</string>
|
||||
<string name="activity_title_new_exercise_set">New Exercise Set</string>
|
||||
<string name="dialog_add_exercise_set_setname">exercise set name</string>
|
||||
<string name="dialog_add_exercise_set_title">Add New Exercise Set</string>
|
||||
<string name="activity_title_break_reminder">Break Reminder</string>
|
||||
<string name="dialog_add_exercise_set_name">Exercise Set Name</string>
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:initialKeyguardLayout="@layout/app_widget2x1"
|
||||
android:initialLayout="@layout/app_widget2x2"
|
||||
android:minHeight="40dp"
|
||||
android:minWidth="110dp"
|
||||
android:previewImage="@drawable/widget_preview"
|
||||
android:resizeMode="horizontal|vertical"
|
||||
android:updatePeriodMillis="86400000"
|
||||
android:widgetCategory="home_screen"></appwidget-provider>
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:initialKeyguardLayout="@layout/app_widget2x2"
|
||||
android:initialLayout="@layout/app_widget2x2"
|
||||
android:minHeight="110dp"
|
||||
android:minWidth="110dp"
|
||||
android:previewImage="@drawable/widget_preview"
|
||||
android:resizeMode="none"
|
||||
android:updatePeriodMillis="86400000"
|
||||
android:widgetCategory="home_screen"></appwidget-provider>
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:initialKeyguardLayout="@layout/app_widget3x3"
|
||||
android:initialLayout="@layout/app_widget3x3"
|
||||
android:minHeight="180dp"
|
||||
android:minWidth="180dp"
|
||||
android:previewImage="@drawable/widget_preview"
|
||||
android:resizeMode="none"
|
||||
android:updatePeriodMillis="86400000"
|
||||
android:widgetCategory="home_screen"></appwidget-provider>
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:initialKeyguardLayout="@layout/app_widget4x4"
|
||||
android:initialLayout="@layout/app_widget4x4"
|
||||
android:minHeight="250dp"
|
||||
android:minWidth="250dp"
|
||||
android:previewImage="@drawable/widget_preview"
|
||||
android:resizeMode="none"
|
||||
android:updatePeriodMillis="86400000"
|
||||
android:widgetCategory="home_screen"></appwidget-provider>
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<PreferenceCategory android:title="@string/help_general_title">
|
||||
<Preference
|
||||
android:summary="@string/help_general_information" />
|
||||
|
||||
<Preference
|
||||
android:summary="@string/help_general_breaks" />
|
||||
|
||||
<Preference
|
||||
android:summary="@string/help_general_settings" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
|
||||
<PreferenceCategory android:title="@string/help_tipps_title">
|
||||
<Preference
|
||||
android:title="@string/help_tipps_pomodoro_title"
|
||||
android:summary="@string/help_tipps_pomodoro" />
|
||||
<Preference
|
||||
android:title="@string/help_tepps_brac_title"
|
||||
android:summary="@string/help_tipps_brac" />
|
||||
</PreferenceCategory>
|
||||
|
||||
|
||||
<PreferenceCategory android:title="@string/help_support_title">
|
||||
<Preference
|
||||
android:title="@string/help_support_clock_title"
|
||||
android:icon="@drawable/tutorial_clock"
|
||||
android:summary="@string/help_support_clock_descr" />
|
||||
<Preference
|
||||
android:title="@string/tutorial_profiles"
|
||||
android:icon="@drawable/tutorial_spinner"
|
||||
android:summary="@string/tutorial_profile_description" />
|
||||
<Preference
|
||||
android:title="@string/break_next"
|
||||
android:icon="@drawable/help_next_button"
|
||||
android:summary="@string/help_support_next" />
|
||||
</PreferenceCategory>
|
||||
|
||||
|
||||
<PreferenceCategory android:title="@string/disclaimer_title">
|
||||
<Preference
|
||||
android:icon="@drawable/ic_law"
|
||||
android:summary="@string/disclaimer" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory android:title="@string/help_protection_title">
|
||||
<Preference
|
||||
android:title="@string/help_protection_permission"
|
||||
android:summary="@string/help_protection_text" />
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
||||
Loading…
Add table
Add a link
Reference in a new issue