forked from chrisbanes/Android-PullToRefresh
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[maven-release-plugin] copy for tag v2.1.1
- Loading branch information
Showing
27 changed files
with
696 additions
and
427 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
...ent/src/com/handmark/pulltorefresh/extras/listfragment/PullToRefreshBaseListFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/******************************************************************************* | ||
* Copyright 2011, 2012 Chris Banes. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*******************************************************************************/ | ||
package com.handmark.pulltorefresh.extras.listfragment; | ||
|
||
import android.os.Bundle; | ||
import android.support.v4.app.ListFragment; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.AbsListView; | ||
import android.widget.ListView; | ||
|
||
import com.handmark.pulltorefresh.library.PullToRefreshBase; | ||
|
||
abstract class PullToRefreshBaseListFragment<T extends PullToRefreshBase<? extends AbsListView>> extends ListFragment { | ||
|
||
private T mPullToRefreshListView; | ||
|
||
@Override | ||
public final View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { | ||
View layout = super.onCreateView(inflater, container, savedInstanceState); | ||
|
||
ListView lv = (ListView) layout.findViewById(android.R.id.list); | ||
ViewGroup parent = (ViewGroup) lv.getParent(); | ||
|
||
// Remove ListView and add PullToRefreshListView in its place | ||
int lvIndex = parent.indexOfChild(lv); | ||
parent.removeViewAt(lvIndex); | ||
mPullToRefreshListView = onCreatePullToRefreshListView(inflater, savedInstanceState); | ||
parent.addView(mPullToRefreshListView, lvIndex, lv.getLayoutParams()); | ||
|
||
return layout; | ||
} | ||
|
||
/** | ||
* @return The {@link PullToRefreshBase} attached to this ListFragment. | ||
*/ | ||
public final T getPullToRefreshListView() { | ||
return mPullToRefreshListView; | ||
} | ||
|
||
/** | ||
* Returns the {@link PullToRefreshBase} which will replace the ListView | ||
* created from ListFragment. You should override this method if you wish to | ||
* customise the {@link PullToRefreshBase} from the default. | ||
* | ||
* @param inflater - LayoutInflater which can be used to inflate from XML. | ||
* @param savedInstanceState - Bundle passed through from | ||
* {@link ListFragment#onCreateView(LayoutInflater, ViewGroup, Bundle) | ||
* onCreateView(...)} | ||
* @return The {@link PullToRefreshBase} which will replace the ListView. | ||
*/ | ||
protected abstract T onCreatePullToRefreshListView(LayoutInflater inflater, Bundle savedInstanceState); | ||
|
||
} |
46 changes: 46 additions & 0 deletions
46
...c/com/handmark/pulltorefresh/extras/listfragment/PullToRefreshExpandableListFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/******************************************************************************* | ||
* Copyright 2011, 2012 Chris Banes. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*******************************************************************************/ | ||
package com.handmark.pulltorefresh.extras.listfragment; | ||
|
||
import android.os.Bundle; | ||
import android.support.v4.app.ListFragment; | ||
import android.view.LayoutInflater; | ||
|
||
import com.handmark.pulltorefresh.library.PullToRefreshExpandableListView; | ||
|
||
/** | ||
* A sample implementation of how to use {@link PullToRefreshExpandableListView} | ||
* with {@link ListFragment}. This implementation simply replaces the ListView | ||
* that {@code ListFragment} creates with a new | ||
* {@code PullToRefreshExpandableListView}. This means that ListFragment still | ||
* works 100% (e.g. <code>setListShown(...)</code> ). | ||
* <p/> | ||
* The new PullToRefreshListView is created in the method | ||
* {@link #onCreatePullToRefreshListView(LayoutInflater, Bundle)}. If you wish | ||
* to customise the {@code PullToRefreshExpandableListView} then override this | ||
* method and return your customised instance. | ||
* | ||
* @author Chris Banes | ||
* | ||
*/ | ||
public class PullToRefreshExpandableListFragment extends PullToRefreshBaseListFragment<PullToRefreshExpandableListView> { | ||
|
||
protected PullToRefreshExpandableListView onCreatePullToRefreshListView(LayoutInflater inflater, | ||
Bundle savedInstanceState) { | ||
return new PullToRefreshExpandableListView(getActivity()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,29 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<merge xmlns:android="http://schemas.android.com/apk/res/android" > | ||
|
||
<ImageView | ||
android:id="@+id/pull_to_refresh_image" | ||
<FrameLayout | ||
android:id="@+id/fl_inner" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="center" /> | ||
android:layout_height="fill_parent" | ||
android:paddingBottom="@dimen/header_footer_top_bottom_padding" | ||
android:paddingLeft="@dimen/header_footer_left_right_padding" | ||
android:paddingRight="@dimen/header_footer_left_right_padding" | ||
android:paddingTop="@dimen/header_footer_top_bottom_padding" > | ||
|
||
<ProgressBar | ||
android:id="@+id/pull_to_refresh_progress" | ||
style="?android:attr/progressBarStyleSmall" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="center" | ||
android:indeterminate="true" | ||
android:visibility="gone" /> | ||
<ImageView | ||
android:id="@+id/pull_to_refresh_image" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="center" /> | ||
|
||
<ProgressBar | ||
android:id="@+id/pull_to_refresh_progress" | ||
style="?android:attr/progressBarStyleSmall" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="center" | ||
android:indeterminate="true" | ||
android:visibility="gone" /> | ||
</FrameLayout> | ||
|
||
</merge> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.