├── .gitignore
├── AppRaterDemo
├── build.gradle
├── libs
│ └── android-support-v4.jar
├── proguard-project.txt
├── project.properties
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── org
│ │ └── codechimp
│ │ └── appraterdemo
│ │ └── MainActivity.java
│ └── res
│ ├── drawable-hdpi
│ └── ic_launcher.png
│ ├── drawable-mdpi
│ └── ic_launcher.png
│ ├── drawable-xhdpi
│ └── ic_launcher.png
│ ├── layout
│ └── activity_main.xml
│ ├── menu
│ └── activity_main.xml
│ ├── values-v11
│ └── styles.xml
│ ├── values-v14
│ └── styles.xml
│ └── values
│ ├── strings.xml
│ └── styles.xml
├── AppRaterLibrary
├── build.gradle
├── gradle.properties
├── proguard-project.txt
├── project.properties
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── org
│ │ └── codechimp
│ │ └── apprater
│ │ ├── AmazonMarket.java
│ │ ├── AppRater.java
│ │ ├── ApplicationRatingInfo.java
│ │ ├── GoogleMarket.java
│ │ └── Market.java
│ └── res
│ ├── values-ar
│ └── strings.xml
│ ├── values-bg
│ └── strings.xml
│ ├── values-ca
│ └── strings.xml
│ ├── values-cs
│ └── strings.xml
│ ├── values-de
│ └── strings.xml
│ ├── values-es
│ └── strings.xml
│ ├── values-fa
│ └── strings.xml
│ ├── values-fr
│ └── strings.xml
│ ├── values-he
│ └── strings.xml
│ ├── values-hr
│ └── strings.xml
│ ├── values-hu
│ └── strings.xml
│ ├── values-id
│ └── strings.xml
│ ├── values-it
│ └── strings.xml
│ ├── values-iw
│ └── strings.xml
│ ├── values-ja
│ └── strings.xml
│ ├── values-ko
│ └── strings.xml
│ ├── values-nl
│ └── strings.xml
│ ├── values-pl
│ └── strings.xml
│ ├── values-pt-rBR
│ └── strings.xml
│ ├── values-pt
│ └── strings.xml
│ ├── values-ru
│ └── strings.xml
│ ├── values-sk
│ └── strings.xml
│ ├── values-sl
│ └── strings.xml
│ ├── values-sq
│ └── strings.xml
│ ├── values-sr
│ └── strings.xml
│ ├── values-sv
│ └── strings.xml
│ ├── values-th
│ └── strings.xml
│ ├── values-tr
│ └── strings.xml
│ ├── values-uk
│ └── strings.xml
│ ├── values-vi
│ └── strings.xml
│ ├── values-zh-rHK
│ └── strings.xml
│ ├── values-zh-rTW
│ └── strings.xml
│ ├── values-zh
│ └── strings.xml
│ └── values
│ └── strings.xml
├── README.md
├── Screenshots
├── demo-dark.png
└── demo-light.png
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── maven_push.gradle
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | # built application files
2 | *.apk
3 | *.ap_
4 |
5 | # files for the dex VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 |
11 | # generated files
12 | bin/
13 | gen/
14 |
15 | # Local configuration file (sdk path, etc)
16 | local.properties
17 | signing.properties
18 |
19 | # Android Studio files
20 | *.iml
21 | out/
22 | build/
23 | .idea
24 |
25 | .gradle
26 |
27 |
--------------------------------------------------------------------------------
/AppRaterDemo/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion rootProject.ext.compileSdkVersion
5 |
6 | defaultConfig {
7 | minSdkVersion 8
8 | targetSdkVersion 27
9 | versionName project.VERSION_NAME
10 | versionCode Integer.parseInt(project.VERSION_CODE)
11 | }
12 |
13 | lintOptions {
14 | disable 'MissingTranslation'
15 | }
16 |
17 | signingConfigs {
18 | release
19 | }
20 |
21 | buildTypes {
22 | if (isReleaseBuild()) {
23 | release {
24 | signingConfig signingConfigs.release
25 | }
26 | }
27 |
28 | debug {
29 | applicationIdSuffix ".debug"
30 | versionNameSuffix "-debug"
31 | }
32 | }
33 | }
34 |
35 | dependencies {
36 | compile project(':AppRaterLibrary')
37 | }
38 |
39 |
40 | def Properties props = new Properties()
41 | def propFile = file('signing.properties')
42 | if (propFile.canRead()){
43 | props.load(new FileInputStream(propFile))
44 |
45 | if (props!=null && props.containsKey('STORE_FILE') && props.containsKey('STORE_PASSWORD') &&
46 | props.containsKey('KEY_ALIAS') && props.containsKey('KEY_PASSWORD')) {
47 |
48 | println 'RELEASE BUILD SIGNING'
49 |
50 | android.signingConfigs.release.storeFile = file(props['STORE_FILE'])
51 | android.signingConfigs.release.storePassword = props['STORE_PASSWORD']
52 | android.signingConfigs.release.keyAlias = props['KEY_ALIAS']
53 | android.signingConfigs.release.keyPassword = props['KEY_PASSWORD']
54 | } else {
55 | println 'RELEASE BUILD NOT FOUND SIGNING PROPERTIES'
56 |
57 | android.buildTypes.release.signingConfig = null
58 | }
59 | }else {
60 | println 'RELEASE BUILD NOT FOUND SIGNING FILE'
61 | android.buildTypes.release.signingConfig = null
62 | }
63 |
64 |
--------------------------------------------------------------------------------
/AppRaterDemo/libs/android-support-v4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codechimp-org/AppRater/018d481b26ce6112a0f431e9e58e80e1745a63b6/AppRaterDemo/libs/android-support-v4.jar
--------------------------------------------------------------------------------
/AppRaterDemo/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/AppRaterDemo/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-18
15 | android.library.reference.1=../AppRater
16 |
--------------------------------------------------------------------------------
/AppRaterDemo/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
11 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/AppRaterDemo/src/main/java/org/codechimp/appraterdemo/MainActivity.java:
--------------------------------------------------------------------------------
1 | package org.codechimp.appraterdemo;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 | import android.view.Menu;
6 | import android.view.MenuInflater;
7 | import android.view.MenuItem;
8 | import android.view.View;
9 | import android.view.View.OnClickListener;
10 | import android.widget.Button;
11 |
12 | import org.codechimp.apprater.AppRater;
13 |
14 | public class MainActivity extends Activity {
15 |
16 | private Button buttonTest;
17 |
18 | @Override
19 | protected void onCreate(Bundle savedInstanceState) {
20 | super.onCreate(savedInstanceState);
21 | setContentView(R.layout.activity_main);
22 |
23 |
24 | buttonTest = (Button) findViewById(R.id.button1);
25 |
26 | buttonTest.setOnClickListener(new OnClickListener() {
27 | public void onClick(View v) {
28 |
29 | // This forces display of the rate prompt.
30 | // It should only be used for testing purposes
31 | AppRater.showRateDialog(v.getContext());
32 | }
33 | });
34 |
35 |
36 | // Optionally you can set the Market you want to use prior to calling app_launched
37 | // If setMarket not called it will default to Google Play
38 | // Current implementations are Google Play and Amazon App Store, you can add your own by implementing Market
39 | // AppRater.setMarket(new GoogleMarket());
40 | // AppRater.setMarket(new AmazonMarket());
41 |
42 | // This will keep a track of when the app was first used and whether to show a prompt
43 | // It should be the default implementation of AppRater
44 |
45 | AppRater.setPackageName("com.johncrossley");
46 | AppRater.app_launched(this);
47 | }
48 |
49 | @Override
50 | public boolean onCreateOptionsMenu(Menu menu) {
51 | MenuInflater inflater = getMenuInflater();
52 | inflater.inflate(R.menu.activity_main, menu);
53 | return super.onCreateOptionsMenu(menu);
54 | }
55 |
56 | @Override
57 | public boolean onOptionsItemSelected(MenuItem item) {
58 | super.onOptionsItemSelected(item);
59 | switch (item.getItemId()) {
60 | case (R.id.menu_ratenow): {
61 | AppRater.rateNow(this);
62 | return true;
63 | }
64 | }
65 | return false;
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/AppRaterDemo/src/main/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codechimp-org/AppRater/018d481b26ce6112a0f431e9e58e80e1745a63b6/AppRaterDemo/src/main/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/AppRaterDemo/src/main/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codechimp-org/AppRater/018d481b26ce6112a0f431e9e58e80e1745a63b6/AppRaterDemo/src/main/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/AppRaterDemo/src/main/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codechimp-org/AppRater/018d481b26ce6112a0f431e9e58e80e1745a63b6/AppRaterDemo/src/main/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/AppRaterDemo/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
14 |
15 |
22 |
23 |
--------------------------------------------------------------------------------
/AppRaterDemo/src/main/res/menu/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/AppRaterDemo/src/main/res/values-v11/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/AppRaterDemo/src/main/res/values-v14/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
11 |
12 |
--------------------------------------------------------------------------------
/AppRaterDemo/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | AppRaterDemo
5 | By default a prompt will appear after 3 days and the app must have been activated at least 7 times.
6 | Force Rate Prompt
7 | Rate Now
8 |
--------------------------------------------------------------------------------
/AppRaterDemo/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
14 |
15 |
16 |
19 |
20 |
--------------------------------------------------------------------------------
/AppRaterLibrary/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion rootProject.ext.compileSdkVersion
5 |
6 | defaultConfig {
7 | minSdkVersion 8
8 | targetSdkVersion 27
9 | versionName project.VERSION_NAME
10 | versionCode Integer.parseInt(project.VERSION_CODE)
11 | }
12 |
13 | // This is important, it will run lint checks but won't abort build
14 | lintOptions {
15 | abortOnError false
16 | }
17 | }
18 |
19 | // Used to update in Maven
20 | apply from: '../maven_push.gradle'
21 |
--------------------------------------------------------------------------------
/AppRaterLibrary/gradle.properties:
--------------------------------------------------------------------------------
1 | POM_NAME=AppRater Library
2 | POM_ARTIFACT_ID=library
3 | POM_PACKAGING=aar
4 |
--------------------------------------------------------------------------------
/AppRaterLibrary/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/AppRaterLibrary/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-18
15 | android.library=true
16 |
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
7 |
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/java/org/codechimp/apprater/AmazonMarket.java:
--------------------------------------------------------------------------------
1 | package org.codechimp.apprater;
2 |
3 | import android.content.Context;
4 | import android.net.Uri;
5 |
6 | public class AmazonMarket extends Market {
7 | private static String marketLink = "http://www.amazon.com/gp/mas/dl/android?p=";
8 |
9 | @Override
10 | public Uri getMarketURI(Context context) {
11 | return Uri.parse(marketLink + Market.getPackageName(context));
12 | }
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/java/org/codechimp/apprater/AppRater.java:
--------------------------------------------------------------------------------
1 | package org.codechimp.apprater;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.annotation.TargetApi;
5 | import android.app.AlertDialog;
6 | import android.app.AlertDialog.Builder;
7 | import android.content.ActivityNotFoundException;
8 | import android.content.Context;
9 | import android.content.DialogInterface;
10 | import android.content.Intent;
11 | import android.content.SharedPreferences;
12 | import android.os.Build;
13 | import android.util.Log;
14 | import android.view.Gravity;
15 | import android.widget.Button;
16 | import android.widget.LinearLayout;
17 |
18 | public class AppRater {
19 | // Preference Constants
20 | private final static String PREF_NAME = "apprater";
21 | private final static String PREF_LAUNCH_COUNT = "launch_count";
22 | private final static String PREF_FIRST_LAUNCHED = "date_firstlaunch";
23 | private final static String PREF_DONT_SHOW_AGAIN = "dontshowagain";
24 | private final static String PREF_REMIND_LATER = "remindmelater";
25 | private final static String PREF_APP_VERSION_NAME = "app_version_name";
26 | private final static String PREF_APP_VERSION_CODE = "app_version_code";
27 |
28 | private final static int DAYS_UNTIL_PROMPT = 3;
29 | private final static int LAUNCHES_UNTIL_PROMPT = 7;
30 | private static int DAYS_UNTIL_PROMPT_FOR_REMIND_LATER = 3;
31 | private static int LAUNCHES_UNTIL_PROMPT_FOR_REMIND_LATER = 7;
32 | private static boolean isDark;
33 | private static boolean themeSet;
34 | private static boolean hideNoButton;
35 | private static boolean isVersionNameCheckEnabled;
36 | private static boolean isVersionCodeCheckEnabled;
37 | private static boolean isCancelable = true;
38 |
39 | private static String packageName;
40 |
41 | private static Market market = new GoogleMarket();
42 |
43 | /**
44 | * Decides if the version name check is active or not
45 | *
46 | * @param versionNameCheck
47 | */
48 | public static void setVersionNameCheckEnabled(boolean versionNameCheck) {
49 | isVersionNameCheckEnabled = versionNameCheck;
50 | }
51 |
52 | /**
53 | * Decides if the version code check is active or not
54 | *
55 | * @param versionCodeCheck
56 | */
57 | public static void setVersionCodeCheckEnabled(boolean versionCodeCheck) {
58 | isVersionCodeCheckEnabled = versionCodeCheck;
59 | }
60 |
61 | /**
62 | * sets number of day until rating dialog pops up for next time when remind
63 | * me later option is chosen
64 | *
65 | * @param daysUntilPromt
66 | */
67 | public static void setNumDaysForRemindLater(int daysUntilPromt) {
68 | DAYS_UNTIL_PROMPT_FOR_REMIND_LATER = daysUntilPromt;
69 | }
70 |
71 | /**
72 | * sets the number of launches until the rating dialog pops up for next time
73 | * when remind me later option is chosen
74 | *
75 | * @param launchesUntilPrompt
76 | */
77 | public static void setNumLaunchesForRemindLater(int launchesUntilPrompt) {
78 |
79 | LAUNCHES_UNTIL_PROMPT_FOR_REMIND_LATER = launchesUntilPrompt;
80 | }
81 |
82 | /**
83 | * decides if No thanks button appear in dialog or not
84 | *
85 | * @param isNoButtonVisible
86 | */
87 | public static void setDontRemindButtonVisible(boolean isNoButtonVisible) {
88 | AppRater.hideNoButton = isNoButtonVisible;
89 | }
90 |
91 | /**
92 | * sets whether the rating dialog is cancelable or not, default is true.
93 | *
94 | * @param cancelable
95 | */
96 | public static void setCancelable(boolean cancelable) {
97 | isCancelable = cancelable;
98 | }
99 |
100 | /**
101 | * Call this method at the end of your OnCreate method to determine whether
102 | * to show the rate prompt using the specified or default day, launch count
103 | * values and checking if the version is changed or not
104 | *
105 | * @param context
106 | */
107 | public static void app_launched(Context context) {
108 | app_launched(context, DAYS_UNTIL_PROMPT, LAUNCHES_UNTIL_PROMPT);
109 | }
110 |
111 | /**
112 | * Call this method at the end of your OnCreate method to determine whether
113 | * to show the rate prompt using the specified or default day, launch count
114 | * values with additional day and launch parameter for remind me later option
115 | * and checking if the version is changed or not
116 | *
117 | * @param context
118 | * @param daysUntilPrompt
119 | * @param launchesUntilPrompt
120 | * @param daysForRemind
121 | * @param launchesForRemind
122 | */
123 | public static void app_launched(Context context, int daysUntilPrompt, int launchesUntilPrompt, int daysForRemind, int launchesForRemind) {
124 | setNumDaysForRemindLater(daysForRemind);
125 | setNumLaunchesForRemindLater(launchesForRemind);
126 | app_launched(context, daysUntilPrompt, launchesUntilPrompt);
127 | }
128 |
129 | /**
130 | * Call this method at the end of your OnCreate method to determine whether
131 | * to show the rate prompt
132 | *
133 | * @param context
134 | * @param daysUntilPrompt
135 | * @param launchesUntilPrompt
136 | */
137 | public static void app_launched(Context context, int daysUntilPrompt, int launchesUntilPrompt) {
138 | SharedPreferences prefs = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
139 | SharedPreferences.Editor editor = prefs.edit();
140 | ApplicationRatingInfo ratingInfo = ApplicationRatingInfo.createApplicationInfo(context);
141 | int days;
142 | int launches;
143 | if (isVersionNameCheckEnabled) {
144 | if (!ratingInfo.getApplicationVersionName().equals(prefs.getString(PREF_APP_VERSION_NAME, "none"))) {
145 | editor.putString(PREF_APP_VERSION_NAME, ratingInfo.getApplicationVersionName());
146 | resetData(context);
147 | commitOrApply(editor);
148 | }
149 | }
150 | if (isVersionCodeCheckEnabled) {
151 | if (ratingInfo.getApplicationVersionCode() != (prefs.getInt(PREF_APP_VERSION_CODE, -1))) {
152 | editor.putInt(PREF_APP_VERSION_CODE, ratingInfo.getApplicationVersionCode());
153 | resetData(context);
154 | commitOrApply(editor);
155 | }
156 | }
157 | if (prefs.getBoolean(PREF_DONT_SHOW_AGAIN, false)) {
158 | return;
159 | } else if (prefs.getBoolean(PREF_REMIND_LATER, false)) {
160 | days = DAYS_UNTIL_PROMPT_FOR_REMIND_LATER;
161 | launches = LAUNCHES_UNTIL_PROMPT_FOR_REMIND_LATER;
162 | } else {
163 | days = daysUntilPrompt;
164 | launches = launchesUntilPrompt;
165 | }
166 |
167 | // Increment launch counter
168 | long launch_count = prefs.getLong(PREF_LAUNCH_COUNT, 0) + 1;
169 | editor.putLong(PREF_LAUNCH_COUNT, launch_count);
170 | // Get date of first launch
171 | Long date_firstLaunch = prefs.getLong(PREF_FIRST_LAUNCHED, 0);
172 | if (date_firstLaunch == 0) {
173 | date_firstLaunch = System.currentTimeMillis();
174 | editor.putLong(PREF_FIRST_LAUNCHED, date_firstLaunch);
175 | }
176 | // Wait for at least the number of launches or the number of days used
177 | // until prompt
178 | if (launch_count >= launches || (System.currentTimeMillis() >= date_firstLaunch + (days * 24 * 60 * 60 * 1000))) {
179 | showRateAlertDialog(context, editor);
180 | }
181 | commitOrApply(editor);
182 | }
183 |
184 | /**
185 | * Call this method directly if you want to force a rate prompt, useful for
186 | * testing purposes
187 | *
188 | * @param context
189 | */
190 | public static void showRateDialog(final Context context) {
191 | showRateAlertDialog(context, null);
192 | }
193 |
194 | /**
195 | * Call this method directly to go straight to play store listing for rating
196 | *
197 | * @param context
198 | */
199 | public static void rateNow(final Context context) {
200 | try {
201 | context.startActivity(new Intent(Intent.ACTION_VIEW, market.getMarketURI(context)));
202 | } catch (ActivityNotFoundException activityNotFoundException1) {
203 | Log.e(AppRater.class.getSimpleName(), "Market Intent not found");
204 | }
205 | }
206 |
207 | public static void setPackageName(String packageName) {
208 | AppRater.market.overridePackageName(packageName);
209 | }
210 |
211 | /**
212 | * Set an alternate Market, defaults to Google Play
213 | *
214 | * @param market
215 | */
216 | public static void setMarket(Market market) {
217 | AppRater.market = market;
218 | }
219 |
220 | /**
221 | * Get the currently set Market
222 | *
223 | * @return market
224 | */
225 | public static Market getMarket() {
226 | return market;
227 | }
228 |
229 | /**
230 | * Sets dialog theme to dark
231 | */
232 | @TargetApi(11)
233 | public static void setDarkTheme() {
234 | isDark = true;
235 | themeSet = true;
236 | }
237 |
238 | /**
239 | * Sets dialog theme to light
240 | */
241 | @TargetApi(11)
242 | public static void setLightTheme() {
243 | isDark = false;
244 | themeSet = true;
245 | }
246 |
247 | /**
248 | * The meat of the library, actually shows the rate prompt dialog
249 | */
250 | @SuppressLint("NewApi")
251 | private static void showRateAlertDialog(final Context context, final SharedPreferences.Editor editor) {
252 | Builder builder;
253 | if (Build.VERSION.SDK_INT >= 11 && themeSet) {
254 | builder = new AlertDialog.Builder(context, (isDark ? AlertDialog.THEME_HOLO_DARK : AlertDialog.THEME_HOLO_LIGHT));
255 | } else {
256 | builder = new AlertDialog.Builder(context);
257 | }
258 | ApplicationRatingInfo ratingInfo = ApplicationRatingInfo.createApplicationInfo(context);
259 | builder.setTitle(String.format(context.getString(R.string.apprater_dialog_title), ratingInfo.getApplicationName()));
260 |
261 | builder.setMessage(context.getString(R.string.apprater_rate_message));
262 |
263 | builder.setCancelable(isCancelable);
264 |
265 | builder.setPositiveButton(context.getString(R.string.apprater_rate),
266 | new DialogInterface.OnClickListener() {
267 | public void onClick(DialogInterface dialog, int id) {
268 | rateNow(context);
269 | if (editor != null) {
270 | editor.putBoolean(PREF_DONT_SHOW_AGAIN, true);
271 | commitOrApply(editor);
272 | }
273 | dialog.dismiss();
274 | }
275 | });
276 |
277 | builder.setNeutralButton(context.getString(R.string.apprater_later),
278 | new DialogInterface.OnClickListener() {
279 | public void onClick(DialogInterface dialog, int id) {
280 | if (editor != null) {
281 | Long date_firstLaunch = System.currentTimeMillis();
282 | editor.putLong(PREF_FIRST_LAUNCHED, date_firstLaunch);
283 | editor.putLong(PREF_LAUNCH_COUNT, 0);
284 | editor.putBoolean(PREF_REMIND_LATER, true);
285 | editor.putBoolean(PREF_DONT_SHOW_AGAIN, false);
286 | commitOrApply(editor);
287 | }
288 | dialog.dismiss();
289 | }
290 | });
291 | if (!hideNoButton) {
292 | builder.setNegativeButton(context.getString(R.string.apprater_no_thanks),
293 | new DialogInterface.OnClickListener() {
294 | public void onClick(DialogInterface dialog, int id) {
295 | if (editor != null) {
296 | editor.putBoolean(PREF_DONT_SHOW_AGAIN, true);
297 | editor.putBoolean(PREF_REMIND_LATER, false);
298 | long date_firstLaunch = System.currentTimeMillis();
299 | editor.putLong(PREF_FIRST_LAUNCHED, date_firstLaunch);
300 | editor.putLong(PREF_LAUNCH_COUNT, 0);
301 | commitOrApply(editor);
302 | }
303 | dialog.dismiss();
304 | }
305 | });
306 | }
307 | final AlertDialog alertDialog = builder.create();
308 | alertDialog.setOnShowListener(new DialogInterface.OnShowListener() {
309 | @Override
310 | public void onShow(DialogInterface dialog) {
311 | try {
312 | final Button buttonPositive = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
313 |
314 | if (buttonPositive == null) {
315 | return;
316 | }
317 |
318 | LinearLayout linearLayout = (LinearLayout)buttonPositive.getParent();
319 | if (linearLayout == null) {
320 | return;
321 | }
322 |
323 | // Check positive button not fits in window
324 | boolean shouldUseVerticalLayout = false;
325 | if (buttonPositive.getLeft() + buttonPositive.getWidth() > linearLayout.getWidth()) {
326 | shouldUseVerticalLayout = true;
327 | }
328 |
329 | // Change layout orientation to vertical
330 | if (shouldUseVerticalLayout ) {
331 | linearLayout.setOrientation(LinearLayout.VERTICAL);
332 | linearLayout.setGravity(Gravity.END);
333 | }
334 | } catch (Exception ignored) {
335 | }
336 | }
337 | });
338 | alertDialog.show();
339 | }
340 |
341 | @SuppressLint("NewApi")
342 | private static void commitOrApply(SharedPreferences.Editor editor) {
343 | if (Build.VERSION.SDK_INT > 8) {
344 | editor.apply();
345 | } else {
346 | editor.commit();
347 | }
348 | }
349 |
350 | public static void resetData(Context context) {
351 | SharedPreferences prefs = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
352 | SharedPreferences.Editor editor = prefs.edit();
353 | editor.putBoolean(PREF_DONT_SHOW_AGAIN, false);
354 | editor.putBoolean(PREF_REMIND_LATER, false);
355 | editor.putLong(PREF_LAUNCH_COUNT, 0);
356 | long date_firstLaunch = System.currentTimeMillis();
357 | editor.putLong(PREF_FIRST_LAUNCHED, date_firstLaunch);
358 | commitOrApply(editor);
359 | }
360 | }
361 |
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/java/org/codechimp/apprater/ApplicationRatingInfo.java:
--------------------------------------------------------------------------------
1 | package org.codechimp.apprater;
2 |
3 | import android.content.Context;
4 | import android.content.pm.ApplicationInfo;
5 | import android.content.pm.PackageInfo;
6 | import android.content.pm.PackageManager;
7 |
8 | public final class ApplicationRatingInfo {
9 | private String applicationName;
10 |
11 | public String getApplicationName() {
12 | return applicationName;
13 | }
14 |
15 | public int getApplicationVersionCode() {
16 | return applicationVersionCode;
17 | }
18 |
19 | public String getApplicationVersionName() {
20 | return applicationVersionName;
21 | }
22 |
23 | private int applicationVersionCode;
24 | private String applicationVersionName;
25 |
26 | private ApplicationRatingInfo() {
27 | }
28 |
29 | public static ApplicationRatingInfo createApplicationInfo(Context context) {
30 | PackageManager packageManager = context.getPackageManager();
31 | ApplicationInfo applicationInfo = null;
32 | PackageInfo packageInfo = null;
33 | try {
34 | applicationInfo = packageManager.getApplicationInfo(
35 | context.getApplicationInfo().packageName, 0);
36 | packageInfo = packageManager.getPackageInfo(
37 | context.getApplicationInfo().packageName, 0);
38 | } catch (final PackageManager.NameNotFoundException e) {
39 | }
40 | ApplicationRatingInfo resultInfo = new ApplicationRatingInfo();
41 | resultInfo.applicationName = packageManager.getApplicationLabel(
42 | applicationInfo).toString();
43 | resultInfo.applicationVersionCode = packageInfo.versionCode;
44 | resultInfo.applicationVersionName = packageInfo.versionName;
45 | return resultInfo;
46 | }
47 | }
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/java/org/codechimp/apprater/GoogleMarket.java:
--------------------------------------------------------------------------------
1 | package org.codechimp.apprater;
2 |
3 | import android.content.Context;
4 | import android.net.Uri;
5 |
6 | public class GoogleMarket extends Market {
7 | private static String marketLink = "market://details?id=";
8 |
9 | @Override
10 | public Uri getMarketURI(Context context) {
11 | return Uri.parse(marketLink + Market.getPackageName(context));
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/java/org/codechimp/apprater/Market.java:
--------------------------------------------------------------------------------
1 | package org.codechimp.apprater;
2 |
3 | import android.content.Context;
4 | import android.net.Uri;
5 |
6 | public abstract class Market {
7 |
8 | protected static String packageName;
9 |
10 | protected abstract Uri getMarketURI(Context context);
11 |
12 | public void overridePackageName(String packageName) {
13 | Market.packageName = packageName;
14 | }
15 |
16 | protected static String getPackageName(Context context) {
17 | if (Market.packageName != null) {
18 | return Market.packageName;
19 | }
20 | return context.getPackageName();
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/res/values-ar/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | قيم %s
4 | إذا استمتعت باستخدام التطبيق الرجاء تقيمه في المتجر... شكرا للدعم!
5 | قيمه الأن
6 | لاحقا
7 | لا أريد
8 |
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/res/values-bg/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Оцени %s
4 | Ако харесвате това приложение, моля оценете го. Благодарим за вашето съдействие!
5 | Оцени Сега
6 | По-късно
7 | Не, благодаря
8 |
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/res/values-ca/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Puntua %s
4 | Si t\'agrada utilitzar aquesta app, si us plau prengui un moment per avaluar-lo. Gràcies pel seu suport!
5 | Puntua ara
6 | Després
7 | No gràcies
8 |
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/res/values-cs/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Ohodnoťte %s
4 | Jestli se Vám aplikace líbí, prosím věnujte chvíli jejímu ohodnocení. Moc děkujeme za vaši podporu.
5 | Ohodnotit nyní
6 | Později
7 | Ne, děkuji
8 |
9 |
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/res/values-de/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | %s bewerten
4 | Wenn Ihnen diese App gefällt, bewerten Sie sie bitte. Vielen Dank dafür!
5 | Bewerten
6 | Später
7 | Nein danke
8 |
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/res/values-es/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Valora %s
4 | Si te gusta esta aplicación, por favor, tómate un momento para valorarla. Gracias!
5 | Valorar Ahora
6 | Más tarde
7 | No gracias
8 |
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/res/values-fa/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | امتیاز به %s
4 | اگر از استفاده از این اپ لذت میبرید، لطفا چند لحظه صرف امتیاز دادن به آن کنید. از پشتیبانی شما سپاسگزاریم.
5 | امتیاز میدهم
6 | بعدا
7 | مایل نیستم
8 |
9 |
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/res/values-fr/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Noter %s
4 | Si vous aimez cette application, s\'il vous plait prenez un moment pour la noter. Merci pour votre soutien!
5 | Noter
6 | Plus tard
7 | Non merci
8 |
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/res/values-he/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | דירוג %s
4 | אם אתה נהנה להשתמש באפליקציה, אנא הקדש דקה מזמנך על מנת לדרג את האפליקציה. תודה על תמיכתך
5 | דרג עכשיו
6 | אחר כך
7 | לא תודה
8 |
9 |
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/res/values-hr/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Ocijeni %s
4 | Ukoliko uživate koristiti ovu aplikaciju, molim vas odvojite trenutak za ocjenjivanje. Hvala na vašoj podršci.
5 | Ocijeni sada
6 | Kasnije
7 | Ne hvala
8 |
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/res/values-hu/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | %s értékelése
4 | Ha az alkalmazás elnyerte tetszését, akkor kérjük értékelje azt. Köszönjük a támogatást!
5 | Értékelje most
6 | Később
7 | Nem, köszönöm
8 |
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/res/values-id/strings.xml:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codechimp-org/AppRater/018d481b26ce6112a0f431e9e58e80e1745a63b6/AppRaterLibrary/src/main/res/values-id/strings.xml
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/res/values-it/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Valuta %s
4 | Se ti piace usare questa applicazione, per favore dedica un momento per valutarla. Grazie per il tuo supporto!
5 | Valuta Ora
6 | Più tardi
7 | No grazie
8 |
9 |
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/res/values-iw/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | דירוג %s
4 | אם אתה נהנה להשתמש באפליקציה, אנא הקדש דקה מזמנך על מנת לדרג את האפליקציה. תודה על תמיכתך
5 | דרג עכשיו
6 | אחר כך
7 | לא תודה
8 |
9 |
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/res/values-ja/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | %sを評価してください
4 | いつもご利用いただきありがとうございます。このアプリを使ってお楽しみいただいた方は、評価をお願いいたします。
5 | いますぐ評価する
6 | あとで
7 | いいえ
8 |
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/res/values-ko/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | %s 평가하기
4 | 어플이 마음에 드셨나요? 잠시 시간을 내어 평가해주세요. 감사합니다!
5 | 지금 평가하기
6 | 나중에
7 | 아니오
8 |
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/res/values-nl/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | %s beoordelen
4 | Als je van deze app geniet, neem dan even tijd om te beoordelen. Bedankt voor uw steun!
5 | Nu Beoordelen
6 | Later
7 | Nee bedankt
8 |
9 |
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/res/values-pl/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Oceń %s
4 | Jeśli podoba ci się ta aplikacja to poświęć moment aby ją ocenić. Dziękujemy za twoje wsparcie!
5 | Oceń teraz
6 | Póżniej
7 | Nie, dziękuję
8 |
9 |
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/res/values-pt-rBR/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Avalie %s
4 | Se você está gostando deste aplicativo, por favor reserve um momento para avaliá-lo. Obrigado pela ajuda!
5 | Avalie Agora
6 | Mais tarde
7 | Não, obrigado
8 |
9 |
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/res/values-pt/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Avalie %s
4 | Se gosta de utilizar esta aplicação, por favor dispense alguns momentos para a avaliar. Obrigado pelo seu apoio.
5 | Avalie agora
6 | Mais tarde
7 | Não obrigado
8 |
9 |
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/res/values-ru/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Оценить %s
4 | Если вам нравится это приложение, оцените его, пожалуйста. Спасибо за поддержку!
5 | Оценить сейчас
6 | Напомнить позже
7 | Спасибо, нет
8 |
9 |
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/res/values-sk/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Ohodnoťte %s
4 | Ak sa Vám aplikácia páči, venujte, prosím, chvíľu jej ohodnoteniu. Ďakujeme za Vašu podporu.
5 | Ohodnotiť teraz
6 | Neskôr
7 | Nie, ďakujem
8 |
9 |
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/res/values-sl/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Oceni %s
4 | Če ti je aplikacija všeč, jo prosim oceni. Hvala za tvojo podporo!
5 | Oceni sedaj
6 | Kasneje
7 | Ne hvala
8 |
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/res/values-sq/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Vlerëso %s
4 | Nqs po ju pëlqen ky program, ju lutemi vlerësojeni me një koment. Faleminderit për suportin tuaj!
5 | Vlerëso Tani
6 | Më Vonë
7 | Jo Faleminderit
8 |
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/res/values-sr/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Оцени %s
4 | Ако вам се свиђе ова апликација, молим вас одвојите мало времена да је оцените. Хвала на подршци!
5 | Оцени сада
6 | Касније
7 | Не, хвала
8 |
9 |
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/res/values-sv/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Betygsätt %s
4 | Om du gillar den här appen, betygsätt den gärna. Tack för din support!
5 | Betygsätt nu
6 | Senare
7 | Nej tack
8 |
9 |
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/res/values-th/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | ให้คะแนน %s
4 | ถ้าคุณคิดว่าแอพนี้มันเจ๋ง ช่วยสละเวลาเพื่อให้คะแนนมันหน่อยนะ ขอบคุณมากที่ช่วยเรา
5 | ให้คะแนน
6 | ไว้ทีหลัง
7 | ไม่ละ ขอบคุณ
8 |
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/res/values-tr/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | %s Derecelendir
4 | Bu uygulamayı beğendiyseniz lütfen derecelendirin. Desteğiniz için teşekkürler.
5 | Şimdi
6 | Sonra
7 | Hayır
8 |
9 |
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/res/values-uk/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Оцінити %s
4 | Якщо Вам подобається цей додаток, будь ласка, оцініть його. Дякуємо за підтримку!
5 | Оцінити зараз
6 | Не зараз
7 | Ні, дякую
8 |
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/res/values-vi/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Bình Chọn %s
4 | Hi, nếu bạn thấy sử dụng ứng dụng này hay, vui lòng dành chút thời gian bình chọn cho chúng tôi bạn nhé. Chúng tôi rất cảm ơn sự nhiệt tình ủng hộ của bạn.
5 | Bình Chọn
6 | Để Sau
7 | Không, Cảm Ơn
8 |
9 |
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/res/values-zh-rHK/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 給%s評分
4 | 如果您對這個APP感到滿意,請給予評分。感謝您的支持。
5 | 評分
6 | 稍後再來
7 | 不用
8 |
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/res/values-zh-rTW/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 給%s評分
4 | 如果您對這個APP感到滿意,請給予評分。感謝您的支持。
5 | 評分
6 | 稍後再來
7 | 不用
8 |
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/res/values-zh/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 评价 %s
4 | 如果您喜欢这款应用,请您花费一点点时间给我们些评价,谢谢您的支持!
5 | 立即评价
6 | 稍后再来
7 | 残忍拒绝
8 |
--------------------------------------------------------------------------------
/AppRaterLibrary/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Rate %s
4 | If you enjoy using this app, please take a moment to rate it. Thanks for your support!
5 | Rate Now
6 | Later
7 | No thanks
8 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # AppRater
2 |
3 | ## This project is no longer maintained
4 |
5 | AppRater is a library for Android designed to facilitate easy prompting of users to rate your app within the Google Play store or Amazon App Store.
6 | It won't prompt until at least 3 days or 7 uses of the app has passed and if the user chooses to rate later the count will start again.
7 |
8 | AppRater inherits your themeing so can be used with light or dark variants as seen here;
9 |
10 | ![Example Image Dark][1] ![Example Image Light][2]
11 |
12 | To use simply add the library to your app and make one call within your onCreate method as follows;
13 |
14 | `AppRater.app_launched(this);`
15 |
16 | There are several options you can also use to change the default behavior.
17 |
18 | You can use the overriden method to specify your own day and launch count parameters.
19 | `setVersionCodeCheckEnabled` or `setVersionNameCheckEnabled` enable version checking, which will re-enable the prompt count if a new version is installed.
20 | `isNoButtonVisible` will disable the No Thanks button, forcing the user to either rate or prompt later.
21 | `setDarkTheme` and `setLightTheme` enable manual control over the theme the dialog uses, overriding your application default.
22 |
23 | By default this will link to the Google Play store. You can optionally set an alternate market by using;
24 |
25 | `AppRater.setMarket(new GoogleMarket());`
26 |
27 | `AppRater.setMarket(new AmazonMarket());`
28 |
29 | You can implement your own market, implementing the Market interface and parse your URI.
30 |
31 | If you want to have a "Rate Now" menu option to go straight to your play store listing call `AppRater.rateNow(this);` within your menu code.
32 |
33 | Try out the demo within this repository.
34 |
35 | ## Gradle
36 |
37 | AppRater is now pushed to Maven Central as an AAR, so you just need to add the following dependency to your `build.gradle`.
38 |
39 | dependencies {
40 | compile 'com.github.codechimp-org.apprater:library:1.0.+'
41 | }
42 |
43 | ## Translations
44 |
45 | If you would like to help localise this library please fork the project, create and verify your language files, then create a pull request to the translations branch.
46 |
47 | ## Contributing Code
48 |
49 | 1. Fork it
50 | 2. Create your feature branch (`git checkout -b my-new-feature`)
51 | 3. Commit your changes (`git commit -am 'Add some feature'`)
52 | 4. Push to the branch (`git push origin my-new-feature`)
53 | 5. Create new Pull Request
54 |
55 | ## Developed By
56 |
57 | Andrew Jackson
58 |
59 | Google+ profile:
60 | [https://plus.google.com/+AndrewJacksonUK](https://plus.google.com/+AndrewJacksonUK)
61 |
62 | Adapted from a snippet originally posted [here](http://www.androidsnippets.com/prompt-engaged-users-to-rate-your-app-in-the-android-market-appirater)
63 |
64 | ## License
65 |
66 | Copyright 2013-2017 Andrew Jackson
67 |
68 | Licensed under the Apache License, Version 2.0 (the "License");
69 | you may not use this file except in compliance with the License.
70 | You may obtain a copy of the License at
71 |
72 | http://www.apache.org/licenses/LICENSE-2.0
73 |
74 | Unless required by applicable law or agreed to in writing, software
75 | distributed under the License is distributed on an "AS IS" BASIS,
76 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
77 | See the License for the specific language governing permissions and
78 | limitations under the License.
79 |
80 |
81 |
82 |
83 |
84 | [1]: https://raw.github.com/codechimp-org/AppRater/master/Screenshots/demo-dark.png
85 | [2]: https://raw.github.com/codechimp-org/AppRater/master/Screenshots/demo-light.png
86 |
--------------------------------------------------------------------------------
/Screenshots/demo-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codechimp-org/AppRater/018d481b26ce6112a0f431e9e58e80e1745a63b6/Screenshots/demo-dark.png
--------------------------------------------------------------------------------
/Screenshots/demo-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codechimp-org/AppRater/018d481b26ce6112a0f431e9e58e80e1745a63b6/Screenshots/demo-light.png
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 | buildscript {
3 | repositories {
4 | jcenter()
5 | maven {
6 | url 'https://maven.google.com/'
7 | name 'Google'
8 | }
9 | }
10 | dependencies {
11 | classpath 'com.android.tools.build:gradle:3.1.2'
12 | }
13 | }
14 |
15 | ext {
16 | compileSdkVersion = 27
17 | }
18 |
19 | def isReleaseBuild() {
20 | return version.contains("SNAPSHOT") == false
21 | }
22 |
23 | allprojects {
24 | version = VERSION_NAME
25 | group = GROUP
26 |
27 | repositories {
28 | jcenter()
29 | maven {
30 | url 'https://maven.google.com/'
31 | name 'Google'
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | VERSION_NAME=1.0.35
2 | VERSION_CODE=45
3 | GROUP=com.github.codechimp-org.apprater
4 |
5 | POM_DESCRIPTION=AppRater Library for Android
6 | POM_URL=https://github.com/codechimp-org/AppRater
7 | POM_SCM_URL=https://github.com/codechimp-org/AppRater
8 | POM_SCM_CONNECTION=scm:git@github.com:codechimp-org/AppRater.git
9 | POM_SCM_DEV_CONNECTION=scm:git@github.com:codechimp-org/AppRater.git
10 | POM_LICENCE_NAME=The Apache Software License, Version 2.0
11 | POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
12 | POM_LICENCE_DIST=repo
13 | POM_DEVELOPER_ID=andrew-codechimp
14 | POM_DEVELOPER_NAME=Andrew Jackson
15 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codechimp-org/AppRater/018d481b26ce6112a0f431e9e58e80e1745a63b6/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sun Jun 10 12:46:01 BST 2018
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/maven_push.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'maven'
2 | apply plugin: 'signing'
3 |
4 | def sonatypeRepositoryUrl
5 | if (isReleaseBuild()) {
6 | println 'RELEASE BUILD'
7 | //sonatypeRepositoryUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
8 | sonatypeRepositoryUrl = hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
9 | : "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
10 | } else {
11 | println 'SNAPSHOT BUILD'
12 | sonatypeRepositoryUrl = hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
13 | : "https://oss.sonatype.org/content/repositories/snapshots/"
14 | //sonatypeRepositoryUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
15 | }
16 |
17 | def getRepositoryUsername() {
18 | return hasProperty('nexusUsername') ? nexusUsername : ""
19 | }
20 |
21 | def getRepositoryPassword() {
22 | return hasProperty('nexusPassword') ? nexusPassword : ""
23 | }
24 |
25 | afterEvaluate { project ->
26 | uploadArchives {
27 | repositories {
28 | mavenDeployer {
29 | beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
30 |
31 | pom.artifactId = POM_ARTIFACT_ID
32 |
33 | repository(url: sonatypeRepositoryUrl) {
34 | authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
35 | }
36 |
37 | pom.project {
38 | name POM_NAME
39 | packaging POM_PACKAGING
40 | description POM_DESCRIPTION
41 | url POM_URL
42 |
43 | scm {
44 | url POM_SCM_URL
45 | connection POM_SCM_CONNECTION
46 | developerConnection POM_SCM_DEV_CONNECTION
47 | }
48 |
49 | licenses {
50 | license {
51 | name POM_LICENCE_NAME
52 | url POM_LICENCE_URL
53 | distribution POM_LICENCE_DIST
54 | }
55 | }
56 |
57 | developers {
58 | developer {
59 | id POM_DEVELOPER_ID
60 | name POM_DEVELOPER_NAME
61 | }
62 | }
63 | }
64 | }
65 | }
66 | }
67 |
68 | signing {
69 | required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
70 | sign configurations.archives
71 | }
72 |
73 | task androidJavadocs(type: Javadoc) {
74 | options {
75 | linksOffline "http://d.android.com/reference", "${android.sdkDirectory}/docs/reference"
76 | }
77 | source = android.sourceSets.main.java.sourceFiles
78 | classpath += project.files(project.android.getBootClasspath().join(File.pathSeparator))
79 | }
80 |
81 | task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
82 | classifier = 'javadoc'
83 | //basename = artifact_id
84 | from androidJavadocs.destinationDir
85 | }
86 |
87 | task androidSourcesJar(type: Jar) {
88 | classifier = 'sources'
89 | //basename = artifact_id
90 | from android.sourceSets.main.java.sourceFiles
91 | }
92 |
93 | artifacts {
94 | //archives packageReleaseJar
95 | archives androidSourcesJar
96 | archives androidJavadocsJar
97 | }
98 | }
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':AppRaterLibrary', ':AppRaterDemo'
2 |
--------------------------------------------------------------------------------