Skip to content

Commit e8d514d

Browse files
committed
add to jcenter.
1 parent f3f27b8 commit e8d514d

File tree

9 files changed

+114
-5
lines changed

9 files changed

+114
-5
lines changed

README.md

+28-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# IntensifyGridView
22
![预览](screenshot/merge.jpg)
33

4-
# Usage
4+
功能如下:
5+
56
- 省略布局(如QQ空间图片大于9张时最后一张的图片显示样式特殊),形式类型TextView的省略样式,可以指定省略位置(前,后,无)
67
- 额外布局(如设置最大长度为9,额外布局为1,那么在长度小于等于9时会出现额外布局,大于等于9时额外布局消失)
78
- 自动布局(根据设置的Block的尺寸进行自动布局,类似于`GridView``auto_fit`
@@ -10,9 +11,32 @@
1011
- 最大行数,或者最大长度
1112
- 指定Block的形状(长方形和正方形)
1213

14+
# Demo
15+
安装 [apk](https://www.pgyer.com/igridview) 文件预览效果,或者通过下面二维码去下载安装:
16+
![Demo 二维码](screenshot/code.png)
17+
18+
# Usage
19+
20+
Use Gradle:
21+
22+
``` groovy
23+
compile 'me.kareluo.intensify:gridview:1.0.0'
24+
```
25+
26+
Or Maven:
27+
28+
``` xml
29+
<dependency>
30+
<groupId>me.kareluo.intensify</groupId>
31+
<artifactId>gridview</artifactId>
32+
<version>1.0.0</version>
33+
<type>pom</type>
34+
</dependency>
35+
```
36+
1337
# Sample
1438

15-
* 当autoFit为true时spanCount便会无效,这时spanCount是由blockWidth决定的,当autoFit为false时,需要设置spanCount来确定列数
39+
`autoFit`为true时`spanCount`便会无效,这时`spanCount`是由blockWidth决定的,当`autoFit`为false时,需要设置`spanCount`来确定列数。布局文件中的使用格式如下,除`divider``orientation`使用`android`命名空间外,其他一些属性都使用自定义命名空间,如下:
1640

1741
``` xml
1842
<me.kareluo.intensify.gridview.IntensifyGridView
@@ -36,6 +60,8 @@
3660
app:spacer="[color|drawable]"/>
3761
```
3862

63+
`Adapter`使用继承自`IntensifyGridAdapter`,其增加了省略布局和额外布局的一些方法。需要注意一点,当设置了`maxLength`或者`maxLines`后不要使用`mAdapter.notifyItemInserted(int position)`来刷新数据,代码如下:
64+
3965
``` java
4066
// Adapter 继承 IntensifyGridAdapter
4167
private class TestAdapter extends IntensifyGridAdapter<DemoViewHolder> {

app/src/main/java/me/kareluo/intensify/sample/MainActivity.java

-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ public boolean onItemLongClick(RecyclerView.ViewHolder holder) {
5555
return false;
5656
}
5757
});
58-
5958
}
6059

6160
@Override
-3.34 KB
Binary file not shown.
-2.15 KB
Binary file not shown.
1.82 KB
Loading
-10.2 KB
Binary file not shown.

build.gradle

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ buildscript {
66
}
77
dependencies {
88
classpath 'com.android.tools.build:gradle:2.1.0'
9-
9+
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
10+
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
1011
// NOTE: Do not place your application dependencies here; they belong
1112
// in the individual module build.gradle files
1213
}

gridview/build.gradle

+84-1
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
apply plugin: 'com.android.library'
2+
apply plugin: 'com.jfrog.bintray'
3+
apply plugin: 'com.github.dcendents.android-maven'
4+
5+
version = "1.0.0"
26

37
android {
48
compileSdkVersion 23
59
buildToolsVersion "23.0.3"
610

11+
resourcePrefix "intensify_"
12+
713
defaultConfig {
814
minSdkVersion 15
915
targetSdkVersion 23
1016
versionCode 1
11-
versionName "1.0"
17+
versionName "1.0.0"
1218
}
1319
buildTypes {
1420
release {
@@ -23,3 +29,80 @@ dependencies {
2329
testCompile 'junit:junit:4.12'
2430
compile 'com.android.support:recyclerview-v7:23.4.0'
2531
}
32+
33+
def siteUrl = 'https://github.com/kareluo/IntensifyGridView'
34+
def gitUrl = 'https://github.com/kareluo/IntensifyGridView.git'
35+
36+
group = "me.kareluo.intensify"
37+
38+
install {
39+
40+
repositories.mavenInstaller {
41+
// This generates POM.xml with proper parameters
42+
pom {
43+
project {
44+
packaging 'aar'
45+
46+
name 'me.kareluo.intensify:gridview'
47+
url siteUrl
48+
49+
licenses {
50+
license {
51+
name 'The Apache Software License, Version 2.0'
52+
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
53+
}
54+
}
55+
56+
developers {
57+
developer {
58+
id 'kareluo'
59+
name 'Felix'
60+
61+
}
62+
}
63+
64+
scm {
65+
connection gitUrl
66+
developerConnection gitUrl
67+
url siteUrl
68+
}
69+
}
70+
}
71+
}
72+
}
73+
74+
task sourcesJar(type: Jar) {
75+
from android.sourceSets.main.java.srcDirs
76+
classifier = 'sources'
77+
}
78+
79+
task javadoc(type: Javadoc) {
80+
source = android.sourceSets.main.java.srcDirs
81+
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
82+
}
83+
84+
task javadocJar(type: Jar, dependsOn: javadoc) {
85+
classifier = 'javadoc'
86+
from javadoc.destinationDir
87+
}
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+
bintray {
97+
user = properties.getProperty("bintray.user")
98+
key = properties.getProperty("bintray.apikey")
99+
configurations = ['archives']
100+
pkg {
101+
repo = "maven"
102+
name = "me.kareluo.intensify:gridview"
103+
websiteUrl = siteUrl
104+
vcsUrl = gitUrl
105+
licenses = ["Apache-2.0"]
106+
publish = true
107+
}
108+
}

screenshot/code.png

365 Bytes
Loading

0 commit comments

Comments
 (0)