mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Rate Us method added to Utils.java and called on AboutActivity.java
This commit is contained in:
parent
4432f2ca1a
commit
fc8b522ac4
11 changed files with 30 additions and 18 deletions
|
|
@ -65,4 +65,10 @@ public class AboutActivity extends NavigationBaseActivity {
|
||||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://commons-app.github.io/\\"));
|
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://commons-app.github.io/\\"));
|
||||||
startActivity(browserIntent);
|
startActivity(browserIntent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OnClick(R.id.about_rate_us)
|
||||||
|
public void rateApp(View view) {
|
||||||
|
|
||||||
|
Utils.rateApp(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
package fr.free.nrw.commons;
|
package fr.free.nrw.commons;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
|
|
||||||
|
|
@ -159,4 +161,15 @@ public class Utils {
|
||||||
|
|
||||||
return stringBuilder.toString();
|
return stringBuilder.toString();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public static void rateApp(Context context) {
|
||||||
|
final String appPackageName = context.getPackageName();
|
||||||
|
try {
|
||||||
|
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
|
||||||
|
}
|
||||||
|
catch (android.content.ActivityNotFoundException anfe) {
|
||||||
|
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName)));
|
||||||
|
}
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -23,6 +23,7 @@ import fr.free.nrw.commons.AboutActivity;
|
||||||
import fr.free.nrw.commons.BuildConfig;
|
import fr.free.nrw.commons.BuildConfig;
|
||||||
import fr.free.nrw.commons.CommonsApplication;
|
import fr.free.nrw.commons.CommonsApplication;
|
||||||
import fr.free.nrw.commons.R;
|
import fr.free.nrw.commons.R;
|
||||||
|
import fr.free.nrw.commons.Utils;
|
||||||
import fr.free.nrw.commons.WelcomeActivity;
|
import fr.free.nrw.commons.WelcomeActivity;
|
||||||
import fr.free.nrw.commons.auth.AccountUtil;
|
import fr.free.nrw.commons.auth.AccountUtil;
|
||||||
import fr.free.nrw.commons.auth.LoginActivity;
|
import fr.free.nrw.commons.auth.LoginActivity;
|
||||||
|
|
@ -133,17 +134,6 @@ public abstract class NavigationBaseActivity extends BaseActivity
|
||||||
Toast.makeText(this, R.string.no_email_client, Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, R.string.no_email_client, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
case R.id.action_rate:
|
|
||||||
drawerLayout.closeDrawer(navigationView);
|
|
||||||
final String appPackageName = getPackageName();
|
|
||||||
Toast.makeText(this, appPackageName, Toast.LENGTH_SHORT).show();
|
|
||||||
try {
|
|
||||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
|
|
||||||
}
|
|
||||||
catch (android.content.ActivityNotFoundException anfe) {
|
|
||||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName)));
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
case R.id.action_logout:
|
case R.id.action_logout:
|
||||||
new AlertDialog.Builder(this)
|
new AlertDialog.Builder(this)
|
||||||
.setMessage(R.string.logout_verification)
|
.setMessage(R.string.logout_verification)
|
||||||
|
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 440 B |
Binary file not shown.
|
Before Width: | Height: | Size: 296 B |
Binary file not shown.
|
Before Width: | Height: | Size: 577 B |
Binary file not shown.
|
Before Width: | Height: | Size: 844 B |
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB |
|
|
@ -104,6 +104,14 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/about_rate_us"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/standard_gap"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textColor="@color/primaryColor"
|
||||||
|
android:text="@string/about_rate_us" />
|
||||||
<fr.free.nrw.commons.ui.widget.HtmlTextView
|
<fr.free.nrw.commons.ui.widget.HtmlTextView
|
||||||
android:id="@+id/about_privacy_policy"
|
android:id="@+id/about_privacy_policy"
|
||||||
style="?android:textAppearanceSmall"
|
style="?android:textAppearanceSmall"
|
||||||
|
|
|
||||||
|
|
@ -30,11 +30,6 @@
|
||||||
android:icon="@drawable/ic_feedback_black_24dp"
|
android:icon="@drawable/ic_feedback_black_24dp"
|
||||||
android:title="@string/navigation_item_feedback"/>
|
android:title="@string/navigation_item_feedback"/>
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/action_rate"
|
|
||||||
android:icon="@drawable/ic_star_black_24dp"
|
|
||||||
android:title="@string/navigation_item_rate"/>
|
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_logout"
|
android:id="@+id/action_logout"
|
||||||
android:icon="@drawable/ic_exit_to_app_black_24dp"
|
android:icon="@drawable/ic_exit_to_app_black_24dp"
|
||||||
|
|
|
||||||
|
|
@ -225,5 +225,5 @@
|
||||||
<string name="notifications_thank_you_edit">Thank you for making an edit</string>
|
<string name="notifications_thank_you_edit">Thank you for making an edit</string>
|
||||||
<string name="notifications_mention">%1$s mentioned you on %2$s.</string>
|
<string name="notifications_mention">%1$s mentioned you on %2$s.</string>
|
||||||
<string name="toggle_view_button">Toggle view</string>
|
<string name="toggle_view_button">Toggle view</string>
|
||||||
<string name="navigation_item_rate">Rate Us</string>
|
<string name="about_rate_us"><u>Rate Us</u></string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue