Fixed some issues
Countdown timer and general settings are updated after selection/change/creation of a profile
This commit is contained in:
parent
286c19ede5
commit
d75e33b2a6
8 changed files with 363 additions and 168 deletions
|
|
@ -149,7 +149,7 @@ public class BreakActivity extends AppCompatActivity implements View.OnClickList
|
|||
r.play();
|
||||
}
|
||||
|
||||
//FIXME Vibrate
|
||||
//FIXME Test Vibration
|
||||
boolean vibrateChecked = sharedPrefs.getBoolean("notifications_new_message_vibrate", false);
|
||||
System.out.println("Vibrate is : " + vibrateChecked);
|
||||
if (vibrateChecked) {
|
||||
|
|
|
|||
|
|
@ -1,13 +1,8 @@
|
|||
package orgprivacy_friendly_apps.secuso.privacyfriendlybreakreminder;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.app.DialogFragment;
|
||||
import android.app.FragmentManager;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.media.Ringtone;
|
||||
|
|
@ -16,7 +11,6 @@ import android.net.Uri;
|
|||
import android.os.Bundle;
|
||||
import android.os.CountDownTimer;
|
||||
import android.os.Vibrator;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
import android.view.View;
|
||||
|
|
@ -35,6 +29,8 @@ import android.widget.Button;
|
|||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class BreakReminder extends AppCompatActivity
|
||||
implements NavigationView.OnNavigationItemSelectedListener, View.OnClickListener {
|
||||
|
||||
|
|
@ -42,12 +38,14 @@ public class BreakReminder extends AppCompatActivity
|
|||
private TextView ct_text;
|
||||
private CountDownTimer ct;
|
||||
private String stopTime = "";
|
||||
private SeekBarPreference _seekBarWork;
|
||||
private SeekBarPreference _seekBarBreak;
|
||||
|
||||
private Spinner profileSpinner;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.activity_break_reminder);
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
|
@ -62,10 +60,20 @@ public class BreakReminder extends AppCompatActivity
|
|||
navigationView.setNavigationItemSelectedListener(this);
|
||||
|
||||
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
String allProfiles = sharedPrefs.getString("profiles", "");
|
||||
if (allProfiles.equals("")) {
|
||||
System.out.println("Es gibt noch keine Profile!!");
|
||||
SharedPreferences.Editor editor = sharedPrefs.edit();
|
||||
editor.putString("profiles", "Sport,5,1;Exams,90,15;Pomodoro,30,5;");
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
System.out.println("Alle Profile: " + sharedPrefs.getString("profiles", "FAIL"));
|
||||
|
||||
// If chosen, set screen to "stay on"
|
||||
boolean stayOn = sharedPrefs.getBoolean("notifications_stayOn", false);
|
||||
if(stayOn)
|
||||
|
||||
if (stayOn)
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
|
||||
int mins = sharedPrefs.getInt("work_value", 50);
|
||||
|
|
@ -74,7 +82,10 @@ public class BreakReminder extends AppCompatActivity
|
|||
if (mins < 10)
|
||||
bufferZeroMinute = "0";
|
||||
|
||||
ct_text = (TextView) findViewById(R.id.textView);
|
||||
ct_text = (TextView)
|
||||
|
||||
findViewById(R.id.textView);
|
||||
|
||||
ct_text.setText(bufferZeroMinute + mins + ":00");
|
||||
|
||||
Button playStopButton = (Button) findViewById(R.id.button_playStop);
|
||||
|
|
@ -83,26 +94,31 @@ public class BreakReminder extends AppCompatActivity
|
|||
resetButton.setOnClickListener(this);
|
||||
ct_text.setOnClickListener(this);
|
||||
|
||||
Button profileButton = (Button) findViewById(R.id.button_profile);
|
||||
profileButton.setOnClickListener(this);
|
||||
profileSpinner = (Spinner) findViewById(R.id.spinner);
|
||||
|
||||
Spinner profileSpinner = (Spinner) findViewById(R.id.spinner);
|
||||
String[] some_array = getResources().getStringArray(R.array.profile_entries);
|
||||
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] = "New Profile...";
|
||||
ArrayAdapter<String> adapter = new
|
||||
ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, some_array);
|
||||
ArrayAdapter<String>(this, R.layout.spinner_layout, profileNames);
|
||||
profileSpinner.setAdapter(adapter);
|
||||
|
||||
//Set the ClickListener for Spinner
|
||||
profileSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
profileSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener()
|
||||
|
||||
{
|
||||
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
System.out.println("Selected item: " + parent.getItemAtPosition(position) + " with id: " + id);
|
||||
//TODO Match the work and break value to the assigned profile
|
||||
switch ((String) parent.getItemAtPosition(position)){
|
||||
case "New Profile":
|
||||
createNewProfile();
|
||||
break;
|
||||
|
||||
String profileSelected = (String) parent.getItemAtPosition(position);
|
||||
if (profileSelected.equals("New Profile...")) {
|
||||
createNewProfile();
|
||||
} else {
|
||||
updatePreference(profileSelected);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -112,6 +128,98 @@ public class BreakReminder extends AppCompatActivity
|
|||
});
|
||||
}
|
||||
|
||||
private void updatePreference(String profileSelected) {
|
||||
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
|
||||
String allProfiles = sharedPrefs.getString("profiles", "");
|
||||
|
||||
String currentProfile = sharedPrefs.getString("name_text", "") + "," + sharedPrefs.getInt("work_value", -1) + "," + sharedPrefs.getInt("break_value", -1);
|
||||
|
||||
System.out.println("Current PROFILE: " + currentProfile + " , PROFILE SELECTED: " + profileSelected);
|
||||
if (allProfiles.contains(currentProfile) && profileSelected.equals(sharedPrefs.getString("name_text", ""))) {
|
||||
System.out.println("Profile didn´t change");
|
||||
} else {
|
||||
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]);
|
||||
if (profileName.equals(profileSelected)) {
|
||||
SharedPreferences.Editor editor = sharedPrefs.edit();
|
||||
editor.putString("name_text", profileName);
|
||||
editor.putInt("work_value", interval);
|
||||
editor.putInt("break_value", break_time);
|
||||
editor.apply();
|
||||
|
||||
//Update clock
|
||||
String bufferZeroMinute = "";
|
||||
int time = interval * 60 * 1000;
|
||||
if (time / 1000 / 60 < 10)
|
||||
bufferZeroMinute = "0";
|
||||
|
||||
ct_text.setText(bufferZeroMinute + time / 1000 / 60 + ":00");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void fillProfiles() {
|
||||
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
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] = "New Profile...";
|
||||
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));
|
||||
|
||||
//Update 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) {
|
||||
System.out.println("Selected item: " + parent.getItemAtPosition(position) + " with id: " + id);
|
||||
|
||||
String profileSelected = (String) parent.getItemAtPosition(position);
|
||||
if (profileSelected.equals("New Profile...")) {
|
||||
createNewProfile();
|
||||
} else {
|
||||
updatePreference(profileSelected);
|
||||
}
|
||||
}
|
||||
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
fillProfiles();
|
||||
profileSpinner = (Spinner) findViewById(R.id.spinner);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||
|
|
@ -204,15 +312,6 @@ public class BreakReminder extends AppCompatActivity
|
|||
|
||||
switch (v.getId()) {
|
||||
|
||||
//FIXME
|
||||
case R.id.button_profile:
|
||||
FragmentManager fm = getFragmentManager();
|
||||
ProfileDialog pd = new ProfileDialog();
|
||||
pd.show(fm, "Profile Dialog");
|
||||
|
||||
//createNewProfile();
|
||||
break;
|
||||
|
||||
case R.id.textView:
|
||||
case R.id.button_playStop:
|
||||
if (isRunning) {
|
||||
|
|
@ -267,7 +366,7 @@ public class BreakReminder extends AppCompatActivity
|
|||
// Play ringtone
|
||||
r.play();
|
||||
}
|
||||
//FIXME Vibrate
|
||||
//FIXME Test Vibration
|
||||
boolean vibrateChecked = sharedPrefs.getBoolean("notifications_new_message_vibrate", false);
|
||||
System.out.println("Vibrate is : " + vibrateChecked);
|
||||
if (vibrateChecked) {
|
||||
|
|
@ -297,8 +396,20 @@ public class BreakReminder extends AppCompatActivity
|
|||
|
||||
|
||||
case R.id.button_reset:
|
||||
if (ct != null)
|
||||
ct.cancel();
|
||||
if (ct != null) {
|
||||
//Reset clock
|
||||
int interval = sharedPrefs.getInt("work_value", 1);
|
||||
|
||||
bufferZeroMinute = "";
|
||||
time = interval * 60 * 1000;
|
||||
if (time / 1000 / 60 < 10)
|
||||
bufferZeroMinute = "0";
|
||||
|
||||
ct_text.setText(bufferZeroMinute + time / 1000 / 60 + ":00");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (oldTime / 1000 / 60 < 10)
|
||||
bufferZeroMinute = "0";
|
||||
|
|
@ -331,21 +442,4 @@ public class BreakReminder extends AppCompatActivity
|
|||
}
|
||||
|
||||
|
||||
public static class ProfileDialog extends DialogFragment {
|
||||
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
|
||||
builder.setTitle("")
|
||||
.setItems(R.array.profile_entries, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
// The 'which' argument contains the index position
|
||||
// of the selected item
|
||||
|
||||
}
|
||||
});
|
||||
return builder.create();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,28 +4,65 @@ package orgprivacy_friendly_apps.secuso.privacyfriendlybreakreminder;
|
|||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.PreferenceFragment;
|
||||
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.EditText;
|
||||
import android.widget.Spinner;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import android.widget.SeekBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class ProfileActivity extends AppCompatActivity implements View.OnClickListener {
|
||||
|
||||
private SeekBar interval_seekbar, break_seekbar;
|
||||
private TextView interval_text, break_text;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.new_profile);
|
||||
|
||||
interval_seekbar = (SeekBar) findViewById(R.id.new_profile_interval);
|
||||
interval_seekbar.setProgress(1);
|
||||
break_seekbar = (SeekBar) findViewById(R.id.new_profile_break);
|
||||
break_seekbar.setProgress(1);
|
||||
|
||||
interval_text = (TextView) findViewById(R.id.interval_text);
|
||||
interval_text.setText("1 Minutes");
|
||||
break_text = (TextView) findViewById(R.id.break_text);
|
||||
break_text.setText("1 Minutes");
|
||||
|
||||
interval_seekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
interval_text.setText(progress + " Minutes");
|
||||
}
|
||||
|
||||
@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 + " Minutes");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Button cancelButton = (Button) findViewById(R.id.button_profile_cancel);
|
||||
cancelButton.setOnClickListener(this);
|
||||
|
||||
|
|
@ -40,18 +77,19 @@ public class ProfileActivity extends AppCompatActivity implements View.OnClickLi
|
|||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.button_profile_save:
|
||||
//Fixme Add new Profile to the Array of Profiles (doesn´t work with xml because it is not possible to add values dynamically to any part of resources)
|
||||
//Fixme Check names for doubles
|
||||
System.out.println("Save new profile!");
|
||||
// Spinner profileSpinner = (Spinner) findViewById(R.id.spinner);
|
||||
// String[] array = getResources().getStringArray(R.array.profile_entries);
|
||||
// List<String> stringList = new ArrayList<String>(Arrays.asList(array));
|
||||
// EditText profileName =
|
||||
// (EditText) findViewById(R.id.editProfileName);
|
||||
// stringList.add(4, profileName.getText().toString());
|
||||
// ArrayAdapter<String> adapter = new
|
||||
// ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, stringList);
|
||||
// profileSpinner.setAdapter(adapter);
|
||||
|
||||
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
SharedPreferences.Editor editor = sharedPrefs.edit();
|
||||
EditText profileName =
|
||||
(EditText) findViewById(R.id.editProfileName);
|
||||
String name = profileName.getText().toString();
|
||||
editor.putString("name_text", name);
|
||||
editor.putInt("work_value",interval_seekbar.getProgress());
|
||||
editor.putInt("break_value",break_seekbar.getProgress());
|
||||
editor.putString("profiles", sharedPrefs.getString("profiles", "") + name + "," + interval_seekbar.getProgress() + "," + break_seekbar.getProgress() + ";");
|
||||
editor.apply();
|
||||
finish();
|
||||
break;
|
||||
|
||||
|
|
@ -73,4 +111,5 @@ public class ProfileActivity extends AppCompatActivity implements View.OnClickLi
|
|||
this.startActivity(intent);
|
||||
System.out.println("Exercise Type Activity!");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import android.text.TextUtils;
|
|||
import android.view.MenuItem;
|
||||
import android.support.v4.app.NavUtils;
|
||||
import android.widget.TextView;
|
||||
|
||||
import orgprivacy_friendly_apps.secuso.privacyfriendlybreakreminder.SeekBarPreference;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -186,6 +187,8 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
|
|||
private SeekBarPreference _seekBarWork;
|
||||
private SeekBarPreference _seekBarBreak;
|
||||
|
||||
private String currentProfile = "";
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
|
@ -199,12 +202,15 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
|
|||
// Set listener :
|
||||
getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
|
||||
|
||||
//Get profile name
|
||||
currentProfile = PreferenceManager.getDefaultSharedPreferences(this.getActivity()).getString("name_text", "");
|
||||
|
||||
// Set seekbar summary :
|
||||
int radius = PreferenceManager.getDefaultSharedPreferences(this.getActivity()).getInt("work_value", 50);
|
||||
_seekBarWork.setSummary(this.getString(R.string.settings_summary).replace("$1", ""+radius));
|
||||
_seekBarWork.setSummary(this.getString(R.string.settings_summary).replace("$1", "" + radius));
|
||||
|
||||
radius = PreferenceManager.getDefaultSharedPreferences(this.getActivity()).getInt("break_value", 10);
|
||||
_seekBarBreak.setSummary(this.getString(R.string.settings_summary).replace("$1", ""+radius));
|
||||
_seekBarBreak.setSummary(this.getString(R.string.settings_summary).replace("$1", "" + radius));
|
||||
|
||||
|
||||
// Bind the summaries of EditText/List/Dialog/Ringtone preferences
|
||||
|
|
@ -229,11 +235,55 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
|
|||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||
|
||||
|
||||
// Set seekbar summary :
|
||||
int radius = PreferenceManager.getDefaultSharedPreferences(this.getActivity()).getInt("work_value", 50);
|
||||
_seekBarWork.setSummary(this.getString(R.string.settings_summary).replace("$1", ""+radius));
|
||||
_seekBarWork.setSummary(this.getString(R.string.settings_summary).replace("$1", "" + radius));
|
||||
radius = PreferenceManager.getDefaultSharedPreferences(this.getActivity()).getInt("break_value", 10);
|
||||
_seekBarBreak.setSummary(this.getString(R.string.settings_summary).replace("$1", ""+radius));
|
||||
_seekBarBreak.setSummary(this.getString(R.string.settings_summary).replace("$1", "" + radius));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
getPreferenceManager().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this);
|
||||
|
||||
int work_radius = PreferenceManager.getDefaultSharedPreferences(this.getActivity()).getInt("work_value", 50);
|
||||
int break_radius = PreferenceManager.getDefaultSharedPreferences(this.getActivity()).getInt("break_value", 10);
|
||||
String newProfileName = PreferenceManager.getDefaultSharedPreferences(this.getActivity()).getString("name_text", "");
|
||||
String allProfiles = PreferenceManager.getDefaultSharedPreferences(this.getActivity()).getString("profiles", "");
|
||||
|
||||
if (allProfiles.contains(newProfileName + "," + work_radius + "," + break_radius)) {
|
||||
//Nothing changes
|
||||
System.out.println("No changes for a profile in general settings");
|
||||
} else {
|
||||
//FIXME Check for doubles
|
||||
SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(this.getActivity()).edit();
|
||||
String[] profiles = allProfiles.split(";");
|
||||
for (int i = 0; i < profiles.length; i++) {
|
||||
if (profiles[i].split(",")[0].equals(currentProfile)) {
|
||||
profiles[i] = newProfileName + "," + work_radius + "," + break_radius;
|
||||
break;
|
||||
}
|
||||
}
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (String s : profiles) {
|
||||
builder.append(s + ";");
|
||||
}
|
||||
editor.putString("profiles", builder.toString());
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
|
||||
currentProfile = PreferenceManager.getDefaultSharedPreferences(this.getActivity()).getString("name_text", "");
|
||||
super.onResume();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,61 +13,53 @@
|
|||
tools:showIn="@layout/app_bar_break_reminder">
|
||||
|
||||
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spinner"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/spinner"
|
||||
android:spinnerMode="dialog"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
|
||||
/>
|
||||
android:layout_alignEnd="@+id/textView"
|
||||
android:layout_alignLeft="@+id/button_playStop"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignRight="@+id/textView"
|
||||
android:layout_alignStart="@+id/button_playStop"
|
||||
android:layout_marginTop="84dp"
|
||||
android:popupBackground="@drawable/side_nav_bar"
|
||||
android:spinnerMode="dropdown" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_playStop"
|
||||
style="?android:attr/buttonStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Play/Stop"
|
||||
android:id="@+id/button_playStop"
|
||||
android:layout_alignTop="@+id/button_reset"
|
||||
android:layout_toLeftOf="@+id/button_reset"
|
||||
android:layout_toStartOf="@+id/button_reset" />
|
||||
android:layout_toStartOf="@+id/button_reset"
|
||||
android:text="Play/Stop" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_reset"
|
||||
style="?android:attr/buttonStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Reset"
|
||||
android:id="@+id/button_reset"
|
||||
android:layout_marginBottom="182dp"
|
||||
android:layout_alignEnd="@+id/textView"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignRight="@+id/textView"
|
||||
android:layout_alignEnd="@+id/textView" />
|
||||
android:layout_marginBottom="182dp"
|
||||
android:text="Reset" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:text="30:00"
|
||||
android:id="@+id/textView"
|
||||
android:layout_above="@+id/button_playStop"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:clickable="true"
|
||||
android:enabled="true"
|
||||
android:textStyle="bold"
|
||||
android:textSize="60dp"
|
||||
android:text="30:00"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textIsSelectable="false"
|
||||
android:layout_above="@+id/button_playStop"
|
||||
android:layout_centerHorizontal="true" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/button_profile"
|
||||
android:layout_above="@+id/textView"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="52dp"
|
||||
android:text="Select Profile" />
|
||||
android:textSize="60dp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?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:orientation="vertical"
|
||||
android:weightSum="1">
|
||||
|
||||
<RelativeLayout
|
||||
|
|
@ -10,135 +10,156 @@
|
|||
android:layout_height="fill_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="Profile Name"
|
||||
android:id="@+id/textView3"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginTop="53dp"
|
||||
android:text="Profile Name"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textSize="24dp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editProfileName"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/editProfileName"
|
||||
android:textSize="25dp"
|
||||
android:layout_alignBottom="@+id/textView3"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginRight="42dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginEnd="42dp"
|
||||
android:inputType="text" />
|
||||
android:layout_marginRight="42dp"
|
||||
android:inputType="text"
|
||||
android:textSize="25dp" />
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/new_profile_interval"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/new_profile_interval"
|
||||
android:layout_below="@+id/textView4"
|
||||
android:layout_centerHorizontal="true" />
|
||||
android:layout_centerHorizontal="true"
|
||||
android:max="120" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="interval"
|
||||
android:id="@+id/textView4"
|
||||
android:layout_below="@+id/editProfileName"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="40dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="Exercise Type"
|
||||
android:id="@+id/textView6"
|
||||
android:layout_marginTop="48dp"
|
||||
android:textSize="24dp"
|
||||
android:layout_below="@+id/seekBar2"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="Break"
|
||||
android:id="@+id/textView5"
|
||||
android:layout_marginTop="40dp"
|
||||
android:layout_below="@+id/new_profile_interval"
|
||||
android:text="interval"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<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="48dp"
|
||||
android:text="Exercise Type"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textSize="24dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Break"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_above="@+id/new_profile_break"
|
||||
android:layout_centerHorizontal="true" />
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/new_profile_break"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/seekBar2"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignLeft="@+id/new_profile_interval"
|
||||
android:layout_alignStart="@+id/new_profile_interval" />
|
||||
android:layout_alignStart="@+id/new_profile_interval"
|
||||
android:layout_centerVertical="true"
|
||||
android:max="30" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkBox"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/checkBox"
|
||||
android:layout_alignBottom="@+id/textView6"
|
||||
android:checked="false"
|
||||
android:layout_alignTop="@+id/textView6"
|
||||
android:layout_alignEnd="@+id/textView5"
|
||||
android:layout_alignLeft="@+id/textView5"
|
||||
android:layout_alignStart="@+id/textView5"
|
||||
android:layout_alignRight="@+id/textView5"
|
||||
android:layout_alignEnd="@+id/textView5" />
|
||||
android:layout_alignStart="@+id/textView5"
|
||||
android:layout_alignTop="@+id/textView6"
|
||||
android:checked="false" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_profile_select"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Select"
|
||||
android:id="@+id/button_profile_select"
|
||||
android:layout_alignBottom="@+id/checkBox"
|
||||
android:layout_toEndOf="@+id/checkBox"
|
||||
android:layout_toRightOf="@+id/checkBox"
|
||||
android:layout_toEndOf="@+id/checkBox" />
|
||||
android:text="Select" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView7"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_below="@+id/textView6"
|
||||
android:layout_marginTop="40dp"
|
||||
android:text="Continuosly"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textSize="24sp" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkBox2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignLeft="@+id/checkBox"
|
||||
android:layout_alignStart="@+id/checkBox"
|
||||
android:layout_alignTop="@+id/textView7"
|
||||
android:checked="false" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_profile_save"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/checkBox2"
|
||||
android:layout_toLeftOf="@+id/checkBox2"
|
||||
android:layout_toStartOf="@+id/checkBox2"
|
||||
android:text="Save" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_profile_cancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/checkBox2"
|
||||
android:layout_toEndOf="@+id/textView4"
|
||||
android:layout_toRightOf="@+id/textView4"
|
||||
android:text="Cancel" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="Continuosly"
|
||||
android:id="@+id/textView7"
|
||||
android:layout_marginTop="40dp"
|
||||
android:textSize="24sp"
|
||||
android:layout_below="@+id/textView6"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true" />
|
||||
android:text="0"
|
||||
android:id="@+id/interval_text"
|
||||
android:layout_alignTop="@+id/textView4"
|
||||
android:layout_toRightOf="@+id/new_profile_interval"
|
||||
android:layout_toEndOf="@+id/new_profile_interval" />
|
||||
|
||||
<CheckBox
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/checkBox2"
|
||||
android:checked="false"
|
||||
android:layout_alignTop="@+id/textView7"
|
||||
android:layout_alignLeft="@+id/checkBox"
|
||||
android:layout_alignStart="@+id/checkBox" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Save"
|
||||
android:id="@+id/button_profile_save"
|
||||
android:layout_below="@+id/checkBox2"
|
||||
android:layout_toLeftOf="@+id/checkBox2"
|
||||
android:layout_toStartOf="@+id/checkBox2" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Cancel"
|
||||
android:id="@+id/button_profile_cancel"
|
||||
android:layout_below="@+id/checkBox2"
|
||||
android:layout_toRightOf="@+id/textView4"
|
||||
android:layout_toEndOf="@+id/textView4" />
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:id="@+id/break_text"
|
||||
android:layout_alignTop="@+id/textView5"
|
||||
android:layout_toRightOf="@+id/new_profile_break"
|
||||
android:layout_toEndOf="@+id/new_profile_break"
|
||||
android:text="0" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
|
|
|||
8
app/src/main/res/layout/spinner_layout.xml
Normal file
8
app/src/main/res/layout/spinner_layout.xml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<?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="#FFFFFF"
|
||||
android:textSize="26sp" />
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string-array name="profile_entries">
|
||||
<item>Sport</item>
|
||||
<item>Exam</item>
|
||||
<item>Work</item>
|
||||
<item>New Profile</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
Loading…
Add table
Add a link
Reference in a new issue