Skip to content

Commit

Permalink
Move all of the LoadingLayout customisation methods to a separate class.
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Banes committed Dec 12, 2012
1 parent d10ab41 commit 4988cbd
Show file tree
Hide file tree
Showing 4 changed files with 284 additions and 248 deletions.
48 changes: 48 additions & 0 deletions library/src/com/handmark/pulltorefresh/library/ILoadingLayout.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.handmark.pulltorefresh.library;

import android.graphics.drawable.Drawable;

public interface ILoadingLayout {

/**
* Set Text to show when the Widget is refreshing
* <code>setRefreshingLabel(releaseLabel, Mode.BOTH)</code>
*
* @param refreshingLabel - CharSequence to display
*/
public void setRefreshingLabel(CharSequence refreshingLabel);

/**
* 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 - CharSequence to display
*/
public void setReleaseLabel(CharSequence releaseLabel);

/**
* Set Text to show when the Widget is being Pulled
* <code>setPullLabel(releaseLabel, Mode.BOTH)</code>
*
* @param pullLabel - CharSequence to display
*/
public void setPullLabel(CharSequence pullLabel);

/**
* 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);

}
111 changes: 28 additions & 83 deletions library/src/com/handmark/pulltorefresh/library/IPullToRefresh.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*******************************************************************************/
package com.handmark.pulltorefresh.library;

import android.graphics.drawable.Drawable;
import android.view.View;
import android.view.animation.Interpolator;

Expand Down Expand Up @@ -57,6 +56,34 @@ public interface IPullToRefresh<T extends View> {
*/
public boolean getFilterTouchEvents();

/**
* Returns a proxy object which allows you to call methods on all of the
* LoadingLayouts (the Views which show when Pulling/Refreshing).
* <p />
* You should not keep the result of this method any longer than you need
* it.
*
* @return Object which will proxy any calls you make on it, to all of the
* LoadingLayouts.
*/
public ILoadingLayout getLoadingLayoutProxy();

/**
* Returns a proxy object which allows you to call methods on the
* LoadingLayouts (the Views which show when Pulling/Refreshing). The actual
* LoadingLayout(s) which will be affected, are chosen by the parameters you
* give.
* <p />
* You should not keep the result of this method any longer than you need
* it.
*
* @param includeStart - Whether to include the Start/Header Views
* @param includeEnd - Whether to include the End/Footer Views
* @return Object which will proxy any calls you make on it, to the
* LoadingLayouts included.
*/
public ILoadingLayout getLoadingLayoutProxy(boolean includeStart, boolean includeEnd);

/**
* Get the mode that this view has been set to. If this returns
* <code>Mode.BOTH</code>, you can use <code>getCurrentMode()</code> to
Expand Down Expand Up @@ -138,32 +165,6 @@ public interface IPullToRefresh<T extends View> {
*/
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.
*
Expand Down Expand Up @@ -193,24 +194,6 @@ public interface IPullToRefresh<T extends View> {
*/
public void setOnRefreshListener(OnRefreshListener2<T> listener);

/**
* Set Text to show when the Widget is being Pulled
* <code>setPullLabel(releaseLabel, Mode.BOTH)</code>
*
* @param pullLabel - CharSequence to display
*/
public void setPullLabel(CharSequence pullLabel);

/**
* Set Text to show when the Widget is being Pulled
*
* @param pullLabel - CharSequence 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(CharSequence pullLabel, Mode mode);

/**
* Sets whether Overscroll support is enabled. This is different to
* Android's standard Overscroll support (the edge-glow). This setting only
Expand All @@ -235,44 +218,6 @@ public interface IPullToRefresh<T extends View> {
*/
public void setRefreshing(boolean doScroll);

/**
* Set Text to show when the Widget is refreshing
* <code>setRefreshingLabel(releaseLabel, Mode.BOTH)</code>
*
* @param refreshingLabel - CharSequence to display
*/
public void setRefreshingLabel(CharSequence refreshingLabel);

/**
* Set Text to show when the Widget is refreshing
*
* @param refreshingLabel - CharSequence 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(CharSequence 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 - CharSequence to display
*/
public void setReleaseLabel(CharSequence releaseLabel);

/**
* Set Text to show when the Widget is being pulled, and will refresh when
* released
*
* @param releaseLabel - CharSequence 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(CharSequence releaseLabel, Mode mode);

/**
* Sets the Animation Interpolator that is used for animated scrolling.
* Defaults to a DecelerateInterpolator
Expand Down
Loading

0 comments on commit 4988cbd

Please sign in to comment.