Skip to content

Commit

Permalink
Merge pull request #107 from qiujuer/develop-caprice
Browse files Browse the repository at this point in the history
Develop caprice
  • Loading branch information
qiujuer authored Aug 12, 2018
2 parents d883975 + 21cf2ff commit babefaf
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 45 deletions.
12 changes: 6 additions & 6 deletions README-ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,18 @@
```groovy
dependencies {
// ui module
api 'net.qiujuer.genius:ui:2.1.0'
api 'net.qiujuer.genius:res:2.1.0'
api 'net.qiujuer.genius:ui:2.1.1'
api 'net.qiujuer.genius:res:2.1.1'
// use to bitmap blur and more
api 'net.qiujuer.genius:graphics:2.1.0'
api 'net.qiujuer.genius:graphics:2.1.1'
// ping/telnet/tracert/dns and run cmd
api 'net.qiujuer.genius:kit-cmd:2.1.0'
api 'net.qiujuer.genius:kit-cmd:2.1.1'
// shuttle between ui-thread and child-thread
api 'net.qiujuer.genius:kit-handler:2.1.0'
api 'net.qiujuer.genius:kit-handler:2.1.1'
// calss reflect
api 'net.qiujuer.genius:kit-reflect:2.1.0'
api 'net.qiujuer.genius:kit-reflect:2.1.1'
}
```

Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,18 @@
```groovy
dependencies {
// ui module
api 'net.qiujuer.genius:ui:2.1.0'
api 'net.qiujuer.genius:res:2.1.0'
api 'net.qiujuer.genius:ui:2.1.1'
api 'net.qiujuer.genius:res:2.1.1'
// use to bitmap blur and more
api 'net.qiujuer.genius:graphics:2.1.0'
api 'net.qiujuer.genius:graphics:2.1.1'
// ping/telnet/tracert/dns and run cmd
api 'net.qiujuer.genius:kit-cmd:2.1.0'
api 'net.qiujuer.genius:kit-cmd:2.1.1'
// shuttle between ui-thread and child-thread
api 'net.qiujuer.genius:kit-handler:2.1.0'
api 'net.qiujuer.genius:kit-handler:2.1.1'
// calss reflect
api 'net.qiujuer.genius:kit-reflect:2.1.0'
api 'net.qiujuer.genius:kit-reflect:2.1.1'
}
```

Expand Down
24 changes: 12 additions & 12 deletions caprice/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ dependencies {

api 'com.android.support:appcompat-v7:27.1.1'

//api project(':ui')
//api project(':res')
//api project(':graphics')
//api project(':kit-cmd')
//api project(':kit-reflect')
//api project(':kit-handler')
api project(':ui')
api project(':res')
api project(':graphics')
api project(':kit-cmd')
api project(':kit-reflect')
api project(':kit-handler')

api 'net.qiujuer.genius:ui:2.0.1'
api 'net.qiujuer.genius:res:2.0.1'
api 'net.qiujuer.genius:graphics:2.0.1'
api 'net.qiujuer.genius:kit-cmd:2.0.1'
api 'net.qiujuer.genius:kit-reflect:2.0.1'
api 'net.qiujuer.genius:kit-handler:2.0.1'
//api 'net.qiujuer.genius:ui:2.0.1'
//api 'net.qiujuer.genius:res:2.0.1'
//api 'net.qiujuer.genius:graphics:2.0.1'
//api 'net.qiujuer.genius:kit-cmd:2.0.1'
//api 'net.qiujuer.genius:kit-reflect:2.0.1'
//api 'net.qiujuer.genius:kit-handler:2.0.1'
}
2 changes: 1 addition & 1 deletion caprice/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.android.tools.build:gradle:3.1.4'
}
}

Expand Down
2 changes: 1 addition & 1 deletion caprice/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_NAME=2.1.0
VERSION_NAME=2.1.1
POM_GROUP_ID=net.qiujuer.genius
POM_DESCRIPTION=Genius Lib For Android
POM_URL=https://github.com/qiujuer/Genius-Android
Expand Down
61 changes: 42 additions & 19 deletions caprice/ui/src/main/java/net/qiujuer/genius/ui/widget/Loading.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.AttributeSet;
Expand Down Expand Up @@ -102,7 +103,43 @@ private void init(AttributeSet attrs, int defStyleAttr, int defStyleRes) {
ColorStateList colorStateList = a.getColorStateList(R.styleable.Loading_gBackgroundColor);
if (colorStateList != null)
bgColor = colorStateList.getDefaultColor();
int fgColorId = a.getResourceId(R.styleable.Loading_gForegroundColor, R.array.g_default_loading_fg);

int fgColor = Color.BLACK;
int[] fgColorArray = null;
try {
fgColor = a.getColor(R.styleable.Loading_gForegroundColor, 0);
} catch (Exception ignored) {
int fgColorId = a.getResourceId(R.styleable.Loading_gForegroundColor, R.array.g_default_loading_fg);
// Check for IDE preview render
if (!isInEditMode()) {
TypedArray taColor = resource.obtainTypedArray(fgColorId);
int length = taColor.length();
if (length > 0) {
fgColorArray = new int[length];
for (int i = 0; i < length; i++) {
fgColorArray[i] = taColor.getColor(i, Color.BLACK);
}
} else {
String type = resource.getResourceTypeName(fgColorId);
try {
switch (type) {
case "color":
fgColor = resource.getColor(fgColorId);
break;
case "array":
fgColorArray = resource.getIntArray(fgColorId);
break;
default:
fgColorArray = resource.getIntArray(R.array.g_default_loading_fg);
break;
}
} catch (Exception e) {
fgColorArray = resource.getIntArray(R.array.g_default_loading_fg);
}
}
taColor.recycle();
}
}

int style = a.getInt(R.styleable.Loading_gProgressStyle, 1);
boolean autoRun = a.getBoolean(R.styleable.Loading_gAutoRun, true);
Expand All @@ -119,24 +156,10 @@ private void init(AttributeSet attrs, int defStyleAttr, int defStyleRes) {
setForegroundLineSize(fgLineSize);
setBackgroundColor(bgColor);

// Check for IDE preview render
if (!isInEditMode()) {
String type = resource.getResourceTypeName(fgColorId);
try {
switch (type) {
case "color":
setForegroundColor(resource.getColor(fgColorId));
break;
case "array":
setForegroundColor(resource.getIntArray(fgColorId));
break;
default:
setForegroundColor(resource.getIntArray(R.array.g_default_loading_fg));
break;
}
} catch (Exception e) {
setForegroundColor(resource.getIntArray(R.array.g_default_loading_fg));
}
if (fgColorArray == null) {
setForegroundColor(fgColor);
} else {
setForegroundColor(fgColorArray);
}
}

Expand Down

0 comments on commit babefaf

Please sign in to comment.