Java Code Examples for android.widget.Button#setBackgroundDrawable()
The following examples show how to use
android.widget.Button#setBackgroundDrawable() .
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: GosCheckDeviceWorkWiFiActivity.java From Gizwits-SmartBuld_Android with MIT License | 6 votes |
private void initView() { etSSID = (EditText) findViewById(R.id.etSSID); etPsw = (EditText) findViewById(R.id.etPsw); btnNext = (Button) findViewById(R.id.btnNext); cbLaws = (CheckBox) findViewById(R.id.cbLaws); imgWiFiList = (ImageView) findViewById(R.id.imgWiFiList); if (!TextUtils.isEmpty(workSSID)) { etSSID.setText(workSSID); if (checkworkSSIDUsed(workSSID)) { if (!TextUtils.isEmpty(spf.getString("workSSIDPsw", ""))) { etPsw.setText(spf.getString("workSSIDPsw", "")); } } } // 配置文件部署 btnNext.setBackgroundDrawable(GosDeploy.setButtonBackgroundColor()); btnNext.setTextColor(GosDeploy.setButtonTextColor()); }
Example 2
Source File: GosForgetPasswordActivity.java From GOpenSource_AppKit_Android_AS with MIT License | 6 votes |
private void initView() { etName = (EditText) findViewById(R.id.etName); btnGetCode = (Button) findViewById(R.id.btnGetCode); etCode = (EditText) findViewById(R.id.etCode); etPsw = (EditText) findViewById(R.id.etPsw); btnReset = (Button) findViewById(R.id.btnReset); cbLaws = (CheckBox) findViewById(R.id.cbLaws); // 配置文件部署 drawable = (GradientDrawable) GosDeploy.setButtonBackgroundColor(); drawable.setCornerRadius(30); btnGetCode.setBackgroundDrawable(drawable); btnReset.setBackgroundDrawable(GosDeploy.setButtonBackgroundColor()); btnReset.setTextColor(GosDeploy.setButtonTextColor()); }
Example 3
Source File: GosRegisterUserActivity.java From gokit-android with MIT License | 6 votes |
private void initView() { etName = (EditText) findViewById(R.id.etName); btnGetCode = (Button) findViewById(R.id.btnGetCode); etCode = (EditText) findViewById(R.id.etCode); etPsw = (EditText) findViewById(R.id.etPsw); btnRrgister = (Button) findViewById(R.id.btnRrgister); cbLaws = (CheckBox) findViewById(R.id.cbLaws); // 配置文件部署 drawable =(GradientDrawable) GosDeploy.setButtonBackgroundColor(); drawable.setCornerRadius(30); btnGetCode.setBackgroundDrawable(drawable); btnRrgister.setBackgroundDrawable(GosDeploy.setButtonBackgroundColor()); btnRrgister.setTextColor(GosDeploy.setButtonTextColor()); }
Example 4
Source File: ThemeUtil.java From YiBo with Apache License 2.0 | 6 votes |
public static void setSecondaryHeader(View headerView) { if (headerView == null) { return; } Theme theme = ThemeUtil.createTheme(headerView.getContext()); LinearLayout llHeaderBase = (LinearLayout)headerView.findViewById(R.id.llHeaderBase); Button btnBack = (Button)headerView.findViewById(R.id.btnBack); Button btnOperate = (Button) headerView.findViewById(R.id.btnOperate); TextView tvTitle = (TextView) headerView.findViewById(R.id.tvTitle); llHeaderBase.setBackgroundDrawable(theme.getDrawable("bg_header")); llHeaderBase.setGravity(Gravity.CENTER); int padding8 = theme.dip2px(8); llHeaderBase.setPadding(padding8, 0, padding8, 0); btnBack.setBackgroundDrawable(theme.getDrawable("selector_btn_action_back")); btnBack.setTextColor(theme.getColorStateList("selector_btn_header_action")); tvTitle.setTextColor(theme.getColorStateList("selector_header_title")); btnOperate.setBackgroundDrawable(theme.getDrawable("selector_btn_action_additional")); int padding12 = theme.dip2px(12); btnOperate.setPadding(padding12, 0, padding12, 0); btnOperate.setTextColor(theme.getColor("selector_btn_header_action")); }
Example 5
Source File: GosAirlinkChooseDeviceWorkWiFiActivity.java From GOpenSource_AppKit_Android_AS with MIT License | 6 votes |
private void initView() { tvMode = (TextView) findViewById(R.id.tvMode); etSSID = (EditText) findViewById(R.id.etSSID); etPsw = (EditText) findViewById(R.id.etPsw); cbLaws = (CheckBox) findViewById(R.id.cbLaws); btnNext = (Button) findViewById(R.id.btnNext); llChooseMode = (LinearLayout) findViewById(R.id.llChooseMode); imgWiFiList = (ImageView) findViewById(R.id.imgWiFiList); // 配置文件部署 btnNext.setBackgroundDrawable(GosDeploy.setButtonBackgroundColor()); btnNext.setTextColor(GosDeploy.setButtonTextColor()); // llChooseMode.setVisibility(GosDeploy.setModuleSelectOn()); llChooseMode.setVisibility(View.GONE); }
Example 6
Source File: f.java From MiBandDecompiled with Apache License 2.0 | 5 votes |
public void a(Button button) { StateListDrawable statelistdrawable = new StateListDrawable(); android.graphics.drawable.Drawable drawable = ImageActivity.a(a, "com.tencent.plus.blue_normal.png"); android.graphics.drawable.Drawable drawable1 = ImageActivity.a(a, "com.tencent.plus.blue_down.png"); android.graphics.drawable.Drawable drawable2 = ImageActivity.a(a, "com.tencent.plus.blue_disable.png"); statelistdrawable.addState(View.PRESSED_ENABLED_STATE_SET, drawable1); statelistdrawable.addState(View.ENABLED_FOCUSED_STATE_SET, drawable); statelistdrawable.addState(View.ENABLED_STATE_SET, drawable); statelistdrawable.addState(View.FOCUSED_STATE_SET, drawable); statelistdrawable.addState(View.EMPTY_STATE_SET, drawable2); button.setBackgroundDrawable(statelistdrawable); }
Example 7
Source File: GosAirlinkReadyActivity.java From gokit-android with MIT License | 5 votes |
private void initView() { cbSelect = (CheckBox) findViewById(R.id.cbSelect); tvSelect = (TextView) findViewById(R.id.tvSelect); btnNext = (Button) findViewById(R.id.btnNext); /** 加载Gif */ GifView gif = (GifView) findViewById(R.id.softreset); gif.setMovieResource(R.drawable.airlink); // 配置文件部署 btnNext.setBackgroundDrawable(GosDeploy.setButtonBackgroundColor()); btnNext.setTextColor(GosDeploy.setButtonTextColor()); }
Example 8
Source File: GosConfigFailedActivity.java From GOpenSource_AppKit_Android_AS with MIT License | 5 votes |
private void initView() { btnAgain = (Button) findViewById(R.id.btnAgain); // 配置文件部署 btnAgain.setBackgroundDrawable(GosDeploy.setButtonBackgroundColor()); btnAgain.setTextColor(GosDeploy.setButtonTextColor()); }
Example 9
Source File: GosDeviceReadyActivity.java From GOpenSource_AppKit_Android_AS with MIT License | 5 votes |
private void initView() { cbSelect = (CheckBox) findViewById(R.id.cbSelect); btnNext = (Button) findViewById(R.id.btnNext); tvNoRedLight = (TextView) findViewById(R.id.tvNoRedLight); tvSelect = (TextView) findViewById(R.id.tvSelect); // 配置文件部署 btnNext.setBackgroundDrawable(GosDeploy.setButtonBackgroundColor()); btnNext.setTextColor(GosDeploy.setButtonTextColor()); }
Example 10
Source File: SearchActivity.java From YiBo with Apache License 2.0 | 5 votes |
private void initComponents() { LinearLayout llRoot = (LinearLayout)this.findViewById(R.id.llRoot); LinearLayout llHeaderBase = (LinearLayout)findViewById(R.id.llHeaderBase); LinearLayout llHeaderSearch = (LinearLayout)findViewById(R.id.llHeaderSearch); EditText etKeyWord = (EditText) findViewById(R.id.etKeyWord); Button btnSearch = (Button) findViewById(R.id.btnSearch); btnSearchStatus = (Button) findViewById(R.id.btnSearchStatus); btnSearchUser = (Button) findViewById(R.id.btnSearchUser); lvSearchResult = (ListView) findViewById(R.id.lvSearchResult); lvSearchResult.setFastScrollEnabled(sheJiaoMao.isSliderEnabled()); lvSearchResult.setOnScrollListener(new StatusScrollListener()); ThemeUtil.setRootBackground(llRoot); ThemeUtil.setSecondaryHeader(llHeaderBase); llHeaderSearch.setBackgroundDrawable(theme.getDrawable("bg_header_corner_search")); int padding6 = theme.dip2px(6); int padding8 = theme.dip2px(8); llHeaderSearch.setPadding(padding6, padding8, padding6, padding8); ThemeUtil.setListViewStyle(lvSearchResult); etKeyWord.setBackgroundDrawable(theme.getDrawable("bg_input_frame_left_half")); btnSearch.setBackgroundDrawable(theme.getDrawable("selector_btn_search")); btnSearchStatus.setBackgroundDrawable(theme.getDrawable("selector_tab_toggle_left")); btnSearchStatus.setPadding(0, 0, 0, 0); ColorStateList selectorBtnTab = theme.getColorStateList("selector_btn_tab"); btnSearchStatus.setTextColor(selectorBtnTab); btnSearchStatus.setGravity(Gravity.CENTER); btnSearchUser.setBackgroundDrawable(theme.getDrawable("selector_tab_toggle_right")); btnSearchUser.setPadding(0, 0, 0, 0); btnSearchUser.setTextColor(selectorBtnTab); btnSearchUser.setGravity(Gravity.CENTER); }
Example 11
Source File: GosAirlinkChooseDeviceWorkWiFiActivity.java From gokit-android with MIT License | 5 votes |
private void initView() { tvMode = (TextView) findViewById(R.id.tvMode); etSSID = (EditText) findViewById(R.id.etSSID); etPsw = (EditText) findViewById(R.id.etPsw); cbLaws = (CheckBox) findViewById(R.id.cbLaws); btnNext = (Button) findViewById(R.id.btnNext); llChooseMode = (LinearLayout) findViewById(R.id.llChooseMode); imgWiFiList = (ImageView) findViewById(R.id.imgWiFiList); // 配置文件部署 btnNext.setBackgroundDrawable(GosDeploy.setButtonBackgroundColor()); btnNext.setTextColor(GosDeploy.setButtonTextColor()); llChooseMode.setVisibility(GosDeploy.setModuleSelectOn()); }
Example 12
Source File: MainActivity.java From SelectorDrawable with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button button1 = (Button) findViewById(R.id.button1); Drawable drawable1 = SelectorFactory.create(new SelectorShape.SelectorBuilder().normalColor(Color.RED).pressColor(Color.GREEN).disableColor(Color.BLUE).shapeBuilder(new Shape.ShapeBuilder().corner(30)).build()); button1.setBackgroundDrawable(drawable1); Button button2 = (Button) findViewById(R.id.button2); Drawable drawable2 = SelectorFactory.create(new SelectorDrawable.SelectorBuilder().normalDrawable(getResources().getDrawable(R.mipmap.button_normal)).pressDrawable(getResources().getDrawable(R.mipmap.button_press)).build()); button2.setBackgroundDrawable(drawable2); Button button3 = (Button) findViewById(R.id.button3); Drawable drawable3 = new Shape.ShapeBuilder().strokeColor(Color.RED).strokeWidth(4).build().createGradientDrawable(Color.RED); button3.setBackgroundDrawable(drawable3); TextView textView = (TextView) findViewById(R.id.textView); Drawable drawable4 = SelectorFactory.create(new SelectorShape.SelectorBuilder().normalColor(Color.BLUE).pressColor(Color.GRAY).shapeBuilder(new Shape.ShapeBuilder().corner(15)).build()); textView.setBackgroundDrawable(drawable4); Button button5 = (Button) findViewById(R.id.button5); Drawable drawable5 = SelectorFactory.create(new SelectorShape.SelectorBuilder().normalColor(Color.RED).pressColor(Color.GREEN).disableColor(Color.GRAY).shapeBuilder(new Shape.ShapeBuilder().corner(30)).build()); button5.setBackgroundDrawable(drawable5); button5.setEnabled(false); Button button6 = (Button) findViewById(R.id.button_select_0); Drawable drawable6 = SelectorFactory.create(new SelectorShape.SelectorBuilder().normalColor(Color.RED).pressColor(Color.BLUE).selectColor(Color.BLUE).shapeBuilder(new Shape.ShapeBuilder().corner(30)).build()); button6.setBackgroundDrawable(drawable6); button6.setSelected(true); // 用颜色设置按钮 }
Example 13
Source File: EditorTestActivity.java From Android-WYSIWYG-Editor with Apache License 2.0 | 5 votes |
public static void setGhost(Button button) { int radius = 4; GradientDrawable background = new GradientDrawable(); background.setShape(GradientDrawable.RECTANGLE); background.setStroke(4, Color.WHITE); background.setCornerRadius(radius); button.setBackgroundDrawable(background); }
Example 14
Source File: ThemeUtil.java From YiBo with Apache License 2.0 | 5 votes |
public static void setBtnActionNegative(Button button) { if (button == null) { return; } Theme theme = ThemeUtil.createTheme(button.getContext()); button.setTextColor(theme.getColorStateList("selector_btn_action_negative")); button.setBackgroundDrawable(theme.getDrawable("selector_btn_action_negative")); }
Example 15
Source File: VerifyActivity.java From sealrtc-android with MIT License | 5 votes |
private void initView() { btn_login = (Button) findViewById(R.id.btn_login); reg_getcode = (Button) findViewById(R.id.reg_getcode); btn_login.setOnClickListener(onClickListener); btn_login.setClickable(false); reg_getcode.setOnClickListener(onClickListener); edit_phone = (EditText) findViewById(R.id.edit_phone); String phone = SessionManager.getInstance().getString(UserUtils.PHONE); if (!TextUtils.isEmpty(phone)) { edit_phone.setText(phone); reg_getcode.setClickable(true); reg_getcode.setBackgroundDrawable( getResources().getDrawable(R.drawable.rs_select_btn_blue)); } tv_tips = (TextView) findViewById(R.id.tv_tips); edit_verificationCode = (EditText) findViewById(R.id.edit_verificationCode); versionCodeView = (TextView) findViewById(R.id.main_page_version_code); versionCodeView.setText( getResources().getString(R.string.blink_description_version) + BuildConfig.VERSION_NAME + (BuildConfig.DEBUG ? "_Debug" : "")); versionCodeView.setTextColor(getResources().getColor(R.color.blink_text_green)); mTvRegion = (TextView) findViewById(R.id.tv_region); mTvCountry = (TextView) findViewById(R.id.tv_country); mTvCountry.setOnClickListener(onClickListener); updateCountry(); img_logo = (ImageView) findViewById(R.id.img_logo); if (img_logo != null) { if (ServerUtils.usePrivateCloud()) { img_logo.setImageResource(R.drawable.ic_launcher_privatecloud); } else { img_logo.setImageResource(R.drawable.ic_launcher); } } }
Example 16
Source File: NewFriendAdapter.java From LoveTalkClient with Apache License 2.0 | 4 votes |
public void toAgreedTextView(Button addBtn) { addBtn.setText(R.string.agreed); addBtn.setBackgroundDrawable(null); addBtn.setTextColor(Utils.getColor(R.color.base_color_text_black)); addBtn.setEnabled(false); }
Example 17
Source File: Skeleton.java From YiBo with Apache License 2.0 | 4 votes |
private void initLayout() { LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflater.inflate(R.layout.home_page, this, true); ThemeUtil.setRootBackground(this); propertySupport = new PropertyChangeSupport(this); ibProfileImage = (ImageButton) this.findViewById(R.id.ibProfileImage); TextView tvTitle = (TextView) this.findViewById(R.id.tvTitle); ImageButton ibGroup = (ImageButton) this.findViewById(R.id.ibGroup); ImageButton ibEdit = (ImageButton) this.findViewById(R.id.ibEdit); Button btnMention = (Button) this.findViewById(R.id.btnMention); Button btnComment = (Button) this.findViewById(R.id.btnComment); Button btnDirectMessage = (Button) this.findViewById(R.id.btnDirectMessage); llFooter = (LinearLayout) this.findViewById(R.id.llFooter); btnMyHome = (Button) this.findViewById(R.id.btnMyHome); btnMessage = (Button) this.findViewById(R.id.btnMessage); btnProfile = (Button) this.findViewById(R.id.btnProfile); btnApp = (Button) this.findViewById(R.id.btnApp); btnMore = (Button) this.findViewById(R.id.btnMore); //主题 Theme theme = ThemeUtil.createTheme(getContext()); LinearLayout llHeader = (LinearLayout)this.findViewById(R.id.llHeader); llHeader.setBackgroundDrawable(theme.getDrawable("bg_header")); llHeader.setGravity(Gravity.CENTER_VERTICAL); ibProfileImage.setBackgroundDrawable(theme.getDrawable("bg_account_display")); ibGroup.setImageDrawable(theme.getDrawable("selector_btn_group")); Drawable bgHeaderDivider = theme.getDrawable("bg_header_divider"); ibGroup.setBackgroundDrawable(bgHeaderDivider); ibEdit.setBackgroundDrawable(theme.getDrawable("selector_btn_status")); ibEdit.setImageDrawable(bgHeaderDivider); tvTitle.setTextColor(theme.getColorStateList("selector_header_title")); btnMention.setBackgroundDrawable(theme.getDrawable("selector_tab_mention")); btnMention.setTextColor(theme.getColorStateList("selector_header_title")); btnComment.setBackgroundDrawable(theme.getDrawable("selector_tab_comment")); btnComment.setTextColor(theme.getColorStateList("selector_header_title")); btnDirectMessage.setBackgroundDrawable(theme.getDrawable("selector_tab_direct_message")); btnDirectMessage.setTextColor(theme.getColorStateList("selector_header_title")); myHomeDrawable = theme.getDrawable("selector_tab_home"); myHomeRefreshDrawable = theme.getDrawable("selector_tab_home_refresh"); messageDrawable = theme.getDrawable("selector_tab_message"); messageRefreshDrawable = theme.getDrawable("selector_tab_message_refresh"); profileDrawable = theme.getDrawable("selector_tab_profile"); profileRefreshDrawable = theme.getDrawable("selector_tab_profile_refresh"); llFooter.setBackgroundDrawable(theme.getDrawable("bg_footer")); llFooter.setPadding(0, 0, 0, 0); btnMyHome.setBackgroundDrawable(myHomeDrawable); btnMessage.setBackgroundDrawable(messageDrawable); btnProfile.setBackgroundDrawable(profileDrawable); btnApp.setBackgroundDrawable(theme.getDrawable("selector_tab_app")); btnMore.setBackgroundDrawable(theme.getDrawable("selector_tab_more")); }
Example 18
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); }
Example 19
Source File: PlatformListPage.java From BigApp_Discuz_Android with Apache License 2.0 | 4 votes |
private void initPageView() { flPage = new FrameLayout(getContext()); flPage.setOnClickListener(this); flPage.setBackgroundDrawable(new ColorDrawable(0x55000000)); // container of the platform gridview llPage = new LinearLayout(getContext()) { public boolean onTouchEvent(MotionEvent event) { return true; } }; llPage.setOrientation(LinearLayout.VERTICAL); llPage.setBackgroundDrawable(new ColorDrawable(0xffffffff)); FrameLayout.LayoutParams lpLl = new FrameLayout.LayoutParams( FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT); lpLl.gravity = Gravity.BOTTOM; llPage.setLayoutParams(lpLl); flPage.addView(llPage); // gridview grid = new PlatformGridView(getContext()); grid.setEditPageBackground(getBackgroundView()); LinearLayout.LayoutParams lpWg = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); grid.setLayoutParams(lpWg); llPage.addView(grid); // cancel button btnCancel = new Button(getContext()); btnCancel.setTextColor(0xff3a65ff); btnCancel.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20); int resId = getStringRes(getContext(), "cancel"); if (resId > 0) { btnCancel.setText(resId); } btnCancel.setPadding(0, 0, 0, com.mob.tools.utils.R.dipToPx(getContext(), 5)); resId = getBitmapRes(getContext(), "classic_platform_corners_bg"); if(resId > 0){ btnCancel.setBackgroundResource(resId); }else { btnCancel.setBackgroundDrawable(new ColorDrawable(0xffffffff)); } LinearLayout.LayoutParams lpBtn = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, com.mob.tools.utils.R.dipToPx(getContext(), 45)); int dp_10 = com.mob.tools.utils.R.dipToPx(getContext(), 10); lpBtn.setMargins(dp_10, dp_10, dp_10, dp_10); btnCancel.setLayoutParams(lpBtn); llPage.addView(btnCancel); }
Example 20
Source File: EditDirectMessageActivity.java From YiBo with Apache License 2.0 | 4 votes |
private void initComponents() { LinearLayout llHeaderBase = (LinearLayout)findViewById(R.id.llHeaderBase); LinearLayout llContentPanel = (LinearLayout)findViewById(R.id.llContentPanel); AutoCompleteTextView etDisplayName = (AutoCompleteTextView)this.findViewById(R.id.etDisplayName); Button btnUserSelector = (Button)this.findViewById(R.id.btnUserSelector); LinearLayout llEditText = (LinearLayout)findViewById(R.id.llEditText); MultiAutoCompleteTextView etText = (MultiAutoCompleteTextView)findViewById(R.id.etText); Button btnEmotion = (Button)this.findViewById(R.id.btnEmotion); Button btnMention = (Button)this.findViewById(R.id.btnMention); Button btnTopic = (Button)this.findViewById(R.id.btnTopic); Button btnTextCount = (Button)this.findViewById(R.id.btnTextCount); ThemeUtil.setSecondaryHeader(llHeaderBase); ThemeUtil.setContentBackground(llContentPanel); int padding6 = theme.dip2px(6); int padding8 = theme.dip2px(8); llContentPanel.setPadding(padding6, padding8, padding6, 0); etDisplayName.setBackgroundDrawable(theme.getDrawable("bg_input_frame_left_half")); etDisplayName.setTextColor(theme.getColor("content")); btnUserSelector.setBackgroundDrawable(theme.getDrawable("selector_btn_message_user")); llEditText.setBackgroundDrawable(theme.getDrawable("bg_input_frame_normal")); etText.setTextColor(theme.getColor("content")); btnEmotion.setBackgroundDrawable(theme.getDrawable("selector_btn_emotion")); btnMention.setBackgroundDrawable(theme.getDrawable("selector_btn_mention")); btnTopic.setBackgroundDrawable(theme.getDrawable("selector_btn_topic")); btnTextCount.setBackgroundDrawable(theme.getDrawable("selector_btn_text_count")); btnTextCount.setPadding(padding6, 0, theme.dip2px(20), 0); btnTextCount.setTextColor(theme.getColor("status_capability")); TextView tvTitle = (TextView) this.findViewById(R.id.tvTitle); tvTitle.setText(R.string.title_edit_direct_message); if (StringUtil.isNotEmpty(displayName)) { etDisplayName.setText(displayName); etText.requestFocus(); } etDisplayName.setAdapter(new UserSuggestAdapter(this)); etDisplayName.setOnTouchListener(hideEmotionGridListener); int length = StringUtil.getLengthByByte(etText.getText().toString()); int leavings = (int)Math.floor((double)(Constants.STATUS_TEXT_MAX_LENGTH * 2 - length) / 2); btnTextCount.setText((leavings < 0 ? "-" : "") + Math.abs(leavings)); emotionViewController = new EmotionViewController(this); }