List of usage examples for android.widget Button Button
public Button(Context context)
From source file:com.health.openscale.gui.TableFragment.java
@Override public void updateOnView(ArrayList<ScaleData> scaleDataList) { TableRow headerRow = (TableRow) tableView.findViewById(R.id.tableHeader); tableDataView.removeAllViews();/* www . j a v a 2s . c o m*/ tableDataView.addView(headerRow); for (ScaleData scaleData : scaleDataList) { TableRow dataRow = new TableRow(tableView.getContext()); dataRow.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); TextView idView = new TextView(tableView.getContext()); idView.setText(Long.toString(scaleData.id)); idView.setVisibility(View.GONE); dataRow.addView(idView); TextView dateTextView = new TextView(tableView.getContext()); if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE || (getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE) { dateTextView.setText(new SimpleDateFormat("dd. MMM yyyy (EE)").format(scaleData.date_time)); } else { dateTextView.setText(new SimpleDateFormat("dd/MM/yy").format(scaleData.date_time)); } dateTextView.setPadding(0, 5, 5, 5); dataRow.addView(dateTextView); TextView timeTextView = new TextView(tableView.getContext()); timeTextView.setText(new SimpleDateFormat("HH:mm").format(scaleData.date_time)); timeTextView.setPadding(0, 5, 5, 5); dataRow.addView(timeTextView); TextView weightView = new TextView(tableView.getContext()); weightView.setText(Float.toString(scaleData.weight)); weightView.setPadding(0, 5, 5, 5); dataRow.addView(weightView); TextView fatView = new TextView(tableView.getContext()); fatView.setText(Float.toString(scaleData.fat)); fatView.setPadding(0, 5, 5, 5); dataRow.addView(fatView); TextView waterView = new TextView(tableView.getContext()); waterView.setText(Float.toString(scaleData.water)); waterView.setPadding(0, 5, 5, 5); dataRow.addView(waterView); TextView muscleView = new TextView(tableView.getContext()); muscleView.setText(Float.toString(scaleData.muscle)); muscleView.setPadding(0, 5, 5, 5); dataRow.addView(muscleView); Button deleteButton = new Button(tableView.getContext()); deleteButton.setText("X"); deleteButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 10); deleteButton.setTextColor(Color.WHITE); deleteButton.setBackgroundResource(R.drawable.flat_selector); deleteButton.setGravity(Gravity.CENTER); deleteButton.setPadding(0, 0, 0, 0); deleteButton.setMinimumHeight(35); deleteButton.setHeight(35); deleteButton.setOnClickListener(new onClickListenerDelete()); dataRow.addView(deleteButton); if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) != Configuration.SCREENLAYOUT_SIZE_XLARGE && (getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) != Configuration.SCREENLAYOUT_SIZE_LARGE) { dateTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11); timeTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11); weightView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11); fatView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11); waterView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11); muscleView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11); } tableDataView.addView(dataRow, new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); } }
From source file:org.cvasilak.jboss.mobile.app.fragments.RuntimeViewFragment.java
private void buildTable() { Map<String, List<String>> table = new HashMap<String, List<String>>(); table.put("Server Status", Arrays.asList("Configuration", "JVM")); List<String> metrics = new ArrayList<String>( Arrays.asList("Data Sources", "JMS Destinations", "Transactions")); // 'Web' section metrics is compatible (for now) only with MANAGEMENT_VERSION_1 // TODO ('Undertow' subsystem metrics can possible replace) if (application.getOperationsManager() .getVersion() == JBossOperationsManager.ManagementVersion.MANAGEMENT_VERSION_1) { metrics.add("Web"); }//from w ww. j a v a2 s . co m table.put("Subsystem Metrics", metrics); if (application.getOperationsManager().isDomainController()) { table.put("Deployments", Arrays.asList("Deployment Content", "Server Groups")); } else { table.put("Deployments", Arrays.asList("Manage Deployments")); } MergeAdapter adapter = new MergeAdapter(); // cater for domain mode and display a button // for the user to change the active server if (application.getOperationsManager().isDomainController()) { chooseServer = new Button(getActivity()); chooseServer.setText(application.getOperationsManager().getDomainHost() + ":" + application.getOperationsManager().getDomainServer()); chooseServer.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_servers_selection, 0); chooseServer.setTypeface(null, Typeface.ITALIC); chooseServer.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showDomainHostChooser(); } }); adapter.addView(chooseServer); } for (Map.Entry<String, List<String>> entry : table.entrySet()) { // add section header TextView section = new TextView(getActivity()); section.setBackgroundColor(Color.DKGRAY); section.setPadding(15, 10, 0, 10); section.setText(entry.getKey()); adapter.addView(section); // add section data adapter.addAdapter( new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1, entry.getValue())); } setListAdapter(adapter); }
From source file:com.hichinaschool.flashcards.anki.multimediacard.activity.MultimediaCardEditorActivity.java
/** * Creates a TabBar in case action bar is not present as well as other UI Elements *//*from w w w .j a v a 2s . c o m*/ private void initUI() { int currentapiVersion = android.os.Build.VERSION.SDK_INT; if (currentapiVersion <= android.os.Build.VERSION_CODES.GINGERBREAD_MR1) { LinearLayout linearLayout = (LinearLayout) findViewById(R.id.LinearLayoutForSpareMenu); createSpareMenu(linearLayout); } mEditorLayout = (LinearLayout) findViewById(R.id.LinearLayoutInScrollView); LinearLayout mToolsLayout = (LinearLayout) findViewById(R.id.LinearLayoutForButtons); LayoutParams pars = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, 1); Button swapButton = new Button(this); swapButton.setText(gtxt(R.string.multimedia_editor_activity_swap_button)); mToolsLayout.addView(swapButton, pars); swapButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { swap(); } }); LinearLayout mButtonsLayout = new LinearLayout(this); mButtonsLayout.setOrientation(LinearLayout.HORIZONTAL); mToolsLayout.addView(mButtonsLayout, pars); pars = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 1); // DEPRECATED< BUT USED IN THE PROJECT. mModelButton = new Button(this); mModelButton.setOnClickListener(new OnClickListener() { @SuppressWarnings("deprecation") @Override public void onClick(View v) { showDialog(DIALOG_MODEL_SELECT); } }); mButtonsLayout.addView(mModelButton, pars); mDeckButton = new Button(this); mDeckButton.setOnClickListener(new OnClickListener() { @SuppressWarnings("deprecation") @Override public void onClick(View v) { showDialog(DIALOG_DECK_SELECT); } }); mButtonsLayout.addView(mDeckButton, pars); }
From source file:com.matthewtamlin.sliding_intro_screen_manual_testing.TestButtonConfig.java
/** * @return a Button which modifies the appearance/behaviour of the buttons and verifies that the * changes are correct//from ww w .j a v a 2 s.c om */ private Button createModifyAppearanceAndBehaviourButton() { final Button button = new Button(this); button.setText("Modify appearance and behaviour"); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { makeChanges(); checkChanges(); } }); return button; }
From source file:com.java2s.intents4.IntentsDemo4Activity.java
void addRow(final LinearLayout layout, String label, String hintStr, boolean addRadioGroup) { LinearLayout.LayoutParams rowLayoutParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams editTextLayoutParams = new LinearLayout.LayoutParams(400, LinearLayout.LayoutParams.WRAP_CONTENT, 1); if (addRadioGroup) { editTextLayoutParams = new LinearLayout.LayoutParams(400, LinearLayout.LayoutParams.WRAP_CONTENT, 1); }//from w w w .j a v a 2 s .c o m LinearLayout.LayoutParams buttonLayoutParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT, 0); LinearLayout row = new LinearLayout(this); row.setOrientation(LinearLayout.HORIZONTAL); row.setGravity(Gravity.CENTER_VERTICAL); TextView textView = new TextView(this); textView.setText(label); row.addView(textView); EditText editText = new EditText(this); editText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12); editText.setHint(hintStr); editText.setLayoutParams(editTextLayoutParams); if (!isFirstTime) { editText.requestFocus(); } row.addView(editText); if (addRadioGroup) { LinearLayout groupLayout = new LinearLayout(this); groupLayout.setOrientation(LinearLayout.VERTICAL); groupLayout.setGravity(Gravity.CENTER_HORIZONTAL); RadioGroup group = new RadioGroup(this); group.setLayoutParams(new RadioGroup.LayoutParams(RadioGroup.LayoutParams.WRAP_CONTENT, RadioGroup.LayoutParams.WRAP_CONTENT)); final Button patternButton = new Button(this); patternButton.setText(pathPatterns[0]); patternButton.setTextSize(8); patternButton.setLayoutParams(buttonLayoutParams); patternButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String patternButtonText = patternButton.getText().toString().trim(); if (patternButtonText.equals(pathPatterns[0])) { patternButton.setText(pathPatterns[1]); } else if (patternButtonText.equals(pathPatterns[1])) { patternButton.setText(pathPatterns[2]); } else if (patternButtonText.equals(pathPatterns[2])) { patternButton.setText(pathPatterns[0]); } } }); groupLayout.addView(patternButton); row.addView(groupLayout); } Button button = new Button(this); button.setTextSize(10); button.setTypeface(null, Typeface.BOLD); button.setText("X"); button.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD); button.setLayoutParams(buttonLayoutParams); button.setOnClickListener(new OnClickListener() { public void onClick(View view) { layout.removeView((LinearLayout) view.getParent()); } }); row.addView(button); row.setLayoutParams(rowLayoutParams); layout.addView(row); }
From source file:org.odk.collect.android.widgets.DrawWidget.java
private void setupScreen() { setOrientation(LinearLayout.VERTICAL); // Retrieve answer from data model and update ui mBinaryName = mPrompt.getAnswerText(); // Set location of folder containing answer mInstanceFolder = FormEntryActivity.mInstancePath.substring(0, FormEntryActivity.mInstancePath.lastIndexOf("/") + 1); // Error text, if needed mErrorTextView = new TextView(getContext()); mErrorTextView.setText("Selected file is not a valid image"); LayoutParams layoutParams = new TableLayout.LayoutParams(); layoutParams.setMargins(7, 5, 7, 5); mCaptureButton = new Button(getContext()); mCaptureButton.setText(getCapturePrompt()); mCaptureButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mAnswerFontsize); mCaptureButton.setPadding(20, 20, 20, 20); mCaptureButton.setEnabled(!mPrompt.isReadOnly()); mCaptureButton.setLayoutParams(layoutParams); // Launch capture intent on click mCaptureButton.setOnClickListener(new View.OnClickListener() { @Override/*from w w w .j a v a 2s . c o m*/ public void onClick(View v) { mWaitingForData = true; mErrorTextView.setVisibility(View.GONE); File tmp = new File( FileUtilsExtended.EXTERNAL_CACHE + File.separator + FileUtilsExtended.CAPTURED_IMAGE_FILE); // Copy existing image into temporary slot (edit existing image) if (mBinaryName == null) { // Remove this file if it's still sitting around tmp.delete(); } else { try { org.apache.commons.io.FileUtils.copyFile(new File(mInstanceFolder, mBinaryName), tmp); } catch (IOException e) { Log.e(Collect.LOGTAG, t + "unable to copy existing binary image to temporary location: " + e.toString()); e.printStackTrace(); } } Intent i = new Intent(getContext(), DrawActivity.class); i.putExtra(DrawActivity.KEY_DRAW_MODE, mDrawMode); i.putExtra(DrawActivity.KEY_OUTPUT_URI, Uri.fromFile(tmp)); ((Activity) getContext()).startActivityForResult(i, FormEntryActivity.IMAGE_CAPTURE); } }); addView(mCaptureButton); // Proceed to add the imageView only if the user has taken a picture if (mBinaryName == null) return; // Below taken from ImageWidget (w/o onClick for loading a larger image) mImageView = new ImageView(getContext()); Display display = ((WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE)) .getDefaultDisplay(); int screenWidth = display.getWidth(); int screenHeight = display.getHeight(); File f = new File(mInstanceFolder + "/" + mBinaryName); if (f.exists()) { Bitmap bmp = FileUtils.getBitmapScaledToDisplay(f, screenHeight, screenWidth); if (bmp == null) { mErrorTextView.setVisibility(View.VISIBLE); } mImageView.setImageBitmap(bmp); } else { mImageView.setImageBitmap(null); } mImageView.setPadding(10, 10, 10, 10); mImageView.setAdjustViewBounds(true); addView(mImageView); }
From source file:com.mifos.mifosxdroid.dialogfragments.datatablerowdialog.DataTableRowDialogFragment.java
private void addSaveButton() { Button bt_processForm = new Button(getActivity()); bt_processForm.setLayoutParams(FormWidget.defaultLayoutParams); bt_processForm.setText(getString(R.string.save)); bt_processForm.setBackgroundColor(getActivity().getResources().getColor(R.color.blue_dark)); linearLayout.addView(bt_processForm); bt_processForm.setOnClickListener(new View.OnClickListener() { @Override/*from w w w . j a v a 2 s.com*/ public void onClick(View v) { try { onSaveActionRequested(); } catch (RequiredFieldException e) { Log.d(LOG_TAG, e.getMessage()); } } }); }
From source file:com.matthewtamlin.sliding_intro_screen_manual_testing.TestPageLock.java
/** * @return creates a Button which locks the ViewPager from commands *//*ww w. j a va 2s. c o m*/ private Button createLockCommandButton() { final Button button = new Button(this); button.setText("Lock to commands"); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { setPagingLockMode(LockableViewPager.LockMode.COMMAND_LOCKED); } }); return button; }
From source file:fiskinfoo.no.sintef.fiskinfoo.CardViewFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View rootView = inflater.inflate(R.layout.fragment_card_view, container, false); RelativeLayout textAreaPlaceHolder = (RelativeLayout) rootView.findViewById(R.id.card_view_container); TextView title = (TextView) rootView.findViewById(R.id.card_view_title_text_view); if (subscription != null) { title.setText(subscription.GeoDataServiceName); TextView idView = generateTextViewWithText("id: " + subscription.Id, title); TextView geoDataServiceNameView = generateTextViewWithText( "Navn p kartlaget: " + subscription.GeoDataServiceName, idView); TextView fileFormatTypeView = generateTextViewWithText("Filformat: " + subscription.FileFormatType, geoDataServiceNameView); TextView userEmailView = generateTextViewWithText("Bruker e-post: " + subscription.UserEmail, fileFormatTypeView);//from w w w . ja v a 2 s.c o m TextView subscriptionEmailView = generateTextViewWithText( "Abbonents e-post: " + subscription.SubscriptionEmail, userEmailView); TextView subscriptionIntervalNameView = generateTextViewWithText( "Kartet sendes: " + subscription.SubscriptionIntervalName, subscriptionEmailView); TextView createdView = generateTextViewWithText("Opprettet: " + subscription.Created, subscriptionIntervalNameView); TextView lastModifiedView = generateTextViewWithText("Sist oppdatert: " + subscription.LastModified, createdView); textAreaPlaceHolder.addView(idView); textAreaPlaceHolder.addView(geoDataServiceNameView); textAreaPlaceHolder.addView(fileFormatTypeView); textAreaPlaceHolder.addView(userEmailView); textAreaPlaceHolder.addView(subscriptionEmailView); textAreaPlaceHolder.addView(subscriptionIntervalNameView); textAreaPlaceHolder.addView(createdView); textAreaPlaceHolder.addView(lastModifiedView); } if (propertyDescription != null) { title.setText(propertyDescription.Name); Button notificationIconButton = (Button) rootView.findViewById(R.id.card_notification_image_view); CardViewInformationRow row; Button downloadMapButton; Button showOnMapButton; final ScrollView scrollView = (ScrollView) rootView.findViewById(R.id.card_view_scroll_view); final LinearLayout informationContainer = (LinearLayout) rootView .findViewById(R.id.card_view_information_container); LinearLayout bottomButtonContainer = (LinearLayout) rootView.findViewById(R.id.bottom_button_container); showOnMapButton = new Button(getActivity()); downloadMapButton = (Button) rootView.findViewById(R.id.card_view_download_map_button); row = utilityRows.getCardViewInformationRow(getActivity(), getString(R.string.last_updated), propertyDescription.LastUpdated.replace('T', ' '), true); informationContainer.addView(row.getView()); String description = (propertyDescription.LongDescription == null || propertyDescription.LongDescription.trim().equals("")) ? propertyDescription.Description : propertyDescription.LongDescription; String hyperlink = null; description = description.replace("<p>", ""); description = description.replace("</p>", ""); // TODO: should rewrite in order to handle multiple links. if (description.contains("<a href=\"")) { hyperlink = "<a href='" + description.substring(description.indexOf("href=") + 6, description.indexOf(">", description.indexOf("href=")) - 1) + "'>" + "\t\t\t* " + getString(R.string.see_more_info) + "</a>"; description = description.substring(0, description.indexOf("<a href")) + description.substring(description.indexOf(">", description.indexOf("<a href")) + 1, description.indexOf("</a")) + "*" + (description.indexOf("a>") > description.length() - 3 ? "" : description.substring(description.indexOf("a>") + 2, description.length())); } row = utilityRows.getCardViewInformationRow(getActivity(), getString(R.string.information), description, true); informationContainer.addView(row.getView()); if (hyperlink != null) { TextView textView = new TextView(getActivity()); textView.setClickable(true); textView.setMovementMethod(LinkMovementMethod.getInstance()); textView.setText(Html.fromHtml(hyperlink)); textView.setTextSize(getResources().getInteger(R.integer.hyperlinkTextSize)); informationContainer.addView(textView); } String updateFrequency = (propertyDescription.UpdateFrequencyText == null || propertyDescription.UpdateFrequencyText.trim().equals("")) ? getString(R.string.update_frequency_not_available) : propertyDescription.UpdateFrequencyText; row = utilityRows.getCardViewInformationRow(getActivity(), getString(R.string.update_frequency), updateFrequency, true); informationContainer.addView(row.getView()); if (ApiErrorType.getType(propertyDescription.ErrorType) == ApiErrorType.WARNING) { row = utilityRows.getCardViewInformationRow(getActivity(), getString(R.string.error_text), propertyDescription.ErrorText, true); final View dataField = row.getView(); final Animation animation = getBlinkAnimation(); notificationIconButton.setVisibility(View.VISIBLE); notificationIconButton .setBackground(ContextCompat.getDrawable(getActivity(), R.drawable.ic_warning_black_36dp)); row.setTextColor(getResources().getColor(R.color.warning_orange)); notificationIconButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { focusOnView(scrollView, dataField); dataField.startAnimation(animation); } }); informationContainer.addView(row.getView()); } else if (ApiErrorType.getType(propertyDescription.ErrorType) == ApiErrorType.WARNING) { row = utilityRows.getCardViewInformationRow(getActivity(), getString(R.string.error_text), propertyDescription.ErrorText, true); final TextView dataField = row.getFieldDataTextView(); final Animation animation = getBlinkAnimation(); notificationIconButton.setVisibility(View.VISIBLE); notificationIconButton.setBackground( ContextCompat.getDrawable(getActivity(), R.drawable.ic_error_outline_black_36dp)); row.setTextColor(getResources().getColor(R.color.error_red)); notificationIconButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { focusOnView(scrollView, dataField); dataField.startAnimation(animation); } }); informationContainer.addView(row.getView()); } row = utilityRows.getCardViewInformationRow(getActivity(), getString(R.string.data_owner), propertyDescription.DataOwner, true); informationContainer.addView(row.getView()); if (propertyDescription.DataOwnerLink != null && !propertyDescription.DataOwnerLink.trim().equals("")) { String partnerLink = (propertyDescription.DataOwnerLink.contains("http") || propertyDescription.DataOwnerLink.contains("www")) ? "<a href='" + propertyDescription.DataOwnerLink + "'>" + propertyDescription.DataOwnerLink + "</a>" : "<a href='" + getString(R.string.about_partners_base_address) + propertyDescription.DataOwnerLink + "'>" + getString(R.string.about_partners_base_address) + propertyDescription.DataOwnerLink + "</a>"; row = utilityRows.getCardViewInformationRow(getActivity(), getString(R.string.data_owner_link), partnerLink, true); row.setHyperlink(partnerLink); row.getFieldDataTextView().setMovementMethod(LinkMovementMethod.getInstance()); informationContainer.addView(row.getView()); } StringBuilder stringBuilder = new StringBuilder(); for (String format : propertyDescription.Formats) { stringBuilder.append(format); stringBuilder.append("\n"); } row = utilityRows.getCardViewInformationRow(getActivity(), getString(R.string.formats), stringBuilder.toString().trim(), false); informationContainer.addView(row.getView()); stringBuilder.setLength(0); for (String interval : propertyDescription.SubscriptionInterval) { stringBuilder.append(SubscriptionInterval.getType(interval).toString()); stringBuilder.append("\n"); } row = utilityRows.getCardViewInformationRow(getActivity(), getString(R.string.subscription_frequencies), stringBuilder.toString().trim(), false); informationContainer.addView(row.getView()); row = utilityRows.getCardViewInformationRow(getActivity(), getString(R.string.map_creation_date), propertyDescription.Created.substring(0, propertyDescription.Created.indexOf('T')), true); informationContainer.addView(row.getView()); LinearLayout.LayoutParams bottomButtonLayoutParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); bottomButtonLayoutParams.gravity = Gravity.CENTER_VERTICAL; bottomButtonLayoutParams.weight = (float) 0.5; showOnMapButton.setLayoutParams(bottomButtonLayoutParams); showOnMapButton.setText(getString(R.string.show_on_map)); showOnMapButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //TODO: Need to update the toolbar as well. List<String> layersList = new ArrayList<>(); String layerName = propertyDescription.Name; layersList.add("Grunnkart"); layersList.add(layerName); user.setActiveLayers(layersList); user.writeToSharedPref(getActivity()); getFragmentManager().beginTransaction().replace(R.id.fragment_container, new FiskInfoUtility().createFragment(MapFragment.TAG, user, TAG), MapFragment.TAG) .addToBackStack(null).commit(); } }); bottomButtonContainer.addView(showOnMapButton); downloadMapButton.setOnClickListener(utilityOnClickListeners .getSubscriptionDownloadButtonOnClickListener(getActivity(), propertyDescription, user, TAG)); } if (warning != null) { TextView content = generateTextViewWithText(warning, title); textAreaPlaceHolder.addView(content); } clearIds(); return rootView; }
From source file:com.mci.firstidol.view.ActionSheet.java
@SuppressWarnings("deprecation") private void createItems() { String[] titles = getOtherButtonTitles(); if (titles != null) { for (int i = 0; i < titles.length; i++) { Button bt = new Button(getActivity()); bt.setId(CANCEL_BUTTON_ID + i + 1); bt.setOnClickListener(this); bt.setBackgroundDrawable(getOtherButtonBg(titles, i)); bt.setText(titles[i]);//from ww w .j a v a2 s . co m bt.setTextColor(mAttrs.otherButtonTextColor); bt.setTextSize(TypedValue.COMPLEX_UNIT_PX, mAttrs.actionSheetTextSize); if (i > 0) { LinearLayout.LayoutParams params = createButtonLayoutParams(); params.topMargin = mAttrs.otherButtonSpacing; mPanel.addView(bt, params); } else { mPanel.addView(bt); } } } Button bt = new Button(getActivity()); bt.getPaint().setFakeBoldText(true); bt.setTextSize(TypedValue.COMPLEX_UNIT_PX, mAttrs.actionSheetTextSize); bt.setId(ActionSheet.CANCEL_BUTTON_ID); bt.setBackgroundDrawable(mAttrs.cancelButtonBackground); bt.setText(getCancelButtonTitle()); bt.setTextColor(mAttrs.cancelButtonTextColor); bt.setOnClickListener(this); LinearLayout.LayoutParams params = createButtonLayoutParams(); params.topMargin = mAttrs.cancelButtonMarginTop; mPanel.addView(bt, params); mPanel.setBackgroundDrawable(mAttrs.background); mPanel.setPadding(mAttrs.padding, mAttrs.padding, mAttrs.padding, mAttrs.padding); }