Skip to content

Commit 7ed301e

Browse files
committed
add
1 parent 3fe450f commit 7ed301e

11 files changed

Lines changed: 118 additions & 76 deletions

File tree

.idea/checkstyle-idea.xml

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gradle.xml

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,6 @@ limitations under the License.
3636
```
3737
CompareIndicator1.updateView(10,90);
3838
```
39+
40+
41+
![alt](https://github.com/AllenCoder/AndroidCustomView/blob/master/gif/device-2016-08-15-180942.png)

app/build.gradle

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,14 @@ android {
1717
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
1818
}
1919
}
20+
compileOptions {
21+
sourceCompatibility JavaVersion.VERSION_1_7
22+
}
2023
}
2124

2225
dependencies {
2326
compile fileTree(include: ['*.jar'], dir: 'libs')
24-
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
25-
exclude group: 'com.android.support', module: 'support-annotations'
26-
})
27-
compile 'com.android.support:appcompat-v7:24.1.1'
28-
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha5'
27+
compile 'com.android.support:appcompat-v7:23.1.1'
2928
testCompile 'junit:junit:4.12'
3029
compile project(':comparsechart')
3130
}

build.gradle

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@ buildscript {
55
jcenter()
66
}
77
dependencies {
8-
classpath 'com.android.tools.build:gradle:2.2.0-alpha6'
9-
10-
// NOTE: Do not place your application dependencies here; they belong
11-
// in the individual module build.gradle files
8+
classpath 'com.android.tools.build:gradle:2.1.2'
9+
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
10+
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.1'
1211
}
1312
}
14-
1513
allprojects {
1614
repositories {
1715
jcenter()

comparsechart/build.gradle

Lines changed: 78 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
apply plugin: 'com.android.library'
2+
apply plugin: 'com.github.dcendents.android-maven'
3+
apply plugin: 'com.jfrog.bintray'
24

35
android {
46
compileSdkVersion 23
5-
buildToolsVersion "23.0.2"
6-
7+
buildToolsVersion "23.0.1"
8+
resourcePrefix "allen_" //随意填写
79
defaultConfig {
810
minSdkVersion 14
911
targetSdkVersion 23
1012
versionCode 1
1113
versionName "1.0"
1214

13-
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
1415

1516
}
1617
buildTypes {
@@ -19,13 +20,82 @@ android {
1920
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
2021
}
2122
}
23+
24+
25+
2226
}
2327

2428
dependencies {
25-
compile fileTree(dir: 'libs', include: ['*.jar'])
26-
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
27-
exclude group: 'com.android.support', module: 'support-annotations'
28-
})
29+
compile fileTree(include: ['*.jar'], dir: 'libs')
2930
compile 'com.android.support:appcompat-v7:24.1.1'
30-
testCompile 'junit:junit:4.12'
3131
}
32+
version = "1.0.0"
33+
def siteUrl = 'https://github.com/AllenCoder/AndroidCustomView' // 项目的主页
34+
def gitUrl = 'git@github.com:AllenCoder/AndroidCustomView.git' // Git仓库的url
35+
group = "com.allen.comparsechart" // Maven Group ID for the artifact,一般填你唯一的包名
36+
install {
37+
repositories.mavenInstaller {
38+
// This generates POM.xml with proper parameters
39+
pom {
40+
project {
41+
packaging 'aar'
42+
// Add your description here
43+
name 'compareindicator' //项目的描述 你可以多写一点
44+
url siteUrl
45+
// Set your license
46+
licenses {
47+
license {
48+
name 'The Apache Software License, Version 2.0'
49+
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
50+
}
51+
}
52+
developers {
53+
developer {
54+
id 'compareindicator' //填写的一些基本信息
55+
name 'compareindicator'
56+
email 'AllenCoder@126.com'
57+
}
58+
}
59+
scm {
60+
connection gitUrl
61+
developerConnection gitUrl
62+
url siteUrl
63+
}
64+
}
65+
}
66+
}
67+
}
68+
task sourcesJar(type: Jar) {
69+
from android.sourceSets.main.java.srcDirs
70+
classifier = 'sources'
71+
}
72+
task javadoc(type: Javadoc) {
73+
source = android.sourceSets.main.java.srcDirs
74+
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
75+
}
76+
task javadocJar(type: Jar, dependsOn: javadoc) {
77+
classifier = 'javadoc'
78+
from javadoc.destinationDir
79+
}
80+
artifacts {
81+
archives javadocJar
82+
archives sourcesJar
83+
}
84+
Properties properties = new Properties()
85+
properties.load(project.rootProject.file('local.properties').newDataInputStream())
86+
bintray {
87+
user = properties.getProperty("bintray.user")
88+
key = properties.getProperty("bintray.apikey")
89+
configurations = ['archives']
90+
pkg {
91+
repo = "maven"
92+
name = "compareindicator" //发布到JCenter上的项目名字
93+
websiteUrl = siteUrl
94+
vcsUrl = gitUrl
95+
licenses = ["Apache-2.0"]
96+
publish = true
97+
}
98+
}
99+
//apply from: 'https://raw.githubusercontent.com/attwellBrian/JCenter/master/installv1.gradle'
100+
//apply from: 'https://raw.githubusercontent.com/attwellBrian/JCenter/master/bintrayv1.gradle'
101+

