From 6a9741218c69a19f6ec553c3a31a6c322fbb0562 Mon Sep 17 00:00:00 2001 From: fccaikai <714564390@qq.com> Date: Sun, 30 Oct 2016 21:44:18 +0800 Subject: [PATCH] =?UTF-8?q?1.=E7=A7=BB=E9=99=A4=E4=B8=8A=E4=BC=A0=E5=88=B0?= =?UTF-8?q?jcenter=E4=BB=93=E5=BA=93=E7=9A=84=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- app/build.gradle | 7 +- .../com/kcode/autoviewpager/MainActivity.java | 13 ++- autoScrollViewPager/build.gradle | 86 +------------------ .../view/BaseViewPagerAdapter.java | 6 +- build.gradle | 5 -- 6 files changed, 20 insertions(+), 99 deletions(-) diff --git a/README.md b/README.md index 0b89249..f154f53 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ replace: in app's build.gradle,add: ``` -compile 'com.kcode.github:autoScrollViewPager:0.7.0' +compile 'com.kcode.github:autoScrollViewPager:0.9.3' ``` ##Usage diff --git a/app/build.gradle b/app/build.gradle index cb536f6..c6c1249 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -27,7 +27,8 @@ dependencies { compile 'com.android.support:appcompat-v7:24.2.0' testCompile 'junit:junit:4.12' compile 'com.squareup.picasso:picasso:2.3.2' - compile 'com.github.fccaikai:AutoScrollViewPager:0.8.0', { - exclude group: 'com.android.support', module: 'appcompat-v7' - } +// compile 'com.github.fccaikai:AutoScrollViewPager:0.8.0', { +// exclude group: 'com.android.support', module: 'appcompat-v7' +// } + compile project(':autoScrollViewPager') } diff --git a/app/src/main/java/com/kcode/autoviewpager/MainActivity.java b/app/src/main/java/com/kcode/autoviewpager/MainActivity.java index b9442f6..d72ba04 100644 --- a/app/src/main/java/com/kcode/autoviewpager/MainActivity.java +++ b/app/src/main/java/com/kcode/autoviewpager/MainActivity.java @@ -29,12 +29,21 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_main); mViewPager = (AutoScrollViewPager) findViewById(R.id.viewPager); - mViewPager.setAdapter(new BaseViewPagerAdapter(this,initData(),listener) { + + BaseViewPagerAdapter adapter = new BaseViewPagerAdapter(this,listener) { @Override public void loadImage(ImageView view, int position, String url) { Picasso.with(MainActivity.this).load(url).into(view); } - }); + }; + mViewPager.setAdapter(adapter); + + try { + Thread.sleep(2000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + adapter.add(initData()); } diff --git a/autoScrollViewPager/build.gradle b/autoScrollViewPager/build.gradle index 00c2329..2432d7c 100644 --- a/autoScrollViewPager/build.gradle +++ b/autoScrollViewPager/build.gradle @@ -1,8 +1,4 @@ apply plugin: 'com.android.library' -apply plugin: 'com.github.dcendents.android-maven' - -// This is the library version used when deploying the artifact -version = "0.2.0" android { compileSdkVersion 24 @@ -25,84 +21,4 @@ android { dependencies { compile 'com.android.support:appcompat-v7:24.2.0' -} - -def siteUrl = 'https://github.com/fccaikai/AutoScrollViewPager' // Homepage URL of the library -def gitUrl = 'https://github.com/fccaikai/AutoScrollViewPager.git' // Git repository URL -group = "com.kcode.github" // Maven Group ID for the artifact - -install { - repositories.mavenInstaller { - // This generates POM.xml with proper parameters - pom { - project { - packaging 'aar' - - // Add your description here - name 'com.kcode.github:AutoScrollViewPager' // TODO - description = 'android auto scroll viewpager' // TODO - url siteUrl - - // Set your license - licenses { - license { - name 'The Apache Software License, Version 2.0' - url 'http://www.apache.org/licenses/LICENSE-2.0.txt' - } - } - developers { - developer { - id 'caikai' // TODO - name 'caikai' // TODO - email 'ck19920702@gmail.com' // TODO - } - } - scm { - connection gitUrl - developerConnection gitUrl - url siteUrl - } - } - } - } -} - -task sourcesJar(type: Jar) { - from android.sourceSets.main.java.srcDirs - classifier = 'sources' -} - -task javadoc(type: Javadoc) { - source = android.sourceSets.main.java.srcDirs - classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) -} - -task javadocJar(type: Jar, dependsOn: javadoc) { - classifier = 'javadoc' - from javadoc.destinationDir -} -artifacts { - archives javadocJar - archives sourcesJar -} - -Properties properties = new Properties() -properties.load(project.rootProject.file('local.properties').newDataInputStream()) - -// https://github.com/bintray/gradle-bintray-plugin -bintray { - user = properties.getProperty("bintray.user") - key = properties.getProperty("bintray.apikey") - - configurations = ['archives'] - pkg { - repo = "maven" - // it is the name that appears in bintray when logged - name = "AutoViewPager" // TODO - websiteUrl = siteUrl - userOrg = "kcode" - vcsUrl = gitUrl - licenses = ["Apache-2.0"] - publish = true - } -} +} \ No newline at end of file diff --git a/autoScrollViewPager/src/main/java/com/kcode/autoscrollviewpager/view/BaseViewPagerAdapter.java b/autoScrollViewPager/src/main/java/com/kcode/autoscrollviewpager/view/BaseViewPagerAdapter.java index f1df049..c71e5de 100644 --- a/autoScrollViewPager/src/main/java/com/kcode/autoscrollviewpager/view/BaseViewPagerAdapter.java +++ b/autoScrollViewPager/src/main/java/com/kcode/autoscrollviewpager/view/BaseViewPagerAdapter.java @@ -83,12 +83,12 @@ public void add(List list){ } data.addAll(list); - //设置初始为中间,这样一开始就能够往左滑动了 - mView.setCurrentItem(0); + + notifyDataSetChanged(); mView.start(); mView.updatePointView(getRealCount()); - notifyDataSetChanged(); + } @Override diff --git a/build.gradle b/build.gradle index 16693c7..831afc8 100644 --- a/build.gradle +++ b/build.gradle @@ -13,11 +13,6 @@ buildscript { } -plugins { - id "com.jfrog.bintray" version "1.7" - id "com.github.dcendents.android-maven" version "1.5" -} - allprojects { repositories { jcenter()