Skip to content

Commit

Permalink
click sound, attr booleans added
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitjain240595 committed Dec 28, 2019
1 parent 9782788 commit add7039
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
15 changes: 9 additions & 6 deletions mosaic/src/main/java/com/matrixdev/mosaic/MosaicView.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

public class MosaicView extends View {

private int defaultColor;
int perc, side;
Context context;
private CountDownTimer countDownTimer;
Expand Down Expand Up @@ -89,6 +90,7 @@ public MosaicView(Context context, AttributeSet attrs) {
isRoundedEdges = attributes.getBoolean(R.styleable.MosaicView_isRoundedEdges, true);
isFadeEnabled = attributes.getBoolean(R.styleable.MosaicView_isFadeEnabled, true);
isShrinkEnabled = attributes.getBoolean(R.styleable.MosaicView_isShrinkEnabled, true);
defaultColor= attributes.getColor(R.styleable.MosaicView_imageBackground,Color.WHITE);

attributes.recycle();
}
Expand Down Expand Up @@ -354,19 +356,20 @@ private Bitmap addRoundCorners(Bitmap bmp, int padding_y) {

Canvas canvas = new Canvas(bmpWithBorder);
canvas.clipPath(path);
canvas.drawColor(
Color.TRANSPARENT,
PorterDuff.Mode.CLEAR);

canvas.drawColor(defaultColor);
canvas.drawBitmap(bmp, null, rect, paint);
return bmpWithBorder;
}

public Bitmap pad(Bitmap Src, int padding_y) {
public Bitmap pad(Bitmap Src, int padding_y) {
Bitmap outputimage = Bitmap.createBitmap(Src.getWidth(),Src.getHeight() + padding_y, Bitmap.Config.ARGB_8888);
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setFlags(Paint.ANTI_ALIAS_FLAG);
Canvas can = new Canvas(outputimage);
// can.drawColor(context.getResources().getColor(R.color.colorAccent)); //This represents White color
can.drawBitmap(Src, 0, padding_y, null);
can.drawColor(defaultColor); //This represents White color
can.drawBitmap(Src, 0, padding_y, paint);
return outputimage;
}

Expand Down
2 changes: 2 additions & 0 deletions mosaic/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
<attr name="isRoundedEdges" format="boolean"/>
<attr name="isFadeEnabled" format="boolean"/>
<attr name="isShrinkEnabled" format="boolean"/>
<attr name="imageBackground" format="color"/>


</declare-styleable>

Expand Down

0 comments on commit add7039

Please sign in to comment.