https://github.com/stanwood/dialog_framework_android
https://github.com/stanwood/dialog_framework_android
android
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/stanwood/dialog_framework_android
- Owner: stanwood
- License: mit
- Created: 2018-06-04T14:31:46.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-10-11T11:41:38.000Z (almost 6 years ago)
- Last Synced: 2025-04-27T16:42:51.934Z (5 months ago)
- Topics: android
- Language: Java
- Size: 526 KB
- Stars: 2
- Watchers: 8
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://jitpack.io/#stanwood/Dialog_Framework_android)
[](https://android-arsenal.com/api?level=21)# 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.

## Import
The stanwood Rating Dialog is hosted on JitPack. Therefore you can simply import it by adding
```groovy
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
```to your project's `build.gradle`.
Then add this to you app's `build.gradle`:
```groovy
dependencies {
implementation 'com.github.stanwood:Dialog_Framework_android:'
}
```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.
```java
public class MyApp extends Application implements HasActivityInjector {
@Inject
DispatchingAndroidInjector dispatchingAndroidInjector;@Inject
RatingService ratingService;
@Override
public void onCreate() {
super.onCreate();
DaggerAppComponent.builder().application(this).build().inject(this);
ratingService.setLaunchTimes(2);
}
@Override
public DispatchingAndroidInjector activityInjector() {
return dispatchingAndroidInjector;
}
}
```Show the dialog within Activity
```java
public class MainActivity extends AppCompatActivity {@Inject
RatingService ratingService;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AndroidInjection.inject(this);
setContentView(R.layout.activity_main);
if (ratingService.shouldBeDisplayed()) {
RatingDialog.builder()
.addParagraph(Html.fromHtml("Hi,
I'm the developer 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:
```java
public String getString(@ConfigName String key) {
return mFirebaseRemoteConfig.getString(key);
}public String getNewLinedString(@ConfigName String key) {
String s = getString(key);
if (s != null) {
return s.replaceAll("\\\\n", "\n");
} else {
return s;
}
}
```## Roadmap
- add more possibilities about when to show the dialog