comparsechart/src/androidTest/java/com/allen/comparsechart/ExampleInstrumentedTest.java

Lines changed: 0 additions & 26 deletions
This file was deleted.

comparsechart/src/main/java/com/allen/comparsechart/CompareIndicator.java

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,10 @@ public class CompareIndicator extends View {
2525
private Paint mApprovePaint;
2626
private int mOppostiteCount = 0;
2727
private int mApproveCount = 0;
28-
private float mApproveLineWidth;
29-
private float mOppositeLineWidth;
3028
private float marginLeft_16dp;
3129
private float marginTop_12dp;
3230
private float Start_down_cx;
3331
private float Start_down_cy;
34-
private float width;
3532

3633
public int getOppostiteCount() {
3734
return mOppostiteCount;
@@ -127,22 +124,24 @@ protected void onDraw(Canvas canvas) {
127124
super.onDraw(canvas);
128125
float end_down_cy = Start_down_cy;
129126
float end_up_cx = getWidth() - marginLeft_16dp - mApproveBitmap.getWidth() - DisplayUtils.dip2px(context, 8);
130-
width = end_up_cx - Start_down_cx - DisplayUtils.dp2px(context, 8);
127+
float width = end_up_cx - Start_down_cx - DisplayUtils.dp2px(context, 8);
128+
float approveLineWidth;
129+
float oppositeLineWidth;
131130
if (mOppostiteCount != 0 && mApproveCount != 0) {
132-
mApproveLineWidth = width / (mOppostiteCount + mApproveCount) * mApproveCount;
133-
mOppositeLineWidth = width / (mOppostiteCount + mApproveCount) * mOppostiteCount;
131+
approveLineWidth = width / (mOppostiteCount + mApproveCount) * mApproveCount;
132+
oppositeLineWidth = width / (mOppostiteCount + mApproveCount) * mOppostiteCount;
134133
} else if (mOppostiteCount == 0 && mApproveCount != 0) {
135-
mOppositeLineWidth = DisplayUtils.dp2px(context, 1);
136-
mApproveLineWidth = width - mOppositeLineWidth;
134+
oppositeLineWidth = DisplayUtils.dp2px(context, 1);
135+
approveLineWidth = width - oppositeLineWidth;
137136

138137
} else if (mOppostiteCount != 0 && mApproveCount == 0) {
139-
mApproveLineWidth = DisplayUtils.dp2px(context, 1);
140-
mOppositeLineWidth = width - mApproveLineWidth;
138+
approveLineWidth = DisplayUtils.dp2px(context, 1);
139+
oppositeLineWidth = width - approveLineWidth;
141140
} else {
142-
mOppositeLineWidth = width / 2;
143-
mApproveLineWidth = width / 2;
141+
oppositeLineWidth = width / 2;
142+
approveLineWidth = width / 2;
144143
}
145-
float end_down_cx = Start_down_cx + mOppositeLineWidth;
144+
float end_down_cx = Start_down_cx + oppositeLineWidth;
146145
/**
147146
* 画 第二个圆弧
148147
*/

0 commit comments

Comments
 (0)