本文整理了Java中android.app.Dialog.setOnShowListener()
方法的一些代码示例,展示了Dialog.setOnShowListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Dialog.setOnShowListener()
方法的具体详情如下:
包路径:android.app.Dialog
类名称:Dialog
方法名:setOnShowListener
暂无
代码示例来源:origin: Hitomis/transferee
private void createDialog() {
transDialog = new AlertDialog.Builder(context, getDialogStyle())
.setView(transLayout)
.create();
transDialog.setOnShowListener(this);
transDialog.setOnKeyListener(this);
}
代码示例来源:origin: sjwall/MaterialTapTargetPrompt
@Override
public Dialog onCreateDialog(@NonNull final Bundle savedInstanceState) {
final Dialog dialog = super.onCreateDialog(savedInstanceState);
View contentView = View.inflate(getContext(), R.layout.fragment_bottom_sheet, null);
dialog.setContentView(contentView);
dialog.setOnShowListener(new DialogInterface.OnShowListener()
{
@Override
public void onShow(DialogInterface dialog)
{
new MaterialTapTargetPrompt.Builder(new DialogResourceFinder(getDialog()), 0)
.setPrimaryText(R.string.search_prompt_title)
.setSecondaryText(R.string.search_prompt_description)
.setAnimationInterpolator(new FastOutSlowInInterpolator())
.setMaxTextWidth(R.dimen.tap_target_menu_max_width)
.setIcon(R.drawable.ic_search)
.setTarget(R.id.bs_search)
.show();
}
});
return dialog;
}
}
代码示例来源:origin: sjwall/MaterialTapTargetPrompt
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_dialog, container);
getDialog().setTitle("DialogFragment");
getDialog().setOnShowListener(new DialogInterface.OnShowListener()
{
@Override
public void onShow(DialogInterface dialog)
{
showFragmentFabPrompt();
}
});
rootView.findViewById(R.id.button_fab_prompt)
.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View view)
{
showFragmentFabPrompt();
}
});
return rootView;
}
代码示例来源:origin: sjwall/MaterialTapTargetPrompt
getDialog().setOnShowListener(new DialogInterface.OnShowListener()
代码示例来源:origin: jclehner/rxdroid
@Override
protected void onPrepareDialog(Dialog dialog)
{
dialog.setOnShowListener(new OnShowListener() {
@Override
public void onShow(DialogInterface dialog) {
mBtnPositive = ((AlertDialog) dialog).getButton(Dialog.BUTTON_POSITIVE);
}
});
}
代码示例来源:origin: behindeye/WxPhoneNumberHelper
public void setOnShowListener(OnShowListener listener) {
super.setOnShowListener(listener);
}
代码示例来源:origin: jclehner/rxdroid
@Override
protected void onPrepareDialog(Dialog dialog) {
dialog.setOnShowListener(mOnShowListener);
}
代码示例来源:origin: gumingwei/WellSwipe
public SwipeDialog setOnShowListener(DialogInterface.OnShowListener listener) {
mDialog.setOnShowListener(listener);
return this;
}
代码示例来源:origin: duanhong169/Camera
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Dialog dialog = super.onCreateDialog(savedInstanceState);
Window window = dialog.getWindow();
if (window != null) {
window.setFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
View decorView = window.getDecorView();
decorView.setSystemUiVisibility(getActivity().getWindow().getDecorView().getSystemUiVisibility());
dialog.setOnShowListener(dialog1 -> window.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE));
}
return dialog;
}
}
代码示例来源:origin: Kunzisoft/AndroidClearChroma
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Dialog dialog = super.onCreateDialog(savedInstanceState);
// request a window without the title
assert dialog.getWindow() != null;
dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
dialog.setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface dialog) {
measureLayout((Dialog) dialog);
}
});
return dialog;
}
代码示例来源:origin: mylhyl/Android-CircleDialog
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
Dialog dialog = getDialog();
if (dialog != null) {
dialog.setOnShowListener(this);
}
}
代码示例来源:origin: milosmns/silly-android
private void showDialogInternal(final int dialogId, @NonNull final Dialog instance) {
instance.setOnShowListener(dialog -> {
if (mListener != null) {
mListener.onDialogShown(dialogId);
}
});
instance.setOnDismissListener(dialog -> {
if (mListener != null) {
mListener.onDialogDismissed(dialogId);
mDialogConfigs.remove(dialogId);
mDialogInstances.remove(dialogId);
}
});
instance.show();
}
代码示例来源:origin: jruesga/rview
@Override
@SuppressLint("RestrictedApi")
public void setupDialog(Dialog dialog, int style) {
super.setupDialog(dialog, style);
dialog.setOnShowListener(dialog1 -> {
Button button = ((AlertDialog) dialog1).getButton(AlertDialog.BUTTON_POSITIVE);
button.setOnClickListener(v -> performAccountStateChanged());
});
}
代码示例来源:origin: wufenglincheng/ImageTrans
public void show() {
build.checkParam();
mDialog = new AlertDialog.Builder(mContext, getDialogStyle())
.setView(createView())
.create();
build.dialog = mDialog;
mDialog.setOnShowListener(this);
mDialog.setOnKeyListener(this);
mDialog.show();
}
代码示例来源:origin: ashishbhandari/AndroidTabbedDialog
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Dialog dialog = new Dialog(getActivity());
Bundle args = getArguments();
if (args != null) {
dialog.setCanceledOnTouchOutside(
args.getBoolean(BaseDialogBuilder.ARG_CANCELABLE_ON_TOUCH_OUTSIDE));
}
/*
* disable the actual title of a dialog cause custom dialog title is rendering through custom layout
*/
dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
dialog.setOnShowListener(this);
return dialog;
}
代码示例来源:origin: michael-rapp/AndroidBottomSheet
/**
* Initializes the bottom sheet.
*/
private void initialize() {
width = getContext().getResources().getDimensionPixelSize(R.dimen.default_width);
maximize = false;
adapter = new DividableGridAdapter(getContext(), Style.LIST, width);
super.setOnShowListener(createOnShowListener());
}
代码示例来源:origin: jruesga/rview
@NonNull
@Override
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public final Dialog onCreateDialog(Bundle savedInstanceState) {
//noinspection ConstantConditions
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
buildDialog(builder, savedInstanceState);
Dialog dialog = builder.create();
if (AndroidHelper.isLollipopOrGreater()) {
dialog.setOnShowListener(dialogInterface -> performEnterRevealTransition());
}
return dialog;
}
代码示例来源:origin: gigabytedevelopers/FireFiles
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
if(!getShowsDialog()){
return;
}
getDialog().setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface dialog) {
try{
tintButtons(getDialog());
} catch (Exception e){
CrashReportingManager.logException(e);
}
}
});
}
代码示例来源:origin: milosmns/silly-android
@Test
public void showDialog_happy_withBundle() {
// setup the callback
final DialogManagerCallback callback = createCallbackMock();
final Dialog dialogMock = createDialogMock();
final Bundle dialogConfig = new Bundle();
when(callback.onCreateDialog(eq(KNOWN_DIALOG), eq(dialogConfig))).thenReturn(dialogMock);
mDialogManager.setCallback(callback);
mDialogManager.showDialog(KNOWN_DIALOG, dialogConfig);
// verify callback was invoked
verify(dialogMock).setOnShowListener(isNotNull());
verify(dialogMock).setOnDismissListener(isNotNull());
// finally verify dialog was shown
assertTrue(mDialogManager.isDialogShowing(KNOWN_DIALOG));
}
// </editor-fold>
代码示例来源:origin: milosmns/silly-android
@Test
public void showDialog_happy_noBundle() {
// setup the callback
final DialogManagerCallback callback = createCallbackMock();
final Dialog dialogMock = createDialogMock();
when(callback.onCreateDialog(eq(KNOWN_DIALOG), isNull())).thenReturn(dialogMock);
mDialogManager.setCallback(callback);
mDialogManager.showDialog(KNOWN_DIALOG);
// verify callback was invoked
verify(dialogMock).setOnShowListener(isNotNull());
verify(dialogMock).setOnDismissListener(isNotNull());
// finally verify dialog was shown
assertTrue(mDialogManager.isDialogShowing(KNOWN_DIALOG));
}
内容来源于网络,如有侵权,请联系作者删除!