This repository has been archived by the owner on Oct 15, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
847 additions
and
292 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,41 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="fill_parent" | ||
android:layout_height="fill_parent" | ||
android:paddingBottom="10dip" | ||
android:paddingTop="10dp" > | ||
android:gravity="center_vertical" | ||
android:orientation="horizontal" | ||
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" > | ||
|
||
<LinearLayout | ||
<ImageView | ||
android:id="@+id/pull_to_refresh_image" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_centerInParent="true" | ||
android:gravity="center" | ||
android:layout_marginRight="@dimen/header_footer_internal_padding" /> | ||
|
||
<LinearLayout | ||
android:layout_width="0px" | ||
android:layout_height="wrap_content" | ||
android:layout_weight="1" | ||
android:orientation="vertical" > | ||
|
||
<TextView | ||
android:id="@+id/pull_to_refresh_text" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="center" | ||
android:singleLine="true" | ||
android:textAppearance="?android:attr/textAppearanceMedium" | ||
android:textStyle="bold" /> | ||
|
||
<TextView | ||
android:id="@+id/pull_to_refresh_sub_text" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="center" | ||
android:singleLine="true" | ||
android:textAppearance="?android:attr/textAppearanceSmall" | ||
android:visibility="gone" /> | ||
</LinearLayout> | ||
|
||
<ImageView | ||
android:id="@+id/pull_to_refresh_image" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_centerVertical="true" | ||
android:layout_marginLeft="30dip" | ||
android:layout_marginRight="20dip" /> | ||
|
||
</RelativeLayout> | ||
</LinearLayout> |
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,7 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
|
||
<dimen name="indicator_right_padding">10dp</dimen> | ||
<dimen name="indicator_corner_radius">12dp</dimen> | ||
<dimen name="indicator_internal_padding">4dp</dimen> | ||
|
||
<dimen name="header_footer_left_right_padding">25dp</dimen> | ||
<dimen name="header_footer_top_bottom_padding">10dp</dimen> | ||
<dimen name="header_footer_internal_padding">20dp</dimen> | ||
|
||
</resources> |
288 changes: 288 additions & 0 deletions
288
library/src/com/handmark/pulltorefresh/library/IPullToRefresh.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,288 @@ | ||
package com.handmark.pulltorefresh.library; | ||
|
||
import android.graphics.drawable.Drawable; | ||
import android.view.View; | ||
import android.view.animation.Interpolator; | ||
|
||
import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode; | ||
import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener; | ||
import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener2; | ||
|
||
public interface IPullToRefresh<T extends View> { | ||
|
||
/** | ||
* Get the mode that this view is currently in. This is only really useful | ||
* when using <code>Mode.BOTH</code>. | ||
* | ||
* @return Mode that the view is currently in | ||
*/ | ||
public Mode getCurrentMode(); | ||
|
||
/** | ||
* Returns whether the Touch Events are filtered or not. If true is | ||
* returned, then the View will only use touch events where the difference | ||
* in the Y-axis is greater than the difference in the X-axis. This means | ||
* that the View will not interfere when it is used in a horizontal | ||
* scrolling View (such as a ViewPager). | ||
* | ||
* @return boolean - true if the View is filtering Touch Events | ||
*/ | ||
public boolean getFilterTouchEvents(); | ||
|
||
/** | ||
* Get the mode that this view has been set to. If this returns | ||
* <code>Mode.BOTH</code>, you can use <code>getCurrentMode()</code> to | ||
* check which mode the view is currently in | ||
* | ||
* @return Mode that the view has been set to | ||
*/ | ||
public Mode getMode(); | ||
|
||
/** | ||
* Get the Wrapped Refreshable View. Anything returned here has already been | ||
* added to the content view. | ||
* | ||
* @return The View which is currently wrapped | ||
*/ | ||
public T getRefreshableView(); | ||
|
||
/** | ||
* Get whether the 'Refreshing' View should be automatically shown when | ||
* refreshing. Returns true by default. | ||
* | ||
* @return - true if the Refreshing View will be show | ||
*/ | ||
public boolean getShowViewWhileRefreshing(); | ||
|
||
/** | ||
* @deprecated Use the value from <code>getCurrentMode()</code> instead | ||
* @return true if the current mode is Mode.PULL_DOWN_TO_REFRESH | ||
*/ | ||
public boolean hasPullFromTop(); | ||
|
||
/** | ||
* Returns whether the widget has disabled scrolling on the Refreshable View | ||
* while refreshing. | ||
* | ||
* @return true if the widget has disabled scrolling while refreshing | ||
*/ | ||
public boolean isDisableScrollingWhileRefreshing(); | ||
|
||
/** | ||
* Gets whether Overscroll support is enabled. This is different to | ||
* Android's standard Overscroll support (the edge-glow) which is available | ||
* from GINGERBREAD onwards | ||
* | ||
* @return true - if both PullToRefresh-OverScroll and Android's inbuilt | ||
* OverScroll are enabled | ||
*/ | ||
public boolean isPullToRefreshOverScrollEnabled(); | ||
|
||
/** | ||
* Whether Pull-to-Refresh is enabled | ||
* | ||
* @return enabled | ||
*/ | ||
public boolean isPullToRefreshEnabled(); | ||
|
||
/** | ||
* Returns whether the Widget is currently in the Refreshing mState | ||
* | ||
* @return true if the Widget is currently refreshing | ||
*/ | ||
public boolean isRefreshing(); | ||
|
||
/** | ||
* Mark the current Refresh as complete. Will Reset the UI and hide the | ||
* Refreshing View | ||
*/ | ||
public void onRefreshComplete(); | ||
|
||
/** | ||
* By default the Widget disabled scrolling on the Refreshable View while | ||
* refreshing. This method can change this behaviour. | ||
* | ||
* @param disableScrollingWhileRefreshing | ||
* - true if you want to disable scrolling while refreshing | ||
*/ | ||
public void setDisableScrollingWhileRefreshing(boolean disableScrollingWhileRefreshing); | ||
|
||
/** | ||
* Set the Touch Events to be filtered or not. If set to true, then the View | ||
* will only use touch events where the difference in the Y-axis is greater | ||
* than the difference in the X-axis. This means that the View will not | ||
* interfere when it is used in a horizontal scrolling View (such as a | ||
* ViewPager), but will restrict which types of finger scrolls will trigger | ||
* the View. | ||
* | ||
* @param filterEvents | ||
* - true if you want to filter Touch Events. Default is true. | ||
*/ | ||
public void setFilterTouchEvents(boolean filterEvents); | ||
|
||
/** | ||
* Set the Last Updated Text. This displayed under the main label when | ||
* Pulling | ||
* | ||
* @param label | ||
* - Label to set | ||
*/ | ||
public void setLastUpdatedLabel(CharSequence label); | ||
|
||
/** | ||
* Set the drawable used in the loading layout. This is the same as calling | ||
* <code>setLoadingDrawable(drawable, Mode.BOTH)</code> | ||
* | ||
* @param drawable | ||
* - Drawable to display | ||
*/ | ||
public void setLoadingDrawable(Drawable drawable); | ||
|
||
/** | ||
* Set the drawable used in the loading layout. | ||
* | ||
* @param drawable | ||
* - Drawable to display | ||
* @param mode | ||
* - Controls which Header/Footer Views will be updated. | ||
* <code>Mode.BOTH</code> will update all available, other values | ||
* will update the relevant View. | ||
*/ | ||
public void setLoadingDrawable(Drawable drawable, Mode mode); | ||
|
||
/** | ||
* Set the mode of Pull-to-Refresh that this view will use. | ||
* | ||
* @param mode | ||
* - Mode to set the View to | ||
*/ | ||
public void setMode(Mode mode); | ||
|
||
/** | ||
* Set OnRefreshListener for the Widget | ||
* | ||
* @param listener | ||
* - Listener to be used when the Widget is set to Refresh | ||
*/ | ||
public void setOnRefreshListener(OnRefreshListener<T> listener); | ||
|
||
/** | ||
* Set OnRefreshListener for the Widget | ||
* | ||
* @param listener | ||
* - Listener to be used when the Widget is set to Refresh | ||
*/ | ||
public void setOnRefreshListener(OnRefreshListener2<T> listener); | ||
|
||
/** | ||
* Sets whether Overscroll support is enabled. This is different to | ||
* Android's standard Overscroll support (the edge-glow). This setting only | ||
* takes effect when running on device with Android v2.3 or greater. | ||
* | ||
* @param enabled | ||
* - true if you want Overscroll enabled | ||
*/ | ||
public void setPullToRefreshOverScrollEnabled(boolean enabled); | ||
|
||
/** | ||
* Set Text to show when the Widget is being Pulled | ||
* <code>setPullLabel(releaseLabel, Mode.BOTH)</code> | ||
* | ||
* @param releaseLabel | ||
* - String to display | ||
*/ | ||
public void setPullLabel(String pullLabel); | ||
|
||
/** | ||
* Set Text to show when the Widget is being Pulled | ||
* | ||
* @param pullLabel | ||
* - String to display | ||
* @param mode | ||
* - Controls which Header/Footer Views will be updated. | ||
* <code>Mode.BOTH</code> will update all available, other values | ||
* will update the relevant View. | ||
*/ | ||
public void setPullLabel(String pullLabel, Mode mode); | ||
|
||
/** | ||
* @deprecated This simple calls setMode with an appropriate mode based on | ||
* the passed value. | ||
* | ||
* @param enable | ||
* Whether Pull-To-Refresh should be used | ||
*/ | ||
public void setPullToRefreshEnabled(boolean enable); | ||
|
||
public void setRefreshing(); | ||
|
||
/** | ||
* Sets the Widget to be in the refresh state. The UI will be updated to | ||
* show the 'Refreshing' view. | ||
* | ||
* @param doScroll | ||
* - true if you want to force a scroll to the Refreshing view. | ||
*/ | ||
public void setRefreshing(boolean doScroll); | ||
|
||
/** | ||
* Set Text to show when the Widget is refreshing | ||
* <code>setRefreshingLabel(releaseLabel, Mode.BOTH)</code> | ||
* | ||
* @param releaseLabel | ||
* - String to display | ||
*/ | ||
public void setRefreshingLabel(String refreshingLabel); | ||
|
||
/** | ||
* Set Text to show when the Widget is refreshing | ||
* | ||
* @param refreshingLabel | ||
* - String to display | ||
* @param mode | ||
* - Controls which Header/Footer Views will be updated. | ||
* <code>Mode.BOTH</code> will update all available, other values | ||
* will update the relevant View. | ||
*/ | ||
public void setRefreshingLabel(String refreshingLabel, Mode mode); | ||
|
||
/** | ||
* Set Text to show when the Widget is being pulled, and will refresh when | ||
* released. This is the same as calling | ||
* <code>setReleaseLabel(releaseLabel, Mode.BOTH)</code> | ||
* | ||
* @param releaseLabel | ||
* - String to display | ||
*/ | ||
public void setReleaseLabel(String releaseLabel); | ||
|
||
/** | ||
* Set Text to show when the Widget is being pulled, and will refresh when | ||
* released | ||
* | ||
* @param releaseLabel | ||
* - String to display | ||
* @param mode | ||
* - Controls which Header/Footer Views will be updated. | ||
* <code>Mode.BOTH</code> will update all available, other values | ||
* will update the relevant View. | ||
*/ | ||
public void setReleaseLabel(String releaseLabel, Mode mode); | ||
|
||
/** | ||
* Sets the Animation Interpolator that is used for animated scrolling. | ||
* Defaults to a DecelerateInterpolator | ||
* | ||
* @param interpolator - Interpolator to use | ||
*/ | ||
public void setScrollAnimationInterpolator(Interpolator interpolator); | ||
|
||
/** | ||
* A mutator to enable/disable whether the 'Refreshing' View should be | ||
* automatically shown when refreshing. | ||
* | ||
* @param showView | ||
*/ | ||
public void setShowViewWhileRefreshing(boolean showView); | ||
|
||
} |
Oops, something went wrong.