-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Wannes Ghielens
committed
Feb 22, 2017
1 parent
fd0ce0d
commit c6eaa18
Showing
9 changed files
with
83 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
app/src/main/java/net/steamcrafted/materialiconview/SetBoundsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package net.steamcrafted.materialiconview; | ||
|
||
import android.content.Context; | ||
import android.content.res.TypedArray; | ||
import android.graphics.Canvas; | ||
import android.graphics.Color; | ||
import android.graphics.Paint; | ||
import android.graphics.Rect; | ||
import android.graphics.drawable.Drawable; | ||
import android.text.TextPaint; | ||
import android.util.AttributeSet; | ||
import android.view.View; | ||
|
||
import net.steamcrafted.materialiconlib.MaterialDrawableBuilder; | ||
|
||
/** | ||
* TODO: document your custom view class. | ||
*/ | ||
public class SetBoundsTest extends View { | ||
|
||
private Drawable mDrawable; | ||
private Drawable mDrawable2; | ||
|
||
public SetBoundsTest(Context context) { | ||
super(context); | ||
init(null, 0); | ||
} | ||
|
||
public SetBoundsTest(Context context, AttributeSet attrs) { | ||
super(context, attrs); | ||
init(attrs, 0); | ||
} | ||
|
||
public SetBoundsTest(Context context, AttributeSet attrs, int defStyle) { | ||
super(context, attrs, defStyle); | ||
init(attrs, defStyle); | ||
} | ||
|
||
private void init(final AttributeSet attrs, final int defStyle) { | ||
mDrawable = MaterialDrawableBuilder.with(getContext()) | ||
.setIcon(MaterialDrawableBuilder.IconValue.NUMERIC_7_BOX) | ||
.setColor(Color.RED) | ||
.setSizeDp(1) | ||
.build(); | ||
|
||
mDrawable2 = getResources().getDrawable(R.mipmap.ic_launcher); | ||
} | ||
|
||
@Override | ||
protected void onDraw(Canvas canvas) { | ||
super.onDraw(canvas); | ||
|
||
Paint p = new Paint(); | ||
p.setColor(Color.BLACK); | ||
|
||
Rect bounds = new Rect(0, 100, getMeasuredHeight(), getMeasuredHeight()); | ||
|
||
canvas.drawRect(bounds, p); | ||
mDrawable.setBounds(bounds); | ||
mDrawable.draw(canvas); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fix for #34