Java Code Examples for android.widget.Button#setTextAppearance()
The following examples show how to use
android.widget.Button#setTextAppearance() .
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: SnackBarItem.java From SnackBar with Apache License 2.0 | 6 votes |
/** * Sets up the action button if available * * @param action */ private void setupActionButton(Button action) { action.setVisibility(View.VISIBLE); action.setText(mActionMessage.toUpperCase()); action.setTextColor(mActionColor); if (mActionTextAppearance != -1) action.setTextAppearance(mActivity, mActionTextAppearance); if (mActionTypeface != null) action.setTypeface(mActionTypeface); action.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mActionButtonPressed = true; mShouldDisposeOnCancel = false; mAnimator.cancel(); if (mActionClickListener != null) mActionClickListener.onClick(view); createHideAnimation(); } }); }
Example 2
Source File: MyDownloadingFragment.java From letv with Apache License 2.0 | 5 votes |
private void setButtonStatus(Button button, boolean canClick) { Logger.d(TAG, " setButtonStatus canClick : " + canClick); if (canClick) { button.setClickable(true); button.setBackgroundResource(R.drawable.btn_blue_selecter); button.setTextAppearance(this.mContext, R.style.letv_text_13_blue_white); return; } button.setClickable(false); button.setBackgroundResource(R.drawable.btn_grey); button.setTextColor(Util.getContext().getResources().getColor(R.color.letv_color_ffa1a1a1)); }
Example 3
Source File: MyRandomSeeFragment.java From letv with Apache License 2.0 | 5 votes |
private void setButtonStatus(Button button, boolean canClick) { LogInfo.log(TAG, " setButtonStatus canClick : " + canClick); if (canClick) { button.setClickable(true); button.setBackgroundResource(2130837706); button.setTextAppearance(this.mActivity, 2131230855); return; } button.setClickable(false); button.setBackgroundResource(2130837728); button.setTextColor(getResources().getColor(2131493280)); }
Example 4
Source File: RelationshipCheckTask.java From YiBo with Apache License 2.0 | 5 votes |
@Override protected void onPreExecute() { if (view != null && view instanceof Button) { Button btn = (Button)view; btn.setVisibility(View.VISIBLE); btn.setText(R.string.btn_loading); btn.setTextAppearance(context, R.style.btn_action_negative); ThemeUtil.setBtnActionNegative(btn); btn.setEnabled(false); } }
Example 5
Source File: Compat.java From geopaparazzi with GNU General Public License v3.0 | 5 votes |
public static void setButtonTextAppearance(Context context, Button button, int type) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { button.setTextAppearance(type); } else { button.setTextAppearance(context, type); } }
Example 6
Source File: ProfileActivity.java From YiBo with Apache License 2.0 | 4 votes |
private void updateRelationship() { if (user == null || user.getRelationship() == null) { return; } Relationship relationship = user.getRelationship(); Button btnFollow = (Button) findViewById(R.id.btnFollow); Button btnMessage = (Button) findViewById(R.id.btnMessage); Button btnBlock = (Button) findViewById(R.id.btnBlock); View.OnClickListener btnFollowOnClickListener = followClickListener; btnFollow.setEnabled(true); if (relationship.isSourceFollowingTarget()) { ((ProfileFollowClickListener)btnFollowOnClickListener).setUser(user); btnFollow.setTextAppearance(this, R.style.btn_action_negative); btnFollow.setText(R.string.btn_personal_unfollow); btnFollow.setTextColor(theme.getColor("selector_btn_action_negative")); btnFollow.setBackgroundDrawable(theme.getDrawable("selector_btn_action_negative")); } else if (relationship.isSourceBlockingTarget()) { ((ProfileBlockClickListener)btnFollowOnClickListener).setUser(user); btnFollow.setTextAppearance(this, R.style.btn_action_positive); btnFollow.setText(R.string.btn_personal_unblock); btnFollow.setTextColor(theme.getColor("selector_btn_action_positive")); btnFollow.setBackgroundDrawable(theme.getDrawable("selector_btn_action_positive")); btnFollowOnClickListener = blockClickListener; } else { ((ProfileFollowClickListener)btnFollowOnClickListener).setUser(user); btnFollow.setTextAppearance(this, R.style.btn_action_positive); btnFollow.setText(R.string.btn_personal_follow); btnFollow.setTextColor(theme.getColor("selector_btn_action_positive")); btnFollow.setBackgroundDrawable(theme.getDrawable("selector_btn_action_positive")); } btnFollow.setOnClickListener(btnFollowOnClickListener); ImageView ivFriendship = (ImageView) this.findViewById(R.id.ivFriendship); if (relationship.isSourceFollowingTarget() && relationship.isSourceFollowedByTarget()) { ivFriendship.setVisibility(View.VISIBLE); } else { ivFriendship.setVisibility(View.GONE); } if (relationship.isSourceFollowedByTarget() || true) { btnMessage.setVisibility(View.VISIBLE); btnMessage.setEnabled(true); btnMessage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(); intent.putExtra("TYPE", Constants.EDIT_TYPE_TO_MESSAGE); intent.putExtra("DISPLAY_NAME", user.getDisplayName()); intent.setClass(v.getContext(), EditDirectMessageActivity.class); v.getContext().startActivity(intent); } }); } if (isSohu) { return; //搜狐不支持黑名单接口,下面代码是黑名单相关的 } if (relationship.isSourceBlockingTarget()) { btnBlock.setBackgroundDrawable(theme.getDrawable("selector_btn_profile_unblock")); } else { btnBlock.setBackgroundDrawable(theme.getDrawable("selector_btn_profile_block")); } btnBlock.setVisibility(View.VISIBLE); btnBlock.setEnabled(true); btnBlock.setOnClickListener(blockClickListener); }