当前位置: 首页>>代码示例>>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;未经允许,请勿转载。