Java 类com.afollestad.materialdialogs.internal.MDButton 实例源码

项目:GitHub    文件:MaterialDialog.java   
/**
 * Retrieves the view of an action button, allowing you to modify properties such as whether or
 * not it's enabled. Use {@link #setActionButton(DialogAction, int)} to change text, since the
 * view returned here is not the view that displays text.
 *
 * @param which The action button of which to get the view for.
 * @return The view from the dialog's layout representing this action button.
 */
public final MDButton getActionButton(@NonNull DialogAction which) {
    switch (which) {
        default:
            return positiveButton;
        case NEUTRAL:
            return neutralButton;
        case NEGATIVE:
            return negativeButton;
    }
}
项目:EasyFrame    文件:MaterialDialog.java   
/**
 * Retrieves the view of an action button, allowing you to modify properties such as whether or not it's enabled.
 * Use {@link #setActionButton(DialogAction, int)} to change text, since the view returned here is not
 * the view that displays text.
 *
 * @param which The action button of which to get the view for.
 * @return The view from the dialog's layout representing this action button.
 */
public final MDButton getActionButton(@NonNull DialogAction which) {
    switch (which) {
        default:
            return positiveButton;
        case NEUTRAL:
            return neutralButton;
        case NEGATIVE:
            return negativeButton;
    }
}
项目:AmazeFileManager    文件:SftpConnectDialog.java   
/**
 * Set the PEM key for authentication when the Intent to browse file returned.
 */
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if(SELECT_PEM_INTENT == requestCode && Activity.RESULT_OK == resultCode)
    {
        mSelectedPem = data.getData();
        Log.d(TAG, "Selected PEM: " + mSelectedPem.toString() + "/ "
                + mSelectedPem.getLastPathSegment());

        try {
            InputStream selectedKeyContent = mContext.getContentResolver()
                    .openInputStream(mSelectedPem);
            new PemToKeyPairTask(selectedKeyContent, result -> {
                if(result.result != null)
                {
                    mSelectedParsedKeyPair = result.result;
                    mSelectedParsedKeyPairName = mSelectedPem.getLastPathSegment()
                            .substring(mSelectedPem.getLastPathSegment().indexOf('/')+1);
                    MDButton okBTN = ((MaterialDialog)getDialog())
                            .getActionButton(DialogAction.POSITIVE);
                    okBTN.setEnabled(okBTN.isEnabled() || true);

                    Button selectPemBTN = getDialog().findViewById(R.id.selectPemBTN);
                    selectPemBTN.setText(mSelectedParsedKeyPairName);
                }
            }).execute();

        } catch(FileNotFoundException e) {
            Log.e(TAG, "File not found", e);
        } catch(IOException shouldNotHappen) {}
    }
}
项目:material-dialogs    文件:MaterialDialog.java   
/**
 * Retrieves the view of an action button, allowing you to modify properties such as whether or
 * not it's enabled. Use {@link #setActionButton(DialogAction, int)} to change text, since the
 * view returned here is not the view that displays text.
 *
 * @param which The action button of which to get the view for.
 * @return The view from the dialog's layout representing this action button.
 */
public final MDButton getActionButton(DialogAction which) {
  switch (which) {
    default:
      return positiveButton;
    case NEUTRAL:
      return neutralButton;
    case NEGATIVE:
      return negativeButton;
  }
}
项目:grooo    文件:MenuActivity.java   
public void showFoodDialog(final HttpFood food, final boolean isNew, String category) {
    MaterialDialog dialog = new MaterialDialog.Builder(MenuActivity.this)
            .title("菜品属性")
            .customView(R.layout.change_food_attribute, true)
            .positiveText("确定")
            .negativeText(android.R.string.cancel)
            .onPositive((dialog1, which) -> {
                food.setName(foodName.getText().toString().trim());
                food.setCategory(foodCategory.getText().toString().trim());
                food.setDescription(foodDescription.getText().toString().trim());
                food.setPrice(foodPrice.getText().toString().trim());
                if (isNew) {
                    addSubscription(NetworkWrapper
                            .get()
                            .addFood(responseBody -> refreshData(), AppPreferences.get().getAuth(), AppManager.getShopInfo().getId(), food));
                } else {
                    addSubscription(NetworkWrapper
                            .get()
                            .editFood(responseBody -> refreshData(), AppPreferences.get().getAuth(), AppManager.getShopInfo().getId(), food));
                }
            }).build();

    final MDButton positiveAction = dialog.getActionButton(DialogAction.POSITIVE);
    //noinspection ConstantConditions
    foodName = (EditText) dialog.getCustomView().findViewById(R.id.food_edit_name);
    foodCategory = (EditText) dialog.getCustomView().findViewById(R.id.food_edit_category);
    foodDescription = (EditText) dialog.getCustomView().findViewById(R.id.food_edit_description);
    foodPrice = (EditText) dialog.getCustomView().findViewById(R.id.food_edit_price);
    Observable.combineLatest(RxTextView.textChanges(foodName).skip(1)
            , RxTextView.textChanges(foodCategory).skip(1)
            , RxTextView.textChanges(foodPrice).skip(1)
            , (name, category1, price) -> !TextUtils.isEmpty(name) && !TextUtils.isEmpty(category1) && !TextUtils.isEmpty(price))
            .subscribe(aBoolean -> {
                positiveAction.setEnabled(aBoolean);
            });
    if (!isNew) {
        foodName.setText(food.getName());
        foodCategory.setText(food.getCategory());
        foodDescription.setText(food.getDescription());
        foodPrice.setText(food.getPrice());
    } else {
        foodCategory.setText(category);
    }
    dialog.show();
    positiveAction.setEnabled(false); // disabled by default
}
项目:JianDanRxJava    文件:InputWatcher.java   
public InputWatcher(EditText name, EditText email, MDButton button) {
    editName = name;
    editEmail = email;
    buttonAction = button;
}