Skip to content

Repository files navigation

ReleaseAPI

stanwood Rating Dialog (Android)

This library contains a simple to use "please rate my app" dialog, which is shown at x-th time of app starts.

Demo

Import

The stanwood Rating Dialog is hosted on JitPack. Therefore you can simply import it by adding

allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}

to your project's build.gradle.

Then add this to you app's build.gradle:

dependencies {
implementation 'com.github.stanwood:Dialog_Framework_android:<insert latest version here>'
}

For more info about how to add Stanwood analytics framework to the app please check the https://github.com/stanwood/Analytics_Framework_android

Usage

Initialise the dialog within Application and set after how many app starts would you want to show the dialog.

publicclassMyAppextendsApplicationimplementsHasActivityInjector {
@InjectDispatchingAndroidInjector<Activity> dispatchingAndroidInjector;
@InjectRatingServiceratingService;
@OverridepublicvoidonCreate() {
super.onCreate();
DaggerAppComponent.builder().application(this).build().inject(this);
ratingService.setLaunchTimes(2);
}
@OverridepublicDispatchingAndroidInjector<Activity> activityInjector() {
returndispatchingAndroidInjector;
}
}

Show the dialog within Activity

publicclassMainActivityextendsAppCompatActivity {
@InjectRatingServiceratingService;
@OverrideprotectedvoidonCreate(BundlesavedInstanceState) {
super.onCreate(savedInstanceState);
AndroidInjection.inject(this);
setContentView(R.layout.activity_main);
if (ratingService.shouldBeDisplayed()) {
RatingDialog.builder()
.addParagraph(Html.fromHtml("Hi, <br/> I'm the <font color='red'>developer</font> of this app."))
.addParagraph("Developers like me live on good ratings in Google Play.")
.addParagraph("If you like the app,\nplease rate it.")
.addParagraph("It takes only 1 minute") .setCancelText("Cancel")
.setOkText("Ok")
.setBannerUrl("https://media.istockphoto.com/photos/plitvice-lakes-picture-id500463760?s=2048x2048")
// alternatively: .setBannerDrawable(bannerDrawableResId)
.setFaceUrl("https://lh5.googleusercontent.com/-_w2wo1s6SkI/AAAAAAAAAAI/AAAAAAAAhMU/s78iSxXwVZk/photo.jpg")
// alternatively: .setFaceDrawable(bannerDrawableResId)//.setAnalyticsTracker(add analytics instance here)
.preloadAndShow(this);
// alternatively just .show(this) if you don't need to preload images (e.g. because you provide them locally via Drawable resources)
}
}
}

Min SDK Version = 21

Glide version = 4.8.x

For more information check out the sample app.

Tips and Tricks

Fixed in 0.6.1: Firebase remote config does not support newlines by ifself. Here's a snippet which solves it:

publicStringgetString(@ConfigNameStringkey) {
returnmFirebaseRemoteConfig.getString(key);
}
publicStringgetNewLinedString(@ConfigNameStringkey) {
Strings = getString(key);
if (s != null) {
returns.replaceAll("\\\\n", "\n");
} else {
returns;
}
}

Roadmap

  • add more possibilities about when to show the dialog

About

No description or website provided.

Topics

Resources

Stars

2 stars

Watchers

8 watching

Forks

Releases

Packages

Contributors

Languages