コード例 #1
0
  @Override
  public boolean onMenuItemSelected(int featureId, MenuItem item) {
    switch (item.getItemId()) {
      case R.id.menu_app_add_preset:
        if (!PMPPreferences.getInstance().isExpertMode()) {
          Toast.makeText(this, getString(R.string.main_presets_disabled), Toast.LENGTH_LONG).show();
          break;
        }

        DialogPresetEdit.ICallback callback =
            new DialogPresetEdit.ICallback() {

              @Override
              public void refresh() {}

              @Override
              public void openPreset(IPreset preset) {
                preset.assignApp(TabPresets.this.app);
                TabPresets.this.refresh();
              }
            };
        new DialogPresetEdit(TabPresets.this, null, callback).show();
        break;
    }
    return super.onMenuItemSelected(featureId, item);
  }
コード例 #2
0
  @Override
  protected void onResume() {
    super.onResume();

    setContentView(R.layout.tab_app_presets);

    this.app = GUITools.getIAppFromIntent(getIntent());

    /* Switch between Expert Mode and Normal Mode */
    TextView tvDescriptionNormalMode = (TextView) findViewById(R.id.TextView_Description_Normal);
    LinearLayout tvDescriptionExpertMode =
        (LinearLayout) findViewById(R.id.TextView_Description_Expert);
    if (PMPPreferences.getInstance().isExpertMode()) {
      tvDescriptionNormalMode.setVisibility(View.GONE);
      tvDescriptionExpertMode.setVisibility(View.VISIBLE);

      refresh();
    } else {
      tvDescriptionNormalMode.setVisibility(View.VISIBLE);
      tvDescriptionExpertMode.setVisibility(View.GONE);
    }
  }