Skip to content

Commit

Permalink
update for 1.0.10
Browse files Browse the repository at this point in the history
  • Loading branch information
liaohuqiu committed Mar 26, 2015
1 parent 4895692 commit 6fe7d85
Show file tree
Hide file tree
Showing 10 changed files with 280 additions and 60 deletions.
11 changes: 11 additions & 0 deletions .travis.yml
@@ -0,0 +1,11 @@
language: android

android:
components:
- build-tools-20.0.0
- android-19

jdk: oraclejdk7

script:
- ./gradlew check
31 changes: 2 additions & 29 deletions README-cn.md 100755 → 100644
Expand Up @@ -11,14 +11,14 @@
<groupId>in.srain.cube</groupId>
<artifactId>grid-view-with-header-footer</artifactId>
<type>jar</type>
<version>1.0.9</version>
<version>1.0.10</version>
</dependency>
```

#### Gradle

``` groovy
compile 'in.srain.cube:grid-view-with-header-footer:1.0.9'
compile 'in.srain.cube:grid-view-with-header-footer:1.0.10'
```

### 使用示例
Expand All @@ -33,33 +33,6 @@ gridView.addHeaderView(headerView);
gridView.addFooterView(footerView);
```

#### 滑到底部之后,加载更多

`1.0.4`之后版本开始支持。

```
public void tryToScrollToBottomSmoothly();
public void tryToScrollToBottomSmoothly(int duration);
```

When scroll to the bottom, you may need to show the footer view when loading data from server.

```java
mFooterView.setVisibility(View.VISIBLE);
mGridView.post(new Runnable() {
@Override
public void run() {
mGridView.tryToScrollToBottomSmoothly(100);
}
});
mGridView.postDelay(new Runnable() {
@Override
public void run() {
// 处理加载更多
}
}, 150);
```

### Thanks

[HeaderGridView](https://android.googlesource.com/platform/packages/apps/Gallery2/+/idea133/src/com/android/photos/views/HeaderGridView.java)
Expand Down
33 changes: 3 additions & 30 deletions README.md
@@ -1,4 +1,4 @@
## [中文版文档](https://github.com/liaohuqiu/android-GridViewWithHeaderAndFooter/blob/master/README-cn.md)
#### [中文版文档](https://github.com/liaohuqiu/android-GridViewWithHeaderAndFooter/blob/master/README-cn.md)

### GridView with Header and Footer

Expand All @@ -13,14 +13,14 @@ This library is contained by `CUBE-SDK`: https://github.com/etao-open-source/cub
<groupId>in.srain.cube</groupId>
<artifactId>grid-view-with-header-footer</artifactId>
<type>jar</type>
<version>1.0.9</version>
<version>1.0.10</version>
</dependency>
```

#### Gradle

``` groovy
compile 'in.srain.cube:grid-view-with-header-footer:1.0.9'
compile 'in.srain.cube:grid-view-with-header-footer:1.0.10'
```

### Usage
Expand All @@ -35,33 +35,6 @@ gridView.addHeaderView(headerView);
gridView.addFooterView(footerView);
```

#### When scroll to bottom to load more data for GridView

since 1.0.4

```
public void tryToScrollToBottomSmoothly();
public void tryToScrollToBottomSmoothly(int duration);
```

When scroll to the bottom, you may need to show the footer view when loading data from server.

```java
mFooterView.setVisibility(View.VISIBLE);
mGridView.post(new Runnable() {
@Override
public void run() {
mGridView.tryToScrollToBottomSmoothly(100);
}
});
mGridView.postDelay(new Runnable() {
@Override
public void run() {
// load more data
}
}, 150);
```

### Thanks

[HeaderGridView](https://android.googlesource.com/platform/packages/apps/Gallery2/+/idea133/src/com/android/photos/views/HeaderGridView.java)
Expand Down
21 changes: 21 additions & 0 deletions build.gradle
@@ -0,0 +1,21 @@
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.+'
}
}

allprojects {
repositories {
jcenter()
mavenCentral();
maven {
url 'https://oss.sonatype.org/content/repositories/releases'
}
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots'
}
}
}
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -13,7 +13,7 @@
<artifactId>grid-view-with-header-footer</artifactId>
<packaging>jar</packaging>
<name>GridViewWithHeaderAndFooter</name>
<version>1.0.9</version>
<version>1.0.10</version>

<description>GridView with Header and Footer</description>
<url>https://github.com/liaohuqiu/android-GridViewWithHeaderAndFooter</url>
Expand Down
51 changes: 51 additions & 0 deletions template/README-cn.md
@@ -0,0 +1,51 @@
### GridView with Header and Footer

