hotchemi.android.rate.AppRate Java Examples

The following examples show how to use hotchemi.android.rate.AppRate. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MainActivity.java    From AppPlus with MIT License 6 votes vote down vote up
private void rateApp() {
    AppRate.with(this)
            .setInstallDays(1) // default 10, 0 means install day.
            .setLaunchTimes(5) // default 10
            .setRemindInterval(2) // default 1
            .setShowLaterButton(true) // default true
            .setOnClickButtonListener(new OnClickButtonListener() { // callback listener.
                @Override
                public void onClickButton(int which) {
                    MobclickAgent.onEvent(MainActivity.this, "rate_score_"+which);
                }
            })
            .monitor();

    // Show a dialog if meets conditions
    AppRate.showRateDialogIfMeetsConditions(this);
}
 
Example #2
Source File: MainActivity.java    From CarbonContacts with MIT License 6 votes vote down vote up
void AppRating(){
    AppRate.with(this)
            .setInstallDays(0) // default 10, 0 means install day.
            .setLaunchTimes(1) // default 10
            .setRemindInterval(1) // default 1
            .setShowLaterButton(true) // default true
            .setDebug(false) // default false
            .setOnClickButtonListener(new OnClickButtonListener() { // callback listener.
                @Override
                public void onClickButton(int which) {
                    Log.d(MainActivity.class.getName(), Integer.toString(which));
                }
            })
            .monitor();

    // Show a dialog if meets conditions
    AppRate.showRateDialogIfMeetsConditions(this);

    AppRate.with(this).clearAgreeShowDialog();
}
 
Example #3
Source File: AboutFragment.java    From android with MIT License 6 votes vote down vote up
@Override
public boolean onPreferenceClick(Preference preference) {
    final String key = preference.getKey();

    if (ONBOARDING.equals(key)) {
        startActivity(TutorialActivity.newIntent(getActivity(), false));
    } else if (RATE_APP.equals(key)) {
        AppRate.setRateDialogAgreed(getActivity());
        /**
         * Launch Playstore to rate app
         */
        final Intent viewIntent = new Intent(Intent.ACTION_VIEW);
        viewIntent.setData(Uri.parse(getResources().getString(R.string.url_playstore)));
        startActivity(viewIntent);
    } else if (TERMS.equals(key) || FAQ.equals(key) || PRIVACY.equals(key)) {
        startActivity(WebViewActivity.newIntent(getActivity(), key));
    }

    return false;
}
 
Example #4
Source File: AboutFragment.java    From AppPlus with MIT License 5 votes vote down vote up
@Override
    public boolean onPreferenceClick(android.preference.Preference preference) {
        String key = preference.getKey();
        //用if判断 效率不会很好 待改善
        if(key.equals(getString(R.string.preference_key_about))){
            String htmlFileName =  Utils.isChineseLanguage()?"about_ch.html":"about.html";
            DialogUtil.showCustomDialogFillInWebView(mContext, mContext.getSupportFragmentManager(), getString(R.string.preference_title_about), htmlFileName, "about");
            MobclickAgent.onEvent(mContext, "setting_about");
        }
        if(key.equals(getString(R.string.preference_key_score))){
//            NavigationManager.gotoMarket(mContext,getActivity().getPackageName());
            AppRate.with(getActivity()).showRateDialog(getActivity());
            MobclickAgent.onEvent(mContext, "setting_market");
        }
        if(key.equals(getString(R.string.preference_key_opinion))){
            NavigationManager.gotoSendOpinion(getActivity());
            MobclickAgent.onEvent(getActivity(), "send_email");
        }
        if(key.equals(getString(R.string.preference_key_check_update))){
            UmengUpdateAgent.setUpdateListener(new CheckUmengUpdateListener());
            UmengUpdateAgent.forceUpdate(mContext);
            MobclickAgent.onEvent(mContext, "setting_check_update");
        }
        if(key.equals(getString(R.string.preference_key_license))){
            DialogUtil.showCustomDialogFillInWebView(mContext, mContext.getSupportFragmentManager(), getString(R.string.preference_title_license), "license.html", "license");
            MobclickAgent.onEvent(mContext, "setting_license");
        }
        return false;
    }
 
Example #5
Source File: RateAppHelper.java    From android with MIT License 5 votes vote down vote up
public static boolean showRateDialog(final Activity activity) {
    AppRate.with(activity)
            .setDialogStyle(R.style.PrkngDialogStyle)
            .setStoreType(AppRate.StoreType.GOOGLEPLAY)
            .setInstallDays(7) // default 10, 0 means install day.
            .setLaunchTimes(5) // default 10 times.
            .setRemindInterval(5) // default 1 day.
            .setShowLaterButton(true) // default true.
            .setDebug(false) // default false.
            .setCancelable(true) // default false.
            .setTitle(R.string.rate_dialog_title)
            .setMessage(R.string.rate_dialog_message)
            .setTextLater(R.string.rate_dialog_later_btn)
            .setTextNever(R.string.rate_dialog_never_btn)
            .setTextRateNow(R.string.rate_dialog_rate_now_btn)
            .setOnClickButtonListener(new OnClickButtonListener() {
                @Override
                public void onClickButton(int which) {
                    if (which == DialogInterface.BUTTON_NEGATIVE) {
                        try {
                            activity.startActivity(getFeedbackIntent(activity));
                        } catch (Exception e) {
                            Crashlytics.logException(e);
                        }
                    }
                }
            })

            .monitor();

    return AppRate.showRateDialogIfMeetsConditions(activity);
}
 
Example #6
Source File: MainActivity.java    From AutoAP with Apache License 2.0 5 votes vote down vote up
@Override
protected void onResumeFragments() {
    super.onResumeFragments();
    setSwitchImageState();

    isReflectionOK = mSharedPrefs.getBoolean(Constants.PREFS_REFLECT_STATUS, false);
    if (isReflectionOK) {
        //Config for rating recomendation, Only show dialog when reflection ok
        AppRate.getInstance().setInstallDays(2).setLaunchTimes(5).monitor(this);
        AppRate.showRateDialogIfMeetsConditions(this);
    }
}
 
Example #7
Source File: MainActivity.java    From Android-Rate with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    AppRate.with(this)
            .setStoreType(StoreType.GOOGLEPLAY) //default is Google, other option is Amazon
            .setInstallDays(3) // default 10, 0 means install day.
            .setLaunchTimes(10) // default 10 times.
            .setRemindInterval(2) // default 1 day.
            .setShowLaterButton(true) // default true.
            .setDebug(true) // default false.
            .setCancelable(false) // default false.
            .setOnClickButtonListener(new OnClickButtonListener() { // callback listener.
                @Override
                public void onClickButton(int which) {
                    Log.d(MainActivity.class.getName(), Integer.toString(which));
                }
            })
            .setTitle(R.string.new_rate_dialog_title)
            .setTextLater(R.string.new_rate_dialog_later)
            .setTextNever(R.string.new_rate_dialog_never)
            .setTextRateNow(R.string.new_rate_dialog_ok)
            .monitor();

    AppRate.showRateDialogIfMeetsConditions(this);
}
 
Example #8
Source File: ActivityMain.java    From uPods-android with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().setBackgroundDrawable(null);
    setContentView(R.layout.activity_main);

    //Toolbar
    toolbar = (Toolbar) findViewById(R.id.toolbar_main);

    int startedFrom = getIntent().getIntExtra(ActivityPlayer.ACTIVITY_STARTED_FROM, -1);

    if (isFirstRun && !Arrays.asList(notificationsActions).contains(startedFrom)) {
        toolbar.setVisibility(View.GONE);
        final FragmentWellcome fragmentWellcome = new FragmentWellcome();
        showFragment(R.id.fl_window, fragmentWellcome, FragmentWellcome.TAG);
        init();
        new Handler().postDelayed(new Runnable() {
            public void run() {
                hideFragment(fragmentWellcome);
                if (!Prefs.getBoolean(FragmentHelp.PREF_HELP_SHOWN, false)) { //!
                    showHelpFragment();
                } else {
                    toolbar.setVisibility(View.VISIBLE);
                    showFragment(R.id.fl_content, getStartFragment(), FragmentMediaItemsGrid.TAG);
                }
            }
        }, WELLCOME_SCREEN_TIME);
    } else {
        init();
        toolbar.setVisibility(View.VISIBLE);

        int startedFragmentNumber = ActivityMain.lastChildFragmentNumber;

        if (startedFrom == NetworkTasksService.NOTIFICATIONS_SHOW_PODCASTS_SUBSCRIBED) {
            startedFragmentNumber = 1;
            startedFrom = MediaItemType.PODCAST.ordinal();
            NotificationManager nMgr = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
            nMgr.cancel(NetworkTasksService.NEW_EPISODS_NOTIFICATION_ID);
        }

        FragmentMediaItemsGrid fragmentMediaItemsGrid = new FragmentMediaItemsGrid();
        fragmentMediaItemsGrid.setMediaItemType(startedFrom == MediaItemType.PODCAST.ordinal() ? MediaItemType.PODCAST : MediaItemType.RADIO);
        if (startedFragmentNumber >= 0) {
            fragmentMediaItemsGrid.setStartItemNumber(startedFragmentNumber);
        }
        showFragment(R.id.fl_content, fragmentMediaItemsGrid, FragmentMediaItemsGrid.TAG);
        AppRate.with(this)
                .setInstallDays(RATE_MIN_INSTALL_DAYS)
                .setLaunchTimes(RATE_MIN_INSTALL_TIMES)
                .setShowLaterButton(true) // default true
                .monitor();

        // Show a dialog if meets conditions
        AppRate.showRateDialogIfMeetsConditions(this);
    }
    isFirstRun = false;
}