@Override
  public void onClick(View view) {
    ScriptTabActivity activity = (ScriptTabActivity) view.getContext();

    BrickTextDialog editDialog =
        new BrickTextDialog() {
          @Override
          protected void initialize() {
            input.setText(String.valueOf(changeGhostEffect));
            input.setInputType(
                InputType.TYPE_CLASS_NUMBER
                    | InputType.TYPE_NUMBER_FLAG_DECIMAL
                    | InputType.TYPE_NUMBER_FLAG_SIGNED);
            input.setSelectAllOnFocus(true);
          }

          @Override
          protected boolean handleOkButton() {
            try {
              changeGhostEffect = Double.parseDouble(input.getText().toString());
            } catch (NumberFormatException exception) {
              Toast.makeText(getActivity(), R.string.error_no_number_entered, Toast.LENGTH_SHORT)
                  .show();
            }

            return true;
          }
        };

    editDialog.show(activity.getSupportFragmentManager(), "dialog_change_ghost_effect_brick");
  }
Exemplo n.º 2
0
 private ScriptFragment getScriptFragment() {
   ScriptTabActivity activity = ((ScriptTabActivity) getActivity());
   return (ScriptFragment) activity.getTabFragment(ScriptTabActivity.INDEX_TAB_SCRIPTS);
 }