List of usage examples for android.app Dialog Dialog
public Dialog(@NonNull Context context, @StyleRes int themeResId)
From source file:droidack.ADialogFragment.java
@NonNull @Override// www . j av a 2s .c o m public Dialog onCreateDialog(Bundle inBundle) { Activity activity = getActivity(); if (mContentLayoutId == 0) { // Not using the AlertDialog setStyle(STYLE_NO_FRAME, 0); mDialog = new Dialog(activity, android.R.style.Theme_Holo_Dialog_NoActionBar); return mDialog; } LayoutInflater inflater = activity.getLayoutInflater(); View mContentView = inflater.inflate(mContentLayoutId, null); AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setView(mContentView); if (mTitleTextId != 0) builder.setTitle(mTitleTextId); if (mNegativeTextId != 0) builder.setNegativeButton(mNegativeTextId, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { mDialog.cancel(); } }); if (mNeutralTextId != 0) builder.setNeutralButton(mNeutralTextId, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { getDialogRootModule().onNeutralClick(); } }); if (mPositiveTextId == 0) logAndThrowError("No positiveTextId provided!"); builder.setPositiveButton(mPositiveTextId, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { getDialogRootModule().onPositiveClick(); } }); mDialog = builder.create(); return mDialog; }
From source file:com.greenorange.gooutdoor.framework.widget.dialogs.core.BaseDialogFragment.java
@NonNull @Override//from w w w. j a va 2 s . c o m 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:com.daxstudio.sa.base.android.BaseDialogFragment.java
@NonNull @Override/*from w ww.j a va 2 s.co m*/ public Dialog onCreateDialog(final Bundle savedInstanceState) { return new Dialog(getActivity(), getTheme()) { @Override public void onBackPressed() { if (isCanceledOnBackPressed()) { super.onBackPressed(); } } }; }
From source file:com.mllrsohn.videodialog.VideoDialogPlugin.java
private void playVideo(JSONObject params, final CallbackContext callbackContext) throws JSONException { loopVideo = params.optBoolean("loop", true); path = params.optString("url"); uri = Uri.parse(path);//from w w w.j a v a 2s.c o m if (path.contains(ASSETS)) { try { String filepath = path.replace(ASSETS, ""); String filename = filepath.substring(filepath.lastIndexOf("/") + 1, filepath.length()); File fp = new File(this.cordova.getActivity().getFilesDir() + "/" + filename); if (!fp.exists()) { this.copy(filepath, filename); } uri = Uri.parse("file://" + this.cordova.getActivity().getFilesDir() + "/" + filename); } catch (IOException e) { callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.IO_EXCEPTION)); } } // Create dialog in new thread cordova.getActivity().runOnUiThread(new Runnable() { public void run() { // Set Basic Dialog dialog = new Dialog((Context) cordova.getActivity(), android.R.style.Theme_NoTitleBar_Fullscreen); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setCancelable(true); // Layout View RelativeLayout main = new RelativeLayout((Context) cordova.getActivity()); main.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); // Video View mVideoView = new VideoView((Context) cordova.getActivity()); RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); lp.addRule(RelativeLayout.CENTER_IN_PARENT); mVideoView.setLayoutParams(lp); mVideoView.setVideoPath(uri.toString()); mVideoView.start(); main.addView(mVideoView); dialog.setContentView(main); dialog.getWindow().setFlags(LayoutParams.FLAG_FULLSCREEN, LayoutParams.FLAG_FULLSCREEN); dialog.show(); // Close on touch mVideoView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.ERROR, "stopped")); dialog.dismiss(); return true; } }); // Set Looping mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { @Override public void onPrepared(MediaPlayer mp) { mp.setLooping(loopVideo); } }); // On Completion mVideoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { @Override public void onCompletion(MediaPlayer mediaplayer) { callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, "Done")); dialog.dismiss(); } }); } }); }
From source file:com.facebook.share.internal.DeviceShareDialogFragment.java
@NonNull @Override// w w w. ja v a2 s . co m public Dialog onCreateDialog(Bundle savedInstanceState) { dialog = new Dialog(getActivity(), R.style.com_facebook_auth_dialog); LayoutInflater inflater = getActivity().getLayoutInflater(); View view = inflater.inflate(R.layout.com_facebook_device_auth_dialog_fragment, null); progressBar = (ProgressBar) view.findViewById(R.id.progress_bar); confirmationCode = (TextView) view.findViewById(R.id.confirmation_code); Button cancelButton = (Button) view.findViewById(R.id.cancel_button); cancelButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); TextView instructions = (TextView) view.findViewById(R.id.com_facebook_device_auth_instructions); instructions.setText(Html.fromHtml(getString(R.string.com_facebook_device_auth_instructions))); dialog.setContentView(view); this.startShare(); return dialog; }
From source file:com.tutor.activity.SlidingActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { if (isShowLeft) { this.isShowLeft = mSlidingMenu.showLeftView(); return false; }//ww w. j av a 2 s . c o m final Dialog dialog = new Dialog(this, R.style.Theme_dialog); dialog.setCanceledOnTouchOutside(true); View view = LayoutInflater.from(this).inflate(R.layout.dialog_yesno_layout, null); dialog.setContentView(view); TextView tvMessage = (TextView) dialog.findViewById(R.id.tvMessage); tvMessage.setText(""); Button confirmButton = (Button) dialog.findViewById(R.id.btnConfirm); confirmButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { finish(); android.os.Process.killProcess(android.os.Process.myPid()); } }); Button cancelButton = (Button) dialog.findViewById(R.id.btnCancel); cancelButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); } return false; }
From source file:com.facebook.login.DeviceAuthDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { dialog = new Dialog(getActivity(), R.style.com_facebook_auth_dialog); LayoutInflater inflater = getActivity().getLayoutInflater(); View view = inflater.inflate(R.layout.com_facebook_device_auth_dialog_fragment, null); progressBar = (ProgressBar) view.findViewById(R.id.progress_bar); confirmationCode = (TextView) view.findViewById(R.id.confirmation_code); Button cancelButton = (Button) view.findViewById(R.id.cancel_button); cancelButton.setOnClickListener(new View.OnClickListener() { @Override//from w w w . j a v a2 s . c o m public void onClick(View v) { onCancel(); } }); TextView instructions = (TextView) view.findViewById(R.id.com_facebook_device_auth_instructions); instructions.setText(Html.fromHtml(getString(R.string.com_facebook_device_auth_instructions))); dialog.setContentView(view); return dialog; }
From source file:com.qubittech.feelknit.app.MainActivity.java
@Override protected void onNavItemSelected(int id) { switch (id) { case 101:// www. j a v a 2s . c o m ShowProfileFragment(ApplicationHelper.getAvatar(getApplicationContext())); break; case 102: ShowCurrentFeelingsFragment(); break; case 103: StartUserFeelingsFragment(); break; case 104: showCommentsFeelingsFragment(); break; case 105: ShowRelatedFeelingFragment(); break; case 106: final Dialog d = new Dialog(this, R.style.CustomDialogTheme); d.setContentView(R.layout.custom_dialog); d.show(); TextView version = (TextView) d.findViewById(R.id.versionTextView); TextView saripaar = (TextView) d.findViewById(R.id.saripaar); TextView licenseLink = (TextView) d.findViewById(R.id.licenseLink); final TextView license = (TextView) d.findViewById(R.id.license); saripaar.setText(Html.fromHtml("<u>android-saripaar</u>")); licenseLink.setText(Html.fromHtml("(<u>license</u>)")); saripaar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Uri uriUrl = Uri.parse("https://github.com/ragunathjawahar/android-saripaar"); Intent launchBrowser = new Intent(Intent.ACTION_VIEW, uriUrl); startActivity(launchBrowser); } }); license.setText("Copyright 2012 - 2015 Mobs and Geeks\n\n" + "Licensed under the Apache License, Version 2.0 (the \"License\");\n" + "you may not use this file except in compliance with the License.\n" + "You may obtain a copy of the License at\n" + "\n" + " http://www.apache.org/licenses/LICENSE-2.0\n" + "\n" + "Unless required by applicable law or agreed to in writing, software\n" + "distributed under the License is distributed on an \"AS IS\" BASIS,\n" + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" + "See the License for the specific language governing permissions and\n" + "limitations under the License."); licenseLink.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { license.setVisibility(license.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE); } }); try { version.setText(getApplicationContext().getPackageManager() .getPackageInfo(getApplicationContext().getPackageName(), 0).versionName); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } TextView close_btn = (TextView) d.findViewById(R.id.okButton); close_btn.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { d.dismiss(); } }); } }
From source file:com.haibison.android.anhuu.utils.ui.history.HistoryFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { if (BuildConfig.DEBUG) Log.d(CLASSNAME, "onCreateDialog()"); Dialog dialog = new Dialog(getActivity(), UI.resolveAttribute(getActivity(), R.attr.anhuu_f5be488d_theme_dialog)) { @Override//from w ww. j a v a2 s. co m public boolean onCreateOptionsMenu(Menu menu) { getActivity().getMenuInflater().inflate(R.menu.anhuu_f5be488d_viewgroup_history, menu); return super.onCreateOptionsMenu(menu); }// onCreateOptionsMenu() @Override public boolean onPrepareOptionsMenu(Menu menu) { menu.findItem(R.id.anhuu_f5be488d_menuitem_clear) .setEnabled(mHistoryCursorAdapter != null && mHistoryCursorAdapter.getGroupCount() > 0); return true; }// onPrepareOptionsMenu() @Override public boolean onMenuItemSelected(int featureId, MenuItem item) { if (BuildConfig.DEBUG) Log.d(CLASSNAME, "onMenuItemSelected() in Dialog"); UI.showSoftKeyboard(mSearchView, false); if (item.getItemId() == R.id.anhuu_f5be488d_menuitem_clear) doConfirmClearHistory(); return true; }// onMenuItemSelected() }; dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setCanceledOnTouchOutside(true); dialog.setContentView(initContentView(dialog.getLayoutInflater(), null)); dialog.setOnKeyListener(mDialogOnKeyListener); UI.adjustDialogSizeForLargeScreens(dialog); return dialog; }
From source file:com.bitants.wally.fragments.MaterialDialogFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { if (getActivity() != null) { final Dialog dialog = new Dialog(getActivity(), android.support.v7.appcompat.R.style.Base_Theme_AppCompat_Light_Dialog); // android.R.style.Theme_DeviceDefault_Light_Dialog); dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE); dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); dialog.setContentView(R.layout.dialog_base_material); textViewTitle = (TextView) dialog.findViewById(R.id.dialog_title); buttonNegative = (Button) dialog.findViewById(R.id.dialog_button_negative); buttonPositive = (Button) dialog.findViewById(R.id.dialog_button_positive); scrollView = (ScrollView) dialog.findViewById(R.id.dialog_scrollview); viewStub = (ViewStub) dialog.findViewById(R.id.dialog_viewstub); setupViews(dialog.getContext()); hideEmptyViews();/*from w ww . ja v a 2 s .co m*/ if (!isCancelable()) { buttonNegative.setVisibility(View.GONE); } return dialog; } else { return null; } }