List of usage examples for android.app Dialog Dialog
public Dialog(@NonNull Context context)
From source file:com.fitme.MainActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.options, menu); MenuItem mi = menu.findItem(R.id.menu_spinner_active_program); final TextView tv = (TextView) mi.getActionView(); ActiveProgramDAO apd = new ActiveProgramDAO(MainActivity.this); activeProgram = apd.getActiveProgramName(); tv.setText(activeProgram);/* w ww. jav a 2s . c o m*/ tv.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { final Dialog dialog = new Dialog(MainActivity.this); dialog.setTitle(getText(R.string.title_select_prog_dialog)); View programView = getLayoutInflater().inflate(R.layout.programs_list, null); ExpandableListView elv = (ExpandableListView) programView.findViewById(R.id.list_programs); final ProgramListAdapter pda = new ProgramListAdapter(MainActivity.this); elv.setAdapter(pda); // Setting listener for Add Program button Button addProgram = (Button) programView.findViewById(R.id.button_add_program); addProgram.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { onAddProgramRequested(pda); } }); elv.setGroupIndicator(null); elv.setOnGroupClickListener(null); elv.setOnChildClickListener(new ExpandableListView.OnChildClickListener() { @Override public boolean onChildClick(ExpandableListView expandableListView, View view, int groupPosition, int childPosition, long l) { pda.setProgramSelected(groupPosition, childPosition); onNewProgramSelected(pda.getSelectedProgramName()); // Refresh trainings section list TrainingsSectionFragment tsf = (TrainingsSectionFragment) mAppSectionsPagerAdapter .getItem(AppSectionsPagerAdapter.SECTION_TRAININGS); tsf.onNewProgramSelected(); dialog.dismiss(); return false; } }); dialog.setContentView(programView); dialog.show(); dialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT); } }); return true; }
From source file:com.jinrustar.sky.main.MainActivity.java
private void itemClick(final int position) { if (prelongTim == 0) {//??? prelongTim = System.currentTimeMillis(); } else {//from w w w . ja v a 2s.co m long curTime = System.currentTimeMillis(); ;//? jiangeTime = curTime - prelongTim; prelongTim = curTime;//??? } if (jiangeTime > 5000 || firstClick) { firstClick = false; if (!TextUtils.isEmpty(content) && isConnect) { Log.i("ip", "ip_address:" + content); if (dialog == null) dialog = new Dialog(context); dialog.getContext().setTheme(R.style.custom); dialog.setContentView(R.layout.layout_dialog_downloadtips); dialog.getWindow().setGravity(Gravity.CENTER); dialog.getWindow().setLayout( dialog.getWindow().getWindowManager().getDefaultDisplay().getWidth() - 200, WindowUtils.getScreenWidthAndHeight()[1] / 3); dialog.findViewById(R.id.tv_downloadcancel).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.findViewById(R.id.tv_download).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // search_layout.setVisibility(View.GONE); // scan.setEnabled(true); downloadVideoInfo = new DownloadVideoInfo(); downloadVideoInfo.setId(videoInfosAll.get(position).getId()); downloadid = videoInfosAll.get(position).getId(); downloadVideoInfo.setName(videoInfosAll.get(position).getName()); if (!isAdd(downloadVideoInfo.getId())) { downloadVideoInfos.add(downloadVideoInfo); } else { dialog.dismiss(); return; } count++; // Toast.makeText(context, "??id=" +videoInfosAll.get(position).getId()+videoInfosAll.get(position).getName(), Toast.LENGTH_SHORT).show(); sendmessage(videoInfosAll.get(position).getId() + ""); dialog.dismiss(); } }); dialog.show(); // showDownLoadDialog(videoInfos.get(position).getId() + ""); } else { showDilogTips(); Toast.makeText(context, "?????", Toast.LENGTH_SHORT).show(); } } else { Toast.makeText(context, "????", Toast.LENGTH_SHORT).show(); } }
From source file:com.laquysoft.bycon.GoogleCardsActivity.java
public void postOrder(View w) { Log.i("ListActivity", "Post Order"); new OrderTask().execute(); // custom dialog final Dialog dialog = new Dialog(this); dialog.setContentView(R.layout.payment_dialog); dialog.setTitle("Place & Pay Order"); // set the custom dialog components - text, image and button ImageView image = (ImageView) dialog.findViewById(R.id.image); image.setImageResource(R.drawable.ic_launcher); Button dialogButton = (Button) dialog.findViewById(R.id.btn_accept); // if button is clicked, close the custom dialog dialogButton.setOnClickListener(new View.OnClickListener() { @Override/*from w w w . j av a 2 s .c o m*/ public void onClick(View v) { dialog.dismiss(); } }); Button dialogCancelButton = (Button) dialog.findViewById(R.id.btn_reject); // if button is clicked, close the custom dialog dialogCancelButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); }
From source file:eu.power_switch.gui.dialog.ConfigurationDialog.java
@NonNull @Override// www . j a va 2 s.co m public Dialog onCreateDialog(Bundle savedInstanceState) { Dialog dialog = new Dialog(getActivity()) { @Override public void onBackPressed() { if (modified) { // ask to really close new AlertDialog.Builder(getActivity()).setTitle(R.string.are_you_sure) .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { getDialog().cancel(); } }).setNeutralButton(android.R.string.no, null) .setMessage(R.string.all_changes_will_be_lost).show(); } else { getDialog().cancel(); } } }; dialog.setTitle(getDialogTitle()); dialog.setCanceledOnTouchOutside(isCancelableOnTouchOutside()); dialog.getWindow().setSoftInputMode(getSoftInputMode()); dialog.show(); return dialog; }
From source file:de.markusressel.android.tutorialtooltip.DialogFragmentTest.java
@NonNull @Override//from ww w . ja v a2 s .c o m public Dialog onCreateDialog(Bundle savedInstanceState) { // ask to really close final Dialog dialog = new Dialog(getActivity()) { @Override public boolean onTouchEvent(MotionEvent event) { switch (event.getAction()) { // When user touches the screen case MotionEvent.ACTION_DOWN: // Getting X coordinate float x = event.getX(); // Getting Y Coordinate float y = event.getY(); createTutorialTooltip(x, y); return true; } return super.onTouchEvent(event); } }; dialog.setTitle("Dialog Test"); dialog.setCanceledOnTouchOutside(true); dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); // WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); // lp.copyFrom(dialog.getWindow().getAttributes()); //// lp.width = WindowManager.LayoutParams.MATCH_PARENT; //// lp.height = WindowManager.LayoutParams.WRAP_CONTENT; // dialog.show(); // dialog.getWindow().setAttributes(lp); dialog.show(); return dialog; }
From source file:com.sentaroh.android.BluetoothWidget.Log.LogFileListDialogFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { if (DEBUG_ENABLE) Log.v(APPLICATION_TAG, "onCreateDialog"); mDialog = new Dialog(getActivity()); mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); mDialog.setCanceledOnTouchOutside(false); if (!mTerminateRequired) { initViewWidget();// w w w . jav a 2s . co m } return mDialog; }
From source file:com.dcs.fakecurrencydetector.MainActivity.java
public void showHelp() { Dialog dialog = new Dialog(MainActivity.this); dialog.setTitle(R.string.action_about); dialog.setContentView(R.layout.dialog); dialog.show();/*from ww w . j a v a 2 s . c o m*/ }
From source file:com.wrmndfzzy.atomize.intro.IntroActivity.java
protected void applicenseDialog() { final Dialog aLDialog = new Dialog(IntroActivity.this); aLDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); aLDialog.setTitle("License Agreement"); aLDialog.setCancelable(false);/* w w w.java 2 s .c om*/ aLDialog.setCanceledOnTouchOutside(false); aLDialog.setContentView(R.layout.app_license_dialog); WebView lic = (WebView) aLDialog.findViewById(R.id.atomizeLic); Button disagree = (Button) aLDialog.findViewById(R.id.alDialogDisagree); Button agree = (Button) aLDialog.findViewById(R.id.alDialogAgree); lic.getSettings().setUseWideViewPort(true); lic.loadUrl("file:///android_asset/atomizeLicense.html"); disagree.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { aLDialog.dismiss(); SharedPreferences.Editor e = getPrefs.edit(); e.putBoolean("agreedToLicense", false); e.apply(); Intent homeIntent = new Intent(Intent.ACTION_MAIN); homeIntent.addCategory(Intent.CATEGORY_HOME); homeIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(homeIntent); IntroActivity.this.finish(); MainActivity.getInstance().finish(); } }); agree.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { SharedPreferences.Editor e = getPrefs.edit(); e.putBoolean("agreedToLicense", true); e.apply(); aLDialog.dismiss(); } }); aLDialog.show(); }
From source file:com.cybrosys.palmcalc.PalmCalcActivity.java
private void Feedback() { dialog = new Dialog(this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setCancelable(true);/* ww w . java 2s. c o m*/ dialog.setContentView(R.layout.feedback); etxtFeedback = (EditText) dialog.findViewById(R.id.etxtFeedback); btnClear = (Button) dialog.findViewById(R.id.btnClear); btnClear.setOnClickListener(this); btnSend = (Button) dialog.findViewById(R.id.btnSend); btnSend.setOnClickListener(this); dialog.show(); }
From source file:com.medisa.myspacecal.Range.java
@Override public void onSideNavigationItemClick(int itemId) { switch (itemId) { case R.id.side_navigation_menu_calendario: range = 0;/* w w w .j a v a 2 s.c om*/ Intent i = new Intent(this, MainActivity.class); startActivity(i); break; case R.id.side_navigation_menu_date_range: // custom dialog final Dialog dialog = new Dialog(this); dialog.setContentView(R.layout.custom_range_date); dialog.setTitle("Data range"); // set the custom dialog components - text, image and button final DatePicker dpStart = (DatePicker) dialog.findViewById(R.id.dpStart); final DatePicker dpEnd = (DatePicker) dialog.findViewById(R.id.dpEnd); Button btnSalva = (Button) dialog.findViewById(R.id.btnSalva); final CheckBox cbIntegralBox = (CheckBox) dialog.findViewById(R.id.cbIntegral); // if button is clicked, close the custom dialog btnSalva.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dateStart = Funzioni.addZero(dpStart.getDayOfMonth(), 2) + "-" + Funzioni.addZero(dpStart.getMonth(), 2) + "-" + dpStart.getYear(); dateEnd = Funzioni.addZero(dpEnd.getDayOfMonth(), 2) + "-" + Funzioni.addZero(dpEnd.getMonth(), 2) + "-" + dpEnd.getYear(); Log.e(dateStart, dateEnd); if (cbIntegralBox.isChecked()) { //#########################JSON AsyncHttpClient client = new AsyncHttpClient(); client.get("http://199.180.196.10/json/integral?startdate=" + dateStart + "&enddate=" + dateEnd, new AsyncHttpResponseHandler() { @Override public void onSuccess(String response) { Log.e("SCARICATO", response); JSONArray jObject; try { jObject = new JSONArray(response); for (int i = 0; i < jObject.length(); i++) { JSONArray menuObject = jObject.getJSONArray(i); String dataStart = menuObject.getString(0); String dataEnd = menuObject.getString(1); String raj2000 = menuObject.getString(2); String decj2000 = menuObject.getString(3); String target = menuObject.getString(4); Log.e("", dataStart + " " + dataEnd + " " + raj2000 + " " + decj2000 + " " + target); satellitiIntegral.add(new SatelliteIntegral(dataStart, dataEnd, raj2000, decj2000, target)); } } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); } dialog.dismiss(); // Intent mioIntent= new Intent(ctx, Range.class); // startActivity(mioIntent); } }); dialog.show(); break; // case R.id.side_navigation_menu_item3: // invokeActivity(getString(R.string.title3), R.drawable.ic_android3); // break; // // case R.id.side_navigation_menu_item4: // invokeActivity(getString(R.string.title4), R.drawable.ic_android4); // break; // // case R.id.side_navigation_menu_item5: // invokeActivity(getString(R.string.title5), R.drawable.ic_android5); // break; default: return; } }