From 62b3850e0370b1010cd4110b788b69b0521b056a Mon Sep 17 00:00:00 2001 From: Christopher Beckmann Date: Mon, 2 Mar 2020 14:03:12 +0100 Subject: [PATCH] Evaluation Link and Dialog added. Version increase to v1.1 --- app/build.gradle | 4 +- .../aktivpause/activities/TimerActivity.java | 62 ++++++++++++++++++- .../res/menu/menu_show_evaluation_dialog.xml | 9 +++ app/src/main/res/values-de/strings.xml | 6 ++ app/src/main/res/values/strings.xml | 7 ++- app/src/main/res/values/styles.xml | 9 ++- 6 files changed, 88 insertions(+), 9 deletions(-) create mode 100644 app/src/main/res/menu/menu_show_evaluation_dialog.xml diff --git a/app/build.gradle b/app/build.gradle index d7be48f..95238b9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -7,8 +7,8 @@ android { applicationId "org.secuso.aktivpause" minSdkVersion 21 targetSdkVersion 28 - versionCode 6 - versionName "1.0" + versionCode 7 + versionName "1.1" vectorDrawables.useSupportLibrary = true } lintOptions { diff --git a/app/src/main/java/org/secuso/aktivpause/activities/TimerActivity.java b/app/src/main/java/org/secuso/aktivpause/activities/TimerActivity.java index f87d384..a9a2d43 100644 --- a/app/src/main/java/org/secuso/aktivpause/activities/TimerActivity.java +++ b/app/src/main/java/org/secuso/aktivpause/activities/TimerActivity.java @@ -9,8 +9,10 @@ import android.content.ServiceConnection; import android.content.SharedPreferences; import android.graphics.drawable.Drawable; +import android.net.Uri; import android.os.IBinder; import android.preference.PreferenceManager; +import android.support.annotation.NonNull; import android.support.constraint.ConstraintLayout; import android.support.constraint.ConstraintSet; import android.support.v4.app.ActivityCompat; @@ -19,6 +21,9 @@ import android.os.Bundle; import android.support.v7.app.AlertDialog; import android.transition.TransitionManager; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.ImageButton; @@ -83,6 +88,8 @@ public class TimerActivity extends BaseActivity implements android.support.v4.ap // Service private TimerService mTimerService = null; + private SharedPreferences pref; + private final ServiceConnection mServiceConnection = new ServiceConnection() { @Override public void onServiceConnected(ComponentName name, IBinder service) { @@ -127,9 +134,62 @@ protected void onCreate(Bundle savedInstanceState) { initResources(); initAnimations(); + + if(pref.getBoolean("SHOW_EVALUATION", true)) { + showEvaluationDialog(); + } + getSupportLoaderManager().initLoader(0, null, this); } + @Override + public boolean onCreateOptionsMenu(Menu menu) { + MenuInflater inflater = getMenuInflater(); + inflater.inflate(R.menu.menu_show_evaluation_dialog, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + if(item.getItemId() == R.id.action_evaluation) { + showEvaluationDialog(); + return true; + } + return super.onOptionsItemSelected(item); + } + + private void showEvaluationDialog() { + AlertDialog.Builder builder = new AlertDialog.Builder(this); + + builder.setPositiveButton(R.string.dialog_evaluation_yes, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + Uri link = Uri.parse("https://soscisurvey.sport.kit.edu/aktivpause/"); + Intent linkIntent = new Intent(Intent.ACTION_VIEW, link); + startActivity(linkIntent); + pref.edit().putBoolean("SHOW_EVALUATION", false).apply(); + dialog.dismiss(); + } + }); + builder.setNegativeButton(R.string.dialog_evaluation_no, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + pref.edit().putBoolean("SHOW_EVALUATION", false).apply(); + dialog.dismiss(); + } + }); + builder.setNeutralButton(R.string.dialog_evaluation_later, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + pref.edit().putBoolean("SHOW_EVALUATION", true).apply(); + dialog.dismiss(); + } + }); + builder.setMessage(R.string.dialog_evaluation_message); + builder.setTitle(R.string.dialog_evaluation_title); + builder.create().show(); + } + /** * Must be called after {@link #initResources()} */ @@ -205,7 +265,7 @@ private void shutdownServiceBinding() { } private void initResources() { - final SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this); + pref = PreferenceManager.getDefaultSharedPreferences(this); exerciseSetAdapter = new ExerciseSetSpinnerAdapter(this, R.layout.layout_exercise_set, new LinkedList()); diff --git a/app/src/main/res/menu/menu_show_evaluation_dialog.xml b/app/src/main/res/menu/menu_show_evaluation_dialog.xml new file mode 100644 index 0000000..57e94cf --- /dev/null +++ b/app/src/main/res/menu/menu_show_evaluation_dialog.xml @@ -0,0 +1,9 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 9e49c44..1f79287 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -170,5 +170,11 @@ Achtung Die gewählte Übungszeit ist nicht ausreichend, um das gewählte Übungsset abzuschließen. Die Zeit wurde automatisch angepasst. Verwende zufällige Übungssets + Später + Vielen Dank, dass Sie die \"Aktivpause to Go\" App verwenden. Wir würden gerne eine Online-Befragung zur App durchführen und bitten um Ihre Mithilfe. Möchten Sie daran teilnehmen?\n\nDrücken auf \"Ja\" führt Sie zu folgender Website:\nhttps://soscisurvey.sport.kit.edu/aktivpause/ + Nicht noch mal Fragen + Online-Befragung + Ja + Online-Befragung \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index cba58f4..8c4bb58 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -162,7 +162,12 @@ Warning The currently selected exercise time is not sufficient to complete the chosen exercise set. The time has been adjusted. Use random exercise sets - + Evaluation + Thank you for using the Aktivpause to Go app. We would like to hear your feedback via an online evaluation. The evaluation is in german. Would you like to participate?\n\nSeleting \"Yes\" will take you to the following website:\nhttps://soscisurvey.sport.kit.edu/aktivpause/ + Later + Don\'t show again + Yes + Online Evaluation diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 9710b9e..483ff70 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -1,7 +1,7 @@ -