Skip to content

Commit

Permalink
change attribute names, add ‘si’ prefix
Browse files Browse the repository at this point in the history
- [fixes #7]
  • Loading branch information
Siyamed Sinir committed Oct 13, 2014
1 parent de52ac3 commit 2531538
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 65 deletions.
68 changes: 34 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ compile 'com.github.siyamed:android-shape-imageview:0.9.+@aar'
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/neo"
app:arrowPosition="right"
app:square="true"/>
app:siArrowPosition="right"
app:siSquare="true"/>
```

Attributes:
* `triangleHeight` the height of the bubble pointer in dp
* `arrowPosition` where to point the arrow, currently `left|right`
* `square` set width and height to the minimum of the given values `true|false`
* `siTriangleHeight` the height of the bubble pointer in dp
* `siArrowPosition` where to point the arrow, currently `left|right`
* `siSquare` set width and height to the minimum of the given values `true|false`

####RoundedImageView
![Android Rounded Rectangle ImageView](images/small-rounded.png)
Expand All @@ -66,18 +66,18 @@ Attributes:
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/neo"
app:radius="6dp"
app:borderWidth="6dp"
app:borderColor="@color/darkgray"
app:square="true"/>
app:siRadius="6dp"
app:siBorderWidth="6dp"
app:siBorderColor="@color/darkgray"
app:siSquare="true"/>
```

Attributes:
* `borderColor` border color
* `borderWidth` border width in dp
* `borderAlpha` alpha value of the border between 0.0-1.0
* `radius` corner radius in dp
* `square` set width and height to the minimum of the given values `true|false`
* `siBorderColor` border color
* `siBorderWidth` border width in dp
* `siBorderAlpha` alpha value of the border between 0.0-1.0
* `siRadius` corner radius in dp
* `siSquare` set width and height to the minimum of the given values `true|false`

####CircularImageView
![Android Circular ImageView](images/small-circle.png)
Expand All @@ -86,14 +86,14 @@ Attributes:
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/neo"
app:borderWidth="6dp"
app:borderColor="@color/darkgray"/>
app:siBorderWidth="6dp"
app:siBorderColor="@color/darkgray"/>
```

Attributes:
* `borderColor` border color
* `borderWidth` border width in dp
* `borderAlpha` alpha value of the border between 0.0-1.0
* `siBorderColor` border color
* `siBorderWidth` border width in dp
* `siBorderAlpha` alpha value of the border between 0.0-1.0

####ShapeImageView
This view has the capability to process a provided SVG file (for a limited set of SVG elements), build a
Expand All @@ -118,18 +118,18 @@ and creatively shaped images in your application. The included SVG files are und
android:layout_height="match_parent"
android:layout_margin="8dp"
android:src="@drawable/neo"
app:borderWidth="8dp"
app:borderColor="@color/darkgray"/>
app:siBorderWidth="8dp"
app:siBorderColor="@color/darkgray"/>
```

Attributes:
* `borderColor` border color
* `borderWidth` border width in dp
* `borderAlpha` alpha value of the border between 0.0-1.0
* `strokeCap` border stroke cap type `butt|round|square`
* `strokeJoin` border stroke join type `bevel|miter|round`
* `square` set width and height to the minimum of the given values `true|false`
* `shape` a reference to an SVG. This is used by ShapeImageView, not the subclasses of it.
* `siBorderColor` border color
* `siBorderWidth` border width in dp
* `siBorderAlpha` alpha value of the border between 0.0-1.0
* `siStrokeCap` border stroke cap type `butt|round|square`
* `siStrokeJoin` border stroke join type `bevel|miter|round`
* `siSquare` set width and height to the minimum of the given values `true|false`
* `siShape` a reference to an SVG. This is used by ShapeImageView, not the subclasses of it.


SVG elements that are supported are: [rectangle][svg_rectangle], [circle][svg_circle],
Expand All @@ -149,9 +149,9 @@ possibly not in a recycling view.
<com.github.siyamed.shapeimageview.shape.PorterShapeImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:shape="@drawable/star"
app:siShape="@drawable/star"
android:src="@drawable/neo"
app:square="true"/>
app:siSquare="true"/>
```

* With [shape XML](sample/src/main/res/drawable/shape_rounded_rectangle.xml):
Expand All @@ -162,9 +162,9 @@ possibly not in a recycling view.
<com.github.siyamed.shapeimageview.shape.PorterShapeImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:shape="@drawable/shape_rounded_rectangle"
app:siShape="@drawable/shape_rounded_rectangle"
android:src="@drawable/neo"
app:square="true"/>
app:siSquare="true"/>
```

rounded rectangle shape definition in XML:
Expand All @@ -181,8 +181,8 @@ rounded rectangle shape definition in XML:
```

Attributes:
* `shape` the bitmap mask shape, either a shape drawable or a bitmap
* `square` set width and height to the minimum of the given values `true|false`
* `siShape` the bitmap mask shape, either a shape drawable or a bitmap
* `siSquare` set width and height to the minimum of the given values `true|false`

This method reads a shape file (either bitmap or an android shape xml), creates a bitmap object using this shape, and finally combines the bitmap of the real image to be shown and the mast bitmap using xfermode.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void setSquare(boolean square) {
private void setup(Context context, AttributeSet attrs, int defStyle) {
if(attrs != null){
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.ShaderImageView, defStyle, 0);
square = typedArray.getBoolean(R.styleable.ShaderImageView_square, false);
square = typedArray.getBoolean(R.styleable.ShaderImageView_siSquare, false);
typedArray.recycle();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public PorterShapeImageView(Context context, AttributeSet attrs, int defStyle) {
private void setup(Context context, AttributeSet attrs, int defStyle) {
if(attrs != null){
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.ShaderImageView, defStyle, 0);
shape = typedArray.getDrawable(R.styleable.ShaderImageView_shape);
shape = typedArray.getDrawable(R.styleable.ShaderImageView_siShape);
typedArray.recycle();
}
matrix = new Matrix();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public void init(Context context, AttributeSet attrs, int defStyle) {
borderWidth = 0;
if(attrs != null){
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.ShaderImageView, defStyle, 0);
triangleHeightPx = typedArray.getDimensionPixelSize(R.styleable.ShaderImageView_triangleHeight, 0);
int arrowPositionInt = typedArray.getInt(R.styleable.ShaderImageView_arrowPosition, ArrowPosition.LEFT.ordinal());
triangleHeightPx = typedArray.getDimensionPixelSize(R.styleable.ShaderImageView_siTriangleHeight, 0);
int arrowPositionInt = typedArray.getInt(R.styleable.ShaderImageView_siArrowPosition, ArrowPosition.LEFT.ordinal());
arrowPosition = ArrowPosition.values()[arrowPositionInt];
typedArray.recycle();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void init(Context context, AttributeSet attrs, int defStyle) {
borderPaint.setStrokeWidth(borderWidth*2);
if(attrs != null){
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.ShaderImageView, defStyle, 0);
radius = typedArray.getDimensionPixelSize(R.styleable.ShaderImageView_radius, radius);
radius = typedArray.getDimensionPixelSize(R.styleable.ShaderImageView_siRadius, radius);
typedArray.recycle();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ public boolean isSquare() {
public void init(Context context, AttributeSet attrs, int defStyle) {
if(attrs != null){
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.ShaderImageView, defStyle, 0);
borderColor = typedArray.getColor(R.styleable.ShaderImageView_borderColor, borderColor);
borderWidth = typedArray.getDimensionPixelSize(R.styleable.ShaderImageView_borderWidth, borderWidth);
borderAlpha = typedArray.getFloat(R.styleable.ShaderImageView_borderAlpha, borderAlpha);
square = typedArray.getBoolean(R.styleable.ShaderImageView_square, square);
borderColor = typedArray.getColor(R.styleable.ShaderImageView_siBorderColor, borderColor);
borderWidth = typedArray.getDimensionPixelSize(R.styleable.ShaderImageView_siBorderWidth, borderWidth);
borderAlpha = typedArray.getFloat(R.styleable.ShaderImageView_siBorderAlpha, borderAlpha);
square = typedArray.getBoolean(R.styleable.ShaderImageView_siSquare, square);
typedArray.recycle();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ public void init(Context context, AttributeSet attrs, int defStyle) {
super.init(context, attrs, defStyle);
if(attrs != null){
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.ShaderImageView, defStyle, 0);
resId = typedArray.getResourceId(R.styleable.ShaderImageView_shape, resId);
borderType = typedArray.getInt(R.styleable.ShaderImageView_borderType, borderType);
strokeCap = typedArray.getInt(R.styleable.ShaderImageView_strokeCap, strokeCap);
strokeJoin = typedArray.getInt(R.styleable.ShaderImageView_strokeJoin, strokeJoin);
strokeMiter = typedArray.getDimensionPixelSize(R.styleable.ShaderImageView_strokeMiter, strokeMiter);
resId = typedArray.getResourceId(R.styleable.ShaderImageView_siShape, resId);
borderType = typedArray.getInt(R.styleable.ShaderImageView_siBorderType, borderType);
strokeCap = typedArray.getInt(R.styleable.ShaderImageView_siStrokeCap, strokeCap);
strokeJoin = typedArray.getInt(R.styleable.ShaderImageView_siStrokeJoin, strokeJoin);
strokeMiter = typedArray.getDimensionPixelSize(R.styleable.ShaderImageView_siStrokeMiter, strokeMiter);
typedArray.recycle();
}

Expand Down
34 changes: 17 additions & 17 deletions library/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>

<resources>
<attr name="arrowPosition">
<attr name="siArrowPosition">
<enum name="left" value="0" />
<enum name="right" value="1" />
</attr>
<attr name="borderType">
<attr name="siBorderType">
<enum name="stroke" value="0" />
<enum name="fill" value="1" />
</attr>
<attr name="strokeCap">
<attr name="siStrokeCap">
<enum name="butt" value="0" />
<enum name="round" value="1" />
<enum name="square" value="2" />
</attr>
<attr name="strokeJoin">
<attr name="siStrokeJoin">
<enum name="bevel" value="0" />
<enum name="miter" value="1" />
<enum name="round" value="2" />
</attr>
<declare-styleable name="ShaderImageView">
<attr name="square" format="boolean" />
<attr name="borderColor" format="color" />
<attr name="borderWidth" format="dimension" />
<attr name="borderAlpha" format="float" />
<attr name="foreground" format="integer|reference" />
<attr name="siSquare" format="boolean" />
<attr name="siBorderColor" format="color" />
<attr name="siBorderWidth" format="dimension" />
<attr name="siBorderAlpha" format="float" />
<attr name="siForeground" format="integer|reference" />
<!-- Rounded Image View -->
<attr name="radius" format="dimension" />
<attr name="siRadius" format="dimension" />
<!--BubbleImageView-->
<attr name="arrowPosition"/>
<attr name="triangleHeight" format="dimension"/>
<attr name="siArrowPosition"/>
<attr name="siTriangleHeight" format="dimension"/>
<!--PorterImageView-->
<attr name="shape" format="integer|reference" />
<attr name="siShape" format="integer|reference" />
<!--ShaderImageView-->
<attr name="borderType"/>
<attr name="strokeCap"/>
<attr name="strokeJoin"/>
<attr name="strokeMiter" format="dimension" />
<attr name="siBorderType"/>
<attr name="siStrokeCap"/>
<attr name="siStrokeJoin"/>
<attr name="siStrokeMiter" format="dimension" />
</declare-styleable>
</resources>

0 comments on commit 2531538

Please sign in to comment.