|
|
@@ -106,7 +106,7 @@ public abstract class PullToRefreshBase<T extends View> extends LinearLayout imp
|
|
|
// ===========================================================
|
|
|
|
|
|
private Handler mHandler=new Handler();
|
|
|
-
|
|
|
+
|
|
|
public PullToRefreshBase(Context context) {
|
|
|
super(context);
|
|
|
init(context, null);
|
|
|
@@ -309,7 +309,7 @@ public abstract class PullToRefreshBase<T extends View> extends LinearLayout imp
|
|
|
setState(State.RESET);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public final void onRefreshComplete(int delay) {
|
|
|
mHandler.postDelayed(new Runnable() {
|
|
|
@Override
|
|
|
@@ -320,14 +320,14 @@ public abstract class PullToRefreshBase<T extends View> extends LinearLayout imp
|
|
|
}
|
|
|
}, delay);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public final void onPullUpRefreshComplete() {
|
|
|
if (isRefreshing()) {
|
|
|
mCurrentMode=Mode.PULL_FROM_END;
|
|
|
setState(State.RESET);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public final void onPullDownRefreshComplete() {
|
|
|
if (isRefreshing()) {
|
|
|
mCurrentMode=Mode.PULL_FROM_START;
|
|
|
@@ -504,7 +504,7 @@ public abstract class PullToRefreshBase<T extends View> extends LinearLayout imp
|
|
|
mOverScrollEnabled = enabled;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
@Override
|
|
|
public final void setPullDownRefreshing() {
|
|
|
if(isRefreshing()){
|
|
|
@@ -513,7 +513,7 @@ public abstract class PullToRefreshBase<T extends View> extends LinearLayout imp
|
|
|
mCurrentMode=Mode.PULL_FROM_START;
|
|
|
setRefreshing(true);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public final void setPullDownRefreshing(int delay) {
|
|
|
mHandler.postDelayed(new Runnable() {
|
|
|
@Override
|
|
|
@@ -522,8 +522,8 @@ public abstract class PullToRefreshBase<T extends View> extends LinearLayout imp
|
|
|
}
|
|
|
}, delay);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public final void setPullUpRefreshing() {
|
|
|
if(isRefreshing()){
|
|
|
@@ -532,7 +532,7 @@ public abstract class PullToRefreshBase<T extends View> extends LinearLayout imp
|
|
|
mCurrentMode=Mode.PULL_FROM_END;
|
|
|
setRefreshing(true);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public final void setPullUpRefreshing(int delay) {
|
|
|
mHandler.postDelayed(new Runnable() {
|
|
|
@Override
|
|
|
@@ -541,8 +541,8 @@ public abstract class PullToRefreshBase<T extends View> extends LinearLayout imp
|
|
|
}
|
|
|
}, delay);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public final void setRefreshing(boolean doScroll) {
|
|
|
@@ -678,7 +678,7 @@ public abstract class PullToRefreshBase<T extends View> extends LinearLayout imp
|
|
|
* <p/>
|
|
|
* Be sure to set the ID of the view in this method, especially if you're
|
|
|
* using a ListActivity or ListFragment.
|
|
|
- *
|
|
|
+ *
|
|
|
* @param context Context to create view with
|
|
|
* @param attrs AttributeSet from wrapped class. Means that anything you
|
|
|
* include in the XML layout declaration will be routed to the
|
|
|
@@ -722,7 +722,7 @@ public abstract class PullToRefreshBase<T extends View> extends LinearLayout imp
|
|
|
/**
|
|
|
* Allows Derivative classes to handle the XML Attrs without creating a
|
|
|
* TypedArray themsevles
|
|
|
- *
|
|
|
+ *
|
|
|
* @param a - TypedArray of PullToRefresh Attributes
|
|
|
*/
|
|
|
protected void handleStyledAttributes(TypedArray a) {
|
|
|
@@ -731,7 +731,7 @@ public abstract class PullToRefreshBase<T extends View> extends LinearLayout imp
|
|
|
/**
|
|
|
* Implemented by derived class to return whether the View is in a state
|
|
|
* where the user can Pull to Refresh by scrolling from the end.
|
|
|
- *
|
|
|
+ *
|
|
|
* @return true if the View is currently in the correct state (for example,
|
|
|
* bottom of a ListView)
|
|
|
*/
|
|
|
@@ -740,7 +740,7 @@ public abstract class PullToRefreshBase<T extends View> extends LinearLayout imp
|
|
|
/**
|
|
|
* Implemented by derived class to return whether the View is in a state
|
|
|
* where the user can Pull to Refresh by scrolling from the start.
|
|
|
- *
|
|
|
+ *
|
|
|
* @return true if the View is currently the correct state (for example, top
|
|
|
* of a ListView)
|
|
|
*/
|
|
|
@@ -749,7 +749,7 @@ public abstract class PullToRefreshBase<T extends View> extends LinearLayout imp
|
|
|
/**
|
|
|
* Called by {@link #onRestoreInstanceState(Parcelable)} so that derivative
|
|
|
* classes can handle their saved instance state.
|
|
|
- *
|
|
|
+ *
|
|
|
* @param savedInstanceState - Bundle which contains saved instance state.
|
|
|
*/
|
|
|
protected void onPtrRestoreInstanceState(Bundle savedInstanceState) {
|
|
|
@@ -758,7 +758,7 @@ public abstract class PullToRefreshBase<T extends View> extends LinearLayout imp
|
|
|
/**
|
|
|
* Called by {@link #onSaveInstanceState()} so that derivative classes can
|
|
|
* save their instance state.
|
|
|
- *
|
|
|
+ *
|
|
|
* @param saveState - Bundle to be updated with saved state.
|
|
|
*/
|
|
|
protected void onPtrSaveInstanceState(Bundle saveState) {
|
|
|
@@ -785,7 +785,7 @@ public abstract class PullToRefreshBase<T extends View> extends LinearLayout imp
|
|
|
/**
|
|
|
* Called when the UI has been to be updated to be in the
|
|
|
* {@link State#REFRESHING} or {@link State#MANUAL_REFRESHING} state.
|
|
|
- *
|
|
|
+ *
|
|
|
* @param doScroll - Whether the UI should scroll for this event.
|
|
|
*/
|
|
|
protected void onRefreshing(final boolean doScroll) {
|
|
|
@@ -1006,7 +1006,7 @@ public abstract class PullToRefreshBase<T extends View> extends LinearLayout imp
|
|
|
/**
|
|
|
* Helper method which just calls scrollTo() in the correct scrolling
|
|
|
* direction.
|
|
|
- *
|
|
|
+ *
|
|
|
* @param value - New Scroll value
|
|
|
*/
|
|
|
@TargetApi(VERSION_CODES.HONEYCOMB)
|
|
|
@@ -1053,7 +1053,7 @@ public abstract class PullToRefreshBase<T extends View> extends LinearLayout imp
|
|
|
/**
|
|
|
* Smooth Scroll to position using the default duration of
|
|
|
* {@value #SMOOTH_SCROLL_DURATION_MS} ms.
|
|
|
- *
|
|
|
+ *
|
|
|
* @param scrollValue - Position to scroll to
|
|
|
*/
|
|
|
protected final void smoothScrollTo(int scrollValue) {
|
|
|
@@ -1063,7 +1063,7 @@ public abstract class PullToRefreshBase<T extends View> extends LinearLayout imp
|
|
|
/**
|
|
|
* Smooth Scroll to position using the default duration of
|
|
|
* {@value #SMOOTH_SCROLL_DURATION_MS} ms.
|
|
|
- *
|
|
|
+ *
|
|
|
* @param scrollValue - Position to scroll to
|
|
|
* @param listener - Listener for scroll
|
|
|
*/
|
|
|
@@ -1074,7 +1074,7 @@ public abstract class PullToRefreshBase<T extends View> extends LinearLayout imp
|
|
|
/**
|
|
|
* Smooth Scroll to position using the longer default duration of
|
|
|
* {@value #SMOOTH_SCROLL_LONG_DURATION_MS} ms.
|
|
|
- *
|
|
|
+ *
|
|
|
* @param scrollValue - Position to scroll to
|
|
|
*/
|
|
|
protected final void smoothScrollToLonger(int scrollValue) {
|
|
|
@@ -1222,7 +1222,7 @@ public abstract class PullToRefreshBase<T extends View> extends LinearLayout imp
|
|
|
|
|
|
/**
|
|
|
* Actions a Pull Event
|
|
|
- *
|
|
|
+ *
|
|
|
* @return true if the Event has been handled, false if there has been no
|
|
|
* change
|
|
|
*/
|
|
|
@@ -1302,7 +1302,7 @@ public abstract class PullToRefreshBase<T extends View> extends LinearLayout imp
|
|
|
|
|
|
/**
|
|
|
* Smooth Scroll to position using the specific duration
|
|
|
- *
|
|
|
+ *
|
|
|
* @param scrollValue - Position to scroll to
|
|
|
* @param duration - Duration of animation in milliseconds
|
|
|
*/
|
|
|
@@ -1373,7 +1373,7 @@ public abstract class PullToRefreshBase<T extends View> extends LinearLayout imp
|
|
|
* Maps an int to a specific mode. This is needed when saving state, or
|
|
|
* inflating the view from XML where the mode is given through a attr
|
|
|
* int.
|
|
|
- *
|
|
|
+ *
|
|
|
* @param modeInt - int to map a Mode to
|
|
|
* @return Mode that modeInt maps to, or ROTATE by default.
|
|
|
*/
|
|
|
@@ -1449,7 +1449,7 @@ public abstract class PullToRefreshBase<T extends View> extends LinearLayout imp
|
|
|
* Maps an int to a specific mode. This is needed when saving state, or
|
|
|
* inflating the view from XML where the mode is given through a attr
|
|
|
* int.
|
|
|
- *
|
|
|
+ *
|
|
|
* @param modeInt - int to map a Mode to
|
|
|
* @return Mode that modeInt maps to, or PULL_FROM_START by default.
|
|
|
*/
|
|
|
@@ -1510,7 +1510,7 @@ public abstract class PullToRefreshBase<T extends View> extends LinearLayout imp
|
|
|
* Simple Listener that allows you to be notified when the user has scrolled
|
|
|
* to the end of the AdapterView. See (
|
|
|
* {@link PullToRefreshAdapterViewBase#setOnLastItemVisibleListener}.
|
|
|
- *
|
|
|
+ *
|
|
|
* @author Chris Banes
|
|
|
*/
|
|
|
public static interface OnLastItemVisibleListener {
|
|
|
@@ -1527,7 +1527,7 @@ public abstract class PullToRefreshBase<T extends View> extends LinearLayout imp
|
|
|
* finished a touch event. Useful when you want to append extra UI events
|
|
|
* (such as sounds). See (
|
|
|
* {@link PullToRefreshAdapterViewBase#setOnPullEventListener}.
|
|
|
- *
|
|
|
+ *
|
|
|
* @author Chris Banes
|
|
|
*/
|
|
|
public static interface OnPullEventListener<V extends View> {
|
|
|
@@ -1535,7 +1535,7 @@ public abstract class PullToRefreshBase<T extends View> extends LinearLayout imp
|
|
|
/**
|
|
|
* Called when the internal state has been changed, usually by the user
|
|
|
* pulling.
|
|
|
- *
|
|
|
+ *
|
|
|
* @param refreshView - View which has had it's state change.
|
|
|
* @param state - The new state of View.
|
|
|
* @param direction - One of {@link Mode#PULL_FROM_START} or
|
|
|
@@ -1550,7 +1550,7 @@ public abstract class PullToRefreshBase<T extends View> extends LinearLayout imp
|
|
|
|
|
|
/**
|
|
|
* Simple Listener to listen for any callbacks to Refresh.
|
|
|
- *
|
|
|
+ *
|
|
|
* @author Chris Banes
|
|
|
*/
|
|
|
public static interface OnRefreshListener<V extends View> {
|
|
|
@@ -1567,7 +1567,7 @@ public abstract class PullToRefreshBase<T extends View> extends LinearLayout imp
|
|
|
* An advanced version of the Listener to listen for callbacks to Refresh.
|
|
|
* This listener is different as it allows you to differentiate between Pull
|
|
|
* Ups, and Pull Downs.
|
|
|
- *
|
|
|
+ *
|
|
|
* @author Chris Banes
|
|
|
*/
|
|
|
public static interface OnRefreshListener2<V extends View> {
|
|
|
@@ -1629,7 +1629,7 @@ public abstract class PullToRefreshBase<T extends View> extends LinearLayout imp
|
|
|
|
|
|
/**
|
|
|
* Maps an int to a specific state. This is needed when saving state.
|
|
|
- *
|
|
|
+ *
|
|
|
* @param stateInt - int to map a State to
|
|
|
* @return State that stateInt maps to
|
|
|
*/
|