Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple quality improvements #11

Merged
merged 1 commit into from
Apr 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ public void run() {
case 4:
model.setBadgeTitle("777");
break;
default:
break;
}
navigationTabBar.postDelayed(new Runnable() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ public void onAnimationEnd(final View view) {
new Intent(MainActivity.this, SamplesNtbActivity.class)
);
break;
default:
break;
}
}

Expand Down
17 changes: 9 additions & 8 deletions library/src/main/java/com/gigamole/library/NavigationTabBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
Expand Down Expand Up @@ -110,8 +111,8 @@ public class NavigationTabBar extends View implements ViewPager.OnPageChangeList
private RectF mBounds = new RectF();
private RectF mPointerBounds = new RectF();
// Badge bounds and bg badge bounds
final Rect mBadgeBounds = new Rect();
final RectF mBgBadgeBounds = new RectF();
private final Rect mBadgeBounds = new Rect();
private final RectF mBgBadgeBounds = new RectF();

// Canvas, where all of other canvas will be merged
private Bitmap mBitmap;
Expand Down Expand Up @@ -149,15 +150,15 @@ public class NavigationTabBar extends View implements ViewPager.OnPageChangeList
};

// Paint for icon mask pointer
final Paint mIconPointerPaint = new Paint(Paint.ANTI_ALIAS_FLAG) {
private final Paint mIconPointerPaint = new Paint(Paint.ANTI_ALIAS_FLAG) {
{
setStyle(Style.FILL);
setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
}
};

// Paint for model title
final Paint mModelTitlePaint = new TextPaint(Paint.ANTI_ALIAS_FLAG) {
private final Paint mModelTitlePaint = new TextPaint(Paint.ANTI_ALIAS_FLAG) {
{
setDither(true);
setColor(Color.WHITE);
Expand All @@ -166,7 +167,7 @@ public class NavigationTabBar extends View implements ViewPager.OnPageChangeList
};

// Paint for badge
final Paint mBadgePaint = new TextPaint(Paint.ANTI_ALIAS_FLAG) {
private final Paint mBadgePaint = new TextPaint(Paint.ANTI_ALIAS_FLAG) {
{
setDither(true);
setTextAlign(Align.CENTER);
Expand All @@ -180,7 +181,7 @@ public class NavigationTabBar extends View implements ViewPager.OnPageChangeList
private int mAnimationDuration;

// NTP models
private ArrayList<Model> mModels = new ArrayList<>();
private List<Model> mModels = new ArrayList<>();

// Variables for ViewPager
private ViewPager mViewPager;
Expand Down Expand Up @@ -361,11 +362,11 @@ public void setAnimationDuration(final int animationDuration) {
resetScroller();
}

public ArrayList<Model> getModels() {
public List<Model> getModels() {
return mModels;
}

public void setModels(final ArrayList<Model> models) {
public void setModels(final List<Model> models) {
//Set update listeners to badge model animation
for (final Model model : models) {
model.mBadgeAnimator.removeAllUpdateListeners();
Expand Down