本文整理匯總了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();
}