Java Code Examples for android.widget.Button#setAllCaps()
The following examples show how to use
android.widget.Button#setAllCaps() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ActivityGetSceneResultSampleActivity.java From scene with Apache License 2.0 | 6 votes |
@NonNull @Override public ViewGroup onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { Button tv = new Button(requireActivity()); tv.setText("Click to set result and finish"); tv.setFitsSystemWindows(true); tv.setAllCaps(false); tv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { requireNavigationScene().setResult(TestScene2.this, "Result is one"); requireNavigationScene().pop(); } }); FrameLayout frameLayout = new FrameLayout(requireActivity()); frameLayout.addView(tv); return frameLayout; }
Example 2
Source File: MainActivity.java From WMRouter with Apache License 2.0 | 6 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); LinearLayout container = findViewById(R.id.layout_container); for (final String uri : URIS) { Button button = new Button(this); button.setAllCaps(false); button.setText(uri); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { jump(uri); } }); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); container.addView(button, params); } }
Example 3
Source File: AdvancedDemoActivity.java From WMRouter with Apache License 2.0 | 6 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); LinearLayout container = findViewById(R.id.layout_container); for (final String uri : URIS) { Button button = new Button(this); button.setAllCaps(false); button.setText(uri); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { jump(uri); } }); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); container.addView(button, params); } }
Example 4
Source File: BotInit.java From iGap-Android with GNU Affero General Public License v3.0 | 6 votes |
private void addButton(LinearLayout layout, String name, String action) { LinearLayout.LayoutParams param = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, 1.0f); param.setMargins(2, 2, 2, 2); Button btn = new Button(G.context); btn.setLayoutParams(param); btn.setTextColor(Color.WHITE); btn.setBackgroundColor(ContextCompat.getColor(G.context, R.color.backgroundColorCall2)); btn.setText(name); btn.setAllCaps(false); btn.setTypeface(G.typeface_IRANSansMobile); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (G.onBotClick != null) { G.onBotClick.onBotCommandText(action); } setLayoutBot(true, false); } }); layout.addView(btn); }
Example 5
Source File: Views.java From Android-Shortify with Apache License 2.0 | 6 votes |
public static $ allcapital(){ try{ if(mView instanceof TextView){ TextView textView = (TextView) mView; textView.setAllCaps(true); } else if(mView instanceof EditText){ EditText editText = (EditText) mView; editText.setAllCaps(true); } else if(mView instanceof Button){ Button button = (Button) mView; button.setAllCaps(true); } }catch (Exception e){ Log.d(TAG, e.getMessage()); } return $.getInstance(); }
Example 6
Source File: AnimationListDemoScene.java From scene with Apache License 2.0 | 5 votes |
private Button addButton(LinearLayout parent, String text, View.OnClickListener onClickListener) { Button button = new Button(getActivity()); button.setAllCaps(false); button.setText(text); button.setOnClickListener(onClickListener); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 150); lp.leftMargin = 20; lp.rightMargin = 20; parent.addView(button, lp); return button; }
Example 7
Source File: CaseListDemo.java From scene with Apache License 2.0 | 5 votes |
private Button addButton(LinearLayout parent, String text, View.OnClickListener onClickListener) { Button button = new Button(getActivity()); button.setAllCaps(false); button.setText(text); button.setOnClickListener(onClickListener); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 150); lp.leftMargin = 20; lp.rightMargin = 20; parent.addView(button, lp); return button; }
Example 8
Source File: NavigationBoardListAdapter.java From Ouroboros with GNU General Public License v3.0 | 5 votes |
public NavigationBoardListViewHolder(View itemView) { super(itemView); boardNameBtn = (Button) itemView.findViewById(R.id.boardlist_boardname_button); deleteItemBtn = (ImageButton) itemView.findViewById(R.id.boardlist_delete_button); handleView = (ImageView) itemView.findViewById(R.id.boardlist_handle); boardObject = new BoardObject(); boardNameBtn.setAllCaps(false); boardNameBtn.setOnClickListener(this); deleteItemBtn.setOnClickListener(this); }
Example 9
Source File: PostingActivity.java From Dashchan with Apache License 2.0 | 5 votes |
private void fillContainer() { float density = ResourceUtils.obtainDensity(PostingActivity.this); int maxButtonsWidth = lastWidth - textFormatView.getPaddingLeft() - textFormatView.getPaddingRight(); int buttonMarginLeft = (int) ((C.API_LOLLIPOP ? -4f : 0f) * density); Pair<Integer, Integer> supportedAndDisplayedTags = MarkupButtonProvider.obtainSupportedAndDisplayedTags (ChanMarkup.get(chanName), boardName, density, maxButtonsWidth, buttonMarginLeft); int supportedTags = supportedAndDisplayedTags.first; int displayedTags = supportedAndDisplayedTags.second; if (commentEditor != null) { commentEditor.handleSimilar(supportedTags); } boolean firstMarkupButton = true; for (MarkupButtonProvider provider : MarkupButtonProvider.iterable(displayedTags)) { Button button = provider.createButton(textFormatView.getContext(), android.R.attr.borderlessButtonStyle); button.setTextSize(TypedValue.COMPLEX_UNIT_DIP, C.API_LOLLIPOP ? 14 : 18); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams ((int) (provider.widthDp * density), (int) (40f * density)); if (!firstMarkupButton) { layoutParams.leftMargin = buttonMarginLeft; } button.setTag(provider.tag); button.setOnClickListener(formatButtonClickListener); button.setPadding(0, 0, 0, 0); if (C.API_LOLLIPOP) { button.setAllCaps(false); } provider.applyTextAndStyle(button); textFormatView.addView(button, layoutParams); firstMarkupButton = false; } }
Example 10
Source File: AccessoryView.java From turbo-editor with GNU General Public License v3.0 | 5 votes |
private void addAButton(final String text) { int dimension = (int) PixelDipConverter.convertDpToPixel(50, getContext()); //int padding = (int) PixelDipConverter.convertDpToPixel(10, getContext()); final Button name = new Button(getContext()); name.setLayoutParams(new LinearLayout.LayoutParams(dimension, dimension)); name.setGravity(Gravity.CENTER); name.setText(text); name.setTextSize(15); name.setAllCaps(true); //name.setPadding(padding, padding, padding, padding); name.setClickable(true); name.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { iAccessoryView.onButtonAccessoryViewClicked(text); } }); name.setBackgroundResource(outValue.resourceId); addView(name); }
Example 11
Source File: GDPRViewManager.java From GDPRDialog with Apache License 2.0 | 4 votes |
private void initButtons(Activity activity, Button btAgree, Button btDisagree, Button btNoConsentAtAll) { if (mSetup.hasPaidVersion()) { if (!mSetup.allowNonPersonalisedForPaidVersion()) { btDisagree.setText(R.string.gdpr_dialog_disagree_buy_app); } else { btNoConsentAtAll.setText(R.string.gdpr_dialog_disagree_buy_app); } } boolean hideAdsInfo = !mSetup.containsAdNetwork(); if (mSetup.hasPaidVersion()) { if (!mSetup.allowNonPersonalisedForPaidVersion()) { btDisagree.setText(R.string.gdpr_dialog_disagree_buy_app); hideAdsInfo = true; } } if (!hideAdsInfo) { // upper case + bold button style is removed and handled manually String textButton = activity.getString(R.string.gdpr_dialog_disagree_no_thanks).toUpperCase() + "\n"; String textInfo = activity.getString(R.string.gdpr_dialog_disagree_info); SpannableString spannableText = new SpannableString(textButton + textInfo); spannableText.setSpan(new StyleSpan(Typeface.BOLD), 0, textButton.length(), 0); spannableText.setSpan(new RelativeSizeSpan(0.8f), textButton.length(), spannableText.length(), 0); spannableText.setSpan(new ForegroundColorSpan(btDisagree.getTextColors().getDefaultColor()), textButton.length(), spannableText.length(), 0); btDisagree.setAllCaps(false); btDisagree.setTypeface(Typeface.DEFAULT); btDisagree.setText(spannableText); } // int textColorPrimary = GDPRUtils.getThemeColor(context, android.R.attr.textColorPrimary); // boolean textColorIsDark = GDPRUtils.isColorDark(textColorPrimary); // // int btBackgorundColor = textColorIsDark ? Color.DKGRAY : Color.WHITE; // int btForegorundColor = textColorIsDark ? Color.WHITE : Color.BLACK; // // btDisagree.getBackground().setColorFilter(btForegorundColor, PorterDuff.Mode.MULTIPLY); // btNoConsentAtAll.getBackground().setColorFilter(btForegorundColor, PorterDuff.Mode.MULTIPLY); // btDisagree.setTextColor(btBackgorundColor); // btNoConsentAtAll.setTextColor(btBackgorundColor); }
Example 12
Source File: Tool.java From DialogUtil with Apache License 2.0 | 4 votes |
/** * 必须在show之后,button才不会返回null * @param bean */ public static void setMdBtnStytle(final ConfigBean bean){ Button btnPositive = bean.alertDialog.getButton(DialogInterface.BUTTON_POSITIVE); Button btnNegative = bean.alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE); Button btnNatural = bean.alertDialog.getButton(DialogInterface.BUTTON_NEUTRAL); if(btnPositive !=null){ btnPositive.setAllCaps(false); if(!TextUtils.isEmpty(bean.text1)){ btnPositive.setText(bean.text1); } if (bean.btn1Color > 0){ btnPositive.setTextColor(getColor(bean.context,bean.btn1Color)); } if(bean.btnTxtSize >0){ btnPositive.setTextSize(bean.btnTxtSize); } btnPositive.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(bean.type == DefaultConfig.TYPE_MD_INPUT){ MdInputHolder holder = (MdInputHolder) bean.viewHolder; boolean isvalid = bean.listener.onInputValid(holder.getTxt1(),holder.getTxt2(),holder.getEt1(),holder.getEt2()); if(!isvalid){ return; } bean.listener.onGetInput(holder.getTxt1(),holder.getTxt2()); }else if(bean.type == DefaultConfig.TYPE_MD_SINGLE_CHOOSE){ }else if(bean.type == DefaultConfig.TYPE_MD_MULTI_CHOOSE){ bean.listener.onGetChoose(bean.checkedItems); List<Integer> selectedIndex = new ArrayList<Integer>(); List<CharSequence> selectedStrs = new ArrayList<CharSequence>(); for(int j=0;j<bean.checkedItems.length;j++){ if(bean.checkedItems[j]){ selectedIndex.add(j); selectedStrs.add(bean.wordsMd[j]); } } bean.listener.onChoosen(selectedIndex,selectedStrs,bean.checkedItems); } bean.listener.onFirst(); dismiss(bean,true); } }); } if(btnNegative !=null){ btnNegative.setAllCaps(false); if(!TextUtils.isEmpty(bean.text2)){ btnNegative.setText(bean.text2); } if (bean.btn2Color > 0 ){ if(bean.btn2Color == DefaultConfig.iosBtnColor ){ btnNegative.setTextColor(getColor(bean.context,R.color.dialogutil_text_gray)); }else { btnNegative.setTextColor(getColor(bean.context,bean.btn2Color)); } } if(bean.btnTxtSize >0){ btnNegative.setTextSize(bean.btnTxtSize); } } if(btnNatural !=null){ btnNatural.setAllCaps(false); if(!TextUtils.isEmpty(bean.text3)){ btnNatural.setText(bean.text3); } if (bean.btn3Color > 0){ btnNatural.setTextColor(getColor(ActivityStackManager.getInstance().getTopActivity(),bean.btn3Color)); } if(bean.btnTxtSize >0){ btnNatural.setTextSize(bean.btnTxtSize); } } }
Example 13
Source File: Settings.java From Hangar with GNU General Public License v3.0 | 4 votes |
protected void setupButton(Button button, LinearLayout.LayoutParams params) { button.setSingleLine(false); button.setAllCaps(true); button.setLayoutParams(params); }