use of cn.bingoogolapple.badgeview.BGABadgeable in project BGABadgeView-Android by bingoogolapple.
the class MainActivity method testRadioButton.
private void testRadioButton() {
mHomeBrb.showTextBadge("10");
mMessageBrb.showTextBadge("1");
mDiscoverBrb.showTextBadge("...");
mMeBrb.showDrawableBadge(BitmapFactory.decodeResource(getResources(), R.mipmap.avatar_vip));
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
mHomeBrb.showTextBadge("1");
}
}, 5000);
mHomeBrb.setDragDismissDelegage(new BGADragDismissDelegate() {
@Override
public void onDismiss(BGABadgeable badgeable) {
ToastUtil.show("消息单选按钮徽章拖动消失");
}
});
mTabRg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
switch(checkedId) {
case R.id.brb_main_home:
ToastUtil.show("首页");
break;
case R.id.brb_main_message:
ToastUtil.show("消息");
break;
case R.id.brb_main_discover:
ToastUtil.show("发现");
break;
case R.id.brb_main_me:
ToastUtil.show("我");
break;
}
}
});
}
use of cn.bingoogolapple.badgeview.BGABadgeable in project BGABadgeView-Android by bingoogolapple.
the class MainActivity method testBadgeView.
private void testBadgeView() {
mTestBv.showTextBadge("9");
mTestBv.getBadgeViewHelper().setBadgeTextSizeSp(15);
mTestBv.getBadgeViewHelper().setBadgePaddingDp(8);
mTestBv.getBadgeViewHelper().setBadgeTextColorInt(Color.parseColor("#FF0000"));
mTestBv.getBadgeViewHelper().setBadgeBgColorInt(Color.parseColor("#00FF00"));
mTestBv.getBadgeViewHelper().setDragable(true);
mTestBv.getBadgeViewHelper().setBadgePaddingDp(7);
mTestBv.getBadgeViewHelper().setBadgeBorderWidthDp(2);
mTestBv.getBadgeViewHelper().setBadgeBorderColorInt(Color.parseColor("#0000FF"));
mTestBtv.showCirclePointBadge();
mNormalBiv.showCirclePointBadge();
Bitmap avatarBadgeBitmap = BitmapFactory.decodeResource(getResources(), R.mipmap.avatar_vip);
RoundedBitmapDrawable roundedDrawable = RoundedBitmapDrawableFactory.create(getResources(), BitmapFactory.decodeResource(getResources(), R.mipmap.avator));
roundedDrawable.getPaint().setAntiAlias(true);
roundedDrawable.setCornerRadius(30);
mRoundedBiv.setImageDrawable(roundedDrawable);
mRoundedBiv.showDrawableBadge(avatarBadgeBitmap);
Bitmap avatarBitmap = BitmapFactory.decodeResource(getResources(), R.mipmap.avator);
RoundedBitmapDrawable circleDrawable = RoundedBitmapDrawableFactory.create(getResources(), avatarBitmap);
circleDrawable.getPaint().setAntiAlias(true);
circleDrawable.setCornerRadius(Math.max(avatarBitmap.getWidth(), avatarBitmap.getHeight()) / 2.0f);
mCircleBiv.setImageDrawable(circleDrawable);
mCircleBiv.showDrawableBadge(avatarBadgeBitmap);
mTestBll.showDrawableBadge(avatarBadgeBitmap);
mTestBrl.showTextBadge("LoveAndroid");
mTestBfl.showTextBadge("8");
mChatBfab.showTextBadge("8");
mChatBfab.setDragDismissDelegage(new BGADragDismissDelegate() {
@Override
public void onDismiss(BGABadgeable badgeable) {
ToastUtil.show("清空聊天消息");
}
});
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
mRoundedBiv.hiddenBadge();
}
}, 3000);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
mRoundedBiv.showCirclePointBadge();
}
}, 6000);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
mRoundedBiv.showDrawableBadge(BitmapFactory.decodeResource(getResources(), R.mipmap.avatar_vip));
}
}, 9000);
}
use of cn.bingoogolapple.badgeview.BGABadgeable in project BGABadgeView-Android by bingoogolapple.
the class MessageAdapter method fillData.
@Override
protected void fillData(BGAViewHolderHelper holderHelper, final int position, final MessageModel message) {
holderHelper.setText(R.id.tv_item_message_title, message.title);
holderHelper.setText(R.id.tv_item_message_detail, message.detail);
BGABadgeLinearLayout rootView = (BGABadgeLinearLayout) holderHelper.getConvertView();
if (message.newMsgCount > 0) {
rootView.showTextBadge("" + message.newMsgCount);
rootView.setDragDismissDelegage(new BGADragDismissDelegate() {
@Override
public void onDismiss(BGABadgeable badgeable) {
message.newMsgCount = 0;
ToastUtil.show(message.title + "的徽章消失");
}
});
} else {
rootView.hiddenBadge();
}
}
Aggregations