Skip to content
This repository was archived by the owner on Oct 23, 2020. It is now read-only.
Open
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
47 changes: 26 additions & 21 deletions library/src/main/java/com/github/clans/fab/Label.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public class Label extends TextView {
private static final Xfermode PORTER_DUFF_CLEAR = new PorterDuffXfermode(PorterDuff.Mode.CLEAR);

private int mShadowRadius;
private int mShadowXOffset;
private int mShadowYOffset;
// private int mShadowXOffset;
// private int mShadowYOffset;
private int mShadowColor;
private Drawable mBackgroundDrawable;
private boolean mShowShadow = true;
Expand Down Expand Up @@ -60,35 +60,35 @@ public Label(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}

@Override
/* @Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
setMeasuredDimension(calculateMeasuredWidth(), calculateMeasuredHeight());
}

}*/
/*
private int calculateMeasuredWidth() {
if (mRawWidth == 0) {
mRawWidth = getMeasuredWidth();
}
return getMeasuredWidth() + calculateShadowWidth();
}
}*/

private int calculateMeasuredHeight() {
/* private int calculateMeasuredHeight() {
if (mRawHeight == 0) {
mRawHeight = getMeasuredHeight();
}
return getMeasuredHeight() + calculateShadowHeight();
}
}*/

int calculateShadowWidth() {
/* int calculateShadowWidth() {
return mShowShadow ? (mShadowRadius + Math.abs(mShadowXOffset)) : 0;
}
}*/

int calculateShadowHeight() {
/* int calculateShadowHeight() {
return mShowShadow ? (mShadowRadius + Math.abs(mShadowYOffset)) : 0;
}
}*/

void updateBackground() {
/* void updateBackground() {
LayerDrawable layerDrawable;
if (mShowShadow) {
layerDrawable = new LayerDrawable(new Drawable[]{
Expand Down Expand Up @@ -116,7 +116,7 @@ void updateBackground() {

setBackgroundCompat(layerDrawable);
}

*/
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private Drawable createFillDrawable() {
StateListDrawable drawable = new StateListDrawable();
Expand Down Expand Up @@ -163,8 +163,8 @@ private Drawable createRectDrawable(int color) {
private void setShadow(FloatingActionButton fab) {
mShadowColor = fab.getShadowColor();
mShadowRadius = fab.getShadowRadius();
mShadowXOffset = fab.getShadowXOffset();
mShadowYOffset = fab.getShadowYOffset();
// mShadowXOffset = fab.getShadowXOffset();
// mShadowYOffset = fab.getShadowYOffset();
mShowShadow = fab.hasShadow();
}

Expand Down Expand Up @@ -334,6 +334,11 @@ private Shadow() {
this.init();
}

@Override
public void draw(Canvas canvas) {

}

private void init() {
setLayerType(LAYER_TYPE_SOFTWARE, null);
mPaint.setStyle(Paint.Style.FILL);
Expand All @@ -342,23 +347,23 @@ private void init() {
mErase.setXfermode(PORTER_DUFF_CLEAR);

if (!isInEditMode()) {
mPaint.setShadowLayer(mShadowRadius, mShadowXOffset, mShadowYOffset, mShadowColor);
// mPaint.setShadowLayer(mShadowRadius, mShadowXOffset, mShadowYOffset, mShadowColor);
}
}

@Override
/* @Override
public void draw(Canvas canvas) {
RectF shadowRect = new RectF(
mShadowRadius + Math.abs(mShadowXOffset),
mShadowRadius + Math.abs(mShadowYOffset),
mShadowRadius + Math.abs(mShadowXOffset),
mShadowRadius + Math.abs(mShadowYOffset),
mRawWidth,
mRawHeight
);

canvas.drawRoundRect(shadowRect, mCornerRadius, mCornerRadius, mPaint);
canvas.drawRoundRect(shadowRect, mCornerRadius, mCornerRadius, mErase);
}

*/
@Override
public void setAlpha(int alpha) {

Expand Down