List of usage examples for android.app Dialog setTitle
public void setTitle(@StringRes int titleId)
From source file:group.pals.android.lib.ui.filechooser.utils.ui.bookmark.BookmarkFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { if (BuildConfig.DEBUG) Log.d(_ClassName, "onCreateDialog()"); Dialog dialog = new Dialog(getActivity(), R.style.Afc_Theme_Dialog_Dark); dialog.setCanceledOnTouchOutside(true); dialog.requestWindowFeature(Window.FEATURE_LEFT_ICON); dialog.setTitle(R.string.afc_title_bookmark_manager); dialog.setContentView(initContentView(dialog.getLayoutInflater(), null)); dialog.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.afc_bookmarks_dark); return dialog; }
From source file:com.beza.briver.fragments.ProfileFragment.java
private void showDocumentsAttachmentCustomDialog() { final Dialog customAttachmentsDialog = new Dialog(getActivity()); customAttachmentsDialog.setContentView(R.layout.layout_custom_attachment_dialog); customAttachmentsDialog.setCancelable(false); customAttachmentsDialog.setTitle("Attach Documents"); Button buttonNo = (Button) customAttachmentsDialog.findViewById(R.id.btn_driver_hire_dialog_cancel); buttonNo.setOnClickListener(new View.OnClickListener() { @Override//www . j a v a 2 s . co m public void onClick(View v) { customAttachmentsDialog.dismiss(); } }); Button buttonYes = (Button) customAttachmentsDialog.findViewById(R.id.btn_driver_hire_dialog_hire); buttonYes.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (imageChanged) { customAttachmentsDialog.dismiss(); etProfileAttachments.setCompoundDrawablesWithIntrinsicBounds(R.mipmap.ic_edit_text_attachment, 0, R.mipmap.ic_edit_text_add_image, 0); File destination = new File(Environment.getExternalStorageDirectory() + File.separator + "Android/data" + File.separator + AppGlobals.getContext().getPackageName()); for (int i = 0; i < 3; i++) { if (hashMapTemp.containsKey(i)) { File file = new File(destination, i + ".jpg"); file.delete(); File from = new File(destination, i + "temp" + ".jpg"); File to = new File(destination, i + ".jpg"); from.renameTo(to); } } Log.i("images array", String.valueOf(imagePathsArray)); imageChanged = false; } else { Toast.makeText(getActivity(), "No Change to submit", Toast.LENGTH_SHORT).show(); } } }); ibPhotoOne = (ImageButton) customAttachmentsDialog.findViewById(R.id.ib_photo_one); ibPhotoTwo = (ImageButton) customAttachmentsDialog.findViewById(R.id.ib_photo_two); ibPhotoThree = (ImageButton) customAttachmentsDialog.findViewById(R.id.ib_photo_three); ibPhotoOne.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ibPosition = 0; Helpers.AlertDialogWithPositiveNegativeFunctionsNeutralButton(getActivity(), "License Front", "Select an option to add photo", "Camera", "Gallery", "Cancel", openCameraIntent, openGalleryIntent); } }); ibPhotoTwo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ibPosition = 1; Helpers.AlertDialogWithPositiveNegativeFunctionsNeutralButton(getActivity(), "License Back", "Select an option to add photo", "Camera", "Gallery", "Cancel", openCameraIntent, openGalleryIntent); } }); ibPhotoThree.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ibPosition = 2; Helpers.AlertDialogWithPositiveNegativeFunctionsNeutralButton(getActivity(), "Police Verification", "Select an option to add photo", "Camera", "Gallery", "Cancel", openCameraIntent, openGalleryIntent); } }); ibPhotoOne.setBackgroundDrawable(null); ibPhotoOne.setImageBitmap(Helpers.getCroppedBitmap( Helpers.getResizedBitmapToDisplay(BitmapFactory.decodeFile(hashMap.get(0)), 120))); ibPhotoTwo.setBackgroundDrawable(null); ibPhotoTwo.setImageBitmap(Helpers.getCroppedBitmap( Helpers.getResizedBitmapToDisplay(BitmapFactory.decodeFile(hashMap.get(1)), 120))); ibPhotoThree.setBackgroundDrawable(null); ibPhotoThree.setImageBitmap(Helpers.getCroppedBitmap( Helpers.getResizedBitmapToDisplay(BitmapFactory.decodeFile(hashMap.get(2)), 120))); customAttachmentsDialog.show(); }
From source file:liqui.droid.activity.Base.java
/** * Open feedback dialog.//from www.j a v a 2 s . c o m */ public void openFeedbackDialog() { Dialog dialog = new Dialog(this); dialog.setContentView(R.layout.dlg_feedback); dialog.setTitle(getResources().getString(R.string.feedback)); Button btnByEmail = (Button) dialog.findViewById(R.id.btn_by_email); btnByEmail.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent sendIntent = new Intent(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { getResources().getString(R.string.my_email) }); sendIntent.setType("message/rfc822"); startActivity(Intent.createChooser(sendIntent, "Select email application.")); } }); dialog.show(); }
From source file:com.google.ytd.SubmitActivity.java
@Override protected Dialog onCreateDialog(int id) { final Dialog dialog = new Dialog(SubmitActivity.this); dialog.setTitle("Terms of Service"); switch (id) { case DIALOG_LEGAL: dialog.setContentView(R.layout.legal); TextView legalText = (TextView) dialog.findViewById(R.id.legal); legalText.setText(Util.readFile(this, R.raw.legal).toString()); dialog.findViewById(R.id.agree).setOnClickListener(new OnClickListener() { @Override/* www .j ava 2 s . co m*/ public void onClick(View v) { dialog.cancel(); getAuthTokenWithPermission(youTubeName); } }); dialog.findViewById(R.id.notagree).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.cancel(); } }); break; } return dialog; }
From source file:com.sastra.app.timetable.TimetableActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.timetable_main); Log.d(TAG, "Entered On Create"); ActionBar Bar = getActionBar();//from w w w . ja v a 2 s. c o m Bar.setLogo(R.drawable.ic_launcher_1); //Bar.setTitle(""); // String path = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/data/SASTRA Timetable/files/test.txt"; SharedPreferences mPreferences = this.getSharedPreferences("AB", MODE_PRIVATE); boolean firstTime = mPreferences.getBoolean("firstTime", true); if (firstTime) { SharedPreferences.Editor editor = mPreferences.edit(); editor.putBoolean("firstTime", false); editor.commit(); Dialog d2 = new Dialog(this); d2.setTitle("HELP"); d2.setCanceledOnTouchOutside(true); TextView tv = new TextView(this); tv.setText( "This application can be used to store your timetable.First,click on Manage Subjects Icon(Wrench Icon) inorder to add all your subjects.Click on Add Subjects on top and enter the details of your subject.The fields that appear are optional and not manditory.Once you have added all the subjects,go back to the main screen and click on Add Classes icon(Plus Icon) to add the different classes to your timetable.The fields that appear are again optional and all of them need not be filled.You can long press on any particular subject to edit or delete them.You can delete all the informations using Delete All(Garbage Icon) option."); ScrollView sav = new ScrollView(this); sav.addView(tv); LayoutParams lap = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); d2.addContentView(sav, lap); d2.show(); } boolean enabled = true; Bar.setHomeButtonEnabled(enabled); //File database=getApplicationContext().getDatabasePath("massey.db"); // if (database.exists()) { data = new InternalDB(this); // } // add fragments mFragments = new ArrayList<Fragment>(); mFragments.add(Fragment.instantiate(this, MONDAYFRAGMENT)); mFragments.add(Fragment.instantiate(this, TUESDAYFRAGMENT)); mFragments.add(Fragment.instantiate(this, WEDNESDAYFRAGMENT)); mFragments.add(Fragment.instantiate(this, THURSDAYFRAGMENT)); mFragments.add(Fragment.instantiate(this, FRIDAYFRAGMENT)); mFragments.add(Fragment.instantiate(this, SATURDAYFRAGMENT)); // adapter mAdapter = new MainPagerAdapter(getSupportFragmentManager(), mFragments); // pager mPager = (ViewPager) findViewById(R.id.view_pager); mPager.setAdapter(mAdapter); // indicator mIndicator = (TitlePageIndicator) findViewById(R.id.title_indicator); //mIndicator.setBackgroundColor(0x0106000e); //mIndicator.setFooterColor(0xffffff); mIndicator.setTextColor(0xFF000000); mIndicator.setSelectedColor(0xFF000000); mIndicator.setViewPager(mPager); intent = new Intent(getApplicationContext(), AddSubjects.class);//intent = new Intent(getApplicationContext(), AddSubjects.class); builder = new AlertDialog.Builder(this); builder.setMessage("Are you sure you want to delete all lessons?").setCancelable(false) .setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { data.open(); data.deleteAllHours(); data.close(); // update(); mAdapter.notifyDataSetChanged(); mAdapter.finishUpdate(mPager); } }).setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); alert = builder.create(); builder2 = new AlertDialog.Builder(this); builder2.setMessage("Are you sure you want to delete this lesson?").setCancelable(false) .setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { data.open(); data.deleteHour(OLDSName, OLDHDay, OLDHType, OLDHClass, OLDHStart, OLDHEnd); data.close(); //update(); mAdapter.notifyDataSetChanged(); mAdapter.finishUpdate(mPager); } }).setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); alert2 = builder2.create(); //added addDialog = new Dialog(this); addDialog.setCancelable(false); action = "insert"; addDialog.setTitle("Add Class"); addDialog.setContentView(R.layout.timetable_addhour); HType = (EditText) addDialog.findViewById(R.id.typeEdit); HClass = (EditText) addDialog.findViewById(R.id.classroomEdit); arraydays = new String[] { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }; HDay = (Spinner) addDialog.findViewById(R.id.day); arrayadapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, arraydays); arrayadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); HDay.setAdapter(arrayadapter); HDay.setOnItemSelectedListener(new OnItemSelectedListener() { public void onItemSelected(AdapterView<?> arg0, View arg1, int position, long id) { selectedDay = arraydays[position]; } public void onNothingSelected(AdapterView<?> arg0) { // TODO Auto-generated method stub } }); fromDialog = new TimePickerDialog(this, fromTimeSetListener, 12, 0, true); toDialog = new TimePickerDialog(this, toTimeSetListener, 12, 0, true); //This place is important. SName = (Spinner) addDialog.findViewById(R.id.SName); SName.setOnItemSelectedListener(new OnItemSelectedListener() { public void onItemSelected(AdapterView<?> arg0, View arg1, int position, long id) { selectedSubject = (String) arraySubjects[position]; Log.d("AB", "We are inside the setOnItemSelectedListener for Sname : 264"); Log.d("AB", selectedSubject); } public void onNothingSelected(AdapterView<?> arg0) { // TODO Auto-generated method stub } }); Button buttonFrom = (Button) addDialog.findViewById(R.id.buttonFrom); buttonFrom.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { fromDialog.show(); } }); Button buttonTo = (Button) addDialog.findViewById(R.id.buttonTo); buttonTo.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { toDialog.show(); } }); start = (TextView) addDialog.findViewById(R.id.start); end = (TextView) addDialog.findViewById(R.id.end); Button cancel = (Button) addDialog.findViewById(R.id.cancel); cancel.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { addDialog.cancel(); fromDialog.updateTime(12, 0); toDialog.updateTime(12, 0); start.setText("--:--"); end.setText("--:--"); HType.setText(null); HClass.setText(null); } }); Button ok = (Button) addDialog.findViewById(R.id.ok); ok.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { int HDay = SDay2IDay(selectedDay); if (action.equals("insert")) { data.open(); data.insertIntoHours(selectedSubject, HDay, HType.getText().toString(), HClass.getText().toString(), start.getText().toString(), end.getText().toString()); data.close(); } else if (action.equals("edit")) { data.open(); data.updateHours(OLDSName, OLDHType, OLDHClass, OLDHDay, OLDHStart, OLDHEnd, selectedSubject, HDay, HType.getText().toString(), HClass.getText().toString(), start.getText().toString(), end.getText().toString()); data.close(); } addDialog.cancel(); fromDialog.updateTime(12, 0); toDialog.updateTime(12, 0); start.setText("--:--"); end.setText("--:--"); HType.setText(null); HClass.setText(null); mAdapter.notifyDataSetChanged(); //update(); mAdapter.finishUpdate(mPager); } }); }
From source file:org.wso2.cdm.agent.AuthenticationActivity.java
public void showAgreement(String message, String title) { final Dialog dialog = new Dialog(context); dialog.setContentView(R.layout.custom_terms_popup); dialog.setTitle(CommonUtilities.EULA_TITLE); dialog.setCancelable(false);//w ww . j a v a 2 s . c om WebView web = (WebView) dialog.findViewById(R.id.webview); String html = "<html><body>" + message + "</body></html>"; String mime = "text/html"; String encoding = "utf-8"; web.loadDataWithBaseURL(null, html, mime, encoding, null); Button dialogButton = (Button) dialog.findViewById(R.id.dialogButtonOK); Button cancelButton = (Button) dialog.findViewById(R.id.dialogButtonCancel); dialogButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Preference.put(context, getResources().getString(R.string.shared_pref_isagreed), "1"); dialog.dismiss(); loadPincodeAcitvity(); } }); cancelButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); cancelEntry(); } }); dialog.setOnKeyListener(new DialogInterface.OnKeyListener() { @Override public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_SEARCH && event.getRepeatCount() == 0) { return true; } else if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) { return true; } return false; } }); dialog.show(); }
From source file:com.haibison.android.anhuu.utils.ui.bookmark.BookmarkFragment.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)); dialog.setCanceledOnTouchOutside(true); dialog.requestWindowFeature(Window.FEATURE_LEFT_ICON); dialog.setTitle(R.string.anhuu_f5be488d_title_bookmark_manager); dialog.setContentView(initContentView(dialog.getLayoutInflater(), null)); dialog.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.anhuu_f5be488d_bookmarks_dark); return dialog; }
From source file:com.prad.yahooweather.YahooWeatherActivity.java
private void showFacebookshareDialog(String okButotnText) { final Dialog dialog = new Dialog(this); dialog.setContentView(R.layout.dialog_layout); dialog.setTitle("Post to Facebook"); Button dialogButton = (Button) dialog.findViewById(R.id.cancel_dialog); // if button is clicked, close the custom dialog dialogButton.setOnClickListener(new OnClickListener() { @Override/*from w ww. ja v a 2s . c o m*/ public void onClick(View v) { dialog.dismiss(); } }); Button postButton = (Button) dialog.findViewById(R.id.post_to_facebook); postButton.setText(okButotnText); // if button is clicked, close the custom dialog postButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { onClickPostStatusUpdate(); dialog.dismiss(); } }); dialog.show(); }
From source file:com.ibm.hellotodoadvanced.MainActivity.java
/** * Launches a dialog for adding a new TodoItem. Called when plus button is tapped. * * @param view The plus button that is tapped. *///w ww . ja v a2 s . c om public void addTodo(View view) { final Dialog addDialog = new Dialog(this); // UI settings for dialog pop-up addDialog.setContentView(R.layout.add_edit_dialog); addDialog.setTitle("Add Todo"); TextView textView = (TextView) addDialog.findViewById(android.R.id.title); if (textView != null) { textView.setGravity(Gravity.CENTER); } addDialog.setCancelable(true); Button add = (Button) addDialog.findViewById(R.id.Add); addDialog.show(); // When done is pressed, send POST request to create TodoItem on Bluemix add.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { EditText itemToAdd = (EditText) addDialog.findViewById(R.id.todo); final String name = itemToAdd.getText().toString(); // If text was added, continue with normal operations if (!name.isEmpty()) { // Create JSON for new TodoItem, id should be 0 for new items String json = "{\"text\":\"" + name + "\",\"isDone\":false,\"id\":0}"; // Create POST request with the Bluemix Mobile Services SDK and set HTTP headers so Bluemix knows what to expect in the request Request request = new Request(bmsClient.getBluemixAppRoute() + "/api/Items", Request.POST); HashMap headers = new HashMap(); List<String> contentType = new ArrayList<>(); contentType.add("application/json"); List<String> accept = new ArrayList<>(); accept.add("Application/json"); headers.put("Content-Type", contentType); headers.put("Accept", accept); request.setHeaders(headers); request.send(getApplicationContext(), json, new ResponseListener() { // On success, update local list with new TodoItem @Override public void onSuccess(Response response) { Log.i(TAG, "Item " + name + " created successfully"); loadList(); } // On failure, log errors @Override public void onFailure(Response response, Throwable throwable, JSONObject extendedInfo) { String errorMessage = ""; if (response != null) { errorMessage += response.toString() + "\n"; } if (throwable != null) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); throwable.printStackTrace(pw); errorMessage += "THROWN" + sw.toString() + "\n"; } if (extendedInfo != null) { errorMessage += "EXTENDED_INFO" + extendedInfo.toString() + "\n"; } if (errorMessage.isEmpty()) errorMessage = "Request Failed With Unknown Error."; Log.e(TAG, "addTodo failed with error: " + errorMessage); } }); } // Close dialog when finished, or if no text was added addDialog.dismiss(); } }); }
From source file:com.ibm.hellotodoadvanced.MainActivity.java
/** * Launches a dialog for updating the TodoItem name. Called when the list item is tapped. * * @param view The TodoItem that is tapped. *///from w w w. j av a 2s . c om public void editTodoName(View view) { // Gets position in list view of tapped item final Integer position = mListView.getPositionForView(view); final Dialog editDialog = new Dialog(this); // UI settings for dialog pop-up editDialog.setContentView(R.layout.add_edit_dialog); editDialog.setTitle("Edit Todo"); TextView textView = (TextView) editDialog.findViewById(android.R.id.title); if (textView != null) { textView.setGravity(Gravity.CENTER); } editDialog.setCancelable(true); EditText currentText = (EditText) editDialog.findViewById(R.id.todo); // Get selected TodoItem values final String name = mTodoItemList.get(position).text; final boolean isDone = mTodoItemList.get(position).isDone; final int id = mTodoItemList.get(position).idNumber; currentText.setText(name); Button editDone = (Button) editDialog.findViewById(R.id.Add); editDialog.show(); // When done is pressed, send PUT request to update TodoItem on Bluemix editDone.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { EditText editedText = (EditText) editDialog.findViewById(R.id.todo); final String updatedName = editedText.getText().toString(); // If new text is not empty, create JSON with updated info and send PUT request if (!updatedName.isEmpty()) { String json = "{\"text\":\"" + updatedName + "\",\"isDone\":" + isDone + ",\"id\":" + id + "}"; // Create PUT REST request using Bluemix Mobile Services SDK and set HTTP headers so Bluemix knows what to expect in the request Request request = new Request(bmsClient.getBluemixAppRoute() + "/api/Items", Request.PUT); HashMap headers = new HashMap(); List<String> contentType = new ArrayList<>(); contentType.add("application/json"); List<String> accept = new ArrayList<>(); accept.add("Application/json"); headers.put("Content-Type", contentType); headers.put("Accept", accept); request.setHeaders(headers); request.send(getApplicationContext(), json, new ResponseListener() { // On success, update local list with updated TodoItem @Override public void onSuccess(Response response) { Log.i(TAG, "Item " + updatedName + " updated successfully"); loadList(); } // On failure, log errors @Override public void onFailure(Response response, Throwable throwable, JSONObject extendedInfo) { String errorMessage = ""; if (response != null) { errorMessage += response.toString() + "\n"; } if (throwable != null) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); throwable.printStackTrace(pw); errorMessage += "THROWN" + sw.toString() + "\n"; } if (extendedInfo != null) { errorMessage += "EXTENDED_INFO" + extendedInfo.toString() + "\n"; } if (errorMessage.isEmpty()) errorMessage = "Request Failed With Unknown Error."; Log.e(TAG, "editTodoName failed with error: " + errorMessage); } }); } editDialog.dismiss(); } }); }