refreshView) {
36 | refreshView.getRefreshableView().reload();
37 | }
38 |
39 | };
40 |
41 | private final WebChromeClient defaultWebChromeClient = new WebChromeClient() {
42 |
43 | @Override
44 | public void onProgressChanged(WebView view, int newProgress) {
45 | if (newProgress == 100) {
46 | onRefreshComplete();
47 | }
48 | }
49 |
50 | };
51 |
52 | public PullToRefreshWebView(Context context) {
53 | super(context);
54 |
55 | /**
56 | * Added so that by default, Pull-to-Refresh refreshes the page
57 | */
58 | setOnRefreshListener(defaultOnRefreshListener);
59 | mRefreshableView.setWebChromeClient(defaultWebChromeClient);
60 | }
61 |
62 | public PullToRefreshWebView(Context context, AttributeSet attrs) {
63 | super(context, attrs);
64 |
65 | /**
66 | * Added so that by default, Pull-to-Refresh refreshes the page
67 | */
68 | setOnRefreshListener(defaultOnRefreshListener);
69 | mRefreshableView.setWebChromeClient(defaultWebChromeClient);
70 | }
71 |
72 | public PullToRefreshWebView(Context context, Mode mode) {
73 | super(context, mode);
74 |
75 | /**
76 | * Added so that by default, Pull-to-Refresh refreshes the page
77 | */
78 | setOnRefreshListener(defaultOnRefreshListener);
79 | mRefreshableView.setWebChromeClient(defaultWebChromeClient);
80 | }
81 |
82 | public PullToRefreshWebView(Context context, Mode mode, AnimationStyle style) {
83 | super(context, mode, style);
84 |
85 | /**
86 | * Added so that by default, Pull-to-Refresh refreshes the page
87 | */
88 | setOnRefreshListener(defaultOnRefreshListener);
89 | mRefreshableView.setWebChromeClient(defaultWebChromeClient);
90 | }
91 |
92 | @Override
93 | public final Orientation getPullToRefreshScrollDirection() {
94 | return Orientation.VERTICAL;
95 | }
96 |
97 | @Override
98 | protected WebView createRefreshableView(Context context, AttributeSet attrs) {
99 | WebView webView;
100 | if (VERSION.SDK_INT >= VERSION_CODES.GINGERBREAD) {
101 | webView = new InternalWebViewSDK9(context, attrs);
102 | } else {
103 | webView = new WebView(context, attrs);
104 | }
105 |
106 | webView.setId(R.id.webview);
107 | return webView;
108 | }
109 |
110 | @Override
111 | protected boolean isReadyForPullStart() {
112 | return mRefreshableView.getScrollY() == 0;
113 | }
114 |
115 | @Override
116 | protected boolean isReadyForPullEnd() {
117 | float exactContentHeight = FloatMath.floor(mRefreshableView.getContentHeight() * mRefreshableView.getScale());
118 | return mRefreshableView.getScrollY() >= (exactContentHeight - mRefreshableView.getHeight());
119 | }
120 |
121 | @Override
122 | protected void onPtrRestoreInstanceState(Bundle savedInstanceState) {
123 | super.onPtrRestoreInstanceState(savedInstanceState);
124 | mRefreshableView.restoreState(savedInstanceState);
125 | }
126 |
127 | @Override
128 | protected void onPtrSaveInstanceState(Bundle saveState) {
129 | super.onPtrSaveInstanceState(saveState);
130 | mRefreshableView.saveState(saveState);
131 | }
132 |
133 | @TargetApi(9)
134 | final class InternalWebViewSDK9 extends WebView {
135 |
136 | // WebView doesn't always scroll back to it's edge so we add some
137 | // fuzziness
138 | static final int OVERSCROLL_FUZZY_THRESHOLD = 2;
139 |
140 | // WebView seems quite reluctant to overscroll so we use the scale
141 | // factor to scale it's value
142 | static final float OVERSCROLL_SCALE_FACTOR = 1.5f;
143 |
144 | public InternalWebViewSDK9(Context context, AttributeSet attrs) {
145 | super(context, attrs);
146 | }
147 |
148 | @Override
149 | protected boolean overScrollBy(int deltaX, int deltaY, int scrollX, int scrollY, int scrollRangeX,
150 | int scrollRangeY, int maxOverScrollX, int maxOverScrollY, boolean isTouchEvent) {
151 |
152 | final boolean returnValue = super.overScrollBy(deltaX, deltaY, scrollX, scrollY, scrollRangeX,
153 | scrollRangeY, maxOverScrollX, maxOverScrollY, isTouchEvent);
154 |
155 | // Does all of the hard work...
156 | OverscrollHelper.overScrollBy(PullToRefreshWebView.this, deltaX, scrollX, deltaY, scrollY,
157 | getScrollRange(), OVERSCROLL_FUZZY_THRESHOLD, OVERSCROLL_SCALE_FACTOR, isTouchEvent);
158 |
159 | return returnValue;
160 | }
161 |
162 | private int getScrollRange() {
163 | return (int) Math.max(0, FloatMath.floor(mRefreshableView.getContentHeight() * mRefreshableView.getScale())
164 | - (getHeight() - getPaddingBottom() - getPaddingTop()));
165 | }
166 | }
167 | }
168 |
--------------------------------------------------------------------------------
/library/src/main/java/com/handmark/pulltorefresh/library/extras/PullToRefreshWebView2.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright 2011, 2012 Chris Banes.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *******************************************************************************/
16 |
17 | package com.handmark.pulltorefresh.library.extras;
18 |
19 | import android.content.Context;
20 | import android.util.AttributeSet;
21 | import android.webkit.WebView;
22 |
23 | import com.handmark.pulltorefresh.library.PullToRefreshWebView;
24 |
25 | import java.util.concurrent.atomic.AtomicBoolean;
26 |
27 | /**
28 | * An advanced version of {@link PullToRefreshWebView} which delegates the
29 | * triggering of the PullToRefresh gesture to the Javascript running within the
30 | * WebView. This means that you should only use this class if:
31 | *
32 | *
33 | * - {@link PullToRefreshWebView} doesn't work correctly because you're using
34 | *
overflow:scroll
or something else which means
35 | * {@link WebView#getScrollY()} doesn't return correct values.
36 | * - You control the web content being displayed, as you need to write some
37 | * Javascript callbacks.
38 | *
39 | *
40 | *
41 | * The way this call works is that when a PullToRefresh gesture is in action,
42 | * the following Javascript methods will be called:
43 | * isReadyForPullDown()
and isReadyForPullUp()
, it is
44 | * your job to calculate whether the view is in a state where a PullToRefresh
45 | * can happen, and return the result via the callback mechanism. An example can
46 | * be seen below:
47 | *
48 | *
49 | *
50 | * function isReadyForPullDown() {
51 | * var result = ... // Probably using the .scrollTop DOM attribute
52 | * ptr.isReadyForPullDownResponse(result);
53 | * }
54 | *
55 | * function isReadyForPullUp() {
56 | * var result = ... // Probably using the .scrollBottom DOM attribute
57 | * ptr.isReadyForPullUpResponse(result);
58 | * }
59 | *
60 | *
61 | * @author Chris Banes
62 | */
63 | public class PullToRefreshWebView2 extends PullToRefreshWebView {
64 |
65 | static final String JS_INTERFACE_PKG = "ptr";
66 | static final String DEF_JS_READY_PULL_DOWN_CALL = "javascript:isReadyForPullDown();";
67 | static final String DEF_JS_READY_PULL_UP_CALL = "javascript:isReadyForPullUp();";
68 |
69 | public PullToRefreshWebView2(Context context) {
70 | super(context);
71 | }
72 |
73 | public PullToRefreshWebView2(Context context, AttributeSet attrs) {
74 | super(context, attrs);
75 | }
76 |
77 | public PullToRefreshWebView2(Context context, Mode mode) {
78 | super(context, mode);
79 | }
80 |
81 | private JsValueCallback mJsCallback;
82 | private final AtomicBoolean mIsReadyForPullDown = new AtomicBoolean(false);
83 | private final AtomicBoolean mIsReadyForPullUp = new AtomicBoolean(false);
84 |
85 | @Override
86 | protected WebView createRefreshableView(Context context, AttributeSet attrs) {
87 | WebView webView = super.createRefreshableView(context, attrs);
88 |
89 | // Need to add JS Interface so we can get the response back
90 | mJsCallback = new JsValueCallback();
91 | webView.addJavascriptInterface(mJsCallback, JS_INTERFACE_PKG);
92 |
93 | return webView;
94 | }
95 |
96 | @Override
97 | protected boolean isReadyForPullStart() {
98 | // Call Javascript...
99 | getRefreshableView().loadUrl(DEF_JS_READY_PULL_DOWN_CALL);
100 |
101 | // Response will be given to JsValueCallback, which will update
102 | // mIsReadyForPullDown
103 |
104 | return mIsReadyForPullDown.get();
105 | }
106 |
107 | @Override
108 | protected boolean isReadyForPullEnd() {
109 | // Call Javascript...
110 | getRefreshableView().loadUrl(DEF_JS_READY_PULL_UP_CALL);
111 |
112 | // Response will be given to JsValueCallback, which will update
113 | // mIsReadyForPullUp
114 |
115 | return mIsReadyForPullUp.get();
116 | }
117 |
118 | /**
119 | * Used for response from Javascript
120 | *
121 | * @author Chris Banes
122 | */
123 | final class JsValueCallback {
124 |
125 | public void isReadyForPullUpResponse(boolean response) {
126 | mIsReadyForPullUp.set(response);
127 | }
128 |
129 | public void isReadyForPullDownResponse(boolean response) {
130 | mIsReadyForPullDown.set(response);
131 | }
132 | }
133 | }
134 |
--------------------------------------------------------------------------------
/library/src/main/java/com/handmark/pulltorefresh/library/extras/SoundPullEventListener.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright 2011, 2012 Chris Banes.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *******************************************************************************/
16 | package com.handmark.pulltorefresh.library.extras;
17 |
18 | import android.content.Context;
19 | import android.media.MediaPlayer;
20 | import android.view.View;
21 |
22 | import com.handmark.pulltorefresh.library.PullToRefreshBase;
23 | import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode;
24 | import com.handmark.pulltorefresh.library.PullToRefreshBase.State;
25 |
26 | import java.util.HashMap;
27 |
28 | public class SoundPullEventListener implements PullToRefreshBase.OnPullEventListener {
29 |
30 | private final Context mContext;
31 | private final HashMap mSoundMap;
32 |
33 | private MediaPlayer mCurrentMediaPlayer;
34 |
35 | /**
36 | * Constructor
37 | *
38 | * @param context - Context
39 | */
40 | public SoundPullEventListener(Context context) {
41 | mContext = context;
42 | mSoundMap = new HashMap();
43 | }
44 |
45 | @Override
46 | public final void onPullEvent(PullToRefreshBase refreshView, State event, Mode direction) {
47 | Integer soundResIdObj = mSoundMap.get(event);
48 | if (null != soundResIdObj) {
49 | playSound(soundResIdObj.intValue());
50 | }
51 | }
52 |
53 | /**
54 | * Set the Sounds to be played when a Pull Event happens. You specify which
55 | * sound plays for which events by calling this method multiple times for
56 | * each event.
57 | *
58 | * If you've already set a sound for a certain event, and add another sound
59 | * for that event, only the new sound will be played.
60 | *
61 | * @param event - The event for which the sound will be played.
62 | * @param resId - Resource Id of the sound file to be played (e.g.
63 | * R.raw.pull_sound)
64 | */
65 | public void addSoundEvent(State event, int resId) {
66 | mSoundMap.put(event, resId);
67 | }
68 |
69 | /**
70 | * Clears all of the previously set sounds and events.
71 | */
72 | public void clearSounds() {
73 | mSoundMap.clear();
74 | }
75 |
76 | /**
77 | * Gets the current (or last) MediaPlayer instance.
78 | */
79 | public MediaPlayer getCurrentMediaPlayer() {
80 | return mCurrentMediaPlayer;
81 | }
82 |
83 | private void playSound(int resId) {
84 | // Stop current player, if there's one playing
85 | if (null != mCurrentMediaPlayer) {
86 | mCurrentMediaPlayer.stop();
87 | mCurrentMediaPlayer.release();
88 | }
89 |
90 | mCurrentMediaPlayer = MediaPlayer.create(mContext, resId);
91 | if (null != mCurrentMediaPlayer) {
92 | mCurrentMediaPlayer.start();
93 | }
94 | }
95 |
96 | }
97 |
--------------------------------------------------------------------------------
/library/src/main/java/com/handmark/pulltorefresh/library/internal/EmptyViewMethodAccessor.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright 2011, 2012 Chris Banes.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *******************************************************************************/
16 | package com.handmark.pulltorefresh.library.internal;
17 |
18 | import android.view.View;
19 |
20 | /**
21 | * Interface that allows PullToRefreshBase to hijack the call to
22 | * AdapterView.setEmptyView()
23 | *
24 | * @author chris
25 | */
26 | public interface EmptyViewMethodAccessor {
27 |
28 | /**
29 | * Calls upto AdapterView.setEmptyView()
30 | *
31 | * @param emptyView - to set as Empty View
32 | */
33 | public void setEmptyViewInternal(View emptyView);
34 |
35 | /**
36 | * Should call PullToRefreshBase.setEmptyView() which will then
37 | * automatically call through to setEmptyViewInternal()
38 | *
39 | * @param emptyView - to set as Empty View
40 | */
41 | public void setEmptyView(View emptyView);
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/library/src/main/java/com/handmark/pulltorefresh/library/internal/FlipLoadingLayout.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright 2011, 2012 Chris Banes.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *******************************************************************************/
16 | package com.handmark.pulltorefresh.library.internal;
17 |
18 | import android.annotation.SuppressLint;
19 | import android.content.Context;
20 | import android.content.res.TypedArray;
21 | import android.graphics.Matrix;
22 | import android.graphics.drawable.Drawable;
23 | import android.view.View;
24 | import android.view.ViewGroup;
25 | import android.view.animation.Animation;
26 | import android.view.animation.RotateAnimation;
27 | import android.widget.ImageView.ScaleType;
28 |
29 | import com.bettycc.animatepulltorefresh.library.R;
30 | import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode;
31 | import com.handmark.pulltorefresh.library.PullToRefreshBase.Orientation;
32 |
33 | ;
34 |
35 | @SuppressLint("ViewConstructor")
36 | public class FlipLoadingLayout extends LoadingLayout {
37 |
38 | static final int FLIP_ANIMATION_DURATION = 150;
39 |
40 | private final Animation mRotateAnimation, mResetRotateAnimation;
41 |
42 | public FlipLoadingLayout(Context context, final Mode mode, final Orientation scrollDirection, TypedArray attrs) {
43 | super(context, mode, scrollDirection, attrs);
44 |
45 | final int rotateAngle = mode == Mode.PULL_FROM_START ? -180 : 180;
46 |
47 | mRotateAnimation = new RotateAnimation(0, rotateAngle, Animation.RELATIVE_TO_SELF, 0.5f,
48 | Animation.RELATIVE_TO_SELF, 0.5f);
49 | mRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
50 | mRotateAnimation.setDuration(FLIP_ANIMATION_DURATION);
51 | mRotateAnimation.setFillAfter(true);
52 |
53 | mResetRotateAnimation = new RotateAnimation(rotateAngle, 0, Animation.RELATIVE_TO_SELF, 0.5f,
54 | Animation.RELATIVE_TO_SELF, 0.5f);
55 | mResetRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
56 | mResetRotateAnimation.setDuration(FLIP_ANIMATION_DURATION);
57 | mResetRotateAnimation.setFillAfter(true);
58 | }
59 |
60 | @Override
61 | protected void onLoadingDrawableSet(Drawable imageDrawable) {
62 | if (null != imageDrawable) {
63 | final int dHeight = imageDrawable.getIntrinsicHeight();
64 | final int dWidth = imageDrawable.getIntrinsicWidth();
65 |
66 | /**
67 | * We need to set the width/height of the ImageView so that it is
68 | * square with each side the size of the largest drawable dimension.
69 | * This is so that it doesn't clip when rotated.
70 | */
71 | ViewGroup.LayoutParams lp = mHeaderImage.getLayoutParams();
72 | lp.width = lp.height = Math.max(dHeight, dWidth);
73 | mHeaderImage.requestLayout();
74 |
75 | /**
76 | * We now rotate the Drawable so that is at the correct rotation,
77 | * and is centered.
78 | */
79 | mHeaderImage.setScaleType(ScaleType.MATRIX);
80 | Matrix matrix = new Matrix();
81 | matrix.postTranslate((lp.width - dWidth) / 2f, (lp.height - dHeight) / 2f);
82 | matrix.postRotate(getDrawableRotationAngle(), lp.width / 2f, lp.height / 2f);
83 | mHeaderImage.setImageMatrix(matrix);
84 | }
85 | }
86 |
87 | @Override
88 | protected void onPullImpl(float scaleOfLayout) {
89 | // NO-OP
90 | }
91 |
92 | @Override
93 | protected void pullToRefreshImpl() {
94 | // Only start reset Animation, we've previously show the rotate anim
95 | // if (mRotateAnimation == mHeaderImage.getAnimation()) {
96 | // mHeaderImage.startAnimation(mResetRotateAnimation);
97 | // }
98 | }
99 |
100 | @Override
101 | protected void refreshingImpl() {
102 | mHeaderImage.clearAnimation();
103 | mHeaderImage.setVisibility(View.INVISIBLE);
104 | mHeaderProgress.setVisibility(View.VISIBLE);
105 | }
106 |
107 | @Override
108 | protected void releaseToRefreshImpl() {
109 | // mHeaderImage.startAnimation(mRotateAnimation);
110 | }
111 |
112 | @Override
113 | protected void resetImpl() {
114 | mHeaderImage.clearAnimation();
115 | mHeaderProgress.setVisibility(View.GONE);
116 | mHeaderImage.setVisibility(View.VISIBLE);
117 | }
118 |
119 | @Override
120 | protected int getDefaultDrawableResId() {
121 | return R.drawable.default_ptr_flip;
122 | }
123 |
124 | private float getDrawableRotationAngle() {
125 | float angle = 0f;
126 | switch (mMode) {
127 | case PULL_FROM_END:
128 | if (mScrollDirection == Orientation.HORIZONTAL) {
129 | angle = 90f;
130 | } else {
131 | angle = 180f;
132 | }
133 | break;
134 |
135 | case PULL_FROM_START:
136 | if (mScrollDirection == Orientation.HORIZONTAL) {
137 | angle = 270f;
138 | }
139 | break;
140 |
141 | default:
142 | break;
143 | }
144 |
145 | return angle;
146 | }
147 |
148 | }
149 |
--------------------------------------------------------------------------------
/library/src/main/java/com/handmark/pulltorefresh/library/internal/GifAnimation.java:
--------------------------------------------------------------------------------
1 | package com.handmark.pulltorefresh.library.internal;
2 |
3 | import android.os.Handler;
4 | import android.os.Message;
5 | import android.widget.ImageView;
6 |
7 | /**
8 | * Created by ccheng on 8/4/14.
9 | */
10 | public class GifAnimation implements Handler.Callback {
11 |
12 | public static final int DELAY_MILLIS = 200;
13 | private final ImageView mHeaderImage;
14 | private final int[] mGifReses;
15 | private final Handler mHandler;
16 | private int mIndex;
17 | private boolean mStart;
18 |
19 | public GifAnimation(ImageView headerImage, int[] gifRes) {
20 | mHeaderImage = headerImage;
21 | mGifReses = gifRes;
22 |
23 | mHandler = new Handler(headerImage.getContext().getMainLooper(), this);
24 | }
25 |
26 | public void start() {
27 | if (!mStart) {
28 | mStart = true;
29 | mIndex = 0;
30 |
31 | nextImage();
32 | mHandler.sendEmptyMessageDelayed(0, DELAY_MILLIS);
33 | }
34 | }
35 |
36 | private void nextImage() {
37 | mHeaderImage.setImageResource(mGifReses[mIndex]);
38 | mIndex = (mIndex + 1) % 3;
39 | }
40 |
41 | @Override
42 | public boolean handleMessage(Message msg) {
43 | if (!mStart) {
44 | return true;
45 | }
46 |
47 | nextImage();
48 | mHandler.sendEmptyMessageDelayed(0, DELAY_MILLIS);
49 | return true;
50 | }
51 |
52 | public void stop() {
53 | mStart = false;
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/library/src/main/java/com/handmark/pulltorefresh/library/internal/GifLoadingLayout.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright 2011, 2012 Chris Banes.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *******************************************************************************/
16 | package com.handmark.pulltorefresh.library.internal;
17 |
18 | import android.content.Context;
19 | import android.content.res.TypedArray;
20 | import android.graphics.Matrix;
21 | import android.graphics.drawable.Drawable;
22 | import android.widget.ImageView.ScaleType;
23 |
24 | import com.bettycc.animatepulltorefresh.library.R;
25 | import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode;
26 | import com.handmark.pulltorefresh.library.PullToRefreshBase.Orientation;
27 |
28 | import java.io.IOException;
29 |
30 | import pl.droidsonroids.gif.GifDrawable;
31 |
32 | public class GifLoadingLayout extends LoadingLayout {
33 |
34 | static final int ROTATION_ANIMATION_DURATION = 1200;
35 |
36 | private final Matrix mHeaderImageMatrix;
37 |
38 | private final boolean mRotateDrawableWhilePulling;
39 | private GifAnimation mGifAnimation;
40 |
41 | private int[] mGifRes = {
42 | R.drawable.dropdown_loading_00,
43 | R.drawable.dropdown_loading_01,
44 | R.drawable.dropdown_loading_02,
45 | };
46 |
47 | private GifDrawable mGifDrawable;
48 | private final String mAssetFile;
49 |
50 | public GifLoadingLayout(Context context, Mode mode, Orientation scrollDirection, TypedArray attrs) {
51 | super(context, mode, scrollDirection, attrs);
52 |
53 | mRotateDrawableWhilePulling = attrs.getBoolean(R.styleable.PullToRefresh_ptrRotateDrawableWhilePulling, true);
54 | mAssetFile = attrs.getString(R.styleable.PullToRefresh_ptrGifAsset);
55 |
56 | mHeaderImage.setScaleType(ScaleType.MATRIX);
57 | mHeaderImageMatrix = new Matrix();
58 | mHeaderImage.setImageMatrix(mHeaderImageMatrix);
59 | try {
60 | mGifDrawable = new GifDrawable(context.getAssets(), mAssetFile);
61 | mHeaderImage.setImageDrawable(mGifDrawable);
62 | } catch (IOException e) {
63 | e.printStackTrace();
64 | }
65 | }
66 |
67 | public void onLoadingDrawableSet(Drawable imageDrawable) {
68 | }
69 |
70 | int mPrevIndex = -1;
71 | protected void onPullImpl(float scaleOfLayout) {
72 | if (mPrevIndex == -1 && scaleOfLayout > 0.3) {
73 | mGifDrawable.pause();
74 | mPrevIndex = 0;
75 | }
76 | }
77 |
78 | @Override
79 | protected void refreshingImpl() {
80 | if (!mGifDrawable.isPlaying()) {
81 | mGifDrawable.start();
82 | }
83 | }
84 |
85 | @Override
86 | protected void resetImpl() {
87 | pauseGif();
88 | }
89 |
90 | private void pauseGif() {
91 | if (mGifDrawable != null && mGifDrawable.isPlaying()) {
92 | mGifDrawable.pause();
93 | }
94 | }
95 |
96 | @Override
97 | protected void pullToRefreshImpl() {
98 | // NO-OP
99 | }
100 |
101 | @Override
102 | protected void releaseToRefreshImpl() {
103 | // NO-OP
104 | }
105 |
106 | @Override
107 | protected int getDefaultDrawableResId() {
108 | return R.drawable.default_ptr_rotate;
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/library/src/main/java/com/handmark/pulltorefresh/library/internal/IndicatorLayout.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright 2011, 2012 Chris Banes.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *******************************************************************************/
16 | package com.handmark.pulltorefresh.library.internal;
17 |
18 | import android.annotation.SuppressLint;
19 | import android.content.Context;
20 | import android.graphics.Matrix;
21 | import android.graphics.drawable.Drawable;
22 | import android.view.View;
23 | import android.view.animation.Animation;
24 | import android.view.animation.Animation.AnimationListener;
25 | import android.view.animation.AnimationUtils;
26 | import android.view.animation.Interpolator;
27 | import android.view.animation.LinearInterpolator;
28 | import android.view.animation.RotateAnimation;
29 | import android.widget.FrameLayout;
30 | import android.widget.ImageView;
31 | import android.widget.ImageView.ScaleType;
32 |
33 | import com.bettycc.animatepulltorefresh.library.R;
34 | import com.handmark.pulltorefresh.library.PullToRefreshBase;
35 |
36 | @SuppressLint("ViewConstructor")
37 | public class IndicatorLayout extends FrameLayout implements AnimationListener {
38 |
39 | static final int DEFAULT_ROTATION_ANIMATION_DURATION = 150;
40 |
41 | private Animation mInAnim, mOutAnim;
42 | private ImageView mArrowImageView;
43 |
44 | private final Animation mRotateAnimation, mResetRotateAnimation;
45 |
46 | public IndicatorLayout(Context context, PullToRefreshBase.Mode mode) {
47 | super(context);
48 | mArrowImageView = new ImageView(context);
49 |
50 | Drawable arrowD = getResources().getDrawable(R.drawable.indicator_arrow);
51 | mArrowImageView.setImageDrawable(arrowD);
52 |
53 | final int padding = getResources().getDimensionPixelSize(R.dimen.indicator_internal_padding);
54 | mArrowImageView.setPadding(padding, padding, padding, padding);
55 | addView(mArrowImageView);
56 |
57 | int inAnimResId, outAnimResId;
58 | switch (mode) {
59 | case PULL_FROM_END:
60 | inAnimResId = R.anim.slide_in_from_bottom;
61 | outAnimResId = R.anim.slide_out_to_bottom;
62 | setBackgroundResource(R.drawable.indicator_bg_bottom);
63 |
64 | // Rotate Arrow so it's pointing the correct way
65 | mArrowImageView.setScaleType(ScaleType.MATRIX);
66 | Matrix matrix = new Matrix();
67 | matrix.setRotate(180f, arrowD.getIntrinsicWidth() / 2f, arrowD.getIntrinsicHeight() / 2f);
68 | mArrowImageView.setImageMatrix(matrix);
69 | break;
70 | default:
71 | case PULL_FROM_START:
72 | inAnimResId = R.anim.slide_in_from_top;
73 | outAnimResId = R.anim.slide_out_to_top;
74 | setBackgroundResource(R.drawable.indicator_bg_top);
75 | break;
76 | }
77 |
78 | mInAnim = AnimationUtils.loadAnimation(context, inAnimResId);
79 | mInAnim.setAnimationListener(this);
80 |
81 | mOutAnim = AnimationUtils.loadAnimation(context, outAnimResId);
82 | mOutAnim.setAnimationListener(this);
83 |
84 | final Interpolator interpolator = new LinearInterpolator();
85 | mRotateAnimation = new RotateAnimation(0, -180, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
86 | 0.5f);
87 | mRotateAnimation.setInterpolator(interpolator);
88 | mRotateAnimation.setDuration(DEFAULT_ROTATION_ANIMATION_DURATION);
89 | mRotateAnimation.setFillAfter(true);
90 |
91 | mResetRotateAnimation = new RotateAnimation(-180, 0, Animation.RELATIVE_TO_SELF, 0.5f,
92 | Animation.RELATIVE_TO_SELF, 0.5f);
93 | mResetRotateAnimation.setInterpolator(interpolator);
94 | mResetRotateAnimation.setDuration(DEFAULT_ROTATION_ANIMATION_DURATION);
95 | mResetRotateAnimation.setFillAfter(true);
96 |
97 | }
98 |
99 | public final boolean isVisible() {
100 | Animation currentAnim = getAnimation();
101 | if (null != currentAnim) {
102 | return mInAnim == currentAnim;
103 | }
104 |
105 | return getVisibility() == View.VISIBLE;
106 | }
107 |
108 | public void hide() {
109 | startAnimation(mOutAnim);
110 | }
111 |
112 | public void show() {
113 | mArrowImageView.clearAnimation();
114 | startAnimation(mInAnim);
115 | }
116 |
117 | @Override
118 | public void onAnimationEnd(Animation animation) {
119 | if (animation == mOutAnim) {
120 | mArrowImageView.clearAnimation();
121 | setVisibility(View.GONE);
122 | } else if (animation == mInAnim) {
123 | setVisibility(View.VISIBLE);
124 | }
125 |
126 | clearAnimation();
127 | }
128 |
129 | @Override
130 | public void onAnimationRepeat(Animation animation) {
131 | // NO-OP
132 | }
133 |
134 | @Override
135 | public void onAnimationStart(Animation animation) {
136 | setVisibility(View.VISIBLE);
137 | }
138 |
139 | public void releaseToRefresh() {
140 | mArrowImageView.startAnimation(mRotateAnimation);
141 | }
142 |
143 | public void pullToRefresh() {
144 | mArrowImageView.startAnimation(mResetRotateAnimation);
145 | }
146 |
147 | }
148 |
--------------------------------------------------------------------------------
/library/src/main/java/com/handmark/pulltorefresh/library/internal/LoadingLayout.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright 2011, 2012 Chris Banes.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *******************************************************************************/
16 | package com.handmark.pulltorefresh.library.internal;
17 |
18 | import android.annotation.SuppressLint;
19 | import android.content.Context;
20 | import android.content.res.ColorStateList;
21 | import android.content.res.TypedArray;
22 | import android.graphics.Typeface;
23 | import android.graphics.drawable.AnimationDrawable;
24 | import android.graphics.drawable.Drawable;
25 | import android.text.TextUtils;
26 | import android.util.TypedValue;
27 | import android.view.Gravity;
28 | import android.view.LayoutInflater;
29 | import android.view.View;
30 | import android.view.ViewGroup;
31 | import android.view.animation.Interpolator;
32 | import android.view.animation.LinearInterpolator;
33 | import android.widget.FrameLayout;
34 | import android.widget.ImageView;
35 | import android.widget.TextView;
36 |
37 | import com.bettycc.animatepulltorefresh.library.R;
38 | import com.handmark.pulltorefresh.library.ILoadingLayout;
39 | import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode;
40 | import com.handmark.pulltorefresh.library.PullToRefreshBase.Orientation;
41 |
42 | import pl.droidsonroids.gif.GifImageView;
43 |
44 | @SuppressLint("ViewConstructor")
45 | public abstract class LoadingLayout extends FrameLayout implements ILoadingLayout {
46 |
47 | static final String LOG_TAG = "PullToRefresh-LoadingLayout";
48 |
49 | static final Interpolator ANIMATION_INTERPOLATOR = new LinearInterpolator();
50 |
51 | private FrameLayout mInnerLayout;
52 |
53 | public final GifImageView mHeaderImage;
54 | public final ImageView mTickImage;
55 | protected final View mHeaderProgress;
56 |
57 | private boolean mUseIntrinsicAnimation;
58 |
59 | private final TextView mHeaderText;
60 | private final TextView mSubHeaderText;
61 |
62 | protected final Mode mMode;
63 | protected final Orientation mScrollDirection;
64 |
65 | private CharSequence mPullLabel;
66 | private CharSequence mRefreshingLabel;
67 | private CharSequence mReleaseLabel;
68 |
69 | public LoadingLayout(Context context, final Mode mode, final Orientation scrollDirection, TypedArray attrs) {
70 | super(context);
71 | mMode = mode;
72 | mScrollDirection = scrollDirection;
73 |
74 | switch (scrollDirection) {
75 | case HORIZONTAL:
76 | LayoutInflater.from(context).inflate(R.layout.pull_to_refresh_header_horizontal, this);
77 | break;
78 | case VERTICAL:
79 | default:
80 | LayoutInflater.from(context).inflate(R.layout.pull_to_refresh_header_vertical, this);
81 | break;
82 | }
83 |
84 | mInnerLayout = (FrameLayout) findViewById(R.id.fl_inner);
85 | mHeaderText = (TextView) mInnerLayout.findViewById(R.id.pull_to_refresh_text);
86 | mHeaderProgress = mInnerLayout.findViewById(R.id.pull_to_refresh_progress);
87 | mSubHeaderText = (TextView) mInnerLayout.findViewById(R.id.pull_to_refresh_sub_text);
88 | mHeaderImage = (GifImageView) mInnerLayout.findViewById(R.id.pull_to_refresh_image);
89 | mTickImage = (ImageView) mInnerLayout.findViewById(R.id.pull_to_refresh_tick);
90 |
91 | FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mInnerLayout.getLayoutParams();
92 |
93 | switch (mode) {
94 | case PULL_FROM_END:
95 | lp.gravity = scrollDirection == Orientation.VERTICAL ? Gravity.TOP : Gravity.LEFT;
96 |
97 | // Load in labels
98 | mPullLabel = context.getString(R.string.pull_to_refresh_from_bottom_pull_label);
99 | mRefreshingLabel = context.getString(R.string.pull_to_refresh_from_bottom_refreshing_label);
100 | mReleaseLabel = context.getString(R.string.pull_to_refresh_from_bottom_release_label);
101 | break;
102 |
103 | case PULL_FROM_START:
104 | default:
105 | lp.gravity = scrollDirection == Orientation.VERTICAL ? Gravity.BOTTOM : Gravity.RIGHT;
106 |
107 | // Load in labels
108 | mPullLabel = context.getString(R.string.pull_to_refresh_pull_label);
109 | mRefreshingLabel = context.getString(R.string.pull_to_refresh_refreshing_label);
110 | mReleaseLabel = context.getString(R.string.pull_to_refresh_release_label);
111 | break;
112 | }
113 |
114 | if (attrs.hasValue(R.styleable.PullToRefresh_ptrHeaderBackground)) {
115 | Drawable background = attrs.getDrawable(R.styleable.PullToRefresh_ptrHeaderBackground);
116 | if (null != background) {
117 | ViewCompat.setBackground(this, background);
118 | }
119 | }
120 |
121 | if (attrs.hasValue(R.styleable.PullToRefresh_ptrHeaderTextAppearance)) {
122 | TypedValue styleID = new TypedValue();
123 | attrs.getValue(R.styleable.PullToRefresh_ptrHeaderTextAppearance, styleID);
124 | setTextAppearance(styleID.data);
125 | }
126 | if (attrs.hasValue(R.styleable.PullToRefresh_ptrSubHeaderTextAppearance)) {
127 | TypedValue styleID = new TypedValue();
128 | attrs.getValue(R.styleable.PullToRefresh_ptrSubHeaderTextAppearance, styleID);
129 | setSubTextAppearance(styleID.data);
130 | }
131 |
132 | // Text Color attrs need to be set after TextAppearance attrs
133 | if (attrs.hasValue(R.styleable.PullToRefresh_ptrHeaderTextColor)) {
134 | ColorStateList colors = attrs.getColorStateList(R.styleable.PullToRefresh_ptrHeaderTextColor);
135 | if (null != colors) {
136 | setTextColor(colors);
137 | }
138 | }
139 | if (attrs.hasValue(R.styleable.PullToRefresh_ptrHeaderSubTextColor)) {
140 | ColorStateList colors = attrs.getColorStateList(R.styleable.PullToRefresh_ptrHeaderSubTextColor);
141 | if (null != colors) {
142 | setSubTextColor(colors);
143 | }
144 | }
145 |
146 | // Try and get defined drawable from Attrs
147 | Drawable imageDrawable = null;
148 | if (attrs.hasValue(R.styleable.PullToRefresh_ptrDrawable)) {
149 | imageDrawable = attrs.getDrawable(R.styleable.PullToRefresh_ptrDrawable);
150 | }
151 |
152 | // Check Specific Drawable from Attrs, these overrite the generic
153 | // drawable attr above
154 | switch (mode) {
155 | case PULL_FROM_START:
156 | default:
157 | if (attrs.hasValue(R.styleable.PullToRefresh_ptrDrawableStart)) {
158 | imageDrawable = attrs.getDrawable(R.styleable.PullToRefresh_ptrDrawableStart);
159 | } else if (attrs.hasValue(R.styleable.PullToRefresh_ptrDrawableTop)) {
160 | Utils.warnDeprecation("ptrDrawableTop", "ptrDrawableStart");
161 | imageDrawable = attrs.getDrawable(R.styleable.PullToRefresh_ptrDrawableTop);
162 | }
163 | break;
164 |
165 | case PULL_FROM_END:
166 | if (attrs.hasValue(R.styleable.PullToRefresh_ptrDrawableEnd)) {
167 | imageDrawable = attrs.getDrawable(R.styleable.PullToRefresh_ptrDrawableEnd);
168 | } else if (attrs.hasValue(R.styleable.PullToRefresh_ptrDrawableBottom)) {
169 | Utils.warnDeprecation("ptrDrawableBottom", "ptrDrawableEnd");
170 | imageDrawable = attrs.getDrawable(R.styleable.PullToRefresh_ptrDrawableBottom);
171 | }
172 | break;
173 | }
174 |
175 | // If we don't have a user defined drawable, load the default
176 | if (null == imageDrawable) {
177 | imageDrawable = context.getResources().getDrawable(getDefaultDrawableResId());
178 | }
179 |
180 | // Set Drawable, and save width/height
181 | setLoadingDrawable(imageDrawable);
182 |
183 | reset();
184 | }
185 |
186 | public final void setHeight(int height) {
187 | ViewGroup.LayoutParams lp = (ViewGroup.LayoutParams) getLayoutParams();
188 | lp.height = height;
189 | requestLayout();
190 | }
191 |
192 | public final void setWidth(int width) {
193 | ViewGroup.LayoutParams lp = (ViewGroup.LayoutParams) getLayoutParams();
194 | lp.width = width;
195 | requestLayout();
196 | }
197 |
198 | public final int getContentSize() {
199 | switch (mScrollDirection) {
200 | case HORIZONTAL:
201 | return mInnerLayout.getWidth();
202 | case VERTICAL:
203 | default:
204 | return mInnerLayout.getHeight();
205 | }
206 | }
207 |
208 | public final void hideAllViews() {
209 | if (View.VISIBLE == mHeaderText.getVisibility()) {
210 | mHeaderText.setVisibility(View.INVISIBLE);
211 | }
212 | if (View.VISIBLE == mHeaderProgress.getVisibility()) {
213 | mHeaderProgress.setVisibility(View.INVISIBLE);
214 | }
215 | if (View.VISIBLE == mHeaderImage.getVisibility()) {
216 | mHeaderImage.setVisibility(View.INVISIBLE);
217 | }
218 | if (View.VISIBLE == mSubHeaderText.getVisibility()) {
219 | mSubHeaderText.setVisibility(View.INVISIBLE);
220 | }
221 | }
222 |
223 | public final void onPull(float scaleOfLayout) {
224 | if (!mUseIntrinsicAnimation) {
225 | onPullImpl(scaleOfLayout);
226 | }
227 | }
228 |
229 | public final void pullToRefresh() {
230 | if (null != mHeaderText) {
231 | mHeaderText.setText(mPullLabel);
232 | }
233 |
234 | // Now call the callback
235 | pullToRefreshImpl();
236 | }
237 |
238 | public final void refreshing() {
239 | if (null != mHeaderText) {
240 | mHeaderText.setText(mRefreshingLabel);
241 | }
242 |
243 | if (mUseIntrinsicAnimation) {
244 | ((AnimationDrawable) mHeaderImage.getDrawable()).start();
245 | } else {
246 | // Now call the callback
247 | refreshingImpl();
248 | }
249 |
250 | if (null != mSubHeaderText) {
251 | mSubHeaderText.setVisibility(View.GONE);
252 | }
253 | }
254 |
255 | public final void releaseToRefresh() {
256 | if (null != mHeaderText) {
257 | mHeaderText.setText(mReleaseLabel);
258 | }
259 |
260 | // Now call the callback
261 | releaseToRefreshImpl();
262 | }
263 |
264 | public final void reset() {
265 | if (null != mHeaderText) {
266 | mHeaderText.setText(mPullLabel);
267 | }
268 | mHeaderImage.setVisibility(View.VISIBLE);
269 |
270 | if (mUseIntrinsicAnimation) {
271 | ((AnimationDrawable) mHeaderImage.getDrawable()).stop();
272 | } else {
273 | // Now call the callback
274 | resetImpl();
275 | }
276 |
277 | if (null != mSubHeaderText) {
278 | if (TextUtils.isEmpty(mSubHeaderText.getText())) {
279 | mSubHeaderText.setVisibility(View.GONE);
280 | } else {
281 | mSubHeaderText.setVisibility(View.VISIBLE);
282 | }
283 | }
284 | }
285 |
286 | @Override
287 | public void setLastUpdatedLabel(CharSequence label) {
288 | setSubHeaderText(label);
289 | }
290 |
291 | public final void setLoadingDrawable(Drawable imageDrawable) {
292 | // Set Drawable
293 | mHeaderImage.setImageDrawable(imageDrawable);
294 | mUseIntrinsicAnimation = (imageDrawable instanceof AnimationDrawable);
295 |
296 | // Now call the callback
297 | onLoadingDrawableSet(imageDrawable);
298 | }
299 |
300 | public void setPullLabel(CharSequence pullLabel) {
301 | mPullLabel = pullLabel;
302 | }
303 |
304 | public void setRefreshingLabel(CharSequence refreshingLabel) {
305 | mRefreshingLabel = refreshingLabel;
306 | }
307 |
308 | public void setReleaseLabel(CharSequence releaseLabel) {
309 | mReleaseLabel = releaseLabel;
310 | }
311 |
312 | @Override
313 | public void setTextTypeface(Typeface tf) {
314 | mHeaderText.setTypeface(tf);
315 | }
316 |
317 | public final void showInvisibleViews() {
318 | if (View.INVISIBLE == mHeaderText.getVisibility()) {
319 | mHeaderText.setVisibility(View.VISIBLE);
320 | }
321 | if (View.INVISIBLE == mHeaderProgress.getVisibility()) {
322 | mHeaderProgress.setVisibility(View.VISIBLE);
323 | }
324 | if (View.INVISIBLE == mHeaderImage.getVisibility()) {
325 | mHeaderImage.setVisibility(View.VISIBLE);
326 | }
327 | if (View.INVISIBLE == mSubHeaderText.getVisibility()) {
328 | mSubHeaderText.setVisibility(View.VISIBLE);
329 | }
330 | }
331 |
332 | /**
333 | * Callbacks for derivative Layouts
334 | */
335 |
336 | protected abstract int getDefaultDrawableResId();
337 |
338 | protected abstract void onLoadingDrawableSet(Drawable imageDrawable);
339 |
340 | protected abstract void onPullImpl(float scaleOfLayout);
341 |
342 | protected abstract void pullToRefreshImpl();
343 |
344 | protected abstract void refreshingImpl();
345 |
346 | protected abstract void releaseToRefreshImpl();
347 |
348 | protected abstract void resetImpl();
349 |
350 | private void setSubHeaderText(CharSequence label) {
351 | if (null != mSubHeaderText) {
352 | if (TextUtils.isEmpty(label)) {
353 | mSubHeaderText.setVisibility(View.GONE);
354 | } else {
355 | mSubHeaderText.setText(label);
356 |
357 | // Only set it to Visible if we're GONE, otherwise VISIBLE will
358 | // be set soon
359 | if (View.GONE == mSubHeaderText.getVisibility()) {
360 | mSubHeaderText.setVisibility(View.VISIBLE);
361 | }
362 | }
363 | }
364 | }
365 |
366 | private void setSubTextAppearance(int value) {
367 | if (null != mSubHeaderText) {
368 | mSubHeaderText.setTextAppearance(getContext(), value);
369 | }
370 | }
371 |
372 | private void setSubTextColor(ColorStateList color) {
373 | if (null != mSubHeaderText) {
374 | mSubHeaderText.setTextColor(color);
375 | }
376 | }
377 |
378 | private void setTextAppearance(int value) {
379 | if (null != mHeaderText) {
380 | mHeaderText.setTextAppearance(getContext(), value);
381 | }
382 | if (null != mSubHeaderText) {
383 | mSubHeaderText.setTextAppearance(getContext(), value);
384 | }
385 | }
386 |
387 | private void setTextColor(ColorStateList color) {
388 | if (null != mHeaderText) {
389 | mHeaderText.setTextColor(color);
390 | }
391 | if (null != mSubHeaderText) {
392 | mSubHeaderText.setTextColor(color);
393 | }
394 | }
395 |
396 | }
397 |
--------------------------------------------------------------------------------
/library/src/main/java/com/handmark/pulltorefresh/library/internal/RotateLoadingLayout.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright 2011, 2012 Chris Banes.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *******************************************************************************/
16 | package com.handmark.pulltorefresh.library.internal;
17 |
18 | import android.content.Context;
19 | import android.content.res.TypedArray;
20 | import android.graphics.Bitmap;
21 | import android.graphics.BitmapFactory;
22 | import android.graphics.Matrix;
23 | import android.graphics.drawable.Drawable;
24 | import android.widget.ImageView.ScaleType;
25 |
26 | import com.bettycc.animatepulltorefresh.library.R;
27 | import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode;
28 | import com.handmark.pulltorefresh.library.PullToRefreshBase.Orientation;
29 |
30 |
31 | public class RotateLoadingLayout extends LoadingLayout {
32 |
33 | static final int ROTATION_ANIMATION_DURATION = 1200;
34 |
35 | private final Matrix mHeaderImageMatrix;
36 |
37 | private float mRotationPivotX, mRotationPivotY;
38 |
39 | private final boolean mRotateDrawableWhilePulling;
40 | private GifAnimation mGifAnimation;
41 |
42 | private int[] mGifRes = {
43 | R.drawable.dropdown_loading_00,
44 | R.drawable.dropdown_loading_01,
45 | R.drawable.dropdown_loading_02,
46 | };
47 |
48 | public RotateLoadingLayout(Context context, Mode mode, Orientation scrollDirection, TypedArray attrs) {
49 | super(context, mode, scrollDirection, attrs);
50 |
51 | mRotateDrawableWhilePulling = attrs.getBoolean(R.styleable.PullToRefresh_ptrRotateDrawableWhilePulling, true);
52 |
53 | mHeaderImage.setScaleType(ScaleType.MATRIX);
54 | mHeaderImageMatrix = new Matrix();
55 | mHeaderImage.setImageMatrix(mHeaderImageMatrix);
56 | }
57 |
58 | public void onLoadingDrawableSet(Drawable imageDrawable) {
59 | System.out.println("RotateLoadingLayout.onLoadingDrawableSet");
60 | if (null != imageDrawable) {
61 | mRotationPivotX = Math.round(imageDrawable.getIntrinsicWidth() / 2f);
62 | mRotationPivotY = Math.round(imageDrawable.getIntrinsicHeight() / 2f);
63 | }
64 | }
65 |
66 | int mPrevIndex = -1;
67 | protected void onPullImpl(float scaleOfLayout) {
68 | float angle;
69 | if (mRotateDrawableWhilePulling) {
70 | angle = scaleOfLayout * 90f;
71 | } else {
72 | angle = Math.max(0f, Math.min(180f, scaleOfLayout * 360f - 180f));
73 | }
74 |
75 | float max = 1.7f;
76 | int index = (int) (scaleOfLayout / 1f * 10);
77 | if (index == mPrevIndex) {
78 | return;
79 | } else {
80 | if (index > 10) {
81 | index = 10;
82 | }
83 | int res = getResources().getIdentifier(String.format("dropdown_anim_%02d",
84 | index), "drawable", getContext().getPackageName());
85 | // Bitmap scaledBitmap = getScaledBitmap(res, index);
86 | // mHeaderImage.setImageBitmap(scaledBitmap);
87 | mHeaderImage.setImageResource(res);
88 | mPrevIndex = index;
89 | }
90 | }
91 |
92 | private Bitmap getScaledBitmap(int res, int index) {
93 | float p = ((float) index/10*7 + 3)/10;
94 | Bitmap bitmap = BitmapFactory.decodeResource(getResources(), res);
95 | return Bitmap.createScaledBitmap(bitmap, (int)(mHeaderImage.getWidth()*p), (int)(mHeaderImage.getHeight()*p), false);
96 | }
97 |
98 | @Override
99 | protected void refreshingImpl() {
100 | if (mGifAnimation == null) {
101 | mGifAnimation = new GifAnimation(mHeaderImage, mGifRes);
102 | }
103 | mGifAnimation.start();
104 | }
105 |
106 | @Override
107 | protected void resetImpl() {
108 | mHeaderImage.clearAnimation();
109 | if (mGifAnimation != null) {
110 | mGifAnimation.stop();
111 | }
112 | }
113 |
114 | @Override
115 | protected void pullToRefreshImpl() {
116 | // NO-OP
117 | }
118 |
119 | @Override
120 | protected void releaseToRefreshImpl() {
121 | // NO-OP
122 | }
123 |
124 | @Override
125 | protected int getDefaultDrawableResId() {
126 | return R.drawable.default_ptr_rotate;
127 | }
128 | }
129 |
--------------------------------------------------------------------------------
/library/src/main/java/com/handmark/pulltorefresh/library/internal/Utils.java:
--------------------------------------------------------------------------------
1 | package com.handmark.pulltorefresh.library.internal;
2 |
3 | import android.util.Log;
4 |
5 | public class Utils {
6 |
7 | static final String LOG_TAG = "PullToRefresh";
8 |
9 | public static void warnDeprecation(String depreacted, String replacement) {
10 | Log.w(LOG_TAG, "You're using the deprecated " + depreacted + " attr, please switch over to " + replacement);
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/library/src/main/java/com/handmark/pulltorefresh/library/internal/ViewCompat.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright 2011, 2012 Chris Banes.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *******************************************************************************/
16 | package com.handmark.pulltorefresh.library.internal;
17 |
18 | import android.annotation.TargetApi;
19 | import android.graphics.drawable.Drawable;
20 | import android.os.Build.VERSION;
21 | import android.os.Build.VERSION_CODES;
22 | import android.view.View;
23 |
24 | @SuppressWarnings("deprecation")
25 | public class ViewCompat {
26 |
27 | public static void postOnAnimation(View view, Runnable runnable) {
28 | if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) {
29 | SDK16.postOnAnimation(view, runnable);
30 | } else {
31 | view.postDelayed(runnable, 16);
32 | }
33 | }
34 |
35 | public static void setBackground(View view, Drawable background) {
36 | if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) {
37 | SDK16.setBackground(view, background);
38 | } else {
39 | view.setBackgroundDrawable(background);
40 | }
41 | }
42 |
43 | public static void setLayerType(View view, int layerType) {
44 | if (VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB) {
45 | SDK11.setLayerType(view, layerType);
46 | }
47 | }
48 |
49 | @TargetApi(11)
50 | static class SDK11 {
51 |
52 | public static void setLayerType(View view, int layerType) {
53 | view.setLayerType(layerType, null);
54 | }
55 | }
56 |
57 | @TargetApi(16)
58 | static class SDK16 {
59 |
60 | public static void postOnAnimation(View view, Runnable runnable) {
61 | view.postOnAnimation(runnable);
62 | }
63 |
64 | public static void setBackground(View view, Drawable background) {
65 | view.setBackground(background);
66 | }
67 |
68 | }
69 |
70 | }
71 |
--------------------------------------------------------------------------------
/library/src/main/res/anim/slide_in_from_bottom.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
22 |
--------------------------------------------------------------------------------
/library/src/main/res/anim/slide_in_from_top.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
22 |
--------------------------------------------------------------------------------
/library/src/main/res/anim/slide_out_to_bottom.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
22 |
--------------------------------------------------------------------------------
/library/src/main/res/anim/slide_out_to_top.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
22 |
--------------------------------------------------------------------------------
/library/src/main/res/drawable-hdpi/default_ptr_flip.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ufo22940268/Android-AnimatePullToRefreshListView/43f552852b275fb9d5a5b2bf513092e9d260d07e/library/src/main/res/drawable-hdpi/default_ptr_flip.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-hdpi/default_ptr_rotate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ufo22940268/Android-AnimatePullToRefreshListView/43f552852b275fb9d5a5b2bf513092e9d260d07e/library/src/main/res/drawable-hdpi/default_ptr_rotate.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ufo22940268/Android-AnimatePullToRefreshListView/43f552852b275fb9d5a5b2bf513092e9d260d07e/library/src/main/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-hdpi/indicator_arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ufo22940268/Android-AnimatePullToRefreshListView/43f552852b275fb9d5a5b2bf513092e9d260d07e/library/src/main/res/drawable-hdpi/indicator_arrow.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-mdpi/default_ptr_flip.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ufo22940268/Android-AnimatePullToRefreshListView/43f552852b275fb9d5a5b2bf513092e9d260d07e/library/src/main/res/drawable-mdpi/default_ptr_flip.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-mdpi/default_ptr_rotate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ufo22940268/Android-AnimatePullToRefreshListView/43f552852b275fb9d5a5b2bf513092e9d260d07e/library/src/main/res/drawable-mdpi/default_ptr_rotate.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ufo22940268/Android-AnimatePullToRefreshListView/43f552852b275fb9d5a5b2bf513092e9d260d07e/library/src/main/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-mdpi/indicator_arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ufo22940268/Android-AnimatePullToRefreshListView/43f552852b275fb9d5a5b2bf513092e9d260d07e/library/src/main/res/drawable-mdpi/indicator_arrow.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-xhdpi/default_ptr_flip.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ufo22940268/Android-AnimatePullToRefreshListView/43f552852b275fb9d5a5b2bf513092e9d260d07e/library/src/main/res/drawable-xhdpi/default_ptr_flip.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-xhdpi/default_ptr_rotate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ufo22940268/Android-AnimatePullToRefreshListView/43f552852b275fb9d5a5b2bf513092e9d260d07e/library/src/main/res/drawable-xhdpi/default_ptr_rotate.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-xhdpi/dropdown_anim_00.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ufo22940268/Android-AnimatePullToRefreshListView/43f552852b275fb9d5a5b2bf513092e9d260d07e/library/src/main/res/drawable-xhdpi/dropdown_anim_00.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-xhdpi/dropdown_anim_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ufo22940268/Android-AnimatePullToRefreshListView/43f552852b275fb9d5a5b2bf513092e9d260d07e/library/src/main/res/drawable-xhdpi/dropdown_anim_01.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-xhdpi/dropdown_anim_02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ufo22940268/Android-AnimatePullToRefreshListView/43f552852b275fb9d5a5b2bf513092e9d260d07e/library/src/main/res/drawable-xhdpi/dropdown_anim_02.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-xhdpi/dropdown_anim_03.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ufo22940268/Android-AnimatePullToRefreshListView/43f552852b275fb9d5a5b2bf513092e9d260d07e/library/src/main/res/drawable-xhdpi/dropdown_anim_03.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-xhdpi/dropdown_anim_04.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ufo22940268/Android-AnimatePullToRefreshListView/43f552852b275fb9d5a5b2bf513092e9d260d07e/library/src/main/res/drawable-xhdpi/dropdown_anim_04.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-xhdpi/dropdown_anim_05.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ufo22940268/Android-AnimatePullToRefreshListView/43f552852b275fb9d5a5b2bf513092e9d260d07e/library/src/main/res/drawable-xhdpi/dropdown_anim_05.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-xhdpi/dropdown_anim_06.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ufo22940268/Android-AnimatePullToRefreshListView/43f552852b275fb9d5a5b2bf513092e9d260d07e/library/src/main/res/drawable-xhdpi/dropdown_anim_06.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-xhdpi/dropdown_anim_07.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ufo22940268/Android-AnimatePullToRefreshListView/43f552852b275fb9d5a5b2bf513092e9d260d07e/library/src/main/res/drawable-xhdpi/dropdown_anim_07.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-xhdpi/dropdown_anim_08.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ufo22940268/Android-AnimatePullToRefreshListView/43f552852b275fb9d5a5b2bf513092e9d260d07e/library/src/main/res/drawable-xhdpi/dropdown_anim_08.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-xhdpi/dropdown_anim_09.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ufo22940268/Android-AnimatePullToRefreshListView/43f552852b275fb9d5a5b2bf513092e9d260d07e/library/src/main/res/drawable-xhdpi/dropdown_anim_09.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-xhdpi/dropdown_anim_10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ufo22940268/Android-AnimatePullToRefreshListView/43f552852b275fb9d5a5b2bf513092e9d260d07e/library/src/main/res/drawable-xhdpi/dropdown_anim_10.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-xhdpi/dropdown_loading_00.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ufo22940268/Android-AnimatePullToRefreshListView/43f552852b275fb9d5a5b2bf513092e9d260d07e/library/src/main/res/drawable-xhdpi/dropdown_loading_00.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-xhdpi/dropdown_loading_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ufo22940268/Android-AnimatePullToRefreshListView/43f552852b275fb9d5a5b2bf513092e9d260d07e/library/src/main/res/drawable-xhdpi/dropdown_loading_01.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-xhdpi/dropdown_loading_02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ufo22940268/Android-AnimatePullToRefreshListView/43f552852b275fb9d5a5b2bf513092e9d260d07e/library/src/main/res/drawable-xhdpi/dropdown_loading_02.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-xhdpi/gif_loading1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ufo22940268/Android-AnimatePullToRefreshListView/43f552852b275fb9d5a5b2bf513092e9d260d07e/library/src/main/res/drawable-xhdpi/gif_loading1.gif
--------------------------------------------------------------------------------
/library/src/main/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ufo22940268/Android-AnimatePullToRefreshListView/43f552852b275fb9d5a5b2bf513092e9d260d07e/library/src/main/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-xhdpi/indicator_arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ufo22940268/Android-AnimatePullToRefreshListView/43f552852b275fb9d5a5b2bf513092e9d260d07e/library/src/main/res/drawable-xhdpi/indicator_arrow.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-xhdpi/loading.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ufo22940268/Android-AnimatePullToRefreshListView/43f552852b275fb9d5a5b2bf513092e9d260d07e/library/src/main/res/drawable-xhdpi/loading.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-xhdpi/ok.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ufo22940268/Android-AnimatePullToRefreshListView/43f552852b275fb9d5a5b2bf513092e9d260d07e/library/src/main/res/drawable-xhdpi/ok.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ufo22940268/Android-AnimatePullToRefreshListView/43f552852b275fb9d5a5b2bf513092e9d260d07e/library/src/main/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable/indicator_bg_bottom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
11 |
17 |
18 |
--------------------------------------------------------------------------------
/library/src/main/res/drawable/indicator_bg_top.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
11 |
17 |
18 |
--------------------------------------------------------------------------------
/library/src/main/res/layout/pull_to_refresh_header_horizontal.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
12 |
13 |
18 |
19 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/library/src/main/res/layout/pull_to_refresh_header_vertical.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
13 |
14 |
18 |
19 |
24 |
25 |
33 |
34 |
41 |
42 |
43 |
44 |
51 |
52 |
59 |
60 |
67 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/library/src/main/res/values-ar/pull_refresh_strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | اسحب للتحديث…
4 | اترك للتحديث…
5 | تحميل…
6 |
7 |
--------------------------------------------------------------------------------
/library/src/main/res/values-cs/pull_refresh_strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Tažením aktualizujete…
4 | Uvolněním aktualizujete…
5 | Načítání…
6 |
7 |
--------------------------------------------------------------------------------
/library/src/main/res/values-de/pull_refresh_strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Ziehen zum Aktualisieren…
4 | Loslassen zum Aktualisieren…
5 | Laden…
6 |
7 |
--------------------------------------------------------------------------------
/library/src/main/res/values-es/pull_refresh_strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Tirar para actualizar…
4 | Soltar para actualizar…
5 | Cargando…
6 |
7 |
--------------------------------------------------------------------------------
/library/src/main/res/values-fi/pull_refresh_strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Päivitä vetämällä alas…
5 | Päivitä vapauttamalla…
6 | Päivitetään…
7 |
8 |
9 | Päivitä vetämällä ylös…
10 | @string/pull_to_refresh_release_label
11 | @string/pull_to_refresh_refreshing_label
12 |
13 |
--------------------------------------------------------------------------------
/library/src/main/res/values-fr/pull_refresh_strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Tirez pour rafraîchir…
4 | Relâcher pour rafraîchir…
5 | Chargement…
6 |
7 |
--------------------------------------------------------------------------------
/library/src/main/res/values-he/pull_refresh_strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | משוך לרענון…
4 | שחרר לרענון…
5 | טוען…
6 |
7 |
--------------------------------------------------------------------------------
/library/src/main/res/values-it/pull_refresh_strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Tira per aggiornare…
4 | Rilascia per aggionare…
5 | Caricamento…
6 |
7 |
--------------------------------------------------------------------------------
/library/src/main/res/values-iw/pull_refresh_strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | משוך לרענון…
4 | שחרר לרענון…
5 | טוען…
6 |
7 |
--------------------------------------------------------------------------------
/library/src/main/res/values-ja/pull_refresh_strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 画面を引っ張って…
4 | 指を離して更新…
5 | 読み込み中…
6 |
7 |
--------------------------------------------------------------------------------
/library/src/main/res/values-ko/pull_refresh_strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 당겨서 새로 고침…
4 | 놓아서 새로 고침…
5 | 로드 중…
6 |
7 |
--------------------------------------------------------------------------------
/library/src/main/res/values-nl/pull_refresh_strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Sleep om te vernieuwen…
4 | Loslaten om te vernieuwen…
5 | Laden…
6 |
7 |
--------------------------------------------------------------------------------
/library/src/main/res/values-pl/pull_refresh_strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Pociągnij, aby odświeżyć…
4 | Puść, aby odświeżyć…
5 | Wczytywanie…
6 |
7 |
--------------------------------------------------------------------------------
/library/src/main/res/values-pt-rBR/pull_refresh_strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Puxe para atualizar…
4 | Libere para atualizar…
5 | Carregando…
6 |
7 |
--------------------------------------------------------------------------------
/library/src/main/res/values-pt/pull_refresh_strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Puxe para atualizar…
4 | Liberação para atualizar…
5 | A carregar…
6 |
7 |
--------------------------------------------------------------------------------
/library/src/main/res/values-ro/pull_refresh_strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Trage pentru a reîmprospăta…
4 | Eliberează pentru a reîmprospăta…
5 | Încărcare…
6 |
7 |
--------------------------------------------------------------------------------
/library/src/main/res/values-ru/pull_refresh_strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Потяните для обновления…
4 | Отпустите для обновления…
5 | Загрузка…
6 |
7 |
--------------------------------------------------------------------------------
/library/src/main/res/values-zh/pull_refresh_strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 下拉刷新…
4 | 放开以刷新…
5 | 正在载入…
6 |
7 |
--------------------------------------------------------------------------------
/library/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
69 |
70 |
71 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
--------------------------------------------------------------------------------
/library/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 10dp
5 | 12dp
6 | 4dp
7 | 24dp
8 | 12dp
9 |
10 |
--------------------------------------------------------------------------------
/library/src/main/res/values/ids.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/library/src/main/res/values/pull_refresh_strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Pull to refresh…
5 | Release to refresh…
6 | Loading…
7 |
8 |
9 | @string/pull_to_refresh_pull_label
10 | @string/pull_to_refresh_release_label
11 | @string/pull_to_refresh_refreshing_label
12 |
13 |
--------------------------------------------------------------------------------
/library/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | My Module
3 |
4 |
--------------------------------------------------------------------------------
/library/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':library'
2 |
--------------------------------------------------------------------------------
/slide.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ufo22940268/Android-AnimatePullToRefreshListView/43f552852b275fb9d5a5b2bf513092e9d260d07e/slide.gif
--------------------------------------------------------------------------------