Skip to content

Commit 5980d2b

Browse files
committed
1.0.1
1 parent b97ddaf commit 5980d2b

File tree

6 files changed

+146
-9
lines changed

6 files changed

+146
-9
lines changed

build.gradle

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,20 @@
22

33
buildscript {
44
repositories {
5-
jcenter()
5+
jcenter{"http://jcenter.bintray.com/"};
66
}
77
dependencies {
88
classpath 'com.android.tools.build:gradle:1.3.0'
9-
9+
classpath 'com.github.dcendents:android-maven-plugin:1.2'
10+
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
1011
// NOTE: Do not place your application dependencies here; they belong
1112
// in the individual module build.gradle files
1213
}
1314
}
1415

1516
allprojects {
1617
repositories {
17-
jcenter()
18+
jcenter{"http://jcenter.bintray.com/"};
1819
}
1920
}
2021

demo/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,5 @@ android {
2222
dependencies {
2323
compile project(path: ':library')
2424
compile fileTree(dir: 'libs', include: ['*.jar'])
25-
testCompile 'junit:junit:4.12'
2625
compile 'com.android.support:appcompat-v7:23.1.0'
2726
}

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip

library/build.gradle

Lines changed: 87 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
apply plugin: 'com.android.library'
2+
apply plugin: 'com.github.dcendents.android-maven'
3+
apply plugin: 'com.jfrog.bintray'
4+
5+
// This is the library version used when deploying the artifact
6+
version = "1.0.1"
27

38
android {
49
compileSdkVersion 23
510
buildToolsVersion "23.0.1"
11+
resourcePrefix "ltzwheelview__"
12+
613
defaultConfig {
714
minSdkVersion 11
815
targetSdkVersion 23
9-
versionCode 1
10-
versionName "1.0"
16+
versionCode 2
17+
versionName "1.0.1"
1118
}
1219
buildTypes {
1320
release {
@@ -19,8 +26,85 @@ android {
1926
}
2027
}
2128

29+
def siteUrl = 'https://github.com/lantouzi/WheelView-Android'
30+
def gitUrl = 'https://github.com/lantouzi/WheelView-Android.git'
31+
group = "com.lantouzi.wheelview"
32+
33+
install {
34+
repositories.mavenInstaller {
35+
// This generates POM.xml with proper parameters
36+
pom {
37+
//noinspection GroovyAssignabilityCheck
38+
project {
39+
packaging 'aar'
40+
41+
// Add your description here
42+
name 'WheelView'
43+
url siteUrl
44+
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 'lantouzi'
55+
name 'lantouzi'
56+
email 'zhangduo@zuinianqing.com'
57+
}
58+
}
59+
scm {
60+
connection gitUrl
61+
developerConnection gitUrl
62+
url siteUrl
63+
64+
}
65+
}
66+
}
67+
}
68+
}
69+
2270
dependencies {
2371
compile fileTree(dir: 'libs', include: ['*.jar'])
24-
testCompile 'junit:junit:4.12'
2572
compile 'com.android.support:appcompat-v7:23.1.0'
2673
}
74+
75+
task sourcesJar(type: Jar) {
76+
from android.sourceSets.main.java.srcDirs
77+
classifier = 'sources'
78+
}
79+
80+
task javadoc(type: Javadoc) {
81+
source = android.sourceSets.main.java.srcDirs
82+
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
83+
}
84+
85+
task javadocJar(type: Jar, dependsOn: javadoc) {
86+
classifier = 'javadoc'
87+
from javadoc.destinationDir
88+
}
89+
artifacts {
90+
archives javadocJar
91+
archives sourcesJar
92+
}
93+
94+
Properties properties = new Properties()
95+
properties.load(project.rootProject.file('local.properties').newDataInputStream())
96+
97+
bintray {
98+
user = properties.getProperty("bintray.user")
99+
key = properties.getProperty("bintray.apikey")
100+
101+
configurations = ['archives']
102+
pkg {
103+
repo = "maven"
104+
name = "WheelView"
105+
websiteUrl = siteUrl
106+
vcsUrl = gitUrl
107+
licenses = ["Apache-2.0"]
108+
publish = true
109+
}
110+
}

library/library.iml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<module external.linked.project.id=":library" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="WheelView-Android" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
2+
<module external.linked.project.id=":library" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="com.lantouzi.wheelview" external.system.module.version="1.0.1" type="JAVA_MODULE" version="4">
33
<component name="FacetManager">
44
<facet type="android-gradle" name="Android-Gradle">
55
<configuration>

library/src/main/java/com/lantouzi/wheelview/WheelView.java

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
import android.graphics.Path;
88
import android.graphics.Rect;
99
import android.graphics.RectF;
10+
import android.os.Parcel;
11+
import android.os.Parcelable;
1012
import android.support.v4.view.GestureDetectorCompat;
1113
import android.support.v4.view.ViewCompat;
1214
import android.text.TextPaint;
@@ -472,6 +474,57 @@ public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float ve
472474
}
473475
}
474476

477+
@Override
478+
public Parcelable onSaveInstanceState() {
479+
Parcelable superState = super.onSaveInstanceState();
480+
SavedState ss = new SavedState(superState);
481+
ss.index = getSelectedPosition();
482+
return ss;
483+
}
484+
485+
@Override
486+
public void onRestoreInstanceState(Parcelable state) {
487+
SavedState ss = (SavedState) state;
488+
super.onRestoreInstanceState(ss.getSuperState());
489+
selectIndex(ss.index);
490+
requestLayout();
491+
}
492+
493+
static class SavedState extends BaseSavedState {
494+
int index;
495+
public static final Parcelable.Creator<SavedState> CREATOR
496+
= new Parcelable.Creator<SavedState>() {
497+
public SavedState createFromParcel(Parcel in) {
498+
return new SavedState(in);
499+
}
500+
501+
public SavedState[] newArray(int size) {
502+
return new SavedState[size];
503+
}
504+
};
505+
SavedState(Parcelable superState) {
506+
super(superState);
507+
}
508+
509+
private SavedState(Parcel in) {
510+
super(in);
511+
index = (int) in.readValue(null);
512+
}
513+
514+
@Override
515+
public void writeToParcel(Parcel out, int flags) {
516+
super.writeToParcel(out, flags);
517+
out.writeValue(index);
518+
}
519+
520+
@Override
521+
public String toString() {
522+
return "WheelView.SavedState{"
523+
+ Integer.toHexString(System.identityHashCode(this))
524+
+ " index=" + index + "}";
525+
}
526+
}
527+
475528
public interface OnWheelItemSelectedListener {
476529
void onWheelItemSelected(int position);
477530
}

0 commit comments

Comments
 (0)