Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
update version
  • Loading branch information
liaohuqiu committed May 16, 2015
1 parent fd5cb7e commit d4a99ef
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 24 deletions.
4 changes: 2 additions & 2 deletions README-cn.md
Expand Up @@ -19,14 +19,14 @@ Github: https://github.com/liaohuqiu
<groupId>in.srain.cube</groupId>
<artifactId>grid-view-with-header-footer</artifactId>
<type>jar</type>
<version>1.0.11</version>
<version>1.0.12</version>
</dependency>
```

#### Gradle

``` groovy
compile 'in.srain.cube:grid-view-with-header-footer:1.0.11'
compile 'in.srain.cube:grid-view-with-header-footer:1.0.12'
```

### 使用示例
Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -21,14 +21,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.11</version>
<version>1.0.12</version>
</dependency>
```

#### Gradle

``` groovy
compile 'in.srain.cube:grid-view-with-header-footer:1.0.11'
compile 'in.srain.cube:grid-view-with-header-footer:1.0.12'
```

### Usage
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
@@ -1,4 +1,4 @@
VERSION_NAME=1.0.11
VERSION_NAME=1.0.12

ANDROID_BUILD_MIN_SDK_VERSION=8
ANDROID_BUILD_TARGET_SDK_VERSION=16
Expand Down
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.11</version>
<version>1.0.12</version>

<description>GridView with Header and Footer</description>
<url>https://github.com/liaohuqiu/android-GridViewWithHeaderAndFooter</url>
Expand Down
46 changes: 29 additions & 17 deletions src/in/srain/cube/views/GridViewWithHeaderAndFooter.java
Expand Up @@ -35,7 +35,7 @@
* See {@link GridViewWithHeaderAndFooter#addHeaderView(View, Object, boolean)}
* See {@link GridViewWithHeaderAndFooter#addFooterView(View, Object, boolean)}
*/
public class GridViewWithHeaderAndFooter extends GridView implements android.widget.AdapterView.OnItemClickListener, AdapterView.OnItemLongClickListener {
public class GridViewWithHeaderAndFooter extends GridView {

public static boolean DEBUG = false;
private OnItemClickListener mOnItemClickListener;
Expand Down Expand Up @@ -70,6 +70,7 @@ private static class FixedViewInfo {
private ArrayList<FixedViewInfo> mHeaderViewInfos = new ArrayList<FixedViewInfo>();
private ArrayList<FixedViewInfo> mFooterViewInfos = new ArrayList<FixedViewInfo>();
private ListAdapter mOriginalAdapter;
private ItemClickHandler mItemClickHandler;

private void initHeaderGridView() {
}
Expand Down Expand Up @@ -418,6 +419,7 @@ public void setAdapter(ListAdapter adapter) {

/**
* Return original adapter for convenience.
*
* @return
*/
public ListAdapter getOriginalAdapter() {
Expand Down Expand Up @@ -844,33 +846,43 @@ public void notifyDataSetChanged() {
@Override
public void setOnItemClickListener(OnItemClickListener l) {
mOnItemClickListener = l;
super.setOnItemClickListener(this);
super.setOnItemClickListener(getItemClickHandler());
}

@Override
public void setOnItemLongClickListener(OnItemLongClickListener listener) {
mOnItemLongClickListener = listener;
super.setOnItemLongClickListener(this);
super.setOnItemLongClickListener(getItemClickHandler());
}

@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (mOnItemClickListener != null) {
int resPos = position - getHeaderViewCount() * getNumColumnsCompatible();
if (resPos >= 0) {
mOnItemClickListener.onItemClick(parent, view, resPos, id);
}
private ItemClickHandler getItemClickHandler() {
if (mItemClickHandler == null) {
mItemClickHandler = new ItemClickHandler();
}
return mItemClickHandler;
}

@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
if (mOnItemLongClickListener != null) {
int resPos = position - getHeaderViewCount() * getNumColumnsCompatible();
if (resPos >= 0) {
mOnItemLongClickListener.onItemLongClick(parent, view, resPos, id);
private class ItemClickHandler implements android.widget.AdapterView.OnItemClickListener, AdapterView.OnItemLongClickListener {

@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (mOnItemClickListener != null) {
int resPos = position - getHeaderViewCount() * getNumColumnsCompatible();
if (resPos >= 0) {
mOnItemClickListener.onItemClick(parent, view, resPos, id);
}
}
}
return true;

@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
if (mOnItemLongClickListener != null) {
int resPos = position - getHeaderViewCount() * getNumColumnsCompatible();
if (resPos >= 0) {
mOnItemLongClickListener.onItemLongClick(parent, view, resPos, id);
}
}
return true;
}
}
}
2 changes: 1 addition & 1 deletion update-project.py
@@ -1,6 +1,6 @@
import os
vars = {
'lib_version': '1.0.11'
'lib_version': '1.0.12'
}

files = [
Expand Down

0 comments on commit d4a99ef

Please sign in to comment.