![Screen Shot](https://raw.githubusercontent.com/liaohuqiu/android-GridViewWithHeaderAndFooter/master/screen-shot.png)

只有一个文件,你可以将源代码放入你的项目中。另外项目发布到了Maven中央库,你可以通过`pom`或者`gradle`引入。

#### Maven

```xml
<dependency>
<groupId>in.srain.cube</groupId>
<artifactId>grid-view-with-header-footer</artifactId>
<type>jar</type>
<version>{lib_version}</version>
</dependency>
```

#### Gradle

``` groovy
compile 'in.srain.cube:grid-view-with-header-footer:{lib_version}'
```

### 使用示例

```java
GridViewWithHeaderAndFooter gridView = (GridViewWithHeaderAndFooter) v.findViewById(R.id.ly_image_list_grid);

LayoutInflater layoutInflater = LayoutInflater.from(this);
View headerView = layoutInflater.inflate(R.layout.test_header_view, null);
View footerView = layoutInflater.inflate(R.layout.test_footer_view, null);
gridView.addHeaderView(headerView);
gridView.addFooterView(footerView);
```

### Thanks

[HeaderGridView](https://android.googlesource.com/platform/packages/apps/Gallery2/+/idea133/src/com/android/photos/views/HeaderGridView.java)

### License

Apache 2

### 联系方式 / 帮助支持

Please fell free to contact me if there is any problem when using the library.

* srain@php.net
* twitter: https://twitter.com/liaohuqiu
* 微博: http://weibo.com/liaohuqiu
* QQ 群: 271918140
53 changes: 53 additions & 0 deletions template/README.md
@@ -0,0 +1,53 @@
#### [中文版文档](https://github.com/liaohuqiu/android-GridViewWithHeaderAndFooter/blob/master/README-cn.md)

### GridView with Header and Footer

![Screen Shot](https://raw.githubusercontent.com/liaohuqiu/android-GridViewWithHeaderAndFooter/master/screen-shot.png)

This library is contained by `CUBE-SDK`: https://github.com/etao-open-source/cube-sdk. The Demo is HERE: https://github.com/liaohuqiu/android-cube-app .

#### Maven

```xml
<dependency>
<groupId>in.srain.cube</groupId>
<artifactId>grid-view-with-header-footer</artifactId>
<type>jar</type>
<version>{lib_version}</version>
</dependency>
```

#### Gradle

``` groovy
compile 'in.srain.cube:grid-view-with-header-footer:{lib_version}'
```

### Usage

```java
GridViewWithHeaderAndFooter gridView = (GridViewWithHeaderAndFooter) v.findViewById(R.id.ly_image_list_grid);

LayoutInflater layoutInflater = LayoutInflater.from(this);
View headerView = layoutInflater.inflate(R.layout.test_header_view, null);
View footerView = layoutInflater.inflate(R.layout.test_footer_view, null);
gridView.addHeaderView(headerView);
gridView.addFooterView(footerView);
```

### Thanks

[HeaderGridView](https://android.googlesource.com/platform/packages/apps/Gallery2/+/idea133/src/com/android/photos/views/HeaderGridView.java)

### License

Apache 2

### contact or help

Please fell free to contact me if there is any problem when using the library.

* srain@php.net
* twitter: https://twitter.com/liaohuqiu
* weibo: http://weibo.com/liaohuqiu
* QQ tribe: 271918140
100 changes: 100 additions & 0 deletions template/pom.xml
@@ -0,0 +1,100 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>in.srain</groupId>
<artifactId>cube-parent-for-oss</artifactId>
<version>1.0.1</version>
</parent>

<groupId>in.srain.cube</groupId>
<artifactId>grid-view-with-header-footer</artifactId>
<packaging>jar</packaging>
<name>GridViewWithHeaderAndFooter</name>
<version>{lib_version}</version>

<description>GridView with Header and Footer</description>
<url>https://github.com/liaohuqiu/android-GridViewWithHeaderAndFooter</url>
<inceptionYear>2014</inceptionYear>

<scm>
<url>https://github.com/liaohuqiu/android-GridViewWithHeaderAndFooter</url>
<connection>scm:git:git@github.com:liaohuqiu/android-GridViewWithHeaderAndFooter.git</connection>
<developerConnection>scm:git:git@github.com:liaohuqiu/android-GridViewWithHeaderAndFooter.git
</developerConnection>
</scm>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>4.1.1.4</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

<developers>
<developer>
<name>Huqiu Liao</name>
<email>liaohuqiu@gmail.com</email>
<id>liaohuqiu</id>
<url>http://www.liaohuqiu.net</url>
<timezone>+8</timezone>
<roles>
<role>developer</role>
</roles>
</developer>
</developers>

<licenses>
<license>
<name>Apache License Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>

<organization>
<name>Huqiu Liao</name>
<url>http://www.liaohuqiu.net</url>
</organization>

<issueManagement>
<system>GitHub Issues</system>
<url>https://github.com/liaohuqiu/android-GridViewWithHeaderAndFooter/issues</url>
</issueManagement>

<properties>
<android.maven.plugin.version>3.7.0</android.maven.plugin.version>
<android.compile.apilevel>16</android.compile.apilevel>
</properties>

<build>
<finalName>${project.artifactId}</finalName>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<extensions>true</extensions>
<version>${android.maven.plugin.version}</version>
<configuration>
<sdk>
<path>${env.ANDROID_HOME}</path>
<platform>${android.compile.apilevel}</platform>
</sdk>
<sign>
<debug>false</debug>
</sign>
</configuration>
</plugin>
</plugins>
</build>
</project>
2 changes: 2 additions & 0 deletions update-and-publish.sh
@@ -0,0 +1,2 @@
python update-project.py
mvn deploy
36 changes: 36 additions & 0 deletions update-project.py
@@ -0,0 +1,36 @@
import os
vars = {
'lib_version': '1.0.10'
}

files = [
'README.md',
'README-cn.md',
'pom.xml',
]

current_dir = os.path.dirname(os.path.realpath(__file__))
print current_dir
src_dir = current_dir + '/template/'
dst_dir = current_dir + '/'

def update_var_for_file(file, vars):
src_file = src_dir + file
dst_file = dst_dir + file
print "update_var_for_file: %s => %s" % (src_file, dst_file)
infile = open(src_file)
outfile = open(dst_file, 'w')

for line in infile:
for src, target in vars.iteritems():
line = line.replace(src, target)
outfile.write(line)
infile.close()
outfile.close()

real_vars = {}
for src, target in vars.iteritems():
real_vars['{' + src + '}'] = target

for f in files:
update_var_for_file(f, real_vars)

0 comments on commit 6fe7d85

Please sign in to comment.