Skip to content

Commit

Permalink
fixed color transparincy not picked up in xml files
Browse files Browse the repository at this point in the history
  • Loading branch information
code-mc committed Mar 7, 2016
1 parent 5ea4d1b commit d170fa7
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ You don't have to worry about android including the file twice in your apk. Andr

```groovy
dependencies {
compile 'net.steamcrafted:materialiconlib:1.0.8'
compile 'net.steamcrafted:materialiconlib:1.0.9'
}
```

Expand Down
1 change: 1 addition & 0 deletions app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/22.2.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/de.hdodenhof/circleimageview/2.0.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
Expand Down
8 changes: 7 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,18 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}



lintOptions {
abortOnError false
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'de.hdodenhof:circleimageview:2.0.0'
/*compile project(':materialiconlib')*/
compile 'net.steamcrafted:materialiconlib:1.0.8'
compile project(":materialiconlib")
}
36 changes: 27 additions & 9 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,31 @@



<GridView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/listview"
android:numColumns="5"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"/>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<net.steamcrafted.materialiconlib.MaterialIconView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="96dp"
app:materialIcon="file"
app:materialIconColor="#3300FF00"

android:id="@+id/file_icon"
android:background="#A0C"
/>

<GridView
android:layout_below="@+id/file_icon"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/listview"
android:numColumns="5"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"/>
</RelativeLayout>

2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ allprojects {
repositories {
jcenter()
}
}
}
2 changes: 1 addition & 1 deletion materialiconlib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'net.steamcrafted'
PUBLISH_ARTIFACT_ID = 'materialiconlib'
PUBLISH_VERSION = '1.0.8'
PUBLISH_VERSION = '1.0.9'
}

android {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,7 @@ public MaterialDrawableBuilder setSizePx(int size) {
*/
public MaterialDrawableBuilder setColor(int color) {
paint.setColor(color);
if(Color.alpha(color) != 255){
paint.setAlpha(Color.alpha(color));

This comment has been minimized.

Copy link
@code-mc

code-mc Mar 7, 2016

Author Owner

#23

}
setAlpha(Color.alpha(color));
return this;
}

Expand Down Expand Up @@ -262,6 +260,7 @@ public void draw(Canvas canvas) {
String textValue = MaterialIconUtils.getIconString(icon.ordinal());
paint.getTextBounds(textValue, 0, 1, mCachedRect);
float textBottom = (getBounds().height() - mCachedRect.height()) / 2f + mCachedRect.height() - mCachedRect.bottom;

canvas.drawText(textValue, getBounds().width() / 2f, textBottom, paint);
}

Expand Down

0 comments on commit d170fa7

Please sign in to comment.