Skip to content

Commit dad7fc7

Browse files
author
Chris Banes
committed
New PullToRefreshListFragment Extra
1 parent 51d37dd commit dad7fc7

7 files changed

Lines changed: 139 additions & 0 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.handmark.pulltorefresh.extras.listfragment"
4+
android:versionCode="1"
5+
android:versionName="1.0" >
6+
7+
<application />
8+
9+
</manifest>
341 KB
Binary file not shown.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<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/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<groupId>com.github.chrisbanes.pulltorefresh</groupId>
6+
<artifactId>extra-listfragment</artifactId>
7+
<packaging>apklib</packaging>
8+
<name>Android-PullToRefresh Extras: ListFragment</name>
9+
10+
<parent>
11+
<groupId>com.github.chrisbanes.pulltorefresh</groupId>
12+
<artifactId>parent</artifactId>
13+
<version>1.4.0-SNAPSHOT</version>
14+
</parent>
15+
16+
<dependencies>
17+
<dependency>
18+
<groupId>com.google.android</groupId>
19+
<artifactId>android</artifactId>
20+
</dependency>
21+
<dependency>
22+
<groupId>com.google.android</groupId>
23+
<artifactId>support-v4</artifactId>
24+
<version>r7</version>
25+
</dependency>
26+
<dependency>
27+
<groupId>${project.groupId}</groupId>
28+
<artifactId>library</artifactId>
29+
<type>apklib</type>
30+
<version>${project.version}</version>
31+
</dependency>
32+
</dependencies>
33+
34+
<build>
35+
<plugins>
36+
<plugin>
37+
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
38+
<artifactId>android-maven-plugin</artifactId>
39+
</plugin>
40+
<plugin>
41+
<groupId>org.apache.maven.plugins</groupId>
42+
<artifactId>maven-eclipse-plugin</artifactId>
43+
</plugin>
44+
</plugins>
45+
</build>
46+
</project>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# This file is automatically generated by Android Tools.
2+
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3+
#
4+
# This file must be checked in Version Control Systems.
5+
#
6+
# To customize properties used by the Ant build system edit
7+
# "ant.properties", and override values to adapt the script to your
8+
# project structure.
9+
#
10+
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11+
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12+
13+
android.library=true
14+
# Project target.
15+
target=android-16
16+
android.library.reference.1=../../library
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package com.handmark.pulltorefresh.extras.listfragment;
2+
3+
import android.os.Bundle;
4+
import android.support.v4.app.ListFragment;
5+
import android.view.LayoutInflater;
6+
import android.view.View;
7+
import android.view.ViewGroup;
8+
import android.widget.ListView;
9+
10+
import com.handmark.pulltorefresh.library.PullToRefreshListView;
11+
12+
public class PullToRefreshListFragment extends ListFragment {
13+
14+
private PullToRefreshListView mPullToRefreshListView;
15+
16+
@Override
17+
public final View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
18+
View layout = super.onCreateView(inflater, container, savedInstanceState);
19+
20+
ListView lv = (ListView) layout.findViewById(android.R.id.list);
21+
ViewGroup parent = (ViewGroup) lv.getParent();
22+
23+
// Iterate through parent's children until we find the ListView
24+
for (int i = 0, z = parent.getChildCount(); i < z; i++) {
25+
View child = parent.getChildAt(i);
26+
27+
if (child == lv) {
28+
// Remove the ListView first
29+
parent.removeViewAt(i);
30+
31+
// Now create ListView, and add it in it's place...
32+
mPullToRefreshListView = onCreatePullToRefreshListView(inflater, savedInstanceState);
33+
parent.addView(mPullToRefreshListView, i, lv.getLayoutParams());
34+
break;
35+
}
36+
}
37+
38+
return layout;
39+
}
40+
41+
protected PullToRefreshListView onCreatePullToRefreshListView(LayoutInflater inflater, Bundle savedInstanceState) {
42+
return new PullToRefreshListView(getActivity());
43+
}
44+
45+
protected final PullToRefreshListView getPullToRefreshListView() {
46+
return mPullToRefreshListView;
47+
}
48+
}

extras/pom.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<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/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<groupId>com.github.chrisbanes.pulltorefresh</groupId>
6+
<artifactId>extras</artifactId>
7+
<packaging>pom</packaging>
8+
<name>Android-PullToRefresh Extras</name>
9+
10+
<parent>
11+
<groupId>com.github.chrisbanes.pulltorefresh</groupId>
12+
<artifactId>parent</artifactId>
13+
<version>1.4.0-SNAPSHOT</version>
14+
</parent>
15+
16+
<modules>
17+
<module>PullToRefreshListFragment</module>
18+
</modules>
19+
</project>

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
<modules>
3737
<module>library</module>
3838
<module>sample</module>
39+
<module>extras</module>
3940
</modules>
4041
<properties>
4142
<!-- build settings -->

0 commit comments

Comments
 (0)