Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
lurbas committed Mar 20, 2017
1 parent 74a2a59 commit 8717232
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@


/**
* Description.
* Implementation of List Item from Material Design guidelines.
*
* @author Lucas Urbas
*/
public class ListItemView extends FrameLayout {

// CONSTANTS

public static final int NULL = -1;

private static final String TAG = "ListItemView";
Expand All @@ -58,6 +60,8 @@ public class ListItemView extends FrameLayout {

private static final int SUBTITLE_LEADING_SP = 20;

// CHILD VIEWS

private LinearLayout mItemLayout;

private LinearLayout mTextsLayout;
Expand Down Expand Up @@ -227,7 +231,6 @@ private void setupView() {
setMenuActionColor(mMenuActionColor);
setMenuOverflowColor(mMenuOverflowColor);
inflateMenu(mMenuId);

}

private void assertPadding() {
Expand Down Expand Up @@ -499,7 +502,7 @@ public void setIconColor(@ColorInt final int iconColor) {
Color.alpha(mIconColor) == 0 ? mDefaultColor : mIconColor);

} else if (mCircularIconView.getIconDrawable() != null) {
mCircularIconView.useMask(Color.alpha(mIconColor) == 0);
mCircularIconView.setMask(Color.alpha(mIconColor) == 0);
Drawable wrappedDrawable = DrawableCompat.wrap(mCircularIconView.getIconDrawable());
DrawableCompat.setTint(wrappedDrawable,
Color.alpha(mIconColor) == 0 ? Color.WHITE : mIconColor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import com.lucasurbas.listitemview.util.ViewUtils;

/**
* Description.
* Item icon rendered in the circle.
*
* @author Lucas Urbas
*/
Expand All @@ -29,14 +29,14 @@ public class CircularIconView extends View {

private Bitmap mMask;

private Xfermode xfermode;
private Xfermode mXfermode;

private Drawable mIconDrawable;

@ColorInt
private int mCircleColor;

private boolean mUseMask;
private boolean mIsMask;


public CircularIconView(final Context context) {
Expand All @@ -51,12 +51,12 @@ public CircularIconView(final Context context, @Nullable final AttributeSet attr

private void init() {
setLayerType(View.LAYER_TYPE_SOFTWARE, null);
xfermode = new PorterDuffXfermode(PorterDuff.Mode.DST_OUT);
mXfermode = new PorterDuffXfermode(PorterDuff.Mode.DST_OUT);
mPaint = new Paint();
mPaint.setAntiAlias(true);
mPaint.setStyle(Paint.Style.FILL);
mCircleColor = ViewUtils.getDefaultColor(getContext());
mUseMask = true;
mIsMask = true;
}

@Override
Expand All @@ -76,9 +76,9 @@ protected void onDraw(final Canvas canvas) {
mPaint.setXfermode(null);
canvas.drawOval(mRect, mPaint);

if (mUseMask) {
if (mIsMask) {
mPaint.setColor(Color.WHITE);
mPaint.setXfermode(xfermode);
mPaint.setXfermode(mXfermode);
canvas.drawBitmap(mMask, 0.0f, 0.0f, mPaint);
} else {
mIconDrawable.draw(canvas);
Expand All @@ -89,7 +89,7 @@ protected void onDraw(final Canvas canvas) {
}

@Nullable
private Bitmap makeBitmapMask(@Nullable Drawable drawable) {
private Bitmap makeBitmapMask(@Nullable final Drawable drawable) {
int mh = getMeasuredHeight();
int mw = getMeasuredWidth();
if (drawable != null) {
Expand All @@ -107,7 +107,7 @@ private Bitmap makeBitmapMask(@Nullable Drawable drawable) {
return null;
}

private void swapBitmapMask(@Nullable Bitmap newMask) {
private void swapBitmapMask(@Nullable final Bitmap newMask) {
if (newMask != null) {
if (mMask != null && !mMask.isRecycled()) {
mMask.recycle();
Expand All @@ -126,12 +126,12 @@ public Drawable getIconDrawable(){
return mIconDrawable;
}

public void useMask(boolean useMask) {
mUseMask = useMask;
public void setMask(final boolean isMask) {
mIsMask = isMask;
invalidate();
}

public void setCircleColor(@ColorInt int circleColor){
public void setCircleColor(@ColorInt final int circleColor){
mCircleColor = circleColor;
invalidate();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import java.util.List;

/**
* Description.
* View to represent action items on the right.
*
* @author urbl
*/
Expand Down Expand Up @@ -72,12 +72,12 @@ private void init() {
mOverflowIconColor = color;
}

public void setActionIconColor(int actionColor) {
public void setActionIconColor(final int actionColor) {
this.mActionIconColor = actionColor;
refreshColors();
}

public void setOverflowColor(int overflowColor) {
public void setOverflowColor(final int overflowColor) {
this.mOverflowIconColor = overflowColor;
refreshColors();
}
Expand All @@ -95,7 +95,7 @@ private void refreshColors() {
* Set the callback that will be called when menu
* items a selected.
*/
public void setMenuCallback(MenuBuilder.Callback menuCallback) {
public void setMenuCallback(final MenuBuilder.Callback menuCallback) {
this.mMenuCallback = menuCallback;
}

Expand All @@ -112,7 +112,7 @@ public void setMenuCallback(MenuBuilder.Callback menuCallback) {
* android:showAsAction="ifRoom" or android:showAsAction="always"
* will show as actions.
*/
public void reset(int menu, int menuItemsRoom) {
public void reset(final int menu, int menuItemsRoom) {
mMenuResId = menu;

//clean view and re-inflate
Expand Down

0 comments on commit 8717232

Please sign in to comment.