Added Rate Button

This commit is contained in:
Sebastian Seedorf
2019-10-17 15:12:03 +02:00
parent 88f885202f
commit c8dac5d2fc
10 changed files with 46 additions and 22 deletions

View File

@@ -4,8 +4,8 @@
<facet type="android-gradle" name="Android-Gradle"> <facet type="android-gradle" name="Android-Gradle">
<configuration> <configuration>
<option name="GRADLE_PROJECT_PATH" value=":app" /> <option name="GRADLE_PROJECT_PATH" value=":app" />
<option name="LAST_SUCCESSFUL_SYNC_AGP_VERSION" value="3.5.0" /> <option name="LAST_SUCCESSFUL_SYNC_AGP_VERSION" value="3.5.1" />
<option name="LAST_KNOWN_AGP_VERSION" value="3.5.0" /> <option name="LAST_KNOWN_AGP_VERSION" value="3.5.1" />
</configuration> </configuration>
</facet> </facet>
<facet type="android" name="Android"> <facet type="android" name="Android">

View File

@@ -2,11 +2,14 @@ package de.sebse.fuplanner;
import android.accounts.Account; import android.accounts.Account;
import android.accounts.AccountManager; import android.accounts.AccountManager;
import android.content.ActivityNotFoundException;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.ContentResolver; import android.content.ContentResolver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.ServiceConnection; import android.content.ServiceConnection;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.IBinder; import android.os.IBinder;
import android.text.TextUtils; import android.text.TextUtils;
@@ -378,6 +381,21 @@ public class MainActivity extends AppCompatActivity
sendIntent.setType("text/plain"); sendIntent.setType("text/plain");
startActivity(sendIntent); startActivity(sendIntent);
break; break;
case R.id.nav_rate:
Uri uri = Uri.parse("market://details?id=" + getApplicationContext().getPackageName());
Intent viewIntent = new Intent(Intent.ACTION_VIEW, uri);
if (Build.VERSION.SDK_INT <= 21)
viewIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
else
viewIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_NEW_DOCUMENT | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
try {
startActivity(viewIntent);
} catch (ActivityNotFoundException e) {
uri = Uri.parse("http://play.google.com/store/apps/details?id=" + getApplicationContext().getPackageName());
viewIntent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(viewIntent);
}
break;
case R.id.nav_logout: case R.id.nav_logout:
getKVV(kvv -> { getKVV(kvv -> {
kvv.account().logout(true); kvv.account().logout(true);

View File

@@ -104,6 +104,10 @@ public class MealFragment extends Fragment {
browser.getCanteens(canteens -> { browser.getCanteens(canteens -> {
Canteen canteen = canteens.getCanteen(mCanteenId); Canteen canteen = canteens.getCanteen(mCanteenId);
browser.getCanteen(canteen, success -> { browser.getCanteen(canteen, success -> {
if (success.size() <= mDayPosition) {
swipeLayout.setRefreshing(false);
return;
}
Day day = success.get(mDayPosition); Day day = success.get(mDayPosition);
adapter.setDay(day); adapter.setDay(day);
browser.getDay(day, success1 -> { browser.getDay(day, success1 -> {

View File

@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M20,2L4,2c-1.1,0 -1.99,0.9 -1.99,2L2,22l4,-4h14c1.1,0 2,-0.9 2,-2L22,4c0,-1.1 -0.9,-2 -2,-2zM6,14v-2.47l6.88,-6.88c0.2,-0.2 0.51,-0.2 0.71,0l1.77,1.77c0.2,0.2 0.2,0.51 0,0.71L8.47,14L6,14zM18,14h-7.5l2,-2L18,12v2z"/>
</vector>

View File

@@ -22,6 +22,11 @@
android:icon="@drawable/ic_menu_share" android:icon="@drawable/ic_menu_share"
android:title="@string/share" android:title="@string/share"
android:orderInCategory="700"/> android:orderInCategory="700"/>
<item
android:id="@+id/nav_rate"
android:icon="@drawable/ic_rate_review"
android:title="@string/rate_the_app"
android:orderInCategory="700"/>
</menu> </menu>
</item> </item>

View File

@@ -42,6 +42,11 @@
android:icon="@drawable/ic_menu_share" android:icon="@drawable/ic_menu_share"
android:title="@string/share" android:title="@string/share"
android:orderInCategory="700"/> android:orderInCategory="700"/>
<item
android:id="@+id/nav_rate"
android:icon="@drawable/ic_rate_review"
android:title="@string/rate_the_app"
android:orderInCategory="700"/>
</menu> </menu>
</item> </item>

View File

@@ -114,4 +114,5 @@
<string name="resource_removed">Ressource entfernt: %1$s</string> <string name="resource_removed">Ressource entfernt: %1$s</string>
<string name="network_error">Ein Netzwerkfehler ist aufgetreten!</string> <string name="network_error">Ein Netzwerkfehler ist aufgetreten!</string>
<string name="network_error_parameter">Ein Netzwerkfehler ist aufgetreten: %s!</string> <string name="network_error_parameter">Ein Netzwerkfehler ist aufgetreten: %s!</string>
<string name="rate_the_app">App bewerten!</string>
</resources> </resources>

View File

@@ -122,4 +122,5 @@
<string name="resource_removed">Resource removed: %1$s</string> <string name="resource_removed">Resource removed: %1$s</string>
<string name="network_error">A network error occurred!</string> <string name="network_error">A network error occurred!</string>
<string name="network_error_parameter">A network error occurred: %s!</string> <string name="network_error_parameter">A network error occurred: %s!</string>
<string name="rate_the_app">Rate the App!</string>
</resources> </resources>

View File

@@ -9,7 +9,7 @@ buildscript {
} }
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.5.0' classpath 'com.android.tools.build:gradle:3.5.1'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files

View File

@@ -1,19 +0,0 @@
?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="fuplanner" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="java-gradle" name="Java-Gradle">
<configuration>
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
<option name="BUILDABLE" value="false" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>