List of usage examples for android.app Dialog setOnShowListener
public void setOnShowListener(@Nullable OnShowListener listener)
From source file:com.jaspersoft.android.jaspermobile.dialog.ReportOptionsFragmentDialog.java
@NonNull @Override/*w ww.ja v a 2 s.c o m*/ public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); final View reportOptionLayout = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_report_options, null); loadingBar = (ProgressBar) reportOptionLayout.findViewById(R.id.reportOptionsProgress); reportOptionsList = (ListView) reportOptionLayout.findViewById(R.id.reportOptionsList); builder.setTitle(R.string.ro_show); builder.setView(reportOptionLayout); Dialog dialog = builder.create(); dialog.setCanceledOnTouchOutside(canceledOnTouchOutside); dialog.setOnShowListener(this); return dialog; }
From source file:at.wada811.android.dialogfragments.AbstractDialogFragment.java
protected void setOnShowListener(Dialog dialog) { useOnShowListener = true;//from w w w . ja v a 2s . c o m dialog.setOnShowListener(new OnShowListener() { @Override public void onShow(DialogInterface dialog) { bindShowListener(); } }); }
From source file:jp.co.noxi.app.NXDialog.java
void setOnShowListenerInternal(final OnShowListener listener) { final Dialog dialog = getDialog(); if ((listener == null) || (dialog == null)) { return;//from w w w . ja v a 2 s . c om } dialog.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialog) { listener.onShow(NXDialog.this); } }); }
From source file:com.owncloud.android.ui.dialog.SetupEncryptionDialogFragment.java
@NonNull private Dialog createDialog(int accentColor, View v) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setView(v).setPositiveButton(R.string.common_ok, null) .setNegativeButton(R.string.common_cancel, null) .setTitle(ThemeUtils.getColoredTitle(getString(R.string.end_to_end_encryption_title), accentColor)); Dialog dialog = builder.create(); dialog.setCanceledOnTouchOutside(false); dialog.setOnShowListener(new DialogInterface.OnShowListener() { @Override//from www .j ava 2s . c om public void onShow(final DialogInterface dialog) { Button button = ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_POSITIVE); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { switch (keyResult) { case KEY_CREATED: Log_OC.d(TAG, "New keys generated and stored."); dialog.dismiss(); Intent intentCreated = new Intent(); intentCreated.putExtra(SUCCESS, true); intentCreated.putExtra(ARG_POSITION, getArguments().getInt(ARG_POSITION)); getTargetFragment().onActivityResult(getTargetRequestCode(), SETUP_ENCRYPTION_RESULT_CODE, intentCreated); break; case KEY_EXISTING_USED: Log_OC.d(TAG, "Decrypt private key"); textView.setText(R.string.end_to_end_encryption_decrypting); try { String privateKey = task.get(); String mnemonic = passwordField.getText().toString().replaceAll("\\s", "") .toLowerCase(Locale.ROOT); String decryptedPrivateKey = EncryptionUtils.decryptPrivateKey(privateKey, mnemonic); arbitraryDataProvider.storeOrUpdateKeyValue(account.name, EncryptionUtils.PRIVATE_KEY, decryptedPrivateKey); dialog.dismiss(); Log_OC.d(TAG, "Private key successfully decrypted and stored"); arbitraryDataProvider.storeOrUpdateKeyValue(account.name, EncryptionUtils.MNEMONIC, mnemonic); Intent intentExisting = new Intent(); intentExisting.putExtra(SUCCESS, true); intentExisting.putExtra(ARG_POSITION, getArguments().getInt(ARG_POSITION)); getTargetFragment().onActivityResult(getTargetRequestCode(), SETUP_ENCRYPTION_RESULT_CODE, intentExisting); } catch (Exception e) { textView.setText(R.string.end_to_end_encryption_wrong_password); Log_OC.d(TAG, "Error while decrypting private key: " + e.getMessage()); } break; case KEY_GENERATE: passphraseTextView.setVisibility(View.GONE); positiveButton.setVisibility(View.GONE); negativeButton.setVisibility(View.GONE); getDialog().setTitle(ThemeUtils.getColoredTitle( getString(R.string.end_to_end_encryption_storing_keys), ThemeUtils.primaryColor(getContext()))); GenerateNewKeysAsyncTask newKeysTask = new GenerateNewKeysAsyncTask(); newKeysTask.execute(); break; default: dialog.dismiss(); break; } } }); } }); return dialog; }
From source file:net.alchemiestick.katana.winehqappdb.SearchView.java
@Override protected Dialog onCreateDialog(int id) { Dialog diag; switch (id) { case ABOUT_DLG: diag = about_dialog();//from w w w. j av a2 s . c o m break; case FILTERS_DLG: // TODO: create the real filters dialog and have it modify webData accordingly. diag = new filter_dialog(this, this.webData); break; case WINAPP_DLG: diag = new app_dialog(this); diag.setOnDismissListener(appDismiss); diag.setOnShowListener(appShow); break; default: diag = null; } return diag; }
From source file:cn.reflect.dialogs.core.BaseDialogFragment.java
@NonNull @Override/*from w w w .ja v a 2 s .c o m*/ public Dialog onCreateDialog(Bundle savedInstanceState) { int theme = R.style.SDL_Dialog; Dialog dialog = new Dialog(getActivity(), theme); Bundle args = getArguments(); if (args != null) { dialog.setCanceledOnTouchOutside(args.getBoolean(BaseDialogBuilder.ARG_CANCELABLE_ON_TOUCH_OUTSIDE)); } dialog.setOnShowListener(this); return dialog; }
From source file:arefin.dialogs.core.BaseDialogFragment.java
@NonNull @Override/* www .ja va 2 s . co m*/ public Dialog onCreateDialog(Bundle savedInstanceState) { int theme = resolveTheme(); Dialog dialog = new Dialog(getActivity(), theme); Bundle args = getArguments(); if (args != null) { dialog.setCanceledOnTouchOutside(args.getBoolean(BaseDialogBuilder.ARG_CANCELABLE_ON_TOUCH_OUTSIDE)); } dialog.setOnShowListener(this); return dialog; }
From source file:com.avast.android.dialogs.core.BaseDialogFragment.java
@NonNull @Override/* w ww.ja va 2 s . co m*/ public Dialog onCreateDialog(Bundle savedInstanceState) { int theme = resolveTheme(); Dialog dialog = new Dialog(getActivity(), theme); Bundle args = getArguments(); if (args != null) { dialog.setCanceledOnTouchOutside(args.getBoolean(BaseDialogBuilder.ARG_CANCELABLE_ON_TOUCH_OUTSIDE)); } dialog.setOnShowListener(this); return dialog; }
From source file:com.greenorange.gooutdoor.framework.widget.dialogs.core.BaseDialogFragment.java
@NonNull @Override/*from ww w .ja v a2 s . c om*/ public Dialog onCreateDialog(Bundle savedInstanceState) { Bundle args = getArguments(); if (args != null) { if (args.getBoolean(BaseDialogBuilder.ARG_USE_DARK_THEME)) { //Developer is explicitly using the dark theme darkTheme = true; } else if (args.getBoolean(BaseDialogBuilder.ARG_USE_LIGHT_THEME)) { //Developer is explicitly using the light theme darkTheme = false; } else { //Dynamically detecting the theme declared in manifest resolveTheme(); } } else { //Dynamically detecting the theme declared in manifest resolveTheme(); } Dialog dialog = new Dialog(getActivity(), darkTheme ? R.style.SDL_Dialog_Dark : R.style.SDL_Dialog); if (args != null) { dialog.setCanceledOnTouchOutside(args.getBoolean(BaseDialogBuilder.ARG_CANCELABLE_ON_TOUCH_OUTSIDE)); } dialog.setOnShowListener(this); return dialog; }
From source file:org.catrobat.catroid.ui.dialogs.MultiLineTextDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { View dialogView = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_text_multiline_dialog, null); input = (EditText) dialogView.findViewById(R.id.dialog_text_EditMultiLineText); if (getHint() != null) { input.setHint(getHint());/*from w ww .j av a2s . c o m*/ } input.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View view, boolean hasFocus) { if (hasFocus) { getDialog().getWindow() .setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE); } } }); initialize(); Dialog dialog = new AlertDialog.Builder(getActivity()).setView(dialogView).setTitle(getTitle()) .setNegativeButton(R.string.cancel_button, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dismiss(); } }).setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }).create(); dialog.setCanceledOnTouchOutside(true); dialog.setOnShowListener(new OnShowListener() { @Override public void onShow(DialogInterface dialog) { if (getDialog() == null) { dismiss(); } else { Button buttonPositive = ((AlertDialog) getDialog()).getButton(DialogInterface.BUTTON_POSITIVE); buttonPositive.setEnabled(getPositiveButtonEnabled()); setPositiveButtonClickCustomListener(); InputMethodManager inputManager = (InputMethodManager) getActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.showSoftInput(input, InputMethodManager.SHOW_IMPLICIT); initTextChangedListener(); } } }); return dialog; }