@Override
    protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setTheme(android.R.style.Theme_Dialog);

      final long id = getIntent().getLongExtra(TOKEN_FILTER_ID, -1);
      if (id == -1) {
        finish();
        return;
      }
      final String name = getIntent().getStringExtra(TOKEN_FILTER_NAME);

      DependencyInjectionService.getInstance().inject(this);
      DialogUtilities.okCancelDialog(
          this,
          getString(R.string.DLG_delete_this_item_question, name),
          new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
              PluginServices.getStoreObjectDao().delete(id);
              setResult(RESULT_OK);
              finish();
            }
          },
          new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
              setResult(RESULT_CANCELED);
              finish();
            }
          });
    }
 @Override
 protected void showDialog() {
   DialogUtilities.okCancelDialog(
       this,
       getString(R.string.DLG_delete_this_tag_question, tag),
       getOkListener(),
       getCancelListener());
 }
示例#3
0
 private void searchMarket(final String packageName, int title, int body) {
   DialogUtilities.okCancelDialog(
       activity,
       activity.getString(title),
       activity.getString(body),
       new DialogInterface.OnClickListener() {
         @Override
         public void onClick(DialogInterface d, int which) {
           Intent marketIntent = Constants.MARKET_STRATEGY.generateMarketLink(packageName);
           try {
             if (marketIntent == null)
               throw new ActivityNotFoundException("No market link supplied"); // $NON-NLS-1$
             activity.startActivity(marketIntent);
           } catch (ActivityNotFoundException anf) {
             DialogUtilities.okDialog(
                 activity, activity.getString(R.string.EPr_marketUnavailable_dlg), null);
           }
         }
       },
       null);
 }
示例#4
0
  private void onVoiceInputStatusChanged(final Preference preference, boolean newValue) {
    if (!newValue) return;

    final Resources r = getResources();
    if (!VoiceRecognizer.voiceInputAvailable(this)) {
      if (AndroidUtilities.getSdkVersion() > 6) {
        DialogUtilities.okCancelDialog(
            this,
            r.getString(R.string.EPr_voiceInputInstall_dlg),
            new OnClickListener() {
              @Override
              public void onClick(DialogInterface dialog, int which) {
                voiceInputAssistant.showVoiceInputMarketSearch(
                    new OnClickListener() {
                      @Override
                      public void onClick(DialogInterface dialog1, int which1) {
                        ((CheckBoxPreference) preference).setChecked(false);
                      }
                    });
              }
            },
            new OnClickListener() {
              @Override
              public void onClick(DialogInterface dialog, int which) {
                ((CheckBoxPreference) preference).setChecked(false);
              }
            });
      } else {
        DialogUtilities.okDialog(
            this,
            r.getString(R.string.EPr_voiceInputUnavailable_dlg),
            new OnClickListener() {
              @Override
              public void onClick(DialogInterface dialog1, int which1) {
                ((CheckBoxPreference) preference).setChecked(false);
              }
            });
      }
    }
  }