当前位置: 首页>>代码示例>>Java>>正文


Java MDButton类代码示例

本文整理汇总了Java中com.afollestad.materialdialogs.internal.MDButton的典型用法代码示例。如果您正苦于以下问题:Java MDButton类的具体用法?Java MDButton怎么用?Java MDButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MDButton类属于com.afollestad.materialdialogs.internal包,在下文中一共展示了MDButton类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getActionButton

import com.afollestad.materialdialogs.internal.MDButton; //导入依赖的package包/类
/**
 * 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;
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:MaterialDialog.java

示例2: getActionButton

import com.afollestad.materialdialogs.internal.MDButton; //导入依赖的package包/类
/**
 * 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;
    }
}
 
开发者ID:susong7519,项目名称:EasyFrame,代码行数:19,代码来源:MaterialDialog.java

示例3: onActivityResult

import com.afollestad.materialdialogs.internal.MDButton; //导入依赖的package包/类
/**
 * 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) {}
    }
}
 
开发者ID:TeamAmaze,项目名称:AmazeFileManager,代码行数:36,代码来源:SftpConnectDialog.java

示例4: getActionButton

import com.afollestad.materialdialogs.internal.MDButton; //导入依赖的package包/类
/**
 * 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;
  }
}
 
开发者ID:afollestad,项目名称:material-dialogs,代码行数:19,代码来源:MaterialDialog.java

示例5: showFoodDialog

import com.afollestad.materialdialogs.internal.MDButton; //导入依赖的package包/类
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
}
 
开发者ID:RunziiMo,项目名称:grooo,代码行数:47,代码来源:MenuActivity.java

示例6: InputWatcher

import com.afollestad.materialdialogs.internal.MDButton; //导入依赖的package包/类
public InputWatcher(EditText name, EditText email, MDButton button) {
    editName = name;
    editEmail = email;
    buttonAction = button;
}
 
开发者ID:ZhaoKaiQiang,项目名称:JianDanRxJava,代码行数:6,代码来源:InputWatcher.java


注:本文中的com.afollestad.materialdialogs.internal.MDButton类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。