List of usage examples for android.app AlertDialog.Builder setCancelable
public void setCancelable(boolean flag)
From source file:com.instiwork.RegistrationActivity.java
public void getCountryList() { final String URL = InstiworkConstants.URL_DOMAIN + "Councurr_control"; JsonObjectRequest jsonObjReq = new JsonObjectRequest(Request.Method.GET, URL, null, new Response.Listener<JSONObject>() { @Override//from w w w . j av a 2s . c o m public void onResponse(JSONObject response) { Logger.showMessage(TAG, URL); Logger.showMessage(TAG, response.toString()); countryPbar.setVisibility(View.GONE); objectsCountry = new LinkedList<JSONObject>(); try { JSONObject makeJSONObject = new JSONObject(); makeJSONObject.put("country_id", "0"); makeJSONObject.put("country_name", "Select Country From List"); makeJSONObject.put("country_2_code", "0"); makeJSONObject.put("currency_name", ""); makeJSONObject.put("currency_code", ""); objectsCountry.add(makeJSONObject); } catch (Exception e) { e.printStackTrace(); } country_spinner.setVisibility(View.VISIBLE); try { JSONArray jsonArray = response.getJSONArray("response"); for (int i = 0; i < jsonArray.length(); i++) { objectsCountry.add(jsonArray.getJSONObject(i)); } country_spinner.setAdapter( new CountrySpinnerAdapter(RegistrationActivity.this, objectsCountry)); try { for (int s = 0; s < objectsCountry.size(); s++) { if (objectsCountry.get(s).getString("country_name") .equalsIgnoreCase(currentCountry)) { Logger.showMessage(TAG, "MyCheck: " + "IF"); country_spinner.setSelection(s); break; } else { Logger.showMessage(TAG, "MyCheck: " + "ELSE"); country_spinner.setSelection(0); } } } catch (Exception e) { // e.printStackTrace(); country_spinner.setSelection(0); } } catch (Exception e) { e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Logger.showMessage(TAG, "Error: " + error.getMessage()); countryPbar.setVisibility(View.GONE); if (error instanceof NoConnectionError) { android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder( RegistrationActivity.this); builder.setTitle("Instiwork"); builder.setMessage("You do not have internet connection!"); builder.setPositiveButton("retry", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); countryPbar.setVisibility(View.VISIBLE); country_spinner.setVisibility(View.GONE); getCountryList(); } }); builder.setNegativeButton("cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } }); builder.setCancelable(false); builder.show(); } else { try { String json = null; NetworkResponse response = error.networkResponse; if (response != null && response.data != null) { json = new String(response.data); json = trimMessage(json, "message"); if (json != null) // displayMessage(json); displayMessage(json + " Error Code : " + response.statusCode); } } catch (Exception e) { e.printStackTrace(); } } } }); jsonObjReq.setRetryPolicy(new DefaultRetryPolicy(30000, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT)); InstiworkApplication.getInstance().addToRequestQueue(jsonObjReq); }
From source file:com.smc.tw.waltz.MainActivity.java
private void showOwnerDeleteDeviceDialog(final int index, final int count) { if (DEBUG)//from www . ja v a 2s . com Log.d(TAG, "showOwnerDeleteDeviceDialog i:" + index); final WaltzDevice device = MainApplication.getWaltzDevice(index); if (MainApplication.isUserSignedIn() && device.isOwnerScope() && (count > 1)) { AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.WaltzDialog); builder.setIcon(R.drawable.ic_launcher); builder.setTitle(R.string.app_name); builder.setMessage(getString(R.string.device_owner) + " (" + device.getName() + "). " + getString(R.string.remind_owner)); builder.setCancelable(false); builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int id) { // ParsePush.unsubscribeInBackground("WALTZ_" + device.getSerial()); // unsubscribeGcmChannel("WALTZ_" + device.getSerial()); } }); builder.create().show(); } else { AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.WaltzDialog); builder.setIcon(R.drawable.ic_launcher); builder.setTitle(R.string.app_name); builder.setMessage(getString(R.string.sure_to_remove) + " (" + device.getName() + ") ? " + getString(R.string.device_owner) + "."); builder.setCancelable(false); builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int id) { MainApplication.removeWaltzDevice(index); mDeviceListFragment.notifyDataSetChanged(); onRefreshDevice(); ParsePush.unsubscribeInBackground("WALTZ_" + device.getSerial()); unsubscribeGcmChannel("WALTZ_" + device.getSerial()); } }); builder.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int id) { } }); builder.create().show(); } }
From source file:com.smc.tw.waltz.MainActivity.java
private void showRenameDeviceDialog(int index) { if (DEBUG)// www.ja v a 2s .co m Log.d(TAG, "showRenameDeviceDialog i:" + index); final WaltzDevice device = MainApplication.getWaltzDevice(index); LayoutInflater inflater = LayoutInflater.from(MainActivity.this); View dialogView = inflater.inflate(R.layout.dialog_edit_device, null); AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.WaltzDialog); final EditText deviceNameText = (EditText) dialogView.findViewById(R.id.text_device_name); String name = device.getName(); deviceNameText.setText(name); deviceNameText.setSelection((name.length() > 0) ? (name.length()) : 0); builder.setIcon(R.drawable.ic_launcher); builder.setTitle(R.string.dialog_edit_device); builder.setView(dialogView); builder.setCancelable(false); builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int id) { String deviceName = deviceNameText.getText().toString(); if (deviceName != null && deviceName.length() > 0) { device.setName(deviceName); MainApplication.renameWaltzDevice(index, deviceName); // rename device name in lcoud MainApplication.saveDeviceList(); mDeviceListFragment.notifyDataSetChanged(); } } }); builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int id) { } }); builder.create().show(); }
From source file:com.smc.tw.waltz.MainActivity.java
private void showInputAccessCodeDialog(int index) { if (DEBUG)// www.ja va 2 s . c o m Log.d(TAG, "showInputAccessCodeDialog i:" + index); if (index < 0 || index >= MainApplication.getWaltzDeviceNumber()) return; if (mInputAccessCodeDialog != null) { mInputAccessCodeDialog.dismiss(); } final WaltzDevice device = MainApplication.getWaltzDevice(index); LayoutInflater inflater = LayoutInflater.from(MainActivity.this); View dialogView = inflater.inflate(R.layout.dialog_access_code_input, null); AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.WaltzDialog); final TextView textView = (TextView) dialogView.findViewById(R.id.input_access_code_text); final PinEditText pinView = (PinEditText) dialogView.findViewById(R.id.input_access_code_view); final String name = device.getName(); textView.setText(getString(R.string.dialog_access_code_input) + " " + name); builder.setIcon(R.drawable.ic_launcher); builder.setTitle(R.string.dialog_access_code); builder.setView(dialogView); builder.setCancelable(false); builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int id) { String pinText = pinView.getText().toString(); //20160223 joyce add if (pinText == null || pinText.isEmpty() || pinText.length() <= 5) { showAccessCodeLengthWrongDialog(); return; } device.checkAccessCode(pinText); if (mProgressDialog != null) { mProgressDialog.setMessage(getString(R.string.main_connecting) + " " + name + "..."); mProgressDialog.show(); } } }); builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int id) { } }); mInputAccessCodeDialog = builder.create(); pinView.setOnPinListener(new PinEditText.OnPinListener() { @Override public void onPincodeDone() { if (DEBUG) Log.d(TAG, "showInputAccessCodeDialog t:" + pinView.getText().toString()); } }); mInputAccessCodeDialog.show(); }
From source file:com.example.alyshia.customsimplelauncher.MainActivity.java
void inflateDialog(int type) { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle("PASSWORD"); LayoutInflater inflater = LayoutInflater.from(this); final View view = inflater.inflate(R.layout.dialoglayout, null); EditText edittext = (EditText) view.findViewById(R.id.pswEditText); alert.setView(R.layout.dialoglayout); if (type == TYPE_EXIT) { alert.setPositiveButton("Enter", new DialogInterface.OnClickListener() { @Override//from w w w . j av a2 s . c om public void onClick(DialogInterface dialog, int which) { Dialog d = (Dialog) dialog; EditText et = (EditText) d.findViewById(R.id.pswEditText); Log.d(TAG, "TEXT is " + et.getText().toString()); if (et.getText().toString().equals("")) { dialog.dismiss(); Toast.makeText(MainActivity.this, "wrong password", Toast.LENGTH_SHORT).show(); } else if (et.getText().toString().equals(getPW())) { setkioskReceiver(); if (km == null) { km = KioskMode.getInstance(getApplicationContext()); } if (km.isKioskModeEnabled()) { Log.d(TAG, "Kioskmode being disabled bc it is enabled"); km.disableKioskMode(); } } } }); } else if (type == TYPE_ADMIN) { alert.setPositiveButton("Enter", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Dialog d = (Dialog) dialog; EditText et = (EditText) d.findViewById(R.id.pswEditText); Log.d(TAG, "TEXT is " + et.getText().toString()); if (et.getText().toString().equals("")) { dialog.dismiss(); } else if (et.getText().toString().equals(getPW())) { Intent intent = new Intent(MainActivity.this, AdminActivity.class); startActivity(intent); } } }); } alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); alert.setCancelable(true); AlertDialog cdialog = alert.create(); cdialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); cdialog.show(); }
From source file:com.instiwork.RegistrationFacebookActivity.java
public void login_User(final String URL) { pDialogOut.show();/*ww w .j a v a 2 s. c o m*/ Logger.showMessage(TAG, "OutSide login_User" + URL); JsonObjectRequest jsonObjReq = new JsonObjectRequest(Request.Method.GET, URL, null, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { Logger.showMessage(TAG, "Inside login_User" + URL); Logger.showMessage(TAG, response.toString()); Logger.showMessage(TAG, imgPath); pDialogOut.hide(); txt_terms_conditions.setClickable(true); findViewById(R.id.help_dob).setClickable(true); findViewById(R.id.help_license).setClickable(true); ll_license.setClickable(true); dateOfBirth.setClickable(true); findViewById(R.id.footer).setClickable(true); findViewById(R.id.loginBttn).setClickable(true); txt_terms_conditions.setEnabled(true); findViewById(R.id.help_dob).setEnabled(true); findViewById(R.id.help_license).setEnabled(true); ll_license.setEnabled(true); dateOfBirth.setEnabled(true); findViewById(R.id.footer).setEnabled(true); findViewById(R.id.loginBttn).setEnabled(true); try { InstiworkApplication.getInstance().setSelectedLicenseArray(null); if (response.getJSONObject("response").getString("status") .equalsIgnoreCase("Success")) { InstiworkApplication.getInstance() .setUSER_ID(response.getJSONObject("response").getString("id")); InstiworkApplication.getInstance() .setUSER_NAME(response.getJSONObject("response").getString("name")); InstiworkApplication.getInstance().setCOMPANY_NAME( response.getJSONObject("response").getString("companyname")); InstiworkApplication.getInstance() .setUSER_EMAIL(response.getJSONObject("response").getString("email")); InstiworkApplication.getInstance() .setMOBILE_NO(response.getJSONObject("response").getString("contact")); try { InstiworkApplication.getInstance().setJOB_SEARCH_RADIUS( response.getJSONObject("response").getString("distance")); InstiworkApplication.getInstance() .setUnit_user(response.getJSONObject("response").getString("unit")); } catch (Exception e) { try { InstiworkApplication.getInstance().setJOB_SEARCH_RADIUS( response.getJSONObject("response").getString("distance_user")); InstiworkApplication.getInstance().setUnit_user( response.getJSONObject("response").getString("unit_user")); } catch (Exception ex) { ex.printStackTrace(); } } try { InstiworkApplication.getInstance().setPush_status( response.getJSONObject("response").getString("push_status")); InstiworkApplication.getInstance().setEmail_status( response.getJSONObject("response").getString("email_status")); InstiworkApplication.getInstance().setText_status( response.getJSONObject("response").getString("text_status")); InstiworkApplication.getInstance().setCountryid( response.getJSONObject("response").getString("country_id")); InstiworkApplication.getInstance().setCurrency_id( response.getJSONObject("response").getString("currency_id")); InstiworkApplication.getInstance().setCountry_name( response.getJSONObject("response").getString("country_name")); InstiworkApplication.getInstance().setCountry_3_code( response.getJSONObject("response").getString("country_3_code")); InstiworkApplication.getInstance().setCountry_2_code( response.getJSONObject("response").getString("country_2_code")); InstiworkApplication.getInstance().setCurrency_code( response.getJSONObject("response").getString("currency_code")); InstiworkApplication.getInstance().setCurrency_name( response.getJSONObject("response").getString("currency_name")); InstiworkApplication.getInstance().setMember_since( response.getJSONObject("response").getString("member_since")); } catch (Exception e) { Logger.showMessage(TAG, "Extra Paremeter : " + e.toString()); } InstiworkApplication.getInstance() .setUSER_IMG(response.getJSONObject("response").getString("profileimage")); try { licenseLinkedList = new LinkedList<JSONObject>(); if (response.getJSONObject("response").getJSONArray("license").length() > 0) { for (int i = 0; i < response.getJSONObject("response") .getJSONArray("license").length(); i++) { licenseLinkedList.add(response.getJSONObject("response") .getJSONArray("license").getJSONObject(i)); } InstiworkApplication.getInstance().setLicenseArray(licenseLinkedList); } else { InstiworkApplication.getInstance().setLicenseArray(null); } } catch (Exception e) { InstiworkApplication.getInstance().setLicenseArray(null); Logger.showMessage(TAG, "license Exception" + e.toString()); } SharedPreferences.Editor edit = appSharedPref.edit(); edit.putString("USER_ID", response.getJSONObject("response").getString("id")); try { edit.putString("CURRENCY_ID", response.getJSONObject("response").getString("currency_id")); } catch (Exception e) { e.printStackTrace(); } edit.commit(); try { Map<String, Object> params = new HashMap<>(); params.put("action", "facebook_registration"); params.put("action_user_id", InstiworkApplication.getInstance().getUSER_ID()); params.put("action_user_name", InstiworkApplication.getInstance().getUSER_NAME()); params.put("action_device", "android"); AdWordsRemarketingReporter.reportWithConversionId(getApplicationContext(), getResources().getString(R.string.conversion_id), params); } catch (Exception e) { Logger.showMessage(TAG, "AdWords : " + e.toString()); } Toast.makeText(RegistrationFacebookActivity.this, "Registered successfully", Toast.LENGTH_SHORT).show(); Intent i = new Intent(getApplicationContext(), LandingActivity.class); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); startActivity(i); finish(); } else { pDialogOut.hide(); // Toast.makeText(RegistrationFacebookActivity.this, response.getJSONObject("response").getString("message"), Toast.LENGTH_SHORT).show(); // Snackbar.make(findViewById(android.R.id.content), response.getString("details"), Snackbar.LENGTH_LONG) // .setActionTextColor(Color.RED) // .show(); try { displayMessage(response.getString("details")); // Snackbar.make(findViewById(android.R.id.content), response.getString("details"), Snackbar.LENGTH_LONG) // .setActionTextColor(Color.RED) // .show(); } catch (Exception ee) { ee.printStackTrace(); try { displayMessage(response.getString("message")); } catch (Exception eee) { eee.printStackTrace(); } } } } catch (Exception e) { e.printStackTrace(); try { displayMessage(response.getString("details")); // Snackbar.make(findViewById(android.R.id.content), response.getString("details"), Snackbar.LENGTH_LONG) // .setActionTextColor(Color.RED) // .show(); } catch (Exception ee) { ee.printStackTrace(); try { displayMessage(response.getString("message")); } catch (Exception eee) { eee.printStackTrace(); } } pDialogOut.hide(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Logger.showMessage(TAG, "Vollllllllll Error: " + error.getMessage()); pDialogOut.hide(); txt_terms_conditions.setClickable(true); findViewById(R.id.help_dob).setClickable(true); findViewById(R.id.help_license).setClickable(true); ll_license.setClickable(true); dateOfBirth.setClickable(true); findViewById(R.id.footer).setClickable(true); findViewById(R.id.loginBttn).setClickable(true); txt_terms_conditions.setEnabled(true); findViewById(R.id.help_dob).setEnabled(true); findViewById(R.id.help_license).setEnabled(true); ll_license.setEnabled(true); dateOfBirth.setEnabled(true); findViewById(R.id.footer).setEnabled(true); findViewById(R.id.loginBttn).setEnabled(true); if (error instanceof NoConnectionError) { android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder( RegistrationFacebookActivity.this); builder.setTitle("Instiwork"); builder.setMessage("You do not have internet connection!"); builder.setPositiveButton("retry", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); pDialogOut.show(); txt_terms_conditions.setClickable(false); findViewById(R.id.help_dob).setClickable(false); findViewById(R.id.help_license).setClickable(false); ll_license.setClickable(false); dateOfBirth.setClickable(false); findViewById(R.id.footer).setClickable(false); findViewById(R.id.loginBttn).setClickable(false); txt_terms_conditions.setEnabled(false); findViewById(R.id.help_dob).setEnabled(false); findViewById(R.id.help_license).setEnabled(false); ll_license.setEnabled(false); dateOfBirth.setEnabled(false); findViewById(R.id.footer).setEnabled(false); findViewById(R.id.loginBttn).setEnabled(false); login_User(URL); } }); builder.setNegativeButton("cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } }); builder.setCancelable(false); builder.show(); } else { try { String json = null; NetworkResponse response = error.networkResponse; if (response != null && response.data != null) { json = new String(response.data); json = trimMessage(json, "message"); if (json != null) // displayMessage(json); displayMessage(json + " Error Code : " + response.statusCode); } } catch (Exception e) { e.printStackTrace(); } } } }); jsonObjReq.setRetryPolicy(new DefaultRetryPolicy(30000, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT)); InstiworkApplication.getInstance().addToRequestQueue(jsonObjReq); }
From source file:com.google.android.apps.forscience.whistlepunk.EditNoteDialog.java
@Override public AlertDialog onCreateDialog(Bundle savedInstanceState) { mLabel = getArguments().getParcelable(KEY_SAVED_LABEL); String timeText = getArguments().getString(KEY_SAVED_TIME_TEXT, ""); String timeTextContentDescription = getArguments().getString(KEY_SAVED_TIME_TEXT_DESCRIPTION); mTimestamp = getArguments().getLong(KEY_SAVED_TIMESTAMP); try {/*from w w w . j a va 2s.c o m*/ mSelectedValue = GoosciLabelValue.LabelValue.parseFrom(getArguments().getByteArray(KEY_SELECTED_VALUE)); } catch (InvalidProtocolBufferNanoException ex) { Log.wtf(TAG, "Couldn't parse label value"); } AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity()); LinearLayout rootView = (LinearLayout) LayoutInflater.from(getActivity()) .inflate(R.layout.run_review_label_edit, null); alertDialog.setView(rootView); ImageView imageView = (ImageView) rootView.findViewById(R.id.picture_note_preview_image); final EditText editText = (EditText) rootView.findViewById(R.id.edit_note_text); TextView autoTextView = (TextView) rootView.findViewById(R.id.auto_note_text); // Use mSelectedValue to load content, because the user may have changed the value since // it was stored in the label. Note that picture labels can't be edited at this time, // but in the future this will apply to picture labels as well. if (mLabel instanceof PictureLabel) { imageView.setVisibility(View.VISIBLE); autoTextView.setVisibility(View.GONE); editText.setText(PictureLabel.getCaption(mSelectedValue)); editText.setHint(R.string.picture_note_caption_hint); Glide.with(getActivity()).load(PictureLabel.getFilePath(mSelectedValue)).into(imageView); imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { PictureUtils.launchExternalViewer(getActivity(), (PictureLabel.getFilePath(mSelectedValue))); } }); } else if (mLabel instanceof TextLabel) { imageView.setVisibility(View.GONE); autoTextView.setVisibility(View.GONE); editText.setText(TextLabel.getText(mSelectedValue)); } else if (mLabel instanceof SensorTriggerLabel) { imageView.setVisibility(View.GONE); autoTextView.setVisibility(View.VISIBLE); editText.setText(SensorTriggerLabel.getCustomText(mSelectedValue)); String autoText = SensorTriggerLabel.getAutogenText(mSelectedValue); TriggerHelper.populateAutoTextViews(autoTextView, autoText, R.drawable.ic_label_black_24dp, getResources()); } alertDialog.setPositiveButton(R.string.action_save, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { mLabel.setTimestamp(mTimestamp); if (mLabel instanceof TextLabel) { ((TextLabel) mLabel).setText(editText.getText().toString()); } else if (mLabel instanceof PictureLabel) { ((PictureLabel) mLabel).setCaption(editText.getText().toString()); } else if (mLabel instanceof SensorTriggerLabel) { ((SensorTriggerLabel) mLabel).setCustomText(editText.getText().toString()); } getDataController().editLabel(mLabel, ((EditNoteDialogListener) getParentFragment()).onLabelEdit(mLabel)); } }); alertDialog.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); alertDialog.setCancelable(true); TextView timeTextView = (TextView) rootView.findViewById(R.id.edit_note_time); timeTextView.setText(timeText); timeTextView.setContentDescription(timeTextContentDescription); if (labelBelongsToRun() && mLabel.canEditTimestamp()) { timeTextView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { GoosciLabelValue.LabelValue value = new GoosciLabelValue.LabelValue(); if (mLabel instanceof PictureLabel) { // Captions can be edited, but the picture path cannot be edited at this // time. PictureLabel.populateStorageValue(value, ((PictureLabel) mLabel).getFilePath(), editText.getText().toString()); ((EditNoteDialogListener) getParentFragment()).onEditNoteTimestampClicked(mLabel, value, mTimestamp); } else if (mLabel instanceof TextLabel) { TextLabel.populateStorageValue(value, editText.getText().toString()); ((EditNoteDialogListener) getParentFragment()).onEditNoteTimestampClicked(mLabel, value, mTimestamp); } } }); } else if (labelBelongsToRun()) { Drawable lockDrawable = getResources().getDrawable(R.drawable.ic_lock_black_18dp); DrawableCompat.setTint(lockDrawable, getResources().getColor(R.color.text_color_light_grey)); // There is already a start drawable. Use it again. Drawable[] drawables = timeTextView.getCompoundDrawablesRelative(); timeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(drawables[0], null, lockDrawable, null); } AlertDialog dialog = alertDialog.create(); if (mLabel instanceof TextLabel || mLabel instanceof SensorTriggerLabel) { dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); } return dialog; }
From source file:com.smc.tw.waltz.MainActivity.java
private void showWPSParingDialog(WaltzDevice device) { if (DEBUG)/*from ww w.j av a 2 s .c om*/ Log.d(TAG, "showWPSParingDialog"); if (mWPSDialog != null) { mWPSDialog.dismiss(); } LayoutInflater inflater = LayoutInflater.from(this); View mDialogView = inflater.inflate(R.layout.sensor_allow_join, null); AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.WaltzDialog); mWPSParingText = (TextView) mDialogView.findViewById(R.id.sensor_allow_join_text); TextView mDeviceNameText = (TextView) mDialogView.findViewById(R.id.device_name); mDeviceNameText.setText(getString(R.string.device) + "(" + device.getName() + ")"); if (mIsEndPrepareParing) mWPSParingText.setText( String.format(getString(R.string.notification_system_wps_still_in_paring), mWPSParingTimeLeft));//mWPSParingCount)); else mWPSParingText.setText(String.format(getString(R.string.notification_system_prepare_wps_paring), mPrepareWPSParingCount));// builder.setIcon(R.drawable.seek_thumb_normal); builder.setTitle(R.string.sensor_allow_join); builder.setView(mDialogView); builder.setCancelable(false); builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int id) { //stopWPSParingTimer(); mIsHasSeenWPSParingAlert = true; stopWPSParingTimeLeftTimer(); } }); mWPSDialog = builder.create(); mWPSDialog.show(); }
From source file:com.example.android.lightcontrol.MainActivity.java
private void openOptionsDialog1() { final AlertDialog.Builder dialog = new AlertDialog.Builder(this); dialog.setCancelable(false); dialog.setTitle(R.string.about_title); dialog.setMessage("Sure for quit?"); dialog.setPositiveButton(R.string.ok_label_1, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialoginterface, int i) { finish();// w w w. j a v a2s . co m } }); dialog.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialoginterface, int i) { } }); dialog.show(); }