├── .gitignore ├── .idea └── modules.xml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── zingat │ │ └── ratemesample │ │ └── ExampleInstrumentedTest.kt │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── zingat │ │ │ └── ratemesample │ │ │ ├── App.kt │ │ │ └── MainActivity.kt │ └── res │ │ ├── drawable-hdpi │ │ └── img_rateus.png │ │ ├── drawable-mdpi │ │ └── img_rateus.png │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable-xhdpi │ │ └── img_rateus.png │ │ ├── drawable-xxhdpi │ │ └── img_rateus.png │ │ ├── drawable-xxxhdpi │ │ └── img_rateus.png │ │ ├── drawable │ │ └── ic_launcher_background.xml │ │ ├── layout │ │ ├── activity_main.xml │ │ └── layout_dialog.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── colors.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── zingat │ └── ratemesample │ └── ExampleUnitTest.kt ├── art ├── customButtonDialogWindow.png ├── customImageDialogWindow.png ├── defaultRatemeDialogWindow.png ├── ratemelogo.png └── zingatLogo.png ├── build.gradle ├── dependencies.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── rateme ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── zingat │ │ └── rateme │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── zingat │ │ │ └── rateme │ │ │ ├── CheckCondition.kt │ │ │ ├── ConditionHelper.kt │ │ │ ├── Constants.kt │ │ │ ├── DataHelper.kt │ │ │ ├── EventsDb.kt │ │ │ ├── EventsSql.kt │ │ │ ├── Rateme.kt │ │ │ ├── SingletonHolder.kt │ │ │ ├── annotations │ │ │ └── RatemeOpen.kt │ │ │ ├── callback │ │ │ ├── RMCallback.kt │ │ │ └── RMEventCallback.kt │ │ │ └── model │ │ │ ├── Condition.kt │ │ │ └── Event.kt │ └── res │ │ ├── drawable │ │ ├── rm_later_button_background.xml │ │ ├── rm_later_button_reverse_background.xml │ │ ├── rm_never_button_background.xml │ │ ├── rm_never_button_reverse_background.xml │ │ ├── rm_rate_button_background.xml │ │ └── rm_rate_button_reverse_background.xml │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── zingat │ └── rateme │ ├── CheckConditionTest.kt │ ├── ConditionHelperTest.kt │ ├── RatemeTest.kt │ └── SuiteTest.kt └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/* 5 | .DS_Store 6 | /build 7 | /rateme/build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 

2 | 3 |

4 | 5 |

6 | 7 | 8 | 9 | 10 | 11 | 12 |

13 | 14 | RateMe is a powerful system to get rates from users in Android applications. 15 | 16 | RateMe takes cares to show pretty dialogs to collect rates from users so you don't have to. 17 | One thing you do is to define some rules and send events to RateMe library. 18 | RateMe watch the events you define and show the a pretty dialog to users on correct time. 19 | 20 | # Table of Contents 21 | 22 | 1. [Gradle Dependency](https://github.com/zingat/RateMe-Android/#gradle-dependency) 23 | 2. [Quick Start](https://github.com/zingat/RateMe-Android/#quick-start) 24 | 1. [Initialize RateMe](https://github.com/zingat/RateMe-Android/#initialize-rateme-in-your-application-class) 25 | 2. [How events are sent to RateMe](https://github.com/zingat/RateMe-Android/#how-touch_me_event-is-sent-to-rateme) 26 | 3. [How button works](https://github.com/zingat/RateMe-Android/#how-buttons-works) 27 | 1. [Rate Us](https://github.com/zingat/RateMe-Android/#rate-us) 28 | 2. [Remind Me Later](https://github.com/zingat/RateMe-Android/#remind-me-later) 29 | 3. [Don't Ask Again](https://github.com/zingat/RateMe-Android/#dont-ask-again) 30 | 4. [Arranging delay time](https://github.com/zingat/RateMe-Android/#arranging-delay-time) 31 | 5. [Callbacks](https://github.com/zingat/RateMe-Android/#callbacks) 32 | 6. [Custom Views](https://github.com/zingat/RateMe-Android/#custom-views) 33 | 7. [Custom Buttons](https://github.com/zingat/RateMe-Android/#custom-buttons) 34 | 8. [Changing colors and texts](https://github.com/zingat/RateMe-Android/#changing-colors-and-texts) 35 | 1. [colors.xml](https://github.com/zingat/RateMe-Android/#colorsxml) 36 | 2. [strings.xml](https://github.com/zingat/RateMe-Android/#strings.xml) 37 | 9. [Adding Multiple Conditions](https://github.com/zingat/RateMe-Android/#adding-multiple-conditions) 38 | 1. [Adding one by one](https://github.com/zingat/RateMe-Android/#adding-one-by-one) 39 | 2. [Adding all as Collection](https://github.com/zingat/RateMe-Android/#adding-all-as-collection) 40 | 3. [How multiple conditions work](https://github.com/zingat/RateMe-Android/#how-multiple-conditions-work) 41 | 42 | ------ 43 | 44 | # GRADLE DEPENDENCY 45 | The minimum API level supported by this library is API 15. 46 | Add the dependency to your `build.gradle`: 47 | 48 | ```Gradle 49 | dependencies { 50 | implementation 'com.zingat:rateme:1.3.0' 51 | } 52 | ``` 53 | 54 | # Quick start 55 | 56 | ### Initialize `RateMe` in your `Application` class 57 | ```kotlin 58 | class App : Application() { 59 | 60 | override fun onCreate() { 61 | super.onCreate() 62 | 63 | Rateme.getInstance(this@App) 64 | // `addCondition(conditionName,repeatTime)` 65 | .addCondition("touch_me_event", 3) 66 | .reminderDuration(3) 67 | } 68 | 69 | } 70 | ``` 71 | 72 | Now we are telling to RateMe that you can show a dialog when 3 times `touch_me_event` is sent. 73 | 74 | ### How `touch_me_event` is sent to RateMe. 75 | ```kotlin 76 | Rateme.getInstance(this) 77 | .addEvent("touch_me_event") 78 | ``` 79 | 80 | The event can be sent for each statement. For example when a user opens the app 4 times you can send `app_opened` event or user can like 81 | a product in your app 2 times you can send `product_liked` event. For all statements you can send event seperately. 82 | 83 | The default appearance is like picture below. 84 | 85 |

86 | 87 |

88 | 89 | `When dialog shown on screen, user have to choose one of these options to close the window. 90 | To touch background and back button don't close the window.` 91 | 92 | # How Buttons works 93 | 94 | ### Rate Us 95 | 96 | RateMe library detects your applicationId(for example com.zingat.rateme) and 97 | When user clicks the `Rate Us` button, your app's Google Play page opens automaticly 98 | and user can rate your app easily. 99 | 100 | ### Remind Me Later 101 | 102 | When user clicks the `Remind Me Later` button, the dialog disappears until the days finished 103 | you defined in initialization code. `reminderDuration(day:Int)` is used define the necessary time. 104 | The parameter is given in days. 105 | 106 | ### Don't Ask Again 107 | 108 | When user clicks the `Don't Ask Again` button, the dialog disappears and never appear again. 109 | 110 | # Arranging delay time 111 | 112 | RateMe supports to arrange the delay time 113 | `delay(time : Long)` indicates the time to display dialog after all events completed. 114 | Default value is 0. 115 | 116 | 117 | ```kotlin 118 | Rateme.getInstance(this@App) 119 | .addCondition("touch_me_event", 3) 120 | .reminderDuration(3) 121 | .delay(1000) 122 | ``` 123 | 124 | # Callbacks 125 | 126 | To know when the user selects an action button, you set callbacks: 127 | 128 | ```kotlin 129 | Rateme.getInstance(this@App) 130 | .addCondition("touch_me_event", 3) 131 | .delay(1000) 132 | .onRateCallback( object : RMEventCallback{ 133 | override fun onEvent() { 134 | // TODO 135 | } 136 | }) 137 | .onDontAskCallback(object : RMEventCallback{ 138 | override fun onEvent() { 139 | // TODO 140 | } 141 | }) 142 | .onRemindLaterCallback(object : RMEventCallback{ 143 | override fun onEvent() { 144 | // TODO 145 | } 146 | }) 147 | .onShowCallback(object : RMEventCallback{ 148 | override fun onEvent() { 149 | // TODO 150 | } 151 | }) 152 | .onRMCallback(object : RMCallback{ 153 | override fun onEvent(eventName: String, count: Int, which: Int) { 154 | // TODO 155 | } 156 | }) 157 | ``` 158 | If you are listening for all three action buttons, you could just use `onRMCallback()`. 159 | 160 | * `eventName (String)` parameter tells completed event name. In our case this is `touch_me_event` 161 | * `count (Int)` parameter tells completed event count value. In our case this is `3`. 162 | The count value is defined by developer in `addCondition()` method. 163 | * `which (Int)` parameter tells which action is happening. Each number indicates different state. 164 | * STARTED = -1 165 | * POSITIVE = 0 166 | * NEUTRAL = 1 167 | * NEGATIVE = 2 168 | 169 | # Custom Views 170 | 171 | Custom views are very easy to implement. 172 | 173 | ```kotlin 174 | Rateme.getInstance(this@App) 175 | .addCondition("touch_me_event", 3) 176 | .reminderDuration(3) 177 | .delay(1000) 178 | .custom(R.layout.layout_dialog) 179 | ``` 180 | 181 | After custom view is added appearance is like picture below. 182 | 183 |

184 | 185 |

186 | 187 | When `custom()` method is used, default title and content disappears. Only the you layout file will display on screen. 188 | 189 | It is recommended not to use buttons and different type views in custom layout. 190 | Because you can not provide callbacks for buttons. 191 | 192 | # Custom Buttons 193 | 194 | You can use `customButton()` and `customButtonReverse()` methods to provide pretty much colored buttons. 195 | 196 | ```kotlin 197 | Rateme.getInstance(this@App) 198 | .addCondition("touch_me_event", 3) 199 | .delay(1000) 200 | .custom(R.layout.layout_dialog) 201 | .customButton() 202 | ``` 203 | 204 | `customButton()` and `customButtonReverse()` methods shouldn't be used together. 205 | They have different type interfaces. 206 | 207 | After `custombutton()` is added appearance is like picture below. 208 | 209 |

210 | 211 |

212 | 213 | You can use the `customButtonReverse()` method with same way. 214 | 215 | # Changing colors, and texts 216 | 217 | You can change all values by creating new color items with same name in your applications. 218 | 219 | ### colors.xml 220 | 221 | ````xml 222 | 223 | 224 | 225 | #fff 226 | 227 | 228 | #fff 229 | 230 | 231 | 232 | #02a8fe 233 | 234 | 235 | 236 | #4bca5e 237 | 238 | 239 | #ff6175 240 | 241 | 242 | ```` 243 | 244 | ### strings.xml 245 | 246 | ````xml 247 | 248 | 249 | Rate us 250 | 251 | 252 | 253 | Remind Me Later 254 | 255 | 256 | 257 | Don\'t ask again 258 | 259 | 260 | How was your experience? 261 | 262 | 263 | Recommend us to others by rating us on Play Store 264 | 265 | 266 | 267 | ```` 268 | 269 | # Adding Multiple Conditions 270 | 271 | There are two different easy way to add multiple conditions to RateMe library. 272 | 273 | ### Adding one by one 274 | 275 | You can add on by one all condition. You can add event how much you want with this way. 276 | 277 | ````kotlin 278 | Rateme.getInstance(this@App) 279 | // `addCondition(conditionName,repeatTime)` 280 | .addCondition("touch_me_event", 3) 281 | .addCondition("slide_me_event", 2) 282 | .addCondition("rotate_me_event", 4) 283 | .reminderDuration(3) 284 | ```` 285 | 286 | ### Adding all as Collection 287 | 288 | Every condition represents with `Condition` object. Condition object has two variables. 289 | `count` and `type`. 290 | 291 | You can create own `Condition` object and you can add this Condition object in a ArrayList. 292 | Finally you can use `setConditionList( conditionList : ArrayList )` method. 293 | 294 | ```kotlin 295 | package com.zingat.rateme.model 296 | 297 | val conditionList = ArrayList 298 | conditionList.add( Condition( 3, "touch_me_event" ) ) 299 | conditionList.add( Condition( 2, "slide_me_event" ) ) 300 | conditionList.add( Condition( 4, "rotate_me_event" ) ) 301 | 302 | Rateme.getInstance(this@App) 303 | .setConditionList(conditionList) 304 | .reminderDuration(3) 305 | ``` 306 | 307 | ### How multiple conditions work 308 | 309 | When multiple events are added, RateMe shows dialog when one of conditions are completed and even other events 310 | completed, RateMe won't show a new dialog to user. 311 | 312 | For exameple; if `slide_me_event` condition is completed , RateMe will show a new dialog and if user click `Rate Us` or `Don't show again` 313 | buttons, even user complete the `touch_me_event` new dialog won't show. RateMe waits always the first completed condition rules. 314 | In this way user won't be disturbed multiple times. 315 | 316 |

317 | 320 |

321 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-android-extensions' 4 | apply from: '../dependencies.gradle' 5 | 6 | android { 7 | compileSdkVersion versions.targetSdk 8 | defaultConfig { 9 | applicationId "com.zingat.rateme" 10 | minSdkVersion versions.minSdk 11 | targetSdkVersion versions.targetSdk 12 | versionCode versions.sampleVersionCode 13 | versionName versions.sampleVersionName 14 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 15 | } 16 | buildTypes { 17 | release { 18 | minifyEnabled false 19 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 20 | } 21 | } 22 | 23 | } 24 | 25 | dependencies { 26 | implementation fileTree(dir: 'libs', include: ['*.jar']) 27 | implementation project(path: ':rateme') 28 | 29 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 30 | implementation 'com.android.support:appcompat-v7:27.0.2' 31 | 32 | // Stetho 33 | implementation 'com.facebook.stetho:stetho:1.5.0' 34 | implementation 'com.facebook.stetho:stetho-okhttp3:1.5.0' 35 | 36 | testImplementation 'junit:junit:4.12' 37 | androidTestImplementation 'com.android.support.test:runner:1.0.1' 38 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' 39 | } -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/zingat/ratemesample/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.zingat.ratemesample 2 | 3 | import android.support.test.InstrumentationRegistry 4 | import android.support.test.runner.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getTargetContext() 22 | assertEquals("com.zingat.rateme", appContext.packageName) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/java/com/zingat/ratemesample/App.kt: -------------------------------------------------------------------------------- 1 | package com.zingat.ratemesample 2 | 3 | import android.app.Application 4 | import android.widget.Toast 5 | import com.facebook.stetho.Stetho 6 | import com.zingat.rateme.Rateme 7 | import com.zingat.rateme.callback.RMCallback 8 | import com.zingat.rateme.callback.RMEventCallback 9 | 10 | /** 11 | * Created by ismailgungor on 26.01.2018. 12 | */ 13 | class App : Application() { 14 | 15 | 16 | override fun onCreate() { 17 | super.onCreate() 18 | 19 | Stetho.initializeWithDefaults(this@App) 20 | 21 | Rateme.getInstance(this@App) 22 | .addCondition("touch_me_event", 3) 23 | .reminderDuration(3) 24 | .delay(1000) 25 | .custom(R.layout.layout_dialog) 26 | .customButton() 27 | .onRateCallback(object : RMEventCallback { 28 | override fun onEvent() { 29 | // TODO 30 | } 31 | }) 32 | .onDontAskCallback(object : RMEventCallback { 33 | override fun onEvent() { 34 | // TODO 35 | } 36 | }) 37 | .onRemindLaterCallback(object : RMEventCallback { 38 | override fun onEvent() { 39 | // TODO 40 | } 41 | }) 42 | .onShowCallback(object : RMEventCallback { 43 | override fun onEvent() { 44 | // TODO 45 | } 46 | }) 47 | .onRMCallback(object : RMCallback { 48 | override fun onEvent(eventName: String, count: Int, which: Int) { 49 | // TODO 50 | println("RMCallback eventName : $eventName") 51 | println("RMCallback count : $count") 52 | println("RMCallback which : $which") 53 | } 54 | }) 55 | } 56 | 57 | } -------------------------------------------------------------------------------- /app/src/main/java/com/zingat/ratemesample/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.zingat.ratemesample 2 | 3 | import android.content.Intent 4 | import android.support.v7.app.AppCompatActivity 5 | import android.os.Bundle 6 | import android.view.View 7 | import android.widget.Toast 8 | import com.zingat.rateme.Rateme 9 | import com.zingat.rateme.callback.RMEventCallback 10 | 11 | class MainActivity : AppCompatActivity() { 12 | 13 | var count = 0 14 | 15 | override fun onCreate(savedInstanceState: Bundle?) { 16 | super.onCreate(savedInstanceState) 17 | setContentView(R.layout.activity_main) 18 | } 19 | 20 | fun touchMe(view: View) { 21 | count += 1 22 | Rateme.getInstance(this) 23 | .addEvent("touch_me_event") 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/img_rateus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zingat/RateMe-Android/4e08e50c75e4c1dfec5167f1bc864dcccfc11f98/app/src/main/res/drawable-hdpi/img_rateus.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/img_rateus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zingat/RateMe-Android/4e08e50c75e4c1dfec5167f1bc864dcccfc11f98/app/src/main/res/drawable-mdpi/img_rateus.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/img_rateus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zingat/RateMe-Android/4e08e50c75e4c1dfec5167f1bc864dcccfc11f98/app/src/main/res/drawable-xhdpi/img_rateus.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/img_rateus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zingat/RateMe-Android/4e08e50c75e4c1dfec5167f1bc864dcccfc11f98/app/src/main/res/drawable-xxhdpi/img_rateus.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/img_rateus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zingat/RateMe-Android/4e08e50c75e4c1dfec5167f1bc864dcccfc11f98/app/src/main/res/drawable-xxxhdpi/img_rateus.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 11 | 16 | 21 | 26 | 31 | 36 | 41 | 46 | 51 | 56 | 61 | 66 | 71 | 76 | 81 | 86 | 91 | 96 | 101 | 106 | 111 | 116 | 121 | 126 | 131 | 136 | 141 | 146 | 151 | 156 | 161 | 166 | 171 | 172 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 |