Skip to content

Commit

Permalink
Fix #3 issue
Browse files Browse the repository at this point in the history
  • Loading branch information
peng8350 committed Dec 5, 2016
1 parent 70bcb13 commit fd7b436
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 21 deletions.
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
<com.jpeng.jptabbar.JPTabBar
android:id="@+id/tabbar"
android:layout_width="match_parent"

android:layout_height="60dp"
android:layout_alignParentBottom="true"
android:background="@drawable/tab_bg"
jp:TabTextSize="12sp"
jp:TabAnimate="Scale"
jp:TabMiddleIcon="@mipmap/circle"
/>


Expand Down
2 changes: 0 additions & 2 deletions library/src/main/java/com/jpeng/jptabbar/JPTabBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,6 @@ public JPTabBar setSelectedIcons(int... selectedIcons) {
public void generate() {
int[] pos = new int[2];
getLocationOnScreen(pos);
System.out.println(pos[0]);
if (mJPTabItems == null)
initFromAttribute();
}
Expand Down Expand Up @@ -638,7 +637,6 @@ public void onPageScrolled(int position, float positionOffset, int positionOffse

@Override
public void onPageSelected(int position) {
System.out.println(mNeedAnimate);
setSelectTab(position, mNeedAnimate);
}

Expand Down
2 changes: 0 additions & 2 deletions library/src/main/java/com/jpeng/jptabbar/JPTabItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import android.widget.RelativeLayout;
import com.jpeng.jptabbar.animate.Animatable;
import com.jpeng.jptabbar.badgeview.BadgeRelativeLayout;
import com.jpeng.jptabbar.badgeview.BadgeViewHelper;
import com.jpeng.jptabbar.badgeview.Badgeable;
import com.jpeng.jptabbar.badgeview.DragDismissDelegate;
import com.nineoldandroids.animation.ObjectAnimator;
Expand Down Expand Up @@ -163,7 +162,6 @@ private void init(Context context) {
* 初始化徽章
*/
private void initBadge() {
getBadgeViewHelper().setBadgeGravity(BadgeViewHelper.BadgeGravity.RightTop);
getBadgeViewHelper().setBadgeBgColorInt(mBadgeBackground);
getBadgeViewHelper().setBadgeTextSizeSp(mBadgeTextSize);
getBadgeViewHelper().setBadgePaddingDp(mBadgePadding);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,24 +323,10 @@ private void drawTextBadge(Canvas canvas) {

// 计算徽章背景上下的值
mBadgeRectF.top = mBadgeVerticalMargin;
mBadgeRectF.bottom = mBadgeable.getHeight() - mBadgeVerticalMargin;
switch (mBadgeGravity) {
case RightTop:
mBadgeRectF.bottom = mBadgeRectF.top + badgeHeight;
break;
case RightCenter:
mBadgeRectF.top = (mBadgeable.getHeight() - badgeHeight) / 2;
mBadgeRectF.bottom = mBadgeRectF.top + badgeHeight;
break;
case RightBottom:
mBadgeRectF.top = mBadgeRectF.bottom - badgeHeight;
break;
default:
break;
}
mBadgeRectF.bottom = mBadgeRectF.top + badgeHeight;

// 计算徽章背景左右的值
mBadgeRectF.right = mBadgeable.getWidth() - mBadgeHorizontalMargin;
mBadgeRectF.right = mBadgeable.getWidth()/2 + mBadgeHorizontalMargin;
mBadgeRectF.left = mBadgeRectF.right - badgeWidth;

if (mBadgeBorderWidth > 0) {
Expand Down

0 comments on commit fd7b436

Please sign in to comment.