private void init(Context context) { ct = context; setPadding(Utils.px2Dp(context, 4), 0, Utils.px2Dp(context, 4), 0); setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL); setTextSize(TypedValue.COMPLEX_UNIT_DIP, 9); setTextColor(context.getResources().getColor(R.color.no2)); setSingleLine(); setTextColor(0xffffffff); setBackgroundColor(0xff000000); setBadgeCount(0); }
public void setBadgeColor(int color) { GradientDrawable gd = new GradientDrawable(); gd.setColor(color); float corner = Utils.px2Dp(ct, 21); gd.setCornerRadii(new float[] {corner, corner, corner, corner, corner, corner, corner, corner}); setBackgroundDrawable(gd); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_edit_topic); mAppBar = (AppBar) findViewById(R.id.edit_topic_app_bar); mAppBar.getLogoView().setImageResource(R.drawable.menu_back); mAppBar .getLogoView() .setLayoutParams( new RelativeLayout.LayoutParams(Utils.px2Dp(this, 56), Utils.px2Dp(this, 56))); mAppBar .getLogoView() .setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { onBackPressed(); } }); mAppBar.getTextView().setVisibility(View.VISIBLE); mAppBar.getTextView().setText(R.string.chat_topic_edit); mAppBar.getMenuItemView().setVisibility(View.VISIBLE); mAppBar.getMenuItemView().setImageResource(R.drawable.menu_done); RelativeLayout.LayoutParams rlp = new RelativeLayout.LayoutParams(Utils.px2Dp(this, 56), Utils.px2Dp(this, 56)); rlp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); mAppBar.getMenuItemView().setLayoutParams(rlp); etTopicName = (MaterialEditText) findViewById(R.id.edit_topic_materialEditText); etTopicName.setLineFocusedColor(getResources().getColor(R.color.no1)); etTopicName.setLineUnFocusedColor(getResources().getColor(R.color.no1)); etTopicName.setLineFocusedHeight(4); etTopicName.setLineUnFocusedHeight(1); etTopicName.getEditText().setTextColor(getResources().getColor(R.color.no1)); etTopicName.getEditText().setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); etTopicName.getEditText().setSingleLine(); etTopicName.getEditText().setImeOptions(EditorInfo.IME_ACTION_DONE); checkBundle(); }
private void initView() { appbar = (AppBar) findViewById(R.id.wall_app_bar); appbar.getLogoView().setImageResource(R.drawable.menu_back); appbar .getLogoView() .setLayoutParams( new RelativeLayout.LayoutParams(Utils.px2Dp(this, 56), Utils.px2Dp(this, 56))); appbar .getLogoView() .setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { onBackPressed(); } }); appbar.getTextView().setVisibility(View.VISIBLE); appbar.getTextView().setText(R.string.wall_circle); mWallView = (WallView) findViewById(R.id.wall_wallView); header = new FrameLayout(this); LayoutInflater.from(this).inflate(R.layout.view_wall_header, header); header.setLayoutParams(new AbsListView.LayoutParams(-1, Utils.px2Dp(this, 112))); mWallView.setHeaderView(header); addBtn = (ImageView) findViewById(R.id.wall_addBtn); addBtn.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(v.getContext(), CreatePostActivity.class); startActivityForResult(intent, 0); overridePendingTransition(R.anim.slide_in_right, android.R.anim.fade_out); } }); }