congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
com.kobakei.ratethisapp
Code IndexAdd Tabnine to your IDE (free)

How to use com.kobakei.ratethisapp

Best Java code snippets using com.kobakei.ratethisapp (Showing top 20 results out of 315)

origin: kobakei/Android-RateThisApp

  @Override
  public void onClick(View v) {
    // Show rating dialog explicitly.
    RateThisApp.showRateDialog(MainActivity.this);
  }
});
origin: kobakei/Android-RateThisApp

  @Override
  public void onClick(DialogInterface dialog, int which) {
    if (sCallback != null) {
      sCallback.onCancelClicked();
    }
    clearSharedPreferences(context);
    storeAskLaterDate(context);
  }
});
origin: kobakei/Android-RateThisApp

  @Override
  public void onClick(DialogInterface dialog, int which) {
    if (sCallback != null) {
      sCallback.onNoClicked();
    }
    setOptOut(context, true);
  }
});
origin: kobakei/Android-RateThisApp

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  RateThisApp.init(new RateThisApp.Config(3, 5));
  RateThisApp.setCallback(new RateThisApp.Callback() {
    @Override
    public void onYesClicked() {
  Button button1 = (Button) findViewById(R.id.button1);
  button1.setOnClickListener(new View.OnClickListener() {
    @Override
  Button button2 = (Button) findViewById(R.id.button2);
  button2.setOnClickListener(new View.OnClickListener() {
    @Override
  Button button3 = (Button) findViewById(R.id.button3);
  button3.setOnClickListener(new View.OnClickListener() {
    @Override
  RateThisApp.onCreate(this);
  RateThisApp.showRateDialogIfNeeded(this);
origin: JavaCafe01/PdfViewer

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  prefManager = PreferenceManager.getDefaultSharedPreferences(this);
  onFirstInstall();
  onFirstUpdate();
  handleIntent(getIntent());
  if (Utils.tempBool && getIntent().getStringExtra("uri") != null)
    uri = Uri.parse(getIntent().getStringExtra("uri"));
  // Custom condition: 5 days and 5 launches
  RateThisApp.Config config = new RateThisApp.Config(5, 5);
  RateThisApp.init(config);
  RateThisApp.onCreate(this);
  RateThisApp.showRateDialogIfNeeded(this);
}
origin: kobakei/Android-RateThisApp

@Test
public void shouldRateDialogIfNeeded_LaunchTimeIsCorrect() {
  Context context = RuntimeEnvironment.application.getApplicationContext();
  RateThisApp.init(new RateThisApp.Config(1, 3));
  RateThisApp.onStart(context);
  Assert.assertFalse(RateThisApp.shouldShowRateDialog());
  RateThisApp.onStart(context);
  Assert.assertFalse(RateThisApp.shouldShowRateDialog());
  RateThisApp.onStart(context);
  Assert.assertTrue(RateThisApp.shouldShowRateDialog());
  RateThisApp.onStart(context);
  Assert.assertTrue(RateThisApp.shouldShowRateDialog());
}
origin: kobakei/Android-RateThisApp

/**
 * Show the rate dialog if the criteria is satisfied.
 * @param context Context
 * @return true if shown, false otherwise.
 */
public static boolean showRateDialogIfNeeded(final Context context) {
  if (shouldShowRateDialog()) {
    showRateDialog(context);
    return true;
  } else {
    return false;
  }
}
origin: kobakei/Android-RateThisApp

/**
 * This API is deprecated.
 * You should call onCreate instead of this API in Activity's onCreate().
 * @param context
 */
@Deprecated
public static void onStart(Context context) {
  onCreate(context);
}
origin: kobakei/Android-RateThisApp

/**
 * Call this API when the launcher activity is launched.<br>
 * It is better to call this API in onCreate() of the launcher activity.
 * @param context Context
 */
public static void onCreate(Context context) {
  SharedPreferences pref = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
  Editor editor = pref.edit();
  // If it is the first launch, save the date in shared preference.
  if (pref.getLong(KEY_INSTALL_DATE, 0) == 0L) {
    storeInstallDate(context, editor);
  }
  // Increment launch times
  int launchTimes = pref.getInt(KEY_LAUNCH_TIMES, 0);
  launchTimes++;
  editor.putInt(KEY_LAUNCH_TIMES, launchTimes);
  log("Launch times; " + launchTimes);
  editor.apply();
  mInstallDate = new Date(pref.getLong(KEY_INSTALL_DATE, 0));
  mLaunchTimes = pref.getInt(KEY_LAUNCH_TIMES, 0);
  mOptOut = pref.getBoolean(KEY_OPT_OUT, false);
  mAskLaterDate = new Date(pref.getLong(KEY_ASK_LATER_DATE, 0));
  printStatus(context);
}
origin: kobakei/Android-RateThisApp

  @Override
  public void onClick(View v) {
    RateThisApp.stopRateDialog(MainActivity.this);
  }
});
origin: kobakei/Android-RateThisApp

@Test
public void getLaunchCount_IsCorrect() {
  Context context = RuntimeEnvironment.application.getApplicationContext();
  Assert.assertEquals(0, RateThisApp.getLaunchCount(context));
  RateThisApp.onStart(context);
  Assert.assertEquals(1, RateThisApp.getLaunchCount(context));
  RateThisApp.onStart(context);
  Assert.assertEquals(2, RateThisApp.getLaunchCount(context));
}
origin: kobakei/Android-RateThisApp

/**
 * Stop showing the rate dialog
 * @param context
 */
public static void stopRateDialog(final Context context){
  setOptOut(context, true);
}
origin: kobakei/Android-RateThisApp

/**
 * Print values in SharedPreferences (used for debug)
 * @param context
 */
private static void printStatus(final Context context) {
  SharedPreferences pref = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
  log("*** RateThisApp Status ***");
  log("Install Date: " + new Date(pref.getLong(KEY_INSTALL_DATE, 0)));
  log("Launch Times: " + pref.getInt(KEY_LAUNCH_TIMES, 0));
  log("Opt out: " + pref.getBoolean(KEY_OPT_OUT, false));
}
origin: kobakei/Android-RateThisApp

  @Override
  public void onClick(DialogInterface dialog, int which) {
    if (sCallback != null) {
      sCallback.onYesClicked();
    }
    String appPackage = context.getPackageName();
    String url = "market://details?id=" + appPackage;
    if (!TextUtils.isEmpty(sConfig.mUrl)) {
      url = sConfig.mUrl;
    }
    try {
      context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
    } catch (android.content.ActivityNotFoundException anfe) {
      context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + context.getPackageName())));
    }
    setOptOut(context, true);
  }
});
origin: kobakei/Android-RateThisApp

/**
 * Show the rate dialog if the criteria is satisfied.
 * @param context Context
 * @param themeId Theme ID
 * @return true if shown, false otherwise.
 */
public static boolean showRateDialogIfNeeded(final Context context, int themeId) {
  if (shouldShowRateDialog()) {
    showRateDialog(context, themeId);
    return true;
  } else {
    return false;
  }
}
origin: kobakei/Android-RateThisApp

  @Override
  public void onClick(View v) {
    // Show rating dialog explicitly.
    RateThisApp.showRateDialog(MainActivity.this, R.style.MyAlertDialogStyle2);
  }
});
origin: kobakei/Android-RateThisApp

  @Test
  public void stopRateDialog_IsSuccess() {
    Context context = RuntimeEnvironment.application.getApplicationContext();
    RateThisApp.stopRateDialog(context);

    // check shared pref
    SharedPreferences sharedPreferences = RuntimeEnvironment.application.getSharedPreferences(
        PREF_NAME, Context.MODE_PRIVATE);
    Assert.assertTrue(sharedPreferences.getBoolean(KEY_OPT_OUT, false));
  }
}
origin: kobakei/Android-RateThisApp

  @Override
  public void onCancel(DialogInterface dialog) {
    if (sCallback != null) {
      sCallback.onCancelClicked();
    }
    clearSharedPreferences(context);
    storeAskLaterDate(context);
  }
});
origin: kobakei/Android-RateThisApp

/**
 * Show the rate dialog
 * @param context
 * @param themeId
 */
public static void showRateDialog(final Context context, int themeId) {
  AlertDialog.Builder builder = new AlertDialog.Builder(context, themeId);
  showRateDialog(context, builder);
}
origin: kobakei/Android-RateThisApp

/**
 * Show the rate dialog
 * @param context
 */
public static void showRateDialog(final Context context) {
  AlertDialog.Builder builder = new AlertDialog.Builder(context);
  showRateDialog(context, builder);
}
com.kobakei.ratethisapp

Most used classes

  • RateThisApp
    RateThisApp A library to show the app rate dialog
  • RateThisApp$Config
    RateThisApp configuration.
  • RateThisApp$Callback
    Callback of dialog click event
  • MainActivity
    Sample application of RateThisApp
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now