erishforG / Android-Rate-Dialog

Andialog / Android-Rate-Dialog is a library to help you make RateDialog easier than before.

Home Page:https://github.com/erishforG/Android-Rate-Dialog

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Andialog / android-rate-dialog

GitHub tag GitHub license

Andialog / Android-Rate-Dialog is a library to help you make RateDialog easier than before.

screen shot

Getting Started

You can download from maven central.

dependencies {
  compile ‘com.erish.andialog:andialog:0.2.0’
}

Sample

Please try to move the sample.

Support

andialog supports over API level 16.

Configuration

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);
    }

Event Tracking

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.
}

Clear show dialog flag

When you want to show the dialog again, call Andialog#clearAgreeShowDialog().

Andialog.with(this).clearAgreeShowDialog();

When the button presses on

call Andialog.showDialog(Activity).

Andialog.with(this).showDialog(this);

Set custom view

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();

Set custom style (version 0.2.0)

call 'Andialog.setDialogStyle(YourCustomStyle)'.

Andialog.with(this).setDialogStyle(R.style.YourCustomStyle).launch();

Custom dialog

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>

Set Market Store

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").

Contribute

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Copyright & Derivatives

copyright / Android-Rate

About

Andialog / Android-Rate-Dialog is a library to help you make RateDialog easier than before.

https://github.com/erishforG/Android-Rate-Dialog


Languages

Language:Java 100.0%