List of usage examples for android.app Dialog setContentView
public void setContentView(@NonNull View view)
From source file:com.bushstar.kobocoin_android_wallet.util.BitmapFragment.java
@Override public Dialog onCreateDialog(final Bundle savedInstanceState) { final Bitmap bitmap = getArguments().getParcelable(KEY_BITMAP); final Dialog dialog = new Dialog(activity); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.bitmap_dialog); dialog.setCanceledOnTouchOutside(true); final ImageView imageView = (ImageView) dialog.findViewById(R.id.bitmap_dialog_image); imageView.setImageBitmap(bitmap);//from w w w. ja v a 2 s . c om imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View v) { dismiss(); } }); return dialog; }
From source file:de.schildbach.wallet.ui.BitmapFragment.java
@Override public Dialog onCreateDialog(final Bundle savedInstanceState) { final Bundle args = getArguments(); final BitmapDrawable bitmap = new BitmapDrawable(getResources(), (Bitmap) args.getParcelable(KEY_BITMAP)); bitmap.setFilterBitmap(false);/*from w ww . j ava 2 s. com*/ final Dialog dialog = new Dialog(activity); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.bitmap_dialog); dialog.setCanceledOnTouchOutside(true); final ImageView imageView = (ImageView) dialog.findViewById(R.id.bitmap_dialog_image); imageView.setImageDrawable(bitmap); imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View v) { dismissAllowingStateLoss(); } }); return dialog; }
From source file:de.androvdr.activities.ChannelsActivity.java
@Override protected Dialog onCreateDialog(int id) { switch (id) { case DIALOG_WHATS_ON: final Dialog dialog = new Dialog(this); dialog.setContentView(R.layout.extendedchannels_whats_on); dialog.setTitle(R.string.channels_whats_on); final SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); final DatePicker dp = (DatePicker) dialog.findViewById(R.id.channels_datePicker); final TimePicker tp = (TimePicker) dialog.findViewById(R.id.channels_timePicker); tp.setIs24HourView(DateFormat.is24HourFormat(getApplicationContext())); if (sp.contains("whats_on_hour")) { tp.setCurrentHour(sp.getInt("whats_on_hour", 0)); tp.setCurrentMinute(sp.getInt("whats_on_minute", 0)); }/*ww w . j ava 2 s . co m*/ Button button = (Button) dialog.findViewById(R.id.channels_cancel); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); button = (Button) dialog.findViewById(R.id.channels_search); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Editor editor = sp.edit(); editor.putInt("whats_on_hour", tp.getCurrentHour()); editor.putInt("whats_on_minute", tp.getCurrentMinute()); editor.commit(); SimpleDateFormat df = new SimpleDateFormat("dd.MM.yyyy hh:mm"); try { long time = df.parse(dp.getDayOfMonth() + "." + (dp.getMonth() + 1) + "." + dp.getYear() + " " + tp.getCurrentHour() + ":" + tp.getCurrentMinute()).getTime() / 1000; getController().whatsOn(time); } catch (ParseException e) { logger.error("Couldn't get date from pickers", e); } dialog.dismiss(); } }); return dialog; default: return super.onCreateDialog(id); } }
From source file:de.schildbach.litecoinwallet.ui.HelpDialogFragment.java
@Override public Dialog onCreateDialog(final Bundle savedInstanceState) { final Bundle args = getArguments(); final String page = args.getString(KEY_PAGE); final WebView webView = new WebView(activity); webView.loadUrl("file:///android_asset/" + page + languagePrefix() + ".html"); final Dialog dialog = new Dialog(activity); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(webView); dialog.setCanceledOnTouchOutside(true); return dialog; }
From source file:net.evendanan.android.thumbremote.ui.FragmentAlertDialogSupport.java
private Dialog createMediaTimeSeekDialog() { final Dialog seeker = new Dialog(getActivity(), R.style.Popup); seeker.setContentView(R.layout.custom_time_selection); seeker.findViewById(R.id.seeker_close_button).setOnClickListener(new OnClickListener() { @Override//w w w . ja v a 2 s . co m public void onClick(View v) { seeker.dismiss(); } }); seeker.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { ((RemoteUiActivity) getActivity()).mMediaSeekBar = null; } }); SeekBar seekBar = (SeekBar) seeker.findViewById(R.id.time_seek_bar); seekBar.setOnSeekBarChangeListener((RemoteUiActivity) getActivity()); return seeker; }
From source file:com.sawyer.advadapters.app.dialogs.AddJSONArrayDialogFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { Dialog dialog = super.onCreateDialog(savedInstanceState); dialog.setContentView(R.layout.dialog_add_jsonarray); dialog.setTitle(R.string.title_dialog_add_movies); Button btn = (Button) dialog.findViewById(R.id.movie_single_btn); btn.setOnClickListener(new OnAddSingleClickListener()); TextView tv = (TextView) dialog.findViewById(R.id.movie_single_txt); tv.setText("- " + mMovieItems.optJSONObject(0).optString(MovieItem.JSON_TITLE)); btn = (Button) dialog.findViewById(R.id.movies_jsonarray_btn); btn.setOnClickListener(new OnAddJSONArrayClickListener()); tv = (TextView) dialog.findViewById(R.id.movie_multi_txt1); tv.setText("- " + mMovieItems.optJSONObject(1).optString(MovieItem.JSON_TITLE)); tv = (TextView) dialog.findViewById(R.id.movie_multi_txt2); tv.setText("- " + mMovieItems.optJSONObject(2).optString(MovieItem.JSON_TITLE)); btn = (Button) dialog.findViewById(R.id.movies_vararg_btn); btn.setOnClickListener(new OnAddVarargsClickListener()); btn.setVisibility(mIsArgvargsEnabled ? View.VISIBLE : View.GONE); return dialog; }
From source file:it.flaviomascetti.posture.MainActivity.java
@SuppressWarnings("StatementWithEmptyBody") @Override//from w w w .j ava 2 s. c o m public boolean onNavigationItemSelected(MenuItem item) { // Handle navigation view item clicks here. int id = item.getItemId(); if (id == R.id.nav_license) { Dialog d = new Dialog(this); d.setTitle(R.string.license); d.setCancelable(true); d.setContentView(R.layout.app_license_popup); d.show(); } else if (id == R.id.nav_acc_test) { getSupportFragmentManager().beginTransaction().replace(R.id.container, new AccuracyTestFragment()) .commit(); } else if (id == R.id.nav_posture_check) { getSupportFragmentManager().beginTransaction().replace(R.id.container, new PostureCheckFragment()) .commit(); } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; }
From source file:com.idt.ontomedia.geoconsum.BaseActivity.java
private Dialog setDialogWithCheck(int _id) { final Dialog dialog = new Dialog(this); dialog.setContentView(R.layout.dialog_with_check); TextView textViewInfo = (TextView) dialog.findViewById(R.id.text_layout); CheckBox checkBox = (CheckBox) dialog.findViewById(R.id.checkBox1); switch (_id) { case DIALOG_ABOUT_ID: { dialog.setTitle(getResources().getString(R.string.dialog_title_about) + " " + getResources().getString(R.string.app_name)); dialog.setCancelable(true);//from w ww.ja v a 2 s. co m checkBox.setVisibility(View.GONE); ImageView imageViewBanner = (ImageView) dialog.findViewById(R.id.imageViewBanner); imageViewBanner.setImageDrawable(getResources().getDrawable(R.drawable.logo_idt)); imageViewBanner.setVisibility(View.VISIBLE); textViewInfo.setText(R.string.dialog_text_about); } case DIALOG_WARNING_ID: { dialog.setTitle(getResources().getString(R.string.dialog_title_warning)); dialog.setCancelable(false); textViewInfo.setText(R.string.dialog_text_warning); checkBox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton _buttonView, boolean _isChecked) { SharedPreferences sharedPreferences = PreferenceManager .getDefaultSharedPreferences(getBaseContext()); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putBoolean(DialogPreferenceActivity.PREF_DIALOG_CHECK, _isChecked); editor.commit(); } }); } } Button acceptButton = (Button) dialog.findViewById(R.id.button1); acceptButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.cancel(); } }); return dialog; }
From source file:com.itime.team.itime.fragments.QRCodeFragment.java
@NonNull @Override/* ww w . ja v a 2s. co m*/ public Dialog onCreateDialog(Bundle savedInstanceState) { final Dialog dialog = super.onCreateDialog(savedInstanceState); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.fragment_profile_qrcode); ImageView imageView = (ImageView) dialog.findViewById(R.id.setting_profile_qrcode_img); final Bundle arguments = getArguments(); if (!arguments.isEmpty()) { mUserId = arguments.getString(QRCODE_STRING); } Bitmap qrCodeBitmap; // method1: change a fix dip to pixel //final int dim = DensityUtil.dip2px(getContext(), 600); // method2: get the display size and scale into 7/8 // This assumes the view is full screen, which is a good assumption WindowManager manager = (WindowManager) getActivity().getSystemService(Context.WINDOW_SERVICE); Display display = manager.getDefaultDisplay(); Point displaySize = new Point(); display.getSize(displaySize); int width = displaySize.x; int height = displaySize.y; int smallerDimension = width < height ? width : height; final int dim = smallerDimension * 7 / 8; try { qrCodeBitmap = barcodeEncoder.encodeBitmap(mUserId, BarcodeFormat.QR_CODE, dim, dim); imageView.setImageBitmap(qrCodeBitmap); } catch (WriterException e) { Toast.makeText(getActivity(), "QRCode text can not be empty", Toast.LENGTH_SHORT).show(); } return dialog; }
From source file:com.example.energospolitis.ReportListActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case 1:/*from w w w .j av a 2 s . c o m*/ final Dialog dialog = new Dialog(ReportListActivity.this); dialog.setContentView(R.layout.customdialog); dialog.setTitle(""); Button recent = (Button) dialog.findViewById(R.id.recbtn); recent.setText(""); Button type = (Button) dialog.findViewById(R.id.typebtn); type.setText(""); Button rate = (Button) dialog.findViewById(R.id.ratebtn); rate.setText(""); recent.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ReportList.sort("recent"); restart(); dialog.dismiss(); } }); rate.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ReportList.sort("rate"); restart(); dialog.dismiss(); } }); type.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ReportList.sort("type"); dialog.dismiss(); } }); dialog.show(); break; default: return super.onOptionsItemSelected(item); } return true; }