diff --git a/app/src/main/java/orgprivacy_friendly_apps/secuso/privacyfriendlybreakreminder/BreakReminder.java b/app/src/main/java/orgprivacy_friendly_apps/secuso/privacyfriendlybreakreminder/BreakReminder.java index edadefe..caf8027 100644 --- a/app/src/main/java/orgprivacy_friendly_apps/secuso/privacyfriendlybreakreminder/BreakReminder.java +++ b/app/src/main/java/orgprivacy_friendly_apps/secuso/privacyfriendlybreakreminder/BreakReminder.java @@ -1,5 +1,9 @@ package orgprivacy_friendly_apps.secuso.privacyfriendlybreakreminder; +import android.app.Activity; +import android.app.Dialog; +import android.app.DialogFragment; +import android.app.FragmentManager; import android.app.Notification; import android.app.NotificationManager; import android.appwidget.AppWidgetManager; @@ -15,6 +19,8 @@ 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; @@ -30,7 +36,6 @@ 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 { @@ -68,12 +73,16 @@ public class BreakReminder extends AppCompatActivity String allProfiles = sharedPrefs.getString("profiles", ""); if (allProfiles.equals("")) { System.out.println("Es gibt noch keine Profile!!"); - allProfiles = "Sport,5,1,false,-1;Exams,90,15,false,-1;Pomodoro,30,5,false,-1;"; + allProfiles = "Random,90,5,false,Arms.Legs.Head.Neck.Pelvis.Spinal Column.Trunk.;Upper-Body,90,15,true,Arms.Neck.Head.;Torso,30,5,true,Spinal Column.Trunk.;Under-Body,30,5,true,Legs.Pelvis.;"; editor.putString("profiles", allProfiles); - editor.apply(); + + WelcomeDialog welcomeDialog = new WelcomeDialog(); + welcomeDialog.show(getFragmentManager(), "WelcomeDialog"); } + + System.out.println("Alle Profile: " + sharedPrefs.getString("profiles", "FAIL")); // If chosen, set screen to "stay on" @@ -482,4 +491,26 @@ public class BreakReminder extends AppCompatActivity 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_launcher); + builder.setTitle(getActivity().getString(R.string.app_name_long)); + builder.setPositiveButton("Ok", null); + + return builder.create(); + } + } } diff --git a/app/src/main/java/orgprivacy_friendly_apps/secuso/privacyfriendlybreakreminder/SettingsActivity.java b/app/src/main/java/orgprivacy_friendly_apps/secuso/privacyfriendlybreakreminder/SettingsActivity.java index 63e1fb5..3bb6b1d 100644 --- a/app/src/main/java/orgprivacy_friendly_apps/secuso/privacyfriendlybreakreminder/SettingsActivity.java +++ b/app/src/main/java/orgprivacy_friendly_apps/secuso/privacyfriendlybreakreminder/SettingsActivity.java @@ -241,14 +241,6 @@ public class SettingsActivity extends AppCompatPreferenceActivity { @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { - if(key.equals("exercise")) { - System.out.println("GOGOGOGOGOG"); - - System.out.println(sharedPreferences.getString("exercise", "Damn")); - - } - - if (key.equals("current_profile")) { ListPreference listPref = (ListPreference) findPreference("current_profile"); int i = Integer.parseInt(listPref.getValue()); @@ -259,11 +251,13 @@ public class SettingsActivity extends AppCompatPreferenceActivity { editor.putBoolean("change_profiles", true); String[] allProfile = sharedPreferences.getString("profiles", "").split(";"); - //FIXME Deactivate the onPrefListener in SettingsActivity + // Deactivate the onPrefListener in SettingsActivity getPreferenceScreen().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this); editor.putString("name_text", allProfile[i].split(",")[0]); editor.putInt("work_value", Integer.parseInt(allProfile[i].split(",")[1])); editor.putInt("break_value", Integer.parseInt(allProfile[i].split(",")[2])); + editor.putBoolean("cont_value", Boolean.parseBoolean(allProfile[i].split(",")[3])); + editor.putString("exercise_value", allProfile[i].split(",")[4]); editor.apply(); getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this); @@ -273,8 +267,6 @@ public class SettingsActivity extends AppCompatPreferenceActivity { return; } - if(key.equals("cont_value")) - System.out.println("Cont: " + sharedPreferences.getBoolean("cont_value", false)); // Set seekbar summary : int radius = PreferenceManager.getDefaultSharedPreferences(this.getActivity()).getInt("work_value", 50); diff --git a/app/src/main/res/drawable/clock.png b/app/src/main/res/drawable/clock.png new file mode 100644 index 0000000..d2bc80b Binary files /dev/null and b/app/src/main/res/drawable/clock.png differ diff --git a/app/src/main/res/drawable/play_button.png b/app/src/main/res/drawable/play_button.png new file mode 100644 index 0000000..d86db00 Binary files /dev/null and b/app/src/main/res/drawable/play_button.png differ diff --git a/app/src/main/res/drawable/reset_button.png b/app/src/main/res/drawable/reset_button.png new file mode 100644 index 0000000..a078919 Binary files /dev/null and b/app/src/main/res/drawable/reset_button.png differ diff --git a/app/src/main/res/drawable/spinner.png b/app/src/main/res/drawable/spinner.png new file mode 100644 index 0000000..7341d4b Binary files /dev/null and b/app/src/main/res/drawable/spinner.png differ diff --git a/app/src/main/res/layout/first_dialog.xml b/app/src/main/res/layout/first_dialog.xml new file mode 100644 index 0000000..d034b17 --- /dev/null +++ b/app/src/main/res/layout/first_dialog.xml @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/new_profile.xml b/app/src/main/res/layout/new_profile.xml index 6ad52fe..5a2ebbd 100644 --- a/app/src/main/res/layout/new_profile.xml +++ b/app/src/main/res/layout/new_profile.xml @@ -26,8 +26,8 @@ android:layout_width="150dp" android:layout_height="wrap_content" android:inputType="text" - android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" - android:maxLength="9" + android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-" + android:maxLength="10" android:textSize="25sp" android:layout_alignParentTop="true" android:layout_alignParentRight="true" diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 387b84b..d1970cd 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -136,4 +136,23 @@ To see the images in real size simply click on them. To return back to this view re-click on the image! Side/Repetition + + + + + DISCLAIMER PLACEHOLDER + + + + + Select profiles + Press the button to reset the clock + Reset the clock + By pressing one of them, the clock starts or stops + or + By clicking on the current profile (sport), you will see all the currently available profiles. \nYou can add new profiles by clicking on \'New Profiles...\' and edit the current ones in the settings + Start/Stop the clock + Welcome to the Privacy Friendly Break Reminder + + diff --git a/app/src/main/res/xml/pref_general.xml b/app/src/main/res/xml/pref_general.xml index 0e64c9f..32943fc 100644 --- a/app/src/main/res/xml/pref_general.xml +++ b/app/src/main/res/xml/pref_general.xml @@ -12,10 +12,10 @@