本文整理汇总了Java中com.afollestad.materialdialogs.MaterialDialog.onRestoreInstanceState方法的典型用法代码示例。如果您正苦于以下问题:Java MaterialDialog.onRestoreInstanceState方法的具体用法?Java MaterialDialog.onRestoreInstanceState怎么用?Java MaterialDialog.onRestoreInstanceState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.afollestad.materialdialogs.MaterialDialog
的用法示例。
在下文中一共展示了MaterialDialog.onRestoreInstanceState方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showDialog
import com.afollestad.materialdialogs.MaterialDialog; //导入方法依赖的package包/类
@Override protected void showDialog(Bundle state) {
MaterialDialog.Builder builder = new MaterialDialog.Builder(context)
.title(getDialogTitle())
.icon(getDialogIcon())
.dismissListener(this)
.onAny(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
switch (which) {
default:
MaterialDialogPreference.this.onClick(dialog, DialogInterface.BUTTON_POSITIVE);
break;
case NEUTRAL:
MaterialDialogPreference.this.onClick(dialog, DialogInterface.BUTTON_NEUTRAL);
break;
case NEGATIVE:
MaterialDialogPreference.this.onClick(dialog, DialogInterface.BUTTON_NEGATIVE);
break;
}
}
})
.positiveText(getPositiveButtonText())
.negativeText(getNegativeButtonText())
.autoDismiss(true); // immediately close the dialog after selection
final View contentView = onCreateDialogView();
if (contentView != null) {
onBindDialogView(contentView);
builder.customView(contentView, false);
} else {
builder.content(getDialogMessage());
}
PrefUtil.registerOnActivityDestroyListener(this, this);
dialog = builder.build();
if (state != null)
dialog.onRestoreInstanceState(state);
dialog.show();
}
示例2: showDialog
import com.afollestad.materialdialogs.MaterialDialog; //导入方法依赖的package包/类
@Override protected void showDialog(Bundle state) {
Builder mBuilder = new MaterialDialog.Builder(getContext())
.title(getDialogTitle())
.icon(getDialogIcon())
.positiveText(getPositiveButtonText())
.negativeText(getNegativeButtonText())
.dismissListener(this)
.onAny(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
switch (which) {
default:
MaterialEditTextPreference.this.onClick(dialog, DialogInterface.BUTTON_POSITIVE);
break;
case NEUTRAL:
MaterialEditTextPreference.this.onClick(dialog, DialogInterface.BUTTON_NEUTRAL);
break;
case NEGATIVE:
MaterialEditTextPreference.this.onClick(dialog, DialogInterface.BUTTON_NEGATIVE);
break;
}
}
})
.dismissListener(this);
@SuppressLint("InflateParams")
View layout = LayoutInflater.from(getContext()).inflate(R.layout.md_stub_inputpref, null);
onBindDialogView(layout);
MDTintHelper.setTint(editText, color);
TextView message = (TextView) layout.findViewById(android.R.id.message);
if (getDialogMessage() != null && getDialogMessage().toString().length() > 0) {
message.setVisibility(View.VISIBLE);
message.setText(getDialogMessage());
} else {
message.setVisibility(View.GONE);
}
mBuilder.customView(layout, false);
PrefUtil.registerOnActivityDestroyListener(this, this);
dialog = mBuilder.build();
if (state != null)
dialog.onRestoreInstanceState(state);
requestInputMethod(dialog);
dialog.show();
}