Skip to content

Commit

Permalink
Evaluation Link and Dialog added. Version increase to v1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamuno committed Mar 2, 2020
1 parent aa0bddb commit 62b3850
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 9 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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 <b>after</b> {@link #initResources()}
*/
Expand Down Expand Up @@ -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<ExerciseSet>());

Expand Down
9 changes: 9 additions & 0 deletions app/src/main/res/menu/menu_show_evaluation_dialog.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:title="@string/menu_display_evaluation_dialog"
android:id="@+id/action_evaluation"
android:visible="true"
app:showAsAction="never"/>
</menu>
6 changes: 6 additions & 0 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -170,5 +170,11 @@
<string name="warning">Achtung</string>
<string name="toast_not_enough_exercise_time">Die gewählte Übungszeit ist nicht ausreichend, um das gewählte Übungsset abzuschließen. Die Zeit wurde automatisch angepasst.</string>
<string name="pref_schedule_random_exercise">Verwende zufällige Übungssets</string>
<string name="dialog_evaluation_later">Später</string>
<string name="dialog_evaluation_message">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:\n<a href="https://soscisurvey.sport.kit.edu/aktivpause/">https://soscisurvey.sport.kit.edu/aktivpause/</a></string>
<string name="dialog_evaluation_no">Nicht noch mal Fragen</string>
<string name="dialog_evaluation_title">Online-Befragung</string>
<string name="dialog_evaluation_yes">Ja</string>
<string name="menu_display_evaluation_dialog">Online-Befragung</string>

</resources>
7 changes: 6 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,12 @@
<string name="warning">Warning</string>
<string name="toast_not_enough_exercise_time">The currently selected exercise time is not sufficient to complete the chosen exercise set. The time has been adjusted.</string>
<string name="pref_schedule_random_exercise">Use random exercise sets</string>

<string name="dialog_evaluation_title">Evaluation</string>
<string name="dialog_evaluation_message">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:\n<a href="https://soscisurvey.sport.kit.edu/aktivpause/">https://soscisurvey.sport.kit.edu/aktivpause/</a></string>
<string name="dialog_evaluation_later">Later</string>
<string name="dialog_evaluation_no">Don\'t show again</string>
<string name="dialog_evaluation_yes">Yes</string>
<string name="menu_display_evaluation_dialog">Online Evaluation</string>


</resources>
9 changes: 4 additions & 5 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<style name="AppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
Expand Down Expand Up @@ -65,10 +65,9 @@
</style>

<style name="AppTheme.ActionBar" parent="AppTheme">
<item name="android:textColorPrimary">#fff</item>
<item name="android:textColorPrimaryInverse">#fff</item>
<item name="android:textColorSecondary">#fff</item>
<item name="actionMenuTextColor">#fff</item>
<item name="android:textColorPrimary">@color/white</item>
<item name="android:textColor">@color/black</item>
<item name="android:textColorSecondary">@color/white</item>
</style>

</resources>

0 comments on commit 62b3850

Please sign in to comment.