List of usage examples for android.app AlertDialog.Builder setCustomTitle
public void setCustomTitle(View customTitleView)
From source file:at.wada811.android.dialogfragments.AlertDialogFragment.java
private void setCustomTitle(AlertDialog.Builder builder) { DialogFragmentCallback listener = getDialogFragmentCallback(); if (listener == null) { throw new RuntimeException("DialogEventListenerPovider has not implemented."); }//from www. java 2 s. c o m View view = listener.getCustomTitle(this); if (view == null) { throw new NullPointerException("DialogEventListener#getCustomTitle returns null."); } builder.setCustomTitle(view); }
From source file:jp.co.noxi.app.NXAlertDialog.java
private void setCustomTitle(AlertDialog.Builder builder) { final TitleViewDelegate delegate = findListenerByTag(TitleViewDelegate.class, ARG_CUSTOM_TITLE); if (delegate == null) { return;//w ww . j a v a 2 s. c o m } builder.setCustomTitle(delegate.getTitleView(this)); }
From source file:com.corporatetaxi.TaxiOntheWay_Activity.java
public void caceldialog() { AlertDialog.Builder builder = new AlertDialog.Builder(TaxiOntheWay_Activity.this); //builder.setTitle(getString(R.string.cancel_trip)); //builder.setIcon(R.drawable.ic_launcher); LayoutInflater inflater = getLayoutInflater(); View header = inflater.inflate(R.layout.dialog_heading, null); TextView textView = (TextView) header.findViewById(R.id.text); ImageView icon = (ImageView) header.findViewById(R.id.icon); icon.setImageResource(R.drawable.ic_launcher); textView.setText("Taxi On The Way"); builder.setCustomTitle(header); builder.setCancelable(false);/*from w w w .j ava2s.c o m*/ builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // AppPreferences.setTripId(DrawerMainActivity.this, ""); // AppPreferences.setDriverId(DrawerMainActivity.this, ""); dialog.dismiss(); } }); builder.show(); }
From source file:com.corporatetaxi.TaxiArrived_Acitivity.java
public void caceldialog() { AlertDialog.Builder builder = new AlertDialog.Builder(TaxiArrived_Acitivity.this); AppPreferences.setApprequestTaxiScreen(TaxiArrived_Acitivity.this, false); LayoutInflater inflater = getLayoutInflater(); View header = inflater.inflate(R.layout.dialog_heading, null); TextView textView = (TextView) header.findViewById(R.id.text); ImageView icon = (ImageView) header.findViewById(R.id.icon); icon.setImageResource(R.drawable.ic_launcher); textView.setText("Taxi Has Arrived"); builder.setCustomTitle(header); builder.setCancelable(false);/* ww w .j a va 2 s.co m*/ builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } }); builder.show(); }
From source file:com.example.drugsformarinemammals.Dose_Information.java
private void displayMessage(String messageTitle, String message) { AlertDialog.Builder myalert = new AlertDialog.Builder(this); TextView title = new TextView(this); title.setTypeface(Typeface.SANS_SERIF); title.setTextSize(20);//from www. ja va2 s .c om title.setTextColor(getResources().getColor(R.color.blue)); title.setPadding(8, 8, 8, 8); title.setText("Synchronization"); title.setGravity(Gravity.CENTER_VERTICAL); LinearLayout layout = new LinearLayout(this); TextView text = new TextView(this); text.setTypeface(Typeface.SANS_SERIF); text.setTextSize(20); text.setPadding(10, 10, 10, 10); text.setText(message); layout.addView(text); myalert.setView(layout); myalert.setCustomTitle(title); myalert.setCancelable(true); myalert.show(); }
From source file:com.app.blockydemo.ui.adapter.BrickAdapter.java
@Override public void onClick(final View view) { if (!viewSwitchLock.tryLock()) { return;//from w w w .j a v a 2 s . c om } animatedBricks.clear(); final int itemPosition = calculateItemPositionAndTouchPointY(view); final List<CharSequence> items = new ArrayList<CharSequence>(); if (brickList.get(itemPosition) instanceof ScriptBrick) { int scriptIndex = getScriptIndexFromProject(itemPosition); ProjectManager.getInstance().setCurrentScript(sprite.getScript(scriptIndex)); } if (!(brickList.get(itemPosition) instanceof DeadEndBrick) && !(brickList.get(itemPosition) instanceof ScriptBrick)) { items.add(context.getText(R.string.brick_context_dialog_move_brick)); } if (brickList.get(itemPosition) instanceof NestingBrick) { items.add(context.getText(R.string.brick_context_dialog_animate_bricks)); } if (!(brickList.get(itemPosition) instanceof ScriptBrick)) { items.add(context.getText(R.string.brick_context_dialog_copy_brick)); items.add(context.getText(R.string.brick_context_dialog_delete_brick)); } else { items.add(context.getText(R.string.brick_context_dialog_edit_script_name)); items.add(context.getText(R.string.brick_context_dialog_delete_script)); } if (brickList.get(itemPosition) instanceof FormulaBrick) { items.add(context.getText(R.string.brick_context_dialog_formula_edit_brick)); } AlertDialog.Builder builder = new AlertDialog.Builder(context); boolean drawingCacheEnabled = view.isDrawingCacheEnabled(); view.setDrawingCacheEnabled(true); view.setDrawingCacheBackgroundColor(Color.TRANSPARENT); view.buildDrawingCache(true); if (view.getDrawingCache() != null) { Bitmap bitmap = Bitmap.createBitmap(view.getDrawingCache()); view.setDrawingCacheEnabled(drawingCacheEnabled); ImageView imageView = dragAndDropListView.getGlowingBorder(bitmap); builder.setCustomTitle(imageView); } builder.setItems(items.toArray(new CharSequence[items.size()]), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int item) { CharSequence clickedItemText = items.get(item); if (clickedItemText.equals(context.getText(R.string.brick_context_dialog_move_brick))) { view.performLongClick(); } else if (clickedItemText.equals(context.getText(R.string.brick_context_dialog_copy_brick))) { copyBrickListAndProject(itemPosition); } else if (clickedItemText.equals(context.getText(R.string.brick_context_dialog_delete_brick)) || clickedItemText.equals(context.getText(R.string.brick_context_dialog_delete_script))) { showConfirmDeleteDialog(itemPosition); } else if (clickedItemText.equals(context.getText(R.string.brick_context_dialog_animate_bricks))) { int itemPosition = calculateItemPositionAndTouchPointY(view); Brick brick = brickList.get(itemPosition); if (brick instanceof NestingBrick) { List<NestingBrick> list = ((NestingBrick) brick).getAllNestingBrickParts(true); for (Brick tempBrick : list) { animatedBricks.add(tempBrick); } } notifyDataSetChanged(); } else if (clickedItemText .equals(context.getText(R.string.brick_context_dialog_formula_edit_brick))) { if (brickList.get(itemPosition) instanceof FormulaBrick) { FormulaEditorFragment.showFragment(view, brickList.get(itemPosition), ((FormulaBrick) brickList.get(itemPosition)).getFormula()); } } else if (clickedItemText .equals(context.getText(R.string.brick_context_dialog_edit_script_name))) { ScriptNameDialog dialog2 = new ScriptNameDialog( ProjectManager.getInstance().getCurrentScript()); dialog2.show(((FragmentActivity) view.getContext()).getSupportFragmentManager(), ScriptNameDialog.DIALOG_FRAGMENT_TAG); initBrickList(); notifyDataSetChanged(); notifyDataSetInvalidated(); } } }); AlertDialog alertDialog = builder.create(); if ((selectMode == ListView.CHOICE_MODE_NONE)) { alertDialog.show(); } }
From source file:org.mozilla.gecko.GeckoApp.java
/** * @param aPermissions//from w w w .j a v a 2 s .com * Array of JSON objects to represent site permissions. * Example: { type: "offline-app", setting: "Store Offline Data: Allow" } */ private void showSiteSettingsDialog(String aHost, JSONArray aPermissions) { final AlertDialog.Builder builder = new AlertDialog.Builder(this); View customTitleView = getLayoutInflater().inflate(R.layout.site_setting_title, null); ((TextView) customTitleView.findViewById(R.id.title)).setText(R.string.site_settings_title); ((TextView) customTitleView.findViewById(R.id.host)).setText(aHost); builder.setCustomTitle(customTitleView); // If there are no permissions to clear, show the user a message about that. // In the future, we want to disable the menu item if there are no permissions to clear. if (aPermissions.length() == 0) { builder.setMessage(R.string.site_settings_no_settings); } else { // Eventually we should use a list adapter and custom checkable list items // to make a two-line UI to match the mock-ups CharSequence[] items = new CharSequence[aPermissions.length()]; boolean[] states = new boolean[aPermissions.length()]; for (int i = 0; i < aPermissions.length(); i++) { try { items[i] = aPermissions.getJSONObject(i).getString("setting"); // Make all the items checked by default states[i] = true; } catch (JSONException e) { Log.i(LOGTAG, "JSONException: " + e); } } builder.setMultiChoiceItems(items, states, new DialogInterface.OnMultiChoiceClickListener() { public void onClick(DialogInterface dialog, int item, boolean state) { // Do nothing } }); builder.setPositiveButton(R.string.site_settings_clear, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { ListView listView = ((AlertDialog) dialog).getListView(); SparseBooleanArray checkedItemPositions = listView.getCheckedItemPositions(); // An array of the indices of the permissions we want to clear JSONArray permissionsToClear = new JSONArray(); for (int i = 0; i < checkedItemPositions.size(); i++) { boolean checked = checkedItemPositions.get(i); if (checked) permissionsToClear.put(i); } GeckoAppShell.sendEventToGecko( GeckoEvent.createBroadcastEvent("Permissions:Clear", permissionsToClear.toString())); } }); } builder.setNegativeButton(R.string.site_settings_cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); mMainHandler.post(new Runnable() { public void run() { builder.create().show(); } }); }
From source file:com.guardtrax.ui.screens.HomeScreen.java
private void displaytourInfo() { String message = ""; int i = 0;/*w w w . j a va 2 s . com*/ int tagCount = 0; boolean singleDisplay = false; //indicates that only 1 item is to be displayed in the tour list List<Boolean> tourtagsIncluded = new ArrayList<Boolean>(); List<Boolean> tourtagsScanned = new ArrayList<Boolean>(); List<Integer> tourOrder = new ArrayList<Integer>(); List<String> messageList = new ArrayList<String>(); //check if this is a single display (second last character of tour name is a space) singleDisplay = isSingleRandomTour(); tourDB.open(); Cursor c = tourDB.getRecordByTour(GTConstants.tourName); if (c != null && c.moveToFirst()) { tourtagsScanned = refreshtourtagList(c.getCount(), false, true, false, false); tourtagsIncluded = refreshtourtagList(c.getCount(), false, false, true, false); tourOrder = gettourOrder(c.getCount()); //initialize the message array which wil be used to display the messages in the random order while (messageList.size() < c.getCount()) messageList.add(""); for (i = 0; i < c.getCount(); i++) { if (tourtagsScanned.get(i) && tourtagsIncluded.get(i) && !singleDisplay) messageList.add(tourOrder.get(i), "<br><font color='#00FF00'>" + c.getString(2) + "</font><br/>"); else if (!tourtagsScanned.get(i) && !Utility.istourOntime(tourEnd) && Utility.getcurrentState().equals(GTConstants.onShift) && tourtagsIncluded.get(i) && !singleDisplay) messageList.add(tourOrder.get(i), "<br><font color='#FF0000'>" + c.getString(2) + "</font><br/>"); else if (!tourtagsScanned.get(i) && tourtagsIncluded.get(i) && !singleDisplay) messageList.add(tourOrder.get(i), "<br><font color='#FFFFFF'>" + c.getString(2) + "</font><br/>"); else if (singleDisplay && i == touritemNumber) messageList.add(tourOrder.get(i), "<br><font color='#FFFFFF'>" + c.getString(2) + "</font><br/>"); //get the number of tags included if (tourtagsIncluded.get(i)) tagCount++; c.moveToNext(); } } tourDB.close(); //create the message string for (i = 0; i < messageList.size(); i++) if (messageList.get(i).length() > 1) message = message + messageList.get(i); LayoutInflater inflater = LayoutInflater.from(HomeScreen.this); View view = inflater.inflate(R.layout.scroll_dialog, null); TextView textview = (TextView) view.findViewById(R.id.dialogtext); textview.setText(Html.fromHtml(message)); AlertDialog.Builder alertDialog = new AlertDialog.Builder(HomeScreen.this); //create custom title TextView title = new TextView(HomeScreen.this); //if this is a single display tour then do not indicate how many tags are in the tour if (isSingleRandomTour()) //this is a single display tour title.setText(GTConstants.tourName + CRLF + tourTime + CRLF); else title.setText(GTConstants.tourName + CRLF + tourTime + CRLF + String.valueOf(tagCount) + " Tags"); title.setPadding(10, 10, 10, 10); title.setGravity(Gravity.CENTER); title.setTextColor(Color.parseColor("#79ABFF")); title.setTextSize(20); alertDialog.setCustomTitle(title); //alertDialog.setTitle(tourName + CRLF + String.valueOf(i-1) + " Tags"); alertDialog.setView(view); alertDialog.setPositiveButton("OK", null); AlertDialog alert = alertDialog.create(); alert.show(); }