當前位置: 首頁>>代碼示例>>Java>>正文


Java MaterialDialog.onRestoreInstanceState方法代碼示例

本文整理匯總了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();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:41,代碼來源:MaterialDialogPreference.java

示例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();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:50,代碼來源:MaterialEditTextPreference.java


注:本文中的com.afollestad.materialdialogs.MaterialDialog.onRestoreInstanceState方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。