Skip to content
This repository has been archived by the owner on Jul 14, 2021. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
longerian committed Aug 12, 2017
2 parents f1f5eb5 + 4602ceb commit 5c2bd82
Show file tree
Hide file tree
Showing 19 changed files with 511 additions and 65 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ target/
lint.xml

deploy.gradle
jcenterDeploy.gradle
jcenterInstall.gradle
#jcenterDeploy.gradle
#jcenterInstall.gradle
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,23 @@
buildscript {
repositories {
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
maven { url "http://oss.jfrog.org/oss-snapshot-local/" }
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.github.xfumihiro.view-inspector:view-inspector-plugin:0.1.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.0.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
}
}

allprojects {
repositories {
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
maven { url "http://oss.jfrog.org/oss-snapshot-local/" }
jcenter()
mavenLocal()
}
Expand Down
8 changes: 8 additions & 0 deletions docs/VLayoutFAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,11 @@ RecyclerView.OnScrollListener onScrollListener = new RecyclerView.OnScrollListen
在使用方的图片加载成功回调函数里设置一下图片加载成功的状态,可以自行维护一个map或者给View设置一个tag标记。

我们提供了一个简单的`DefaultLayoutViewHelper`封装了这个逻辑,可以参考使用。

## 在可滚动区域里嵌套使用vlayout的RecyclerView

不太建议嵌套滚动,除非手势不冲突;如果要完全展开vlayout里的内容,牺牲滚动复用,可以调用`VirtualLayoutManager``setNoScrolling(true);`方法设置一下。

## 为GridLayoutHelper的设置自定义SpanSizeLookup

在SpanSizeLookup中,public int getSpanSize(int position)方法参数的position是整个页面的position信息,需要获取当前layoutHelper内的相对位置,需要减去一个偏移量,即position - getStartPosition()。
1 change: 1 addition & 0 deletions examples/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@ dependencies {
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:appcompat-v7:21.0.0'
compile 'com.android.support:support-annotations:21.0.0'
compile 'com.android.support:cardview-v7:23.1.1'
}
Original file line number Diff line number Diff line change
Expand Up @@ -240,14 +240,34 @@ public void onBindViewHolder(MainViewHolder holder, int position) {

if (LINEAR_LAYOUT) {
LinearLayoutHelper layoutHelper1 = new LinearLayoutHelper();
layoutHelper1.setBgColor(Color.YELLOW);
layoutHelper1.setAspectRatio(2.0f);
layoutHelper1.setMargin(10, 10, 10, 10);
layoutHelper1.setPadding(10, 10, 10, 10);
LinearLayoutHelper layoutHelper2 = new LinearLayoutHelper();
layoutHelper2.setAspectRatio(4.0f);
layoutHelper2.setDividerHeight(10);
layoutHelper2.setMargin(10, 30, 10, 10);
layoutHelper2.setPadding(10, 30, 10, 10);
layoutHelper2.setMargin(10, 0, 10, 10);
layoutHelper2.setPadding(10, 0, 10, 10);
layoutHelper2.setBgColor(0xFFF5A623);
adapters.add(new SubAdapter(this, layoutHelper1, 1));
final Handler mainHandler = new Handler(Looper.getMainLooper());
adapters.add(new SubAdapter(this, layoutHelper1, 1) {
@Override
public void onBindViewHolder(final MainViewHolder holder, int position) {
super.onBindViewHolder(holder, position);
final SubAdapter subAdapter = this;
//mainHandler.postDelayed(new Runnable() {
// @Override
// public void run() {
// //delegateAdapter.removeAdapter(subAdapter);
// //notifyItemRemoved(1);
// holder.itemView.setVisibility(View.GONE);
// notifyItemChanged(1);
// layoutManager.runAdjustLayout();
// }
//}, 2000L);
}
});
adapters.add(new SubAdapter(this, layoutHelper2, 6) {

@Override
Expand Down Expand Up @@ -275,22 +295,25 @@ public void onBindViewHolder(MainViewHolder holder, int position) {
adapters.add(new SubAdapter(this, layoutHelper, 1, new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 100)));
}

//{
// final StaggeredGridLayoutHelper helper = new StaggeredGridLayoutHelper(3, 10);
// helper.setBgColor(0xFF86345A);
// adapters.add(new SubAdapter(this, helper, 4) {
//
// @Override
// public void onBindViewHolder(MainViewHolder holder, int position) {
// super.onBindViewHolder(holder, position);
// LayoutParams layoutParams = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 300);
// if (position % 2 == 0) {
// layoutParams.mAspectRatio = 1.0f;
// } else {
// layoutParams.height = 340 + position % 7 * 20;
// }
// holder.itemView.setLayoutParams(layoutParams);
// }
// });
//}
{
//final StaggeredGridLayoutHelper helper = new StaggeredGridLayoutHelper(3, 10);
//helper.setBgColor(0xFF86345A);
//adapters.add(new SubAdapter(this, helper, 4) {
// @Override
// public void onBindViewHolder(MainViewHolder holder, int position) {
// super.onBindViewHolder(holder, position);
// LayoutParams layoutParams = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 300);
// if (position % 2 == 0) {
// layoutParams.mAspectRatio = 1.0f;
// } else {
// layoutParams.height = 340 + position % 7 * 20;
// }
// holder.itemView.setLayoutParams(layoutParams);
// }
//});

final GridLayoutHelper helper = new GridLayoutHelper(3, 4);
helper.setBgColor(0xFF86345A);
Expand Down
41 changes: 41 additions & 0 deletions examples/src/main/res/layout/card_item.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ MIT License
~
~ Copyright (c) 2016 Alibaba Group
~
~ Permission is hereby granted, free of charge, to any person obtaining a copy
~ of this software and associated documentation files (the "Software"), to deal
~ in the Software without restriction, including without limitation the rights
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
~ copies of the Software, and to permit persons to whom the Software is
~ furnished to do so, subject to the following conditions:
~
~ The above copyright notice and this permission notice shall be included in all
~ copies or substantial portions of the Software.
~
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
~ SOFTWARE.
-->

<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/border_bg">

<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/item_background"
android:gravity="center"
android:textColor="#999999"
android:textSize="22sp"
android:textStyle="bold"/>
</android.support.v7.widget.CardView>
151 changes: 151 additions & 0 deletions jcenterDeploy.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
/*
* MIT License
*
* Copyright (c) 2017 Alibaba Group
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.jfrog.artifactory'

version = libraryVersion

if (project.hasProperty('deployVersion')) {
version = project.getProperty('deployVersion')
}

if (project.hasProperty("android")) { // Android libraries
task sourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
}

// task javadoc(type: Javadoc) {
// source = android.sourceSets.main.java.srcDirs
// classpath += project.files(android.getBootClasspath().join(File.pathSeparator))

// android.libraryVariants.all { variant ->
// println variant.javaCompile.classpath.files
// if(variant.name == 'release') { //我们只需 release 的 javadoc
// task("generate${variant.name.capitalize()}Javadoc", type: Javadoc) {
// // title = ''
// // description = ''
// source = variant.javaCompile.source
// classpath = files(variant.javaCompile.classpath.files, project.android.getBootClasspath())
// options {
// encoding "utf-8"
// links "http://docs.oracle.com/javase/7/docs/api/"
// linksOffline "http://d.android.com/reference", "${android.sdkDirectory}/docs/reference"
// }
// exclude '**/BuildConfig.java'
// exclude '**/R.java'
// }
// task("javadoc${variant.name.capitalize()}Jar", type: Jar, dependsOn: "generate${variant.name.capitalize()}Javadoc") {
// classifier = 'javadoc'
// from tasks.getByName("generate${variant.name.capitalize()}Javadoc").destinationDir
// }
// artifacts {
// archives tasks.getByName("javadoc${variant.name.capitalize()}Jar")
// }
// }
// }
//
// }
} else { // Java libraries
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
}

//task javadocJar(type: Jar, dependsOn: javadoc) {
// classifier = 'javadoc'
// from javadoc.destinationDir
//}

artifacts {
// archives javadocJar
archives sourcesJar
}

// Bintray
//Properties properties = new Properties()
//properties.load(project.rootProject.file('local.properties').newDataInputStream())

bintray {
// user = properties.getProperty("bintray.user")
// key = properties.getProperty("bintray.apikey")
user = project.hasProperty('bintrayUser') ? project.getProperty('bintrayUser') : ""
key = project.hasProperty('bintrayApikey') ? project.getProperty('bintrayApikey') : ""

configurations = ['archives']
pkg {
repo = bintrayRepo
name = bintrayName
desc = libraryDescription
websiteUrl = siteUrl
vcsUrl = gitUrl
licenses = allLicenses
publish = true
publicDownloadNumbers = true
version {
desc = libraryDescription
gpg {
sign = true //Determines whether to GPG sign the files. The default is false
// passphrase = properties.getProperty("bintray.gpg.password")
passphrase = project.hasProperty('bintrayGPG') ? project.getProperty('bintrayGPG') : ""
//Optional. The passphrase for GPG signing'
}
}
}
}

artifactory {
contextUrl = 'http://oss.jfrog.org/artifactory' //The base Artifactory URL if not overridden by the publisher/resolver
resolve {
repository {
repoKey = 'libs-release'
}
}
publish {
repository {
repoKey = 'oss-snapshot-local' //The Artifactory repository key to publish to
username = bintray.user
password = bintray.key
maven = true
}
defaults {
// the name is the same with that defined in bintray.configurations
publishConfigs('archives')
}
}
}

bintrayUpload.onlyIf {
!version.endsWith("-SNAPSHOT")
}

artifactoryPublish.onlyIf {
version.endsWith("-SNAPSHOT")
}

task deploy(dependsOn: ['install', 'bintrayUpload', 'artifactoryPublish']) << {
println "deploy ...."
}
66 changes: 66 additions & 0 deletions jcenterInstall.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* MIT License
*
* Copyright (c) 2017 Alibaba Group
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

apply plugin: 'com.github.dcendents.android-maven'

group = GROUP

install {
repositories.mavenInstaller {
// This generates POM.xml with proper parameters
pom {
project {
packaging 'aar'
groupId publishedGroupId
artifactId artifact

// Add your description here
name libraryName
description libraryDescription
url siteUrl

// Set your license
licenses {
license {
name licenseName
url licenseUrl
}
}
developers {
developer {
id developerId
name developerName
email developerEmail
}
}
scm {
connection gitUrl
developerConnection gitUrl
url siteUrl

}
}
}
}
}
Loading

0 comments on commit 5c2bd82

Please sign in to comment.