List of usage examples for android.app Dialog findViewById
@Nullable public <T extends View> T findViewById(@IdRes int id)
From source file:com.sentaroh.android.Utilities.LogUtil.CommonLogFileListDialogFragment.java
private void confirmSendLog() { CommonLogUtil.flushLog(mContext, mGp); mThemeColorList = ThemeUtil.getThemeColorList(getActivity()); createTempLogFile();/* ww w . ja v a2 s .co m*/ final Dialog dialog = new Dialog(getActivity()); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.confirm_send_log_dlg); dialog.setCanceledOnTouchOutside(false); LinearLayout title_view = (LinearLayout) dialog.findViewById(R.id.confirm_send_log_dlg_title_view); title_view.setBackgroundColor(mThemeColorList.dialog_title_background_color); TextView title = (TextView) dialog.findViewById(R.id.confirm_send_log_dlg_title); title.setTextColor(mThemeColorList.text_color_dialog_title); TextView msg = (TextView) dialog.findViewById(R.id.confirm_send_log_dlg_msg); msg.setTextColor(mThemeColorList.text_color_info); msg.setBackgroundColor(mThemeColorList.dialog_msg_background_color); final Button btn_ok = (Button) dialog.findViewById(R.id.confirm_send_log_dlg_ok_btn); final Button btn_cancel = (Button) dialog.findViewById(R.id.confirm_send_log_dlg_cancel_btn); final Button btn_preview = (Button) dialog.findViewById(R.id.confirm_send_log_dlg_preview); CommonDialog.setDlgBoxSizeLimit(dialog, false); btn_preview.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent intent = new Intent(android.content.Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse("file://" + mGp.getLogDirName() + "temp_log.txt"), "text/plain"); startActivity(intent); } }); btn_ok.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { sendLogFileToDeveloper(mGp.getLogDirName() + "temp_log.txt"); dialog.dismiss(); } }); btn_cancel.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { dialog.dismiss(); } }); dialog.setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface arg0) { btn_cancel.performClick(); } }); dialog.show(); }
From source file:com.emergencyskills.doe.aed.UI.activity.TabsActivity.java
public void showconfirmationdialog(final int fragnumber) { final Dialog dialog = new Dialog(TabsActivity.this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.dialog_leaving_confirmation); dialog.getWindow()/*from w w w . j a va 2s . c o m*/ .setBackgroundDrawable(new ColorDrawable(getResources().getColor(android.R.color.transparent))); Button yes = (Button) dialog.findViewById(R.id.yesbtn); yes.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { switch (fragnumber) { case 1: showpickupschool(); break; case 2: showdrill(); break; case 3: showservice(); break; case 4: showinstall(); break; case 5: showpending(); break; } dialog.dismiss(); } }); Button no = (Button) dialog.findViewById(R.id.nobtn); no.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); ImageView close = (ImageView) dialog.findViewById(R.id.ivClose); close.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); }
From source file:com.emergencyskills.doe.aed.UI.activity.TabsActivity.java
void init() { // img=(ImageView)findViewById(R.id.logo); TextView build = (TextView) findViewById(R.id.checkfornew); build.setOnClickListener(new View.OnClickListener() { @Override/*from w ww . j a v a 2 s . c om*/ public void onClick(View v) { if (android.os.Build.VERSION.SDK_INT > 9) { StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); } CommonUtilities.logMe("about to check for version "); try { WebServiceHandler wsb = new WebServiceHandler(); ArrayList<NameValuePair> postParameters = new ArrayList<NameValuePair>(); String result = wsb.getWebServiceData("http://doe.emergencyskills.com/api/version.php", postParameters); JSONObject jsonObject = new JSONObject(result); String version = jsonObject.getString("version"); String features = jsonObject.getString("features"); System.err.println("version is : " + version); if (!LoginActivity.myversion.equals(version)) { MyToast.popmessagelong( "There is a new build available. Please download for these features: " + features, TabsActivity.this); Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://vireo.org/esiapp")); browserIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); browserIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(browserIntent); } else { MyToast.popmessagelong("You have the most current version!", TabsActivity.this); } } catch (Exception exc) { exc.printStackTrace(); } } }); TextView maillog = (TextView) findViewById(R.id.maillog); maillog.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final Dialog dialog = new Dialog(TabsActivity.this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.dialog_logout); TextView question = (TextView) dialog.findViewById(R.id.question); question.setText("Are you sure you want to email the log?"); TextView extra = (TextView) dialog.findViewById(R.id.extratext); extra.setText(""); dialog.getWindow().setBackgroundDrawable( new ColorDrawable(getResources().getColor(android.R.color.transparent))); Button yes = (Button) dialog.findViewById(R.id.yesbtn); yes.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(Intent.ACTION_SEND); i.setType("message/rfc822"); i.putExtra(Intent.EXTRA_EMAIL, new String[] { "rachelc@gmail.com" }); i.putExtra(Intent.EXTRA_SUBJECT, "Sending Log"); i.putExtra(Intent.EXTRA_TEXT, "body of email"); try { startActivity(Intent.createChooser(i, "Send mail...")); } catch (android.content.ActivityNotFoundException ex) { Toast.makeText(TabsActivity.this, "There are no email clients installed.", Toast.LENGTH_SHORT).show(); } finish(); } }); Button no = (Button) dialog.findViewById(R.id.nobtn); no.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); ImageView close = (ImageView) dialog.findViewById(R.id.ivClose); close.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); } }); listops listops = new listops(TabsActivity.this); CommonUtilities.logMe("logging in as: " + listops.getString("firstname")); TextView name = (TextView) findViewById(R.id.welcome); name.setText("Welcome, " + listops.getString("firstname")); TextView logoutname = (TextView) findViewById(R.id.logoutname); logoutname.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final Dialog dialog = new Dialog(TabsActivity.this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.dialog_logout); dialog.getWindow().setBackgroundDrawable( new ColorDrawable(getResources().getColor(android.R.color.transparent))); dialog.setContentView(R.layout.dialog_logout); Button yes = (Button) dialog.findViewById(R.id.yesbtn); yes.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { MyToast.popmessagelong("Logging out... ", TabsActivity.this); SharedPreferences prefs = getSharedPreferences("prefs", MODE_PRIVATE); SharedPreferences.Editor editor = prefs.edit(); editor.putString(Constants.loginkey, ""); editor.commit(); listops listops = new listops(TabsActivity.this); //make sure to remove the downloaded schools Intent intent = new Intent(TabsActivity.this, LoginActivity.class); startActivity(intent); ArrayList<Schoolinfomodel> ls = new ArrayList<Schoolinfomodel>(); listops.putdrilllist(ls); listops.putservicelist(ls); listops.putinstallllist(ls); ArrayList<PendingUploadModel> l = new ArrayList<PendingUploadModel>(); listops.putpendinglist(l); finish(); } }); Button no = (Button) dialog.findViewById(R.id.nobtn); no.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); ImageView close = (ImageView) dialog.findViewById(R.id.ivClose); close.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); } }); ll1 = (LinearLayout) findViewById(R.id.ll1); ll2 = (LinearLayout) findViewById(R.id.ll2); ll3 = (LinearLayout) findViewById(R.id.ll3); ll4 = (LinearLayout) findViewById(R.id.ll4); ll5 = (LinearLayout) findViewById(R.id.ll5); ll6 = (LinearLayout) findViewById(R.id.ll6); ll1.setBackgroundColor(getResources().getColor(R.color.White)); llPickSchools = (LinearLayout) findViewById(R.id.llPickSchool); llDrills = (LinearLayout) findViewById(R.id.llDrills); llServiceCalls = (LinearLayout) findViewById(R.id.llServiceCalls); llNewInstalls = (LinearLayout) findViewById(R.id.llNewInstalls); llPendingUploads = (LinearLayout) findViewById(R.id.llPendingUploads); frameLayout = (FrameLayout) findViewById(R.id.frame); }
From source file:net.mypapit.mobile.myrepeater.RepeaterListActivity.java
public void showDialog() throws NameNotFoundException { final Dialog dialog = new Dialog(this); dialog.setContentView(R.layout.about_dialog); dialog.setTitle("About Repeater.MY " + getPackageManager().getPackageInfo(getPackageName(), 0).versionName); dialog.setCancelable(true);//from w ww . java2s . co m // text TextView text = (TextView) dialog.findViewById(R.id.tvAbout); text.setText(R.string.txtLicense); // icon image ImageView img = (ImageView) dialog.findViewById(R.id.ivAbout); img.setImageResource(R.drawable.ic_launcher); dialog.show(); }
From source file:com.emergencyskills.doe.aed.UI.activity.TabsActivity.java
@Override public void onBackPressed() { if (checkcurrentfragment()) {/*from www. j a va 2 s .co m*/ final Dialog dialog = new Dialog(TabsActivity.this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.dialog_leaving_confirmation); dialog.getWindow() .setBackgroundDrawable(new ColorDrawable(getResources().getColor(android.R.color.transparent))); Button yes = (Button) dialog.findViewById(R.id.yesbtn); yes.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); showpickupschool(); } }); Button no = (Button) dialog.findViewById(R.id.nobtn); no.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); ImageView close = (ImageView) dialog.findViewById(R.id.ivClose); close.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); } else { super.onBackPressed(); } }
From source file:github.popeen.dsub.activity.SubsonicFragmentActivity.java
private void showLoginDialog() { final Dialog login = new Dialog(this); login.setContentView(R.layout.dialog_signin); Button btnLogin = (Button) login.findViewById(R.id.btnLogin); Button btnCancel = (Button) login.findViewById(R.id.btnCancel); btnLogin.setOnClickListener(new View.OnClickListener() { @Override//www . j ava 2 s. c o m public void onClick(View view) { //Test server connection. EditText username = (EditText) login.findViewById(R.id.username); EditText password = (EditText) login.findViewById(R.id.password); EditText server = (EditText) login.findViewById(R.id.server); String strUsername = username.getText().toString(); String strPassword = password.getText().toString(); String strServer = server.getText().toString(); if (strUsername.length() > 0 && strPassword.length() > 0 && strServer.length() > 0) { Util.setRestCredentials(SubsonicFragmentActivity.this, null, strUsername, strPassword, strServer); login.dismiss(); //recreate(); SubsonicFragmentActivity.super.restart(); } } }); btnCancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { login.dismiss(); } }); login.show(); }
From source file:com.android.cabapp.fragments.MyAccountFragment.java
void showDialog() { final Dialog dialog = new Dialog(mContext); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.device_id_dialog); dialog.setCanceledOnTouchOutside(false); dialog.setCancelable(false);/*from w w w . j a va 2s . c o m*/ etDeviceName = (EditText) dialog.findViewById(R.id.etDeviceName); rlBtnSave = (RelativeLayout) dialog.findViewById(R.id.rlbtnSave); rlBtnCancel = (RelativeLayout) dialog.findViewById(R.id.rlbtnCancel); if (!Util.getPOSDeviceName(mContext).equals("")) etDeviceName.setText(Util.getPOSDeviceName(mContext)); etDeviceName.setSelection(etDeviceName.getText().length()); // dialog.setTitle("Please enter Serial number"); rlBtnSave.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String szDeviceName = etDeviceName.getText().toString().trim(); if (szDeviceName.isEmpty()) { Util.showToastMessage(mContext, "Field cannot be left empty!", Toast.LENGTH_LONG); } else if (szDeviceName.length() < 11) { Util.showToastMessage(mContext, "Serial number cannot be less than 10!", Toast.LENGTH_LONG); } else { Util.setPOSDeviceName(mContext, szDeviceName); tvDeviceID.setVisibility(View.VISIBLE); tvDeviceID.setText(Util.getPOSDeviceName(mContext)); Util.hideSoftKeyBoard(mContext, rlBtnSave); dialog.dismiss(); } } }); rlBtnCancel.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Util.hideSoftKeyBoard(mContext, v); dialog.dismiss(); } }); dialog.show(); }
From source file:com.nanostuffs.yurdriver.fragment.RegisterFragment.java
private void datepicker() { final Dialog dialog = new Dialog(getActivity()); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setCanceledOnTouchOutside(true); dialog.setContentView(R.layout.datepicker_layout); final DatePicker date = (DatePicker) dialog.findViewById(R.id.datePicker1); final Calendar c = Calendar.getInstance(); c.add(Calendar.DAY_OF_YEAR, -1 * (16 * 365)); date.setMaxDate(c.getTimeInMillis()); Button text = (Button) dialog.findViewById(R.id.ok); text.setOnClickListener(new OnClickListener() { @Override// w w w . j ava 2 s. c o m public void onClick(View v) { v.bringToFront(); String dateString = String .valueOf(date.getYear() + "-" + (date.getMonth() + 1) + "-" + date.getDayOfMonth()); etDOB.setText(dateString); dialog.dismiss(); } }); Button cancel = (Button) dialog.findViewById(R.id.cancel); cancel.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub v.bringToFront(); dialog.dismiss(); } }); dialog.show(); }
From source file:com.eurotong.orderhelperandroid.OrderMenuActivity.java
@Override public void onClick(View v) { if (v.getId() == R.id.btnGoHome) { GotoTableOrderView();/*from w w w .j a v a 2 s . co m*/ //finish(); } if (v.getId() == R.id.btnPrint) { // custom dialog final Dialog dialog = new Dialog(context); dialog.setContentView(R.layout.print_command_selection); dialog.setTitle(R.string.msg_please_select_operation); // set the custom dialog components - text, image and button Button btnPrintBill = (Button) dialog.findViewById(R.id.btnPrintBill); Button btnPrintKitchen = (Button) dialog.findViewById(R.id.btnPrintKitchen); Button btnExit = (Button) dialog.findViewById(R.id.btnExit); Button btnPrintBar = (Button) dialog.findViewById(com.eurotong.orderhelperandroid.R.id.btnPrintBar); Button btnPrintPreview = (Button) dialog .findViewById(com.eurotong.orderhelperandroid.R.id.btnPrintPreview); if (!User.Current().HasRight(Define.UR_DEBUG_PRINT_LAYOUT)) { btnPrintPreview.setVisibility(View.GONE); } // if button is clicked, close the custom dialog btnPrintBill.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (User.Current().HasRight(Define.UR_PRINT)) { DoPrintPos(_table, PrintLayout.Current(), Setting.Current().NumberOfPrints); dialog.dismiss(); } } }); btnPrintKitchen.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (User.Current().HasRight(Define.UR_PRINT_KITCHEN)) { DoPrintPos(_table, PrintLayout.KitchenLayout(), Setting.Current().NumberOfPrintsKitchen); dialog.dismiss(); } } }); btnPrintBar.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (User.Current().HasRight(Define.UR_PRINT_BAR)) { DoPrintPos(_table, PrintLayout.BarLayout(), Setting.Current().NumberOfPrintsBar); dialog.dismiss(); } } }); btnPrintPreview.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(context, PrintPreview.class); i.putExtra(Define.TABLE_NR, _table.TableNr); startActivity(i); dialog.dismiss(); } }); btnExit.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); } if (v.getId() == R.id.btnExtra) { // custom dialog final Dialog dialog = new Dialog(context); dialog.setContentView(R.layout.table_order_extra); dialog.setTitle(R.string.msg_please_select_operation); // set the custom dialog components - text, image and button Button btnViewTableDetail = (Button) dialog.findViewById(R.id.btnViewTableDetail); Button btnDeleteTable = (Button) dialog.findViewById(R.id.btnDeleteTable); Button btnExit = (Button) dialog.findViewById(com.eurotong.orderhelperandroid.R.id.btnExit); Button btnAddChildTable = (Button) dialog .findViewById(com.eurotong.orderhelperandroid.R.id.btnAddChildTable); // if button is clicked, close the custom dialog btnViewTableDetail.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(context, TableDetailActivity.class); i.putExtra(Define.TABLE_NR, _table.TableNr); startActivity(i); dialog.dismiss(); } }); btnAddChildTable.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Table table; if (_table.ParentTable != null) { table = _table.ParentTable.CreateChildTable(); } else { table = _table.CreateChildTable(); } TableHelper.TableList().add(table); TableHelper.SaveTablesToStorage(); _table = table; InitVMMenuGroup(); ShowCurrentOrders(); dialog.dismiss(); } }); btnDeleteTable.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Builder confirmDeleteTableDialog = new AlertDialog.Builder(context); confirmDeleteTableDialog.setTitle(R.string.msg_are_you_sure_to_delete_this_order); confirmDeleteTableDialog.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { TableHelper.DeleteTableByNumber(_table.TableNr); TableHelper.SaveTablesToStorage(); dialog.dismiss(); finish(); //MyApplication.GoToHome(); //finish(); //Intent i = new Intent(context, TablesOverviewActivity.class); //startActivity(i); //dialog.dismiss(); } }); confirmDeleteTableDialog.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { // } }); confirmDeleteTableDialog.show(); dialog.dismiss(); } }); btnExit.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); } //else if(v.getId()==R.id.btnSave) ///{ // SaveTableOrders(); // GotoTableOrderView(); //finish(); //finish means close. want to refresh tableorder when close this view. so instead use gototableorderview() //} //else if(v.getId()==R.id.btnAllMenu) //{ // BindingMenuList(); //} else if (v.getId() == R.id.btnMenuGroup) { MakeMenuGroupButtons(); } //else if(v.getId()==R.id.btnMenuBar) //{ // BingMenuBarList(); //} if (v.getId() == R.id.btnCurrentOrders) { ShowCurrentOrders(); //finish(); } else if (v.getId() == R.id.btnCloseKeyboard) { //close soft keyboard //http://www.workingfromhere.com/blog/2011/04/27/close-hide-the-android-soft-keyboard/ InputMethodManager imm = (InputMethodManager) getSystemService( MyApplication.getAppContext().INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(editTextInput.getWindowToken(), 0); View filling = menusContainer.findViewById(R.id.hint_fill); if (filling != null) { filling.setVisibility(View.GONE); } SetEditTextInputText(""); ShowCurrentOrders(); } }
From source file:com.andrewshu.android.reddit.mail.InboxListActivity.java
@Override protected void onPrepareDialog(int id, Dialog dialog) { super.onPrepareDialog(id, dialog); switch (id) { case Constants.DIALOG_LOGIN: if (mSettings.getUsername() != null) { final TextView loginUsernameInput = (TextView) dialog.findViewById(R.id.login_username_input); loginUsernameInput.setText(mSettings.getUsername()); }/*from ww w . j av a 2 s. co m*/ final TextView loginPasswordInput = (TextView) dialog.findViewById(R.id.login_password_input); loginPasswordInput.setText(""); break; case Constants.DIALOG_REPLY: if (mVoteTargetThingInfo != null && mVoteTargetThingInfo.getReplyDraft() != null) { EditText replyBodyView = (EditText) dialog.findViewById(R.id.body); replyBodyView.setText(mVoteTargetThingInfo.getReplyDraft()); } break; default: // No preparation based on app state is required. break; } }