コード例 #1
0
 /** Method invoked to stop the rename service. */
 private void doStopRenameService() {
   if (mApplication.isRenameFileTaskRunning()) {
     mApplication.setRenameFileTaskCanceled(true);
   } else {
     doFinish();
   }
 }
コード例 #2
0
  /**
   * Method invoked at the end of rename file async task.
   *
   * @param count Number of renamed files.
   */
  @Override
  public void onTaskFinished(int count) {
    String message;
    switch (count) {
      case 0:
        message = DSCApplication.getAppContext().getString(R.string.manually_file_rename_count_0);
        break;
      case 1:
        message = DSCApplication.getAppContext().getString(R.string.manually_file_rename_count_1);
        break;
      default:
        message =
            DSCApplication.getAppContext()
                .getString(R.string.manually_file_rename_count_more, count);
        break;
    }
    AlertDialog.Builder dialog =
        new AlertDialog.Builder(this)
            .setTitle(R.string.app_name)
            .setMessage(message)
            .setIcon(android.R.drawable.ic_dialog_alert)
            .setNeutralButton(
                R.string.ok,
                new DialogInterface.OnClickListener() {

                  public void onClick(DialogInterface dialog, int whichButton) {
                    doFinish();
                  }
                });
    dialog.show();
  }
コード例 #3
0
 /** This method is invoked when the activity is started */
 @Override
 protected void onStart() {
   super.onStart();
   if (mApplication.hideRenameServiceStartConfirmation()) {
     doStartRenameService();
   } else {
     showServiceStartConfirmationDialog();
   }
 }
コード例 #4
0
 /** This method will start the rename service. */
 private void doStartRenameService() {
   mApplication.setRenameFileRequested(true);
   if (!mApplication.isRenameFileTaskRunning()) {
     new RenameFileAsyncTask(mApplication, this, true).execute();
   }
 }