示例#1
0
文件: Eula.java 项目: kvite/Tasquid
 public static void showEulaBasic(Activity activity) {
   final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
   builder.setTitle(R.string.DLG_eula_title);
   builder.setMessage(AndroidUtilities.readFile(activity, R.raw.eula));
   builder.setNeutralButton(android.R.string.ok, null);
   builder.show();
 }
示例#2
0
文件: Eula.java 项目: kvite/Tasquid
  /**
   * Displays the EULA if necessary. This method should be called from the onCreate() method of your
   * main Activity.
   *
   * @param activity The Activity to finish if the user rejects the EULA
   */
  public static void showEula(final Activity activity) {
    if (!new Eula().shouldShowEula(activity)) return;

    final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
    builder.setTitle(R.string.DLG_eula_title);
    builder.setCancelable(true);
    builder.setPositiveButton(
        R.string.DLG_accept,
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
            accept(activity);
          }
        });
    builder.setNegativeButton(
        R.string.DLG_decline,
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
            refuse(activity);
          }
        });
    builder.setOnCancelListener(
        new DialogInterface.OnCancelListener() {
          @Override
          public void onCancel(DialogInterface dialog) {
            refuse(activity);
          }
        });
    builder.setMessage(AndroidUtilities.readFile(activity, R.raw.eula));
    builder.show();
  }