本文整理汇总了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;
}
}
示例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;
}
}
示例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) {}
}
}
示例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;
}
}
示例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
}
示例6: InputWatcher
import com.afollestad.materialdialogs.internal.MDButton; //导入依赖的package包/类
public InputWatcher(EditText name, EditText email, MDButton button) {
editName = name;
editEmail = email;
buttonAction = button;
}