Skip to content

Commit 4432f2c

Browse files
Rate Us feature added
1 parent a7a2b51 commit 4432f2c

File tree

8 files changed

+18
-0
lines changed

8 files changed

+18
-0
lines changed

app/src/main/java/fr/free/nrw/commons/theme/NavigationBaseActivity.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import android.content.ActivityNotFoundException;
66
import android.content.Context;
77
import android.content.Intent;
8+
import android.net.Uri;
89
import android.support.annotation.NonNull;
910
import android.support.design.widget.NavigationView;
1011
import android.support.v4.widget.DrawerLayout;
@@ -132,6 +133,17 @@ public boolean onNavigationItemSelected(@NonNull final MenuItem item) {
132133
Toast.makeText(this, R.string.no_email_client, Toast.LENGTH_SHORT).show();
133134
}
134135
return true;
136+
case R.id.action_rate:
137+
drawerLayout.closeDrawer(navigationView);
138+
final String appPackageName = getPackageName();
139+
Toast.makeText(this, appPackageName, Toast.LENGTH_SHORT).show();
140+
try {
141+
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
142+
}
143+
catch (android.content.ActivityNotFoundException anfe) {
144+
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName)));
145+
}
146+
return true;
135147
case R.id.action_logout:
136148
new AlertDialog.Builder(this)
137149
.setMessage(R.string.logout_verification)
440 Bytes
Loading
296 Bytes
Loading
577 Bytes
Loading
844 Bytes
Loading
1.12 KB
Loading

app/src/main/res/menu/drawer.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@
3030
android:icon="@drawable/ic_feedback_black_24dp"
3131
android:title="@string/navigation_item_feedback"/>
3232

33+
<item
34+
android:id="@+id/action_rate"
35+
android:icon="@drawable/ic_star_black_24dp"
36+
android:title="@string/navigation_item_rate"/>
37+
3338
<item
3439
android:id="@+id/action_logout"
3540
android:icon="@drawable/ic_exit_to_app_black_24dp"

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,4 +225,5 @@
225225
<string name="notifications_thank_you_edit">Thank you for making an edit</string>
226226
<string name="notifications_mention">%1$s mentioned you on %2$s.</string>
227227
<string name="toggle_view_button">Toggle view</string>
228+
<string name="navigation_item_rate">Rate Us</string>
228229
</resources>

0 commit comments

Comments
 (0)