Andialog / Android-Rate-Dialog is a library to help you make RateDialog easier than before.
You can download from maven central.
dependencies {
compile ‘com.erish.andialog:andialog:0.2.0’
}
Please try to move the sample.
andialog supports over API level 16.
andialog provides methods to configure its behavior.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
/**
* Anidialog
*
* Andialog starts with with function.
*
* Each conditions (setInstallDate, setLaunchTimes, setRemindInterval, setEventTimes)
* has no impacts until users set values.
*
* If users set values in this conditions,
* then Andialog will work with users' setting values except non-set values.
*
*/
Andialog.with(this)
.setInstallDate(0) // default -1, 0 means 1st launch day(install day).
.setLaunchTimes(3) // default -1, 1 means 1st launch day(install day).
.setRemindInterval(1) // default 1
.setShowNeutralButton(true) // default true
//.setEventsTimes(5) you can also add event trigger
.setOnClickButtonListener(new OnClickButtonListener() { // callback listener.
@Override
public void onClickButton(int which) {
Log.d(MainActivity.class.getName(), Integer.toString(which));
}
})
.setIsDebug(true) // this is for debug (ignore all conditions)
.launch();
Andialog.showRateDialogIfMeetsConditions(this);
}
When you want to track significant events, write code as below.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Andialog.with(this).setEventsTimes(2).launch();
}
@Override
public void onClick() {
Andialog.passSignificantEvent(this); // when user pass this line for the third time, dialog appears.
}
When you want to show the dialog again, call Andialog#clearAgreeShowDialog()
.
Andialog.with(this).clearAgreeShowDialog();
call Andialog.showDialog(Activity)
.
Andialog.with(this).showDialog(this);
call Andialog.setView(View)
.
LayoutInflater inflater = (LayoutInflater)this.getSystemService(LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.custom_dialog, (ViewGroup)findViewById(R.id.layout_root));
Andialog.with(this).setView(view).launch();
call 'Andialog.setDialogStyle(YourCustomStyle)'.
Andialog.with(this).setDialogStyle(R.style.YourCustomStyle).launch();
If you want to use your own dialog labels, override string xml resources on your application.
<resources>
<string name="app_name">Andialog</string>
<string name="rate_dialog_title">Hello World</string>
<string name="rate_dialog_message">If you enjoy playing this app, would you mind taking a moment to rate it? It won\'t take more than a minute. Thanks for your support!</string>
<string name="rate_dialog_positive">Rate It Now</string>
<string name="rate_diloag_neutral">Remind Me Later</string>
<string name="rate_dialog_negative">No, Thanks</string>
</resources>
Basically the market is for google play store. But in spcecially S.Korea, there are several stores(One Store and Naver app store) You can use it.
Andialog.with(this).setPackageType("One" or "Naver").setPackageId("your market id").
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request