List of usage examples for android.app Dialog getWindow
public @Nullable Window getWindow()
From source file:br.com.anteros.vendas.gui.ClienteConsultaDialog.java
/** * Cria uma janela para a consulta dos clientes * @param savedInstanceState/* w w w .j a v a 2 s.c o m*/ * @return */ @Override public Dialog onCreateDialog(Bundle savedInstanceState) { Dialog dialog = super.onCreateDialog(savedInstanceState); /** * Remove o ttulo da dialog. */ dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE); return dialog; }
From source file:com.lrhehe.android.common.share.ShareDialogFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { Dialog dialog = new Dialog(getActivity()); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); // may have proble to inject in a dialog fragment ViewUtils.inject(getActivity());//from ww w. j a v a 2s .c o m afterViewsInflate(dialog); return dialog; }
From source file:org.wahtod.wififixer.ui.QuickSettingsFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { Dialog dialog = super.onCreateDialog(savedInstanceState); dialog.getWindow().setWindowAnimations(R.style.DialogAnimation); return dialog; }
From source file:nz.ac.otago.psyanlab.common.designer.program.operand.RenameOperandDialogueFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { Bundle args = getArguments();/*from w w w . j a v a 2 s .c o m*/ if (args != null) { mOperandId = args.getLong(ARG_OPERAND_ID, -1); } if (mOperandId == -1) { throw new RuntimeException("Invalid operand id."); } mOperand = mCallbacks.getOperand(mOperandId); LayoutInflater inflater = getActivity().getLayoutInflater(); View view = inflater.inflate(R.layout.dialogue_rename_variable, null); mName = (EditText) view.findViewById(R.id.name); mName.setText(mOperand.getName()); // Thanks to serwus <http://stackoverflow.com/users/1598308/serwus>, // who posted at <http://stackoverflow.com/a/20325852>. Modified to // support unicode codepoints and validating first character of input. InputFilter filter = new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { boolean keepOriginal = true; StringBuilder sb = new StringBuilder(end - start); int offset = 0; String s = source.toString(); while (offset < s.length()) { final int codePoint = s.codePointAt(offset); if ((offset == 0 && isAllowedAsFirst(codePoint)) || (offset > 0 && isAllowed(codePoint))) { sb.appendCodePoint(codePoint); } else { keepOriginal = false; } offset += Character.charCount(codePoint); } if (keepOriginal) return null; else { if (source instanceof Spanned) { SpannableString sp = new SpannableString(sb); TextUtils.copySpansFrom((Spanned) source, start, sb.length(), null, sp, 0); return sp; } else { return sb; } } } private boolean isAllowed(int codePoint) { return Character.isLetterOrDigit(codePoint); } private boolean isAllowedAsFirst(int codePoint) { return Character.isLetter(codePoint); } }; mName.setFilters(new InputFilter[] { filter }); // Build dialogue. AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(getString(R.string.title_rename_variable, mOperand.getName())).setView(view) .setPositiveButton(R.string.action_rename, mPositiveListener) .setNegativeButton(R.string.action_cancel, mNegativeListener); // Create the AlertDialog object and return it Dialog dialog = builder.create(); dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); return dialog; }
From source file:com.sonymobile.androidapp.gridcomputing.activities.WizardActivity.java
/** * Show read more dialog./*from w ww.ja va2 s . co m*/ */ public final void showReadMoreDialog() { final Dialog dialog = new Dialog(this); dialog.setContentView(R.layout.dialog_wizard_info); // Fullscreen dialog.getWindow().setLayout(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); dialog.setTitle(R.string.more_info); final String[] texts = getResources().getStringArray(R.array.help_find_cure); ((TextView) dialog.findViewById(R.id.more_info_tv1)).setText(texts[0]); ((TextView) dialog.findViewById(R.id.more_info_tv2)).setText(texts[1]); ((TextView) dialog.findViewById(R.id.more_info_tv3)).setText(texts[2]); dialog.findViewById(R.id.bt_wizard_done).setOnClickListener(new OnClickListener() { @Override public void onClick(final View view) { dialog.dismiss(); } }); dialog.show(); }
From source file:de.dev.eth0.rssreader.app.ui.dialog.ImageOverlayDialog.java
@Override public void onStart() { super.onStart(); Dialog dialog = getDialog(); if (dialog != null) { int width = ViewGroup.LayoutParams.MATCH_PARENT; int height = ViewGroup.LayoutParams.MATCH_PARENT; dialog.getWindow().setLayout(width, height); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); }/*from w ww .j av a 2 s . c o m*/ }
From source file:org.projectbuendia.client.ui.dialogs.EditPatientDialogFragment.java
public void focusFirstEmptyField(Dialog dialog) { // Open the keyboard. dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); // Set focus. EditText[] fields = { mIdPrefix, mId, mGivenName, mFamilyName, mAgeYears, mAgeMonths }; for (EditText field : fields) { if (field.getText().toString().isEmpty()) { field.requestFocus();//from w w w.j a v a 2s. co m break; } } // Default to focusing on the given name field. mGivenName.requestFocus(); }
From source file:android.support.v7.preference.PreferenceDialogFragmentCompat.java
/** * Sets the required flags on the dialog window to enable input method window to show up. */// w ww . j a v a2 s .c o m private void requestInputMethod(Dialog dialog) { Window window = dialog.getWindow(); window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE); }
From source file:com.amazon.appstream.fireclient.ErrorDialogFragment.java
/** * Standard initialization. Sets up the dialog to quit the * activity on clicking its only button. *//*from w w w . j a v a 2 s.com*/ @Override public Dialog onCreateDialog(Bundle savedInstanceState) { final Dialog dialog = new Dialog(getActivity()); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setCanceledOnTouchOutside(false); dialog.setCancelable(false); dialog.getWindow().setBackgroundDrawable(ConnectDialogFragment.mEmpty); dialog.setContentView(R.layout.fatal_error); final Button signin = (Button) dialog.findViewById(R.id.signin); final TextView message = (TextView) dialog.findViewById(R.id.message); message.setText(mMessage); signin.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); ((FireClientActivity) getActivity()).openConnectDialog(null); } }); return dialog; }
From source file:com.amazon.appstream.sampleclient.ErrorDialogFragment.java
/** * Standard initialization. Sets up the dialog to quit the * activity on clicking its only button. *///from ww w. j a v a 2 s. c o m @Override public Dialog onCreateDialog(Bundle savedInstanceState) { final Dialog dialog = new Dialog(getActivity()); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setCanceledOnTouchOutside(false); dialog.setCancelable(false); dialog.getWindow().setBackgroundDrawable(ConnectDialogFragment.mEmpty); dialog.setContentView(R.layout.fatal_error); final Button signin = (Button) dialog.findViewById(R.id.signin); final TextView message = (TextView) dialog.findViewById(R.id.message); message.setText(mMessage); signin.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); ((SampleClientActivity) getActivity()).openConnectDialog(null); } }); return dialog; }