refreshView) {
- refreshView.getRefreshableView().reload();
- }
-
- };
-
- private final WebChromeClient defaultWebChromeClient = new WebChromeClient() {
-
- @Override
- public void onProgressChanged(WebView view, int newProgress) {
- if (newProgress == 100) {
- onRefreshComplete();
- }
- }
-
- };
-
- public PullToRefreshWebView(Context context) {
- super(context);
-
- /**
- * Added so that by default, Pull-to-Refresh refreshes the page
- */
- setOnRefreshListener(defaultOnRefreshListener);
- mRefreshableView.setWebChromeClient(defaultWebChromeClient);
- }
-
- public PullToRefreshWebView(Context context, AttributeSet attrs) {
- super(context, attrs);
-
- /**
- * Added so that by default, Pull-to-Refresh refreshes the page
- */
- setOnRefreshListener(defaultOnRefreshListener);
- mRefreshableView.setWebChromeClient(defaultWebChromeClient);
- }
-
- public PullToRefreshWebView(Context context, Mode mode) {
- super(context, mode);
-
- /**
- * Added so that by default, Pull-to-Refresh refreshes the page
- */
- setOnRefreshListener(defaultOnRefreshListener);
- mRefreshableView.setWebChromeClient(defaultWebChromeClient);
- }
-
- public PullToRefreshWebView(Context context, Mode mode, AnimationStyle style) {
- super(context, mode, style);
-
- /**
- * Added so that by default, Pull-to-Refresh refreshes the page
- */
- setOnRefreshListener(defaultOnRefreshListener);
- mRefreshableView.setWebChromeClient(defaultWebChromeClient);
- }
-
- @Override
- public final Orientation getPullToRefreshScrollDirection() {
- return Orientation.VERTICAL;
- }
-
- @Override
- protected WebView createRefreshableView(Context context, AttributeSet attrs) {
- WebView webView;
- if (VERSION.SDK_INT >= VERSION_CODES.GINGERBREAD) {
- webView = new InternalWebViewSDK9(context, attrs);
- } else {
- webView = new WebView(context, attrs);
- }
-
- webView.setId(R.id.webview);
- return webView;
- }
-
- @Override
- protected boolean isReadyForPullStart() {
- return mRefreshableView.getScrollY() == 0;
- }
-
- @Override
- protected boolean isReadyForPullEnd() {
- float exactContentHeight = (float) Math.floor(mRefreshableView.getContentHeight() * mRefreshableView.getScale());
- return mRefreshableView.getScrollY() >= (exactContentHeight - mRefreshableView.getHeight());
- }
-
- @Override
- protected void onPtrRestoreInstanceState(Bundle savedInstanceState) {
- super.onPtrRestoreInstanceState(savedInstanceState);
- mRefreshableView.restoreState(savedInstanceState);
- }
-
- @Override
- protected void onPtrSaveInstanceState(Bundle saveState) {
- super.onPtrSaveInstanceState(saveState);
- mRefreshableView.saveState(saveState);
- }
-
- @TargetApi(9)
- final class InternalWebViewSDK9 extends WebView {
-
- // WebView doesn't always scroll back to it's edge so we add some
- // fuzziness
- static final int OVERSCROLL_FUZZY_THRESHOLD = 2;
-
- // WebView seems quite reluctant to overscroll so we use the scale
- // factor to scale it's value
- static final float OVERSCROLL_SCALE_FACTOR = 1.5f;
-
- public InternalWebViewSDK9(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- @Override
- protected boolean overScrollBy(int deltaX, int deltaY, int scrollX, int scrollY, int scrollRangeX,
- int scrollRangeY, int maxOverScrollX, int maxOverScrollY, boolean isTouchEvent) {
-
- final boolean returnValue = super.overScrollBy(deltaX, deltaY, scrollX, scrollY, scrollRangeX,
- scrollRangeY, maxOverScrollX, maxOverScrollY, isTouchEvent);
-
- // Does all of the hard work...
- OverscrollHelper.overScrollBy(PullToRefreshWebView.this, deltaX, scrollX, deltaY, scrollY,
- getScrollRange(), OVERSCROLL_FUZZY_THRESHOLD, OVERSCROLL_SCALE_FACTOR, isTouchEvent);
-
- return returnValue;
- }
-
- private int getScrollRange() {
- return (int) Math.max(0, Math.floor(mRefreshableView.getContentHeight() * mRefreshableView.getScale())
- - (getHeight() - getPaddingBottom() - getPaddingTop()));
- }
- }
-}
diff --git a/core/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/extras/PullToRefreshWebView2.java b/core/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/extras/PullToRefreshWebView2.java
deleted file mode 100644
index 78192037..00000000
--- a/core/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/extras/PullToRefreshWebView2.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * Copyright 2011, 2012 Chris Banes.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *******************************************************************************/
-package com.handmark.pulltorefresh.library.extras;
-
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import android.content.Context;
-import android.util.AttributeSet;
-import android.webkit.WebView;
-
-import com.handmark.pulltorefresh.library.PullToRefreshWebView;
-
-/**
- * An advanced version of {@link PullToRefreshWebView} which delegates the
- * triggering of the PullToRefresh gesture to the Javascript running within the
- * WebView. This means that you should only use this class if:
- *
- *
- * - {@link PullToRefreshWebView} doesn't work correctly because you're using
- *
overflow:scroll
or something else which means
- * {@link WebView#getScrollY()} doesn't return correct values.
- * - You control the web content being displayed, as you need to write some
- * Javascript callbacks.
- *
- *
- *
- * The way this call works is that when a PullToRefresh gesture is in action,
- * the following Javascript methods will be called:
- * isReadyForPullDown()
and isReadyForPullUp()
, it is
- * your job to calculate whether the view is in a state where a PullToRefresh
- * can happen, and return the result via the callback mechanism. An example can
- * be seen below:
- *
- *
- *
- * function isReadyForPullDown() {
- * var result = ... // Probably using the .scrollTop DOM attribute
- * ptr.isReadyForPullDownResponse(result);
- * }
- *
- * function isReadyForPullUp() {
- * var result = ... // Probably using the .scrollBottom DOM attribute
- * ptr.isReadyForPullUpResponse(result);
- * }
- *
- *
- * @author Chris Banes
- */
-public class PullToRefreshWebView2 extends PullToRefreshWebView {
-
- static final String JS_INTERFACE_PKG = "ptr";
- static final String DEF_JS_READY_PULL_DOWN_CALL = "javascript:isReadyForPullDown();";
- static final String DEF_JS_READY_PULL_UP_CALL = "javascript:isReadyForPullUp();";
-
- public PullToRefreshWebView2(Context context) {
- super(context);
- }
-
- public PullToRefreshWebView2(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- public PullToRefreshWebView2(Context context, Mode mode) {
- super(context, mode);
- }
-
- private JsValueCallback mJsCallback;
- private final AtomicBoolean mIsReadyForPullDown = new AtomicBoolean(false);
- private final AtomicBoolean mIsReadyForPullUp = new AtomicBoolean(false);
-
- @Override
- protected WebView createRefreshableView(Context context, AttributeSet attrs) {
- WebView webView = super.createRefreshableView(context, attrs);
-
- // Need to add JS Interface so we can get the response back
- mJsCallback = new JsValueCallback();
- webView.addJavascriptInterface(mJsCallback, JS_INTERFACE_PKG);
-
- return webView;
- }
-
- @Override
- protected boolean isReadyForPullStart() {
- // Call Javascript...
- getRefreshableView().loadUrl(DEF_JS_READY_PULL_DOWN_CALL);
-
- // Response will be given to JsValueCallback, which will update
- // mIsReadyForPullDown
-
- return mIsReadyForPullDown.get();
- }
-
- @Override
- protected boolean isReadyForPullEnd() {
- // Call Javascript...
- getRefreshableView().loadUrl(DEF_JS_READY_PULL_UP_CALL);
-
- // Response will be given to JsValueCallback, which will update
- // mIsReadyForPullUp
-
- return mIsReadyForPullUp.get();
- }
-
- /**
- * Used for response from Javascript
- *
- * @author Chris Banes
- */
- final class JsValueCallback {
-
- public void isReadyForPullUpResponse(boolean response) {
- mIsReadyForPullUp.set(response);
- }
-
- public void isReadyForPullDownResponse(boolean response) {
- mIsReadyForPullDown.set(response);
- }
- }
-}
diff --git a/core/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/extras/SoundPullEventListener.java b/core/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/extras/SoundPullEventListener.java
deleted file mode 100644
index a7aac306..00000000
--- a/core/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/extras/SoundPullEventListener.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright 2011, 2012 Chris Banes.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *******************************************************************************/
-package com.handmark.pulltorefresh.library.extras;
-
-import java.util.HashMap;
-
-import android.content.Context;
-import android.media.MediaPlayer;
-import android.view.View;
-
-import com.handmark.pulltorefresh.library.PullToRefreshBase;
-import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode;
-import com.handmark.pulltorefresh.library.PullToRefreshBase.State;
-
-public class SoundPullEventListener implements PullToRefreshBase.OnPullEventListener {
-
- private final Context mContext;
- private final HashMap mSoundMap;
-
- private MediaPlayer mCurrentMediaPlayer;
-
- /**
- * Constructor
- *
- * @param context - Context
- */
- public SoundPullEventListener(Context context) {
- mContext = context;
- mSoundMap = new HashMap();
- }
-
- @Override
- public final void onPullEvent(PullToRefreshBase refreshView, State event, Mode direction) {
- Integer soundResIdObj = mSoundMap.get(event);
- if (null != soundResIdObj) {
- playSound(soundResIdObj.intValue());
- }
- }
-
- /**
- * Set the Sounds to be played when a Pull Event happens. You specify which
- * sound plays for which events by calling this method multiple times for
- * each event.
- *
- * If you've already set a sound for a certain event, and add another sound
- * for that event, only the new sound will be played.
- *
- * @param event - The event for which the sound will be played.
- * @param resId - Resource Id of the sound file to be played (e.g.
- * R.raw.pull_sound)
- */
- public void addSoundEvent(State event, int resId) {
- mSoundMap.put(event, resId);
- }
-
- /**
- * Clears all of the previously set sounds and events.
- */
- public void clearSounds() {
- mSoundMap.clear();
- }
-
- /**
- * Gets the current (or last) MediaPlayer instance.
- */
- public MediaPlayer getCurrentMediaPlayer() {
- return mCurrentMediaPlayer;
- }
-
- private void playSound(int resId) {
- // Stop current player, if there's one playing
- if (null != mCurrentMediaPlayer) {
- mCurrentMediaPlayer.stop();
- mCurrentMediaPlayer.release();
- }
-
- mCurrentMediaPlayer = MediaPlayer.create(mContext, resId);
- if (null != mCurrentMediaPlayer) {
- mCurrentMediaPlayer.start();
- }
- }
-
-}
diff --git a/core/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/internal/EmptyViewMethodAccessor.java b/core/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/internal/EmptyViewMethodAccessor.java
deleted file mode 100644
index 369f21e8..00000000
--- a/core/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/internal/EmptyViewMethodAccessor.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright 2011, 2012 Chris Banes.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *******************************************************************************/
-package com.handmark.pulltorefresh.library.internal;
-
-import android.view.View;
-
-/**
- * Interface that allows PullToRefreshBase to hijack the call to
- * AdapterView.setEmptyView()
- *
- * @author chris
- */
-public interface EmptyViewMethodAccessor {
-
- /**
- * Calls upto AdapterView.setEmptyView()
- *
- * @param emptyView - to set as Empty View
- */
- public void setEmptyViewInternal(View emptyView);
-
- /**
- * Should call PullToRefreshBase.setEmptyView() which will then
- * automatically call through to setEmptyViewInternal()
- *
- * @param emptyView - to set as Empty View
- */
- public void setEmptyView(View emptyView);
-
-}
diff --git a/core/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/internal/FlipLoadingLayout.java b/core/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/internal/FlipLoadingLayout.java
deleted file mode 100644
index fef31605..00000000
--- a/core/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/internal/FlipLoadingLayout.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*******************************************************************************
- * Copyright 2011, 2012 Chris Banes.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *******************************************************************************/
-package com.handmark.pulltorefresh.library.internal;
-
-import android.annotation.SuppressLint;
-import android.content.Context;
-import android.content.res.TypedArray;
-import android.graphics.Matrix;
-import android.graphics.drawable.Drawable;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.animation.Animation;
-import android.view.animation.RotateAnimation;
-import android.widget.ImageView.ScaleType;
-
-import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode;
-import com.handmark.pulltorefresh.library.PullToRefreshBase.Orientation;
-import com.handmark.pulltorefresh.library.R;
-
-@SuppressLint("ViewConstructor")
-public class FlipLoadingLayout extends LoadingLayout {
-
- static final int FLIP_ANIMATION_DURATION = 150;
-
- private final Animation mRotateAnimation, mResetRotateAnimation;
-
- public FlipLoadingLayout(Context context, final Mode mode, final Orientation scrollDirection, TypedArray attrs) {
- super(context, mode, scrollDirection, attrs);
-
- final int rotateAngle = mode == Mode.PULL_FROM_START ? -180 : 180;
-
- mRotateAnimation = new RotateAnimation(0, rotateAngle, Animation.RELATIVE_TO_SELF, 0.5f,
- Animation.RELATIVE_TO_SELF, 0.5f);
- mRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
- mRotateAnimation.setDuration(FLIP_ANIMATION_DURATION);
- mRotateAnimation.setFillAfter(true);
-
- mResetRotateAnimation = new RotateAnimation(rotateAngle, 0, Animation.RELATIVE_TO_SELF, 0.5f,
- Animation.RELATIVE_TO_SELF, 0.5f);
- mResetRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
- mResetRotateAnimation.setDuration(FLIP_ANIMATION_DURATION);
- mResetRotateAnimation.setFillAfter(true);
- }
-
- @Override
- protected void onLoadingDrawableSet(Drawable imageDrawable) {
- if (null != imageDrawable) {
- final int dHeight = imageDrawable.getIntrinsicHeight();
- final int dWidth = imageDrawable.getIntrinsicWidth();
-
- /**
- * We need to set the width/height of the ImageView so that it is
- * square with each side the size of the largest drawable dimension.
- * This is so that it doesn't clip when rotated.
- */
- ViewGroup.LayoutParams lp = mHeaderImage.getLayoutParams();
- lp.width = lp.height = Math.max(dHeight, dWidth);
- mHeaderImage.requestLayout();
-
- /**
- * We now rotate the Drawable so that is at the correct rotation,
- * and is centered.
- */
- mHeaderImage.setScaleType(ScaleType.MATRIX);
- Matrix matrix = new Matrix();
- matrix.postTranslate((lp.width - dWidth) / 2f, (lp.height - dHeight) / 2f);
- matrix.postRotate(getDrawableRotationAngle(), lp.width / 2f, lp.height / 2f);
- mHeaderImage.setImageMatrix(matrix);
- }
- }
-
- @Override
- protected void onPullImpl(float scaleOfLayout) {
- // NO-OP
- }
-
- @Override
- protected void pullToRefreshImpl() {
- // Only start reset Animation, we've previously show the rotate anim
- if (mRotateAnimation == mHeaderImage.getAnimation()) {
- mHeaderImage.startAnimation(mResetRotateAnimation);
- }
- }
-
- @Override
- protected void refreshingImpl() {
- mHeaderImage.clearAnimation();
- mHeaderImage.setVisibility(View.INVISIBLE);
- mHeaderProgress.setVisibility(View.VISIBLE);
- }
-
- @Override
- protected void releaseToRefreshImpl() {
- mHeaderImage.startAnimation(mRotateAnimation);
- }
-
- @Override
- protected void resetImpl() {
- mHeaderImage.clearAnimation();
- mHeaderProgress.setVisibility(View.GONE);
- mHeaderImage.setVisibility(View.VISIBLE);
- }
-
- @Override
- protected int getDefaultDrawableResId() {
- return R.drawable.default_ptr_flip;
- }
-
- private float getDrawableRotationAngle() {
- float angle = 0f;
- switch (mMode) {
- case PULL_FROM_END:
- if (mScrollDirection == Orientation.HORIZONTAL) {
- angle = 90f;
- } else {
- angle = 180f;
- }
- break;
-
- case PULL_FROM_START:
- if (mScrollDirection == Orientation.HORIZONTAL) {
- angle = 270f;
- }
- break;
-
- default:
- break;
- }
-
- return angle;
- }
-
-}
diff --git a/core/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/internal/IndicatorLayout.java b/core/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/internal/IndicatorLayout.java
deleted file mode 100644
index a9069f2a..00000000
--- a/core/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/internal/IndicatorLayout.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright 2011, 2012 Chris Banes.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *******************************************************************************/
-package com.handmark.pulltorefresh.library.internal;
-
-import android.annotation.SuppressLint;
-import android.content.Context;
-import android.graphics.Matrix;
-import android.graphics.drawable.Drawable;
-import android.view.View;
-import android.view.animation.Animation;
-import android.view.animation.Animation.AnimationListener;
-import android.view.animation.AnimationUtils;
-import android.view.animation.Interpolator;
-import android.view.animation.LinearInterpolator;
-import android.view.animation.RotateAnimation;
-import android.widget.FrameLayout;
-import android.widget.ImageView;
-import android.widget.ImageView.ScaleType;
-
-import com.handmark.pulltorefresh.library.PullToRefreshBase;
-import com.handmark.pulltorefresh.library.R;
-
-@SuppressLint("ViewConstructor")
-public class IndicatorLayout extends FrameLayout implements AnimationListener {
-
- static final int DEFAULT_ROTATION_ANIMATION_DURATION = 150;
-
- private Animation mInAnim, mOutAnim;
- private ImageView mArrowImageView;
-
- private final Animation mRotateAnimation, mResetRotateAnimation;
-
- public IndicatorLayout(Context context, PullToRefreshBase.Mode mode) {
- super(context);
- mArrowImageView = new ImageView(context);
-
- Drawable arrowD = getResources().getDrawable(R.drawable.indicator_arrow);
- mArrowImageView.setImageDrawable(arrowD);
-
- final int padding = getResources().getDimensionPixelSize(R.dimen.indicator_internal_padding);
- mArrowImageView.setPadding(padding, padding, padding, padding);
- addView(mArrowImageView);
-
- int inAnimResId, outAnimResId;
- switch (mode) {
- case PULL_FROM_END:
- inAnimResId = R.anim.slide_in_from_bottom;
- outAnimResId = R.anim.slide_out_to_bottom;
- setBackgroundResource(R.drawable.indicator_bg_bottom);
-
- // Rotate Arrow so it's pointing the correct way
- mArrowImageView.setScaleType(ScaleType.MATRIX);
- Matrix matrix = new Matrix();
- matrix.setRotate(180f, arrowD.getIntrinsicWidth() / 2f, arrowD.getIntrinsicHeight() / 2f);
- mArrowImageView.setImageMatrix(matrix);
- break;
- default:
- case PULL_FROM_START:
- inAnimResId = R.anim.slide_in_from_top;
- outAnimResId = R.anim.slide_out_to_top;
- setBackgroundResource(R.drawable.indicator_bg_top);
- break;
- }
-
- mInAnim = AnimationUtils.loadAnimation(context, inAnimResId);
- mInAnim.setAnimationListener(this);
-
- mOutAnim = AnimationUtils.loadAnimation(context, outAnimResId);
- mOutAnim.setAnimationListener(this);
-
- final Interpolator interpolator = new LinearInterpolator();
- mRotateAnimation = new RotateAnimation(0, -180, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
- 0.5f);
- mRotateAnimation.setInterpolator(interpolator);
- mRotateAnimation.setDuration(DEFAULT_ROTATION_ANIMATION_DURATION);
- mRotateAnimation.setFillAfter(true);
-
- mResetRotateAnimation = new RotateAnimation(-180, 0, Animation.RELATIVE_TO_SELF, 0.5f,
- Animation.RELATIVE_TO_SELF, 0.5f);
- mResetRotateAnimation.setInterpolator(interpolator);
- mResetRotateAnimation.setDuration(DEFAULT_ROTATION_ANIMATION_DURATION);
- mResetRotateAnimation.setFillAfter(true);
-
- }
-
- public final boolean isVisible() {
- Animation currentAnim = getAnimation();
- if (null != currentAnim) {
- return mInAnim == currentAnim;
- }
-
- return getVisibility() == View.VISIBLE;
- }
-
- public void hide() {
- startAnimation(mOutAnim);
- }
-
- public void show() {
- mArrowImageView.clearAnimation();
- startAnimation(mInAnim);
- }
-
- @Override
- public void onAnimationEnd(Animation animation) {
- if (animation == mOutAnim) {
- mArrowImageView.clearAnimation();
- setVisibility(View.GONE);
- } else if (animation == mInAnim) {
- setVisibility(View.VISIBLE);
- }
-
- clearAnimation();
- }
-
- @Override
- public void onAnimationRepeat(Animation animation) {
- // NO-OP
- }
-
- @Override
- public void onAnimationStart(Animation animation) {
- setVisibility(View.VISIBLE);
- }
-
- public void releaseToRefresh() {
- mArrowImageView.startAnimation(mRotateAnimation);
- }
-
- public void pullToRefresh() {
- mArrowImageView.startAnimation(mResetRotateAnimation);
- }
-
-}
diff --git a/core/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/internal/LoadingLayout.java b/core/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/internal/LoadingLayout.java
deleted file mode 100644
index 9c12586d..00000000
--- a/core/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/internal/LoadingLayout.java
+++ /dev/null
@@ -1,393 +0,0 @@
-/*******************************************************************************
- * Copyright 2011, 2012 Chris Banes.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *******************************************************************************/
-package com.handmark.pulltorefresh.library.internal;
-
-import android.annotation.SuppressLint;
-import android.content.Context;
-import android.content.res.ColorStateList;
-import android.content.res.TypedArray;
-import android.graphics.Typeface;
-import android.graphics.drawable.AnimationDrawable;
-import android.graphics.drawable.Drawable;
-import android.text.TextUtils;
-import android.util.TypedValue;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.animation.Interpolator;
-import android.view.animation.LinearInterpolator;
-import android.widget.FrameLayout;
-import android.widget.ImageView;
-import android.widget.ProgressBar;
-import android.widget.TextView;
-
-import com.handmark.pulltorefresh.library.ILoadingLayout;
-import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode;
-import com.handmark.pulltorefresh.library.PullToRefreshBase.Orientation;
-import com.handmark.pulltorefresh.library.R;
-
-@SuppressLint("ViewConstructor")
-public abstract class LoadingLayout extends FrameLayout implements ILoadingLayout {
-
- static final String LOG_TAG = "PullToRefresh-LoadingLayout";
-
- static final Interpolator ANIMATION_INTERPOLATOR = new LinearInterpolator();
-
- private FrameLayout mInnerLayout;
-
- protected final ImageView mHeaderImage;
- protected final ProgressBar mHeaderProgress;
-
- private boolean mUseIntrinsicAnimation;
-
- private final TextView mHeaderText;
- private final TextView mSubHeaderText;
-
- protected final Mode mMode;
- protected final Orientation mScrollDirection;
-
- private CharSequence mPullLabel;
- private CharSequence mRefreshingLabel;
- private CharSequence mReleaseLabel;
-
- public LoadingLayout(Context context, final Mode mode, final Orientation scrollDirection, TypedArray attrs) {
- super(context);
- mMode = mode;
- mScrollDirection = scrollDirection;
-
- switch (scrollDirection) {
- case HORIZONTAL:
- LayoutInflater.from(context).inflate(R.layout.pull_to_refresh_header_horizontal, this);
- break;
- case VERTICAL:
- default:
- LayoutInflater.from(context).inflate(R.layout.pull_to_refresh_header_vertical, this);
- break;
- }
-
- mInnerLayout = (FrameLayout) findViewById(R.id.fl_inner);
- mHeaderText = (TextView) mInnerLayout.findViewById(R.id.pull_to_refresh_text);
- mHeaderProgress = (ProgressBar) mInnerLayout.findViewById(R.id.pull_to_refresh_progress);
- mSubHeaderText = (TextView) mInnerLayout.findViewById(R.id.pull_to_refresh_sub_text);
- mHeaderImage = (ImageView) mInnerLayout.findViewById(R.id.pull_to_refresh_image);
-
- FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mInnerLayout.getLayoutParams();
-
- switch (mode) {
- case PULL_FROM_END:
- lp.gravity = scrollDirection == Orientation.VERTICAL ? Gravity.TOP : Gravity.LEFT;
-
- // Load in labels
- mPullLabel = context.getString(R.string.pull_to_refresh_from_bottom_pull_label);
- mRefreshingLabel = context.getString(R.string.pull_to_refresh_from_bottom_refreshing_label);
- mReleaseLabel = context.getString(R.string.pull_to_refresh_from_bottom_release_label);
- break;
-
- case PULL_FROM_START:
- default:
- lp.gravity = scrollDirection == Orientation.VERTICAL ? Gravity.BOTTOM : Gravity.RIGHT;
-
- // Load in labels
- mPullLabel = context.getString(R.string.pull_to_refresh_pull_label);
- mRefreshingLabel = context.getString(R.string.pull_to_refresh_refreshing_label);
- mReleaseLabel = context.getString(R.string.pull_to_refresh_release_label);
- break;
- }
-
- if (attrs.hasValue(R.styleable.PullToRefresh_ptrHeaderBackground)) {
- Drawable background = attrs.getDrawable(R.styleable.PullToRefresh_ptrHeaderBackground);
- if (null != background) {
- ViewCompat.setBackground(this, background);
- }
- }
-
- if (attrs.hasValue(R.styleable.PullToRefresh_ptrHeaderTextAppearance)) {
- TypedValue styleID = new TypedValue();
- attrs.getValue(R.styleable.PullToRefresh_ptrHeaderTextAppearance, styleID);
- setTextAppearance(styleID.data);
- }
- if (attrs.hasValue(R.styleable.PullToRefresh_ptrSubHeaderTextAppearance)) {
- TypedValue styleID = new TypedValue();
- attrs.getValue(R.styleable.PullToRefresh_ptrSubHeaderTextAppearance, styleID);
- setSubTextAppearance(styleID.data);
- }
-
- // Text Color attrs need to be set after TextAppearance attrs
- if (attrs.hasValue(R.styleable.PullToRefresh_ptrHeaderTextColor)) {
- ColorStateList colors = attrs.getColorStateList(R.styleable.PullToRefresh_ptrHeaderTextColor);
- if (null != colors) {
- setTextColor(colors);
- }
- }
- if (attrs.hasValue(R.styleable.PullToRefresh_ptrHeaderSubTextColor)) {
- ColorStateList colors = attrs.getColorStateList(R.styleable.PullToRefresh_ptrHeaderSubTextColor);
- if (null != colors) {
- setSubTextColor(colors);
- }
- }
-
- // Try and get defined drawable from Attrs
- Drawable imageDrawable = null;
- if (attrs.hasValue(R.styleable.PullToRefresh_ptrDrawable)) {
- imageDrawable = attrs.getDrawable(R.styleable.PullToRefresh_ptrDrawable);
- }
-
- // Check Specific Drawable from Attrs, these overrite the generic
- // drawable attr above
- switch (mode) {
- case PULL_FROM_START:
- default:
- if (attrs.hasValue(R.styleable.PullToRefresh_ptrDrawableStart)) {
- imageDrawable = attrs.getDrawable(R.styleable.PullToRefresh_ptrDrawableStart);
- } else if (attrs.hasValue(R.styleable.PullToRefresh_ptrDrawableTop)) {
- Utils.warnDeprecation("ptrDrawableTop", "ptrDrawableStart");
- imageDrawable = attrs.getDrawable(R.styleable.PullToRefresh_ptrDrawableTop);
- }
- break;
-
- case PULL_FROM_END:
- if (attrs.hasValue(R.styleable.PullToRefresh_ptrDrawableEnd)) {
- imageDrawable = attrs.getDrawable(R.styleable.PullToRefresh_ptrDrawableEnd);
- } else if (attrs.hasValue(R.styleable.PullToRefresh_ptrDrawableBottom)) {
- Utils.warnDeprecation("ptrDrawableBottom", "ptrDrawableEnd");
- imageDrawable = attrs.getDrawable(R.styleable.PullToRefresh_ptrDrawableBottom);
- }
- break;
- }
-
- // If we don't have a user defined drawable, load the default
- if (null == imageDrawable) {
- imageDrawable = context.getResources().getDrawable(getDefaultDrawableResId());
- }
-
- // Set Drawable, and save width/height
- setLoadingDrawable(imageDrawable);
-
- reset();
- }
-
- public final void setHeight(int height) {
- ViewGroup.LayoutParams lp = (ViewGroup.LayoutParams) getLayoutParams();
- lp.height = height;
- requestLayout();
- }
-
- public final void setWidth(int width) {
- ViewGroup.LayoutParams lp = (ViewGroup.LayoutParams) getLayoutParams();
- lp.width = width;
- requestLayout();
- }
-
- public final int getContentSize() {
- switch (mScrollDirection) {
- case HORIZONTAL:
- return mInnerLayout.getWidth();
- case VERTICAL:
- default:
- return mInnerLayout.getHeight();
- }
- }
-
- public final void hideAllViews() {
- if (View.VISIBLE == mHeaderText.getVisibility()) {
- mHeaderText.setVisibility(View.INVISIBLE);
- }
- if (View.VISIBLE == mHeaderProgress.getVisibility()) {
- mHeaderProgress.setVisibility(View.INVISIBLE);
- }
- if (View.VISIBLE == mHeaderImage.getVisibility()) {
- mHeaderImage.setVisibility(View.INVISIBLE);
- }
- if (View.VISIBLE == mSubHeaderText.getVisibility()) {
- mSubHeaderText.setVisibility(View.INVISIBLE);
- }
- }
-
- public final void onPull(float scaleOfLayout) {
- if (!mUseIntrinsicAnimation) {
- onPullImpl(scaleOfLayout);
- }
- }
-
- public final void pullToRefresh() {
- if (null != mHeaderText) {
- mHeaderText.setText(mPullLabel);
- }
-
- // Now call the callback
- pullToRefreshImpl();
- }
-
- public final void refreshing() {
- if (null != mHeaderText) {
- mHeaderText.setText(mRefreshingLabel);
- }
-
- if (mUseIntrinsicAnimation) {
- ((AnimationDrawable) mHeaderImage.getDrawable()).start();
- } else {
- // Now call the callback
- refreshingImpl();
- }
-
- if (null != mSubHeaderText) {
- mSubHeaderText.setVisibility(View.GONE);
- }
- }
-
- public final void releaseToRefresh() {
- if (null != mHeaderText) {
- mHeaderText.setText(mReleaseLabel);
- }
-
- // Now call the callback
- releaseToRefreshImpl();
- }
-
- public final void reset() {
- if (null != mHeaderText) {
- mHeaderText.setText(mPullLabel);
- }
- mHeaderImage.setVisibility(View.VISIBLE);
-
- if (mUseIntrinsicAnimation) {
- ((AnimationDrawable) mHeaderImage.getDrawable()).stop();
- } else {
- // Now call the callback
- resetImpl();
- }
-
- if (null != mSubHeaderText) {
- if (TextUtils.isEmpty(mSubHeaderText.getText())) {
- mSubHeaderText.setVisibility(View.GONE);
- } else {
- mSubHeaderText.setVisibility(View.VISIBLE);
- }
- }
- }
-
- @Override
- public void setLastUpdatedLabel(CharSequence label) {
- setSubHeaderText(label);
- }
-
- public final void setLoadingDrawable(Drawable imageDrawable) {
- // Set Drawable
- mHeaderImage.setImageDrawable(imageDrawable);
- mUseIntrinsicAnimation = (imageDrawable instanceof AnimationDrawable);
-
- // Now call the callback
- onLoadingDrawableSet(imageDrawable);
- }
-
- public void setPullLabel(CharSequence pullLabel) {
- mPullLabel = pullLabel;
- }
-
- public void setRefreshingLabel(CharSequence refreshingLabel) {
- mRefreshingLabel = refreshingLabel;
- }
-
- public void setReleaseLabel(CharSequence releaseLabel) {
- mReleaseLabel = releaseLabel;
- }
-
- @Override
- public void setTextTypeface(Typeface tf) {
- mHeaderText.setTypeface(tf);
- }
-
- public final void showInvisibleViews() {
- if (View.INVISIBLE == mHeaderText.getVisibility()) {
- mHeaderText.setVisibility(View.VISIBLE);
- }
- if (View.INVISIBLE == mHeaderProgress.getVisibility()) {
- mHeaderProgress.setVisibility(View.VISIBLE);
- }
- if (View.INVISIBLE == mHeaderImage.getVisibility()) {
- mHeaderImage.setVisibility(View.VISIBLE);
- }
- if (View.INVISIBLE == mSubHeaderText.getVisibility()) {
- mSubHeaderText.setVisibility(View.VISIBLE);
- }
- }
-
- /**
- * Callbacks for derivative Layouts
- */
-
- protected abstract int getDefaultDrawableResId();
-
- protected abstract void onLoadingDrawableSet(Drawable imageDrawable);
-
- protected abstract void onPullImpl(float scaleOfLayout);
-
- protected abstract void pullToRefreshImpl();
-
- protected abstract void refreshingImpl();
-
- protected abstract void releaseToRefreshImpl();
-
- protected abstract void resetImpl();
-
- private void setSubHeaderText(CharSequence label) {
- if (null != mSubHeaderText) {
- if (TextUtils.isEmpty(label)) {
- mSubHeaderText.setVisibility(View.GONE);
- } else {
- mSubHeaderText.setText(label);
-
- // Only set it to Visible if we're GONE, otherwise VISIBLE will
- // be set soon
- if (View.GONE == mSubHeaderText.getVisibility()) {
- mSubHeaderText.setVisibility(View.VISIBLE);
- }
- }
- }
- }
-
- private void setSubTextAppearance(int value) {
- if (null != mSubHeaderText) {
- mSubHeaderText.setTextAppearance(getContext(), value);
- }
- }
-
- private void setSubTextColor(ColorStateList color) {
- if (null != mSubHeaderText) {
- mSubHeaderText.setTextColor(color);
- }
- }
-
- private void setTextAppearance(int value) {
- if (null != mHeaderText) {
- mHeaderText.setTextAppearance(getContext(), value);
- }
- if (null != mSubHeaderText) {
- mSubHeaderText.setTextAppearance(getContext(), value);
- }
- }
-
- private void setTextColor(ColorStateList color) {
- if (null != mHeaderText) {
- mHeaderText.setTextColor(color);
- }
- if (null != mSubHeaderText) {
- mSubHeaderText.setTextColor(color);
- }
- }
-
-}
diff --git a/core/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/internal/RotateLoadingLayout.java b/core/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/internal/RotateLoadingLayout.java
deleted file mode 100644
index bda7b2fc..00000000
--- a/core/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/internal/RotateLoadingLayout.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright 2011, 2012 Chris Banes.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *******************************************************************************/
-package com.handmark.pulltorefresh.library.internal;
-
-import android.content.Context;
-import android.content.res.TypedArray;
-import android.graphics.Matrix;
-import android.graphics.drawable.Drawable;
-import android.view.animation.Animation;
-import android.view.animation.RotateAnimation;
-import android.widget.ImageView.ScaleType;
-
-import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode;
-import com.handmark.pulltorefresh.library.PullToRefreshBase.Orientation;
-import com.handmark.pulltorefresh.library.R;
-
-public class RotateLoadingLayout extends LoadingLayout {
-
- static final int ROTATION_ANIMATION_DURATION = 1200;
-
- private final Animation mRotateAnimation;
- private final Matrix mHeaderImageMatrix;
-
- private float mRotationPivotX, mRotationPivotY;
-
- private final boolean mRotateDrawableWhilePulling;
-
- public RotateLoadingLayout(Context context, Mode mode, Orientation scrollDirection, TypedArray attrs) {
- super(context, mode, scrollDirection, attrs);
-
- mRotateDrawableWhilePulling = attrs.getBoolean(R.styleable.PullToRefresh_ptrRotateDrawableWhilePulling, true);
-
- mHeaderImage.setScaleType(ScaleType.MATRIX);
- mHeaderImageMatrix = new Matrix();
- mHeaderImage.setImageMatrix(mHeaderImageMatrix);
-
- mRotateAnimation = new RotateAnimation(0, 720, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
- 0.5f);
- mRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
- mRotateAnimation.setDuration(ROTATION_ANIMATION_DURATION);
- mRotateAnimation.setRepeatCount(Animation.INFINITE);
- mRotateAnimation.setRepeatMode(Animation.RESTART);
- }
-
- public void onLoadingDrawableSet(Drawable imageDrawable) {
- if (null != imageDrawable) {
- mRotationPivotX = Math.round(imageDrawable.getIntrinsicWidth() / 2f);
- mRotationPivotY = Math.round(imageDrawable.getIntrinsicHeight() / 2f);
- }
- }
-
- protected void onPullImpl(float scaleOfLayout) {
- float angle;
- if (mRotateDrawableWhilePulling) {
- angle = scaleOfLayout * 90f;
- } else {
- angle = Math.max(0f, Math.min(180f, scaleOfLayout * 360f - 180f));
- }
-
- mHeaderImageMatrix.setRotate(angle, mRotationPivotX, mRotationPivotY);
- mHeaderImage.setImageMatrix(mHeaderImageMatrix);
- }
-
- @Override
- protected void refreshingImpl() {
- mHeaderImage.startAnimation(mRotateAnimation);
- }
-
- @Override
- protected void resetImpl() {
- mHeaderImage.clearAnimation();
- resetImageRotation();
- }
-
- private void resetImageRotation() {
- if (null != mHeaderImageMatrix) {
- mHeaderImageMatrix.reset();
- mHeaderImage.setImageMatrix(mHeaderImageMatrix);
- }
- }
-
- @Override
- protected void pullToRefreshImpl() {
- // NO-OP
- }
-
- @Override
- protected void releaseToRefreshImpl() {
- // NO-OP
- }
-
- @Override
- protected int getDefaultDrawableResId() {
- return R.drawable.default_ptr_rotate;
- }
-
-}
diff --git a/core/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/internal/Utils.java b/core/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/internal/Utils.java
deleted file mode 100644
index 73432189..00000000
--- a/core/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/internal/Utils.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.handmark.pulltorefresh.library.internal;
-
-import android.util.Log;
-
-public class Utils {
-
- static final String LOG_TAG = "PullToRefresh";
-
- public static void warnDeprecation(String depreacted, String replacement) {
- Log.w(LOG_TAG, "You're using the deprecated " + depreacted + " attr, please switch over to " + replacement);
- }
-
-}
diff --git a/core/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/internal/ViewCompat.java b/core/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/internal/ViewCompat.java
deleted file mode 100644
index 618bace0..00000000
--- a/core/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/internal/ViewCompat.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright 2011, 2012 Chris Banes.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *******************************************************************************/
-package com.handmark.pulltorefresh.library.internal;
-
-import android.annotation.TargetApi;
-import android.graphics.drawable.Drawable;
-import android.os.Build.VERSION;
-import android.os.Build.VERSION_CODES;
-import android.view.View;
-
-@SuppressWarnings("deprecation")
-public class ViewCompat {
-
- public static void postOnAnimation(View view, Runnable runnable) {
- if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) {
- SDK16.postOnAnimation(view, runnable);
- } else {
- view.postDelayed(runnable, 16);
- }
- }
-
- public static void setBackground(View view, Drawable background) {
- if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) {
- SDK16.setBackground(view, background);
- } else {
- view.setBackgroundDrawable(background);
- }
- }
-
- public static void setLayerType(View view, int layerType) {
- if (VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB) {
- SDK11.setLayerType(view, layerType);
- }
- }
-
- @TargetApi(11)
- static class SDK11 {
-
- public static void setLayerType(View view, int layerType) {
- view.setLayerType(layerType, null);
- }
- }
-
- @TargetApi(16)
- static class SDK16 {
-
- public static void postOnAnimation(View view, Runnable runnable) {
- view.postOnAnimation(runnable);
- }
-
- public static void setBackground(View view, Drawable background) {
- view.setBackground(background);
- }
-
- }
-
-}
diff --git a/core/pulltorefresh/src/main/res/anim/slide_in_from_bottom.xml b/core/pulltorefresh/src/main/res/anim/slide_in_from_bottom.xml
deleted file mode 100644
index bb430ce9..00000000
--- a/core/pulltorefresh/src/main/res/anim/slide_in_from_bottom.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
diff --git a/core/pulltorefresh/src/main/res/anim/slide_in_from_top.xml b/core/pulltorefresh/src/main/res/anim/slide_in_from_top.xml
deleted file mode 100644
index 52d91afc..00000000
--- a/core/pulltorefresh/src/main/res/anim/slide_in_from_top.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
diff --git a/core/pulltorefresh/src/main/res/anim/slide_out_to_bottom.xml b/core/pulltorefresh/src/main/res/anim/slide_out_to_bottom.xml
deleted file mode 100644
index 83eca5ad..00000000
--- a/core/pulltorefresh/src/main/res/anim/slide_out_to_bottom.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
diff --git a/core/pulltorefresh/src/main/res/anim/slide_out_to_top.xml b/core/pulltorefresh/src/main/res/anim/slide_out_to_top.xml
deleted file mode 100644
index 5105ae1f..00000000
--- a/core/pulltorefresh/src/main/res/anim/slide_out_to_top.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
diff --git a/core/pulltorefresh/src/main/res/drawable-hdpi/default_ptr_flip.png b/core/pulltorefresh/src/main/res/drawable-hdpi/default_ptr_flip.png
deleted file mode 100644
index 0a2c0bd9..00000000
Binary files a/core/pulltorefresh/src/main/res/drawable-hdpi/default_ptr_flip.png and /dev/null differ
diff --git a/core/pulltorefresh/src/main/res/drawable-hdpi/default_ptr_rotate.png b/core/pulltorefresh/src/main/res/drawable-hdpi/default_ptr_rotate.png
deleted file mode 100644
index dc641b72..00000000
Binary files a/core/pulltorefresh/src/main/res/drawable-hdpi/default_ptr_rotate.png and /dev/null differ
diff --git a/core/pulltorefresh/src/main/res/drawable-hdpi/indicator_arrow.png b/core/pulltorefresh/src/main/res/drawable-hdpi/indicator_arrow.png
deleted file mode 100644
index 8ae79770..00000000
Binary files a/core/pulltorefresh/src/main/res/drawable-hdpi/indicator_arrow.png and /dev/null differ
diff --git a/core/pulltorefresh/src/main/res/drawable-mdpi/default_ptr_flip.png b/core/pulltorefresh/src/main/res/drawable-mdpi/default_ptr_flip.png
deleted file mode 100644
index be696c1c..00000000
Binary files a/core/pulltorefresh/src/main/res/drawable-mdpi/default_ptr_flip.png and /dev/null differ
diff --git a/core/pulltorefresh/src/main/res/drawable-mdpi/default_ptr_rotate.png b/core/pulltorefresh/src/main/res/drawable-mdpi/default_ptr_rotate.png
deleted file mode 100644
index 95b22bd7..00000000
Binary files a/core/pulltorefresh/src/main/res/drawable-mdpi/default_ptr_rotate.png and /dev/null differ
diff --git a/core/pulltorefresh/src/main/res/drawable-mdpi/indicator_arrow.png b/core/pulltorefresh/src/main/res/drawable-mdpi/indicator_arrow.png
deleted file mode 100644
index 20fe2c12..00000000
Binary files a/core/pulltorefresh/src/main/res/drawable-mdpi/indicator_arrow.png and /dev/null differ
diff --git a/core/pulltorefresh/src/main/res/drawable-xhdpi/default_ptr_flip.png b/core/pulltorefresh/src/main/res/drawable-xhdpi/default_ptr_flip.png
deleted file mode 100644
index 3e6ddba5..00000000
Binary files a/core/pulltorefresh/src/main/res/drawable-xhdpi/default_ptr_flip.png and /dev/null differ
diff --git a/core/pulltorefresh/src/main/res/drawable-xhdpi/default_ptr_rotate.png b/core/pulltorefresh/src/main/res/drawable-xhdpi/default_ptr_rotate.png
deleted file mode 100644
index 00225c9a..00000000
Binary files a/core/pulltorefresh/src/main/res/drawable-xhdpi/default_ptr_rotate.png and /dev/null differ
diff --git a/core/pulltorefresh/src/main/res/drawable-xhdpi/indicator_arrow.png b/core/pulltorefresh/src/main/res/drawable-xhdpi/indicator_arrow.png
deleted file mode 100644
index 810ff595..00000000
Binary files a/core/pulltorefresh/src/main/res/drawable-xhdpi/indicator_arrow.png and /dev/null differ
diff --git a/core/pulltorefresh/src/main/res/drawable/indicator_bg_bottom.xml b/core/pulltorefresh/src/main/res/drawable/indicator_bg_bottom.xml
deleted file mode 100644
index 81a91aa6..00000000
--- a/core/pulltorefresh/src/main/res/drawable/indicator_bg_bottom.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/core/pulltorefresh/src/main/res/drawable/indicator_bg_top.xml b/core/pulltorefresh/src/main/res/drawable/indicator_bg_top.xml
deleted file mode 100644
index 59fa9cfe..00000000
--- a/core/pulltorefresh/src/main/res/drawable/indicator_bg_top.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/core/pulltorefresh/src/main/res/layout/pull_to_refresh_header_horizontal.xml b/core/pulltorefresh/src/main/res/layout/pull_to_refresh_header_horizontal.xml
deleted file mode 100644
index f05bb033..00000000
--- a/core/pulltorefresh/src/main/res/layout/pull_to_refresh_header_horizontal.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/core/pulltorefresh/src/main/res/layout/pull_to_refresh_header_vertical.xml b/core/pulltorefresh/src/main/res/layout/pull_to_refresh_header_vertical.xml
deleted file mode 100644
index 2185e2d6..00000000
--- a/core/pulltorefresh/src/main/res/layout/pull_to_refresh_header_vertical.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/core/pulltorefresh/src/main/res/values-ar/pull_refresh_strings.xml b/core/pulltorefresh/src/main/res/values-ar/pull_refresh_strings.xml
deleted file mode 100644
index 25d5392d..00000000
--- a/core/pulltorefresh/src/main/res/values-ar/pull_refresh_strings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
- اسحب للتحديث…
- اترك للتحديث…
- تحميل…
-
diff --git a/core/pulltorefresh/src/main/res/values-cs/pull_refresh_strings.xml b/core/pulltorefresh/src/main/res/values-cs/pull_refresh_strings.xml
deleted file mode 100755
index c878da0c..00000000
--- a/core/pulltorefresh/src/main/res/values-cs/pull_refresh_strings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
- Tažením aktualizujete…
- Uvolněním aktualizujete…
- Načítání…
-
diff --git a/core/pulltorefresh/src/main/res/values-de/pull_refresh_strings.xml b/core/pulltorefresh/src/main/res/values-de/pull_refresh_strings.xml
deleted file mode 100755
index 901291bf..00000000
--- a/core/pulltorefresh/src/main/res/values-de/pull_refresh_strings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
- Ziehen zum Aktualisieren…
- Loslassen zum Aktualisieren…
- Laden…
-
diff --git a/core/pulltorefresh/src/main/res/values-es/pull_refresh_strings.xml b/core/pulltorefresh/src/main/res/values-es/pull_refresh_strings.xml
deleted file mode 100755
index 5e9d2803..00000000
--- a/core/pulltorefresh/src/main/res/values-es/pull_refresh_strings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
- Tirar para actualizar…
- Soltar para actualizar…
- Cargando…
-
diff --git a/core/pulltorefresh/src/main/res/values-fi/pull_refresh_strings.xml b/core/pulltorefresh/src/main/res/values-fi/pull_refresh_strings.xml
deleted file mode 100755
index 0381287b..00000000
--- a/core/pulltorefresh/src/main/res/values-fi/pull_refresh_strings.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
- Päivitä vetämällä alas…
- Päivitä vapauttamalla…
- Päivitetään…
-
-
- Päivitä vetämällä ylös…
- @string/pull_to_refresh_release_label
- @string/pull_to_refresh_refreshing_label
-
-
\ No newline at end of file
diff --git a/core/pulltorefresh/src/main/res/values-fr/pull_refresh_strings.xml b/core/pulltorefresh/src/main/res/values-fr/pull_refresh_strings.xml
deleted file mode 100755
index fb53ef8c..00000000
--- a/core/pulltorefresh/src/main/res/values-fr/pull_refresh_strings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
- Tirez pour rafraîchir…
- Relâcher pour rafraîchir…
- Chargement…
-
diff --git a/core/pulltorefresh/src/main/res/values-he/pull_refresh_strings.xml b/core/pulltorefresh/src/main/res/values-he/pull_refresh_strings.xml
deleted file mode 100644
index beedc1f6..00000000
--- a/core/pulltorefresh/src/main/res/values-he/pull_refresh_strings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
- משוך לרענון…
- שחרר לרענון…
- טוען…
-
diff --git a/core/pulltorefresh/src/main/res/values-it/pull_refresh_strings.xml b/core/pulltorefresh/src/main/res/values-it/pull_refresh_strings.xml
deleted file mode 100755
index 415fb9ed..00000000
--- a/core/pulltorefresh/src/main/res/values-it/pull_refresh_strings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
- Tira per aggiornare…
- Rilascia per aggionare…
- Caricamento…
-
diff --git a/core/pulltorefresh/src/main/res/values-iw/pull_refresh_strings.xml b/core/pulltorefresh/src/main/res/values-iw/pull_refresh_strings.xml
deleted file mode 100644
index beedc1f6..00000000
--- a/core/pulltorefresh/src/main/res/values-iw/pull_refresh_strings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
- משוך לרענון…
- שחרר לרענון…
- טוען…
-
diff --git a/core/pulltorefresh/src/main/res/values-ja/pull_refresh_strings.xml b/core/pulltorefresh/src/main/res/values-ja/pull_refresh_strings.xml
deleted file mode 100644
index d24842c9..00000000
--- a/core/pulltorefresh/src/main/res/values-ja/pull_refresh_strings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
- 画面を引っ張って…
- 指を離して更新…
- 読み込み中…
-
diff --git a/core/pulltorefresh/src/main/res/values-ko/pull_refresh_strings.xml b/core/pulltorefresh/src/main/res/values-ko/pull_refresh_strings.xml
deleted file mode 100755
index 53edd592..00000000
--- a/core/pulltorefresh/src/main/res/values-ko/pull_refresh_strings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
- 당겨서 새로 고침…
- 놓아서 새로 고침…
- 로드 중…
-
diff --git a/core/pulltorefresh/src/main/res/values-nl/pull_refresh_strings.xml b/core/pulltorefresh/src/main/res/values-nl/pull_refresh_strings.xml
deleted file mode 100755
index 4c063ed9..00000000
--- a/core/pulltorefresh/src/main/res/values-nl/pull_refresh_strings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
- Sleep om te vernieuwen…
- Loslaten om te vernieuwen…
- Laden…
-
diff --git a/core/pulltorefresh/src/main/res/values-pl/pull_refresh_strings.xml b/core/pulltorefresh/src/main/res/values-pl/pull_refresh_strings.xml
deleted file mode 100755
index 007255a2..00000000
--- a/core/pulltorefresh/src/main/res/values-pl/pull_refresh_strings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
- Pociągnij, aby odświeżyć…
- Puść, aby odświeżyć…
- Wczytywanie…
-
diff --git a/core/pulltorefresh/src/main/res/values-pt-rBR/pull_refresh_strings.xml b/core/pulltorefresh/src/main/res/values-pt-rBR/pull_refresh_strings.xml
deleted file mode 100755
index 0ec1ef7f..00000000
--- a/core/pulltorefresh/src/main/res/values-pt-rBR/pull_refresh_strings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
- Puxe para atualizar…
- Libere para atualizar…
- Carregando…
-
diff --git a/core/pulltorefresh/src/main/res/values-pt/pull_refresh_strings.xml b/core/pulltorefresh/src/main/res/values-pt/pull_refresh_strings.xml
deleted file mode 100755
index d08bc63b..00000000
--- a/core/pulltorefresh/src/main/res/values-pt/pull_refresh_strings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
- Puxe para atualizar…
- Liberação para atualizar…
- A carregar…
-
diff --git a/core/pulltorefresh/src/main/res/values-ro/pull_refresh_strings.xml b/core/pulltorefresh/src/main/res/values-ro/pull_refresh_strings.xml
deleted file mode 100644
index 87ddc941..00000000
--- a/core/pulltorefresh/src/main/res/values-ro/pull_refresh_strings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
- Trage pentru a reîmprospăta…
- Eliberează pentru a reîmprospăta…
- Încărcare…
-
diff --git a/core/pulltorefresh/src/main/res/values-ru/pull_refresh_strings.xml b/core/pulltorefresh/src/main/res/values-ru/pull_refresh_strings.xml
deleted file mode 100755
index 71ddcda7..00000000
--- a/core/pulltorefresh/src/main/res/values-ru/pull_refresh_strings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
- Потяните для обновления…
- Отпустите для обновления…
- Загрузка…
-
diff --git a/core/pulltorefresh/src/main/res/values-zh/pull_refresh_strings.xml b/core/pulltorefresh/src/main/res/values-zh/pull_refresh_strings.xml
deleted file mode 100755
index 08766e0b..00000000
--- a/core/pulltorefresh/src/main/res/values-zh/pull_refresh_strings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
- 下拉刷新…
- 放开以刷新…
- 正在载入…
-
diff --git a/core/pulltorefresh/src/main/res/values/attrs.xml b/core/pulltorefresh/src/main/res/values/attrs.xml
deleted file mode 100644
index a3408ae7..00000000
--- a/core/pulltorefresh/src/main/res/values/attrs.xml
+++ /dev/null
@@ -1,80 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/core/pulltorefresh/src/main/res/values/dimens.xml b/core/pulltorefresh/src/main/res/values/dimens.xml
deleted file mode 100644
index 24339b5b..00000000
--- a/core/pulltorefresh/src/main/res/values/dimens.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
- 10dp
- 12dp
- 4dp
- 24dp
- 12dp
-
-
\ No newline at end of file
diff --git a/core/pulltorefresh/src/main/res/values/ids.xml b/core/pulltorefresh/src/main/res/values/ids.xml
deleted file mode 100644
index 26c9ae76..00000000
--- a/core/pulltorefresh/src/main/res/values/ids.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/core/pulltorefresh/src/main/res/values/pull_refresh_strings.xml b/core/pulltorefresh/src/main/res/values/pull_refresh_strings.xml
deleted file mode 100755
index 20cd2fa4..00000000
--- a/core/pulltorefresh/src/main/res/values/pull_refresh_strings.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
- Pull to refresh…
- Release to refresh…
- Loading…
-
-
- @string/pull_to_refresh_pull_label
- @string/pull_to_refresh_release_label
- @string/pull_to_refresh_refreshing_label
-
-
\ No newline at end of file
diff --git a/settings.gradle b/settings.gradle
index b5554310..df54c39f 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -4,5 +4,4 @@ include ':core:subsonic-api'
include ':core:subsonic-api-image-loader'
include ':core:cache'
include ':core:menudrawer'
-include ':core:pulltorefresh'
include ':ultrasonic'
diff --git a/ultrasonic/build.gradle b/ultrasonic/build.gradle
index 3c7c07b1..390566c7 100644
--- a/ultrasonic/build.gradle
+++ b/ultrasonic/build.gradle
@@ -57,7 +57,6 @@ tasks.withType(Test) {
dependencies {
implementation project(':core:menudrawer')
- implementation project(':core:pulltorefresh')
implementation project(':core:library')
implementation project(':core:domain')
implementation project(':core:subsonic-api')
diff --git a/ultrasonic/src/main/assets/html/fr/index.html b/ultrasonic/src/main/assets/html/fr/index.html
index 0fc3ee9c..81334bf9 100644
--- a/ultrasonic/src/main/assets/html/fr/index.html
+++ b/ultrasonic/src/main/assets/html/fr/index.html
@@ -33,7 +33,7 @@
Écoute et téléchargement illimités vers autant de iPhones et d'appareils Android que souhaité.
Lecture de vidéos.
Une adresse web personnalisée pour votre serveur Subsonic (votrenom.subsonic.org).
- Aucunes publicitées; dans l'interface web de Subsonic.
+ Aucunes publicités dans l'interface web de Subsonic.
Accès gratuit aux nouvelles fonctionnalités avancées.
diff --git a/ultrasonic/src/main/java/org/moire/ultrasonic/activity/BookmarkActivity.java b/ultrasonic/src/main/java/org/moire/ultrasonic/activity/BookmarkActivity.java
index ff4172d2..23301024 100644
--- a/ultrasonic/src/main/java/org/moire/ultrasonic/activity/BookmarkActivity.java
+++ b/ultrasonic/src/main/java/org/moire/ultrasonic/activity/BookmarkActivity.java
@@ -27,9 +27,8 @@ import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.ListView;
-import com.handmark.pulltorefresh.library.PullToRefreshBase;
-import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener;
-import com.handmark.pulltorefresh.library.PullToRefreshListView;
+import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
+
import org.moire.ultrasonic.R;
import org.moire.ultrasonic.data.ActiveServerProvider;
import org.moire.ultrasonic.domain.MusicDirectory;
@@ -50,7 +49,7 @@ import java.util.List;
public class BookmarkActivity extends SubsonicTabActivity
{
- private PullToRefreshListView refreshAlbumListView;
+ private SwipeRefreshLayout refreshAlbumListView;
private ListView albumListView;
private View albumButtons;
private View emptyView;
@@ -71,13 +70,13 @@ public class BookmarkActivity extends SubsonicTabActivity
albumButtons = findViewById(R.id.menu_album);
- refreshAlbumListView = (PullToRefreshListView) findViewById(R.id.select_album_entries);
- albumListView = refreshAlbumListView.getRefreshableView();
+ refreshAlbumListView = findViewById(R.id.select_album_entries_refresh);
+ albumListView = findViewById(R.id.select_album_entries_list);
- refreshAlbumListView.setOnRefreshListener(new OnRefreshListener()
+ refreshAlbumListView.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener()
{
@Override
- public void onRefresh(PullToRefreshBase refreshView)
+ public void onRefresh()
{
new GetDataTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
@@ -473,7 +472,6 @@ public class BookmarkActivity extends SubsonicTabActivity
@Override
protected void onPostExecute(String[] result)
{
- refreshAlbumListView.onRefreshComplete();
super.onPostExecute(result);
}
diff --git a/ultrasonic/src/main/java/org/moire/ultrasonic/activity/ChatActivity.java b/ultrasonic/src/main/java/org/moire/ultrasonic/activity/ChatActivity.java
index a7c9aa6f..83a20677 100644
--- a/ultrasonic/src/main/java/org/moire/ultrasonic/activity/ChatActivity.java
+++ b/ultrasonic/src/main/java/org/moire/ultrasonic/activity/ChatActivity.java
@@ -5,6 +5,9 @@ import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.KeyEvent;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
@@ -13,10 +16,8 @@ import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
-import com.handmark.pulltorefresh.library.PullToRefreshBase;
-import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode;
-import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener;
-import com.handmark.pulltorefresh.library.PullToRefreshListView;
+import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
+
import org.moire.ultrasonic.R;
import org.moire.ultrasonic.data.ActiveServerProvider;
import org.moire.ultrasonic.domain.ChatMessage;
@@ -43,7 +44,6 @@ import static org.koin.java.KoinJavaComponent.inject;
*/
public final class ChatActivity extends SubsonicTabActivity
{
- private PullToRefreshListView refreshChatListView;
private ListView chatListView;
private EditText messageEditText;
private ImageButton sendButton;
@@ -58,9 +58,6 @@ public final class ChatActivity extends SubsonicTabActivity
super.onCreate(bundle);
setContentView(R.layout.chat);
- refreshChatListView = (PullToRefreshListView) findViewById(R.id.chat_entries);
- refreshChatListView.setMode(Mode.PULL_FROM_END);
-
messageEditText = (EditText) findViewById(R.id.chat_edittext);
sendButton = (ImageButton) findViewById(R.id.chat_send);
@@ -74,7 +71,7 @@ public final class ChatActivity extends SubsonicTabActivity
}
});
- chatListView = refreshChatListView.getRefreshableView();
+ chatListView = findViewById(R.id.chat_entries_list);
chatListView.setTranscriptMode(ListView.TRANSCRIPT_MODE_ALWAYS_SCROLL);
chatListView.setStackFromBottom(true);
@@ -121,15 +118,6 @@ public final class ChatActivity extends SubsonicTabActivity
}
});
- refreshChatListView.setOnRefreshListener(new OnRefreshListener()
- {
- @Override
- public void onRefresh(PullToRefreshBase refreshView)
- {
- new GetDataTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
- }
- });
-
View chatMenuItem = findViewById(R.id.menu_chat);
menuDrawer.setActiveView(chatMenuItem);
@@ -144,6 +132,33 @@ public final class ChatActivity extends SubsonicTabActivity
timerMethod();
}
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu)
+ {
+ MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.chat, menu);
+ super.onCreateOptionsMenu(menu);
+
+ return true;
+ }
+
+ /*
+ * Listen for option item selections so that we receive a notification
+ * when the user requests a refresh by selecting the refresh action bar item.
+ */
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ // Check if user triggered a refresh:
+ case R.id.menu_refresh:
+ // Start the refresh background task.
+ new GetDataTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
+ return true;
+ }
+ // User didn't trigger a refresh, let the superclass handle this action
+ return super.onOptionsItemSelected(item);
+ }
+
@Override
protected void onResume()
{
@@ -283,7 +298,6 @@ public final class ChatActivity extends SubsonicTabActivity
protected void onPostExecute(String[] result)
{
load();
- refreshChatListView.onRefreshComplete();
super.onPostExecute(result);
}
@@ -293,4 +307,4 @@ public final class ChatActivity extends SubsonicTabActivity
return null;
}
}
-}
\ No newline at end of file
+}
diff --git a/ultrasonic/src/main/java/org/moire/ultrasonic/activity/SelectAlbumActivity.java b/ultrasonic/src/main/java/org/moire/ultrasonic/activity/SelectAlbumActivity.java
index 5e91390b..b146794f 100644
--- a/ultrasonic/src/main/java/org/moire/ultrasonic/activity/SelectAlbumActivity.java
+++ b/ultrasonic/src/main/java/org/moire/ultrasonic/activity/SelectAlbumActivity.java
@@ -27,14 +27,12 @@ import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
-import android.widget.AbsListView;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
-import com.handmark.pulltorefresh.library.PullToRefreshBase;
-import com.handmark.pulltorefresh.library.PullToRefreshListView;
+import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import org.moire.ultrasonic.R;
import org.moire.ultrasonic.data.ActiveServerProvider;
@@ -61,13 +59,11 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Random;
-import static com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener;
-
public class SelectAlbumActivity extends SubsonicTabActivity
{
public static final String allSongsId = "-1";
- private PullToRefreshListView refreshAlbumListView;
+ private SwipeRefreshLayout refreshAlbumListView;
private ListView albumListView;
private View header;
private View albumButtons;
@@ -92,50 +88,23 @@ public class SelectAlbumActivity extends SubsonicTabActivity
* Called when the activity is first created.
*/
@Override
- public void onCreate(Bundle savedInstanceState)
- {
+ public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.select_album);
albumButtons = findViewById(R.id.menu_album);
- refreshAlbumListView = (PullToRefreshListView) findViewById(R.id.select_album_entries);
- albumListView = refreshAlbumListView.getRefreshableView();
+ refreshAlbumListView = findViewById(R.id.select_album_entries_refresh);
+ albumListView = findViewById(R.id.select_album_entries_list);
- refreshAlbumListView.setOnRefreshListener(new OnRefreshListener()
+ refreshAlbumListView.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener()
{
@Override
- public void onRefresh(PullToRefreshBase refreshView)
- {
+ public void onRefresh() {
new GetDataTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
});
- refreshAlbumListView.setOnScrollListener(new AbsListView.OnScrollListener() {
- @Override
- public void onScrollStateChanged(AbsListView view, int scrollState) {
- for (int i=0;i()
+ refreshArtistListView.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener()
{
@Override
- public void onRefresh(PullToRefreshBase refreshView)
+ public void onRefresh()
{
new GetDataTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
@@ -362,7 +361,6 @@ public class SelectArtistActivity extends SubsonicTabActivity implements Adapter
@Override
protected void onPostExecute(String[] result)
{
- refreshArtistListView.onRefreshComplete();
super.onPostExecute(result);
}
@@ -373,4 +371,4 @@ public class SelectArtistActivity extends SubsonicTabActivity implements Adapter
return null;
}
}
-}
\ No newline at end of file
+}
diff --git a/ultrasonic/src/main/java/org/moire/ultrasonic/activity/SelectGenreActivity.java b/ultrasonic/src/main/java/org/moire/ultrasonic/activity/SelectGenreActivity.java
index aa038463..996edd6d 100644
--- a/ultrasonic/src/main/java/org/moire/ultrasonic/activity/SelectGenreActivity.java
+++ b/ultrasonic/src/main/java/org/moire/ultrasonic/activity/SelectGenreActivity.java
@@ -29,9 +29,8 @@ import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
-import com.handmark.pulltorefresh.library.PullToRefreshBase;
-import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener;
-import com.handmark.pulltorefresh.library.PullToRefreshListView;
+import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
+
import org.moire.ultrasonic.R;
import org.moire.ultrasonic.domain.Genre;
import org.moire.ultrasonic.service.MusicService;
@@ -50,7 +49,7 @@ public class SelectGenreActivity extends SubsonicTabActivity implements AdapterV
private static final String TAG = SelectGenreActivity.class.getSimpleName();
- private PullToRefreshListView refreshGenreListView;
+ private SwipeRefreshLayout refreshGenreListView;
private ListView genreListView;
private View emptyView;
@@ -63,13 +62,13 @@ public class SelectGenreActivity extends SubsonicTabActivity implements AdapterV
super.onCreate(savedInstanceState);
setContentView(R.layout.select_genre);
- refreshGenreListView = (PullToRefreshListView) findViewById(R.id.select_genre_list);
- genreListView = refreshGenreListView.getRefreshableView();
+ refreshGenreListView = findViewById(R.id.select_genre_refresh);
+ genreListView = findViewById(R.id.select_genre_list);
- refreshGenreListView.setOnRefreshListener(new OnRefreshListener()
+ refreshGenreListView.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener()
{
@Override
- public void onRefresh(PullToRefreshBase refreshView)
+ public void onRefresh()
{
new GetDataTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
@@ -181,7 +180,6 @@ public class SelectGenreActivity extends SubsonicTabActivity implements AdapterV
@Override
protected void onPostExecute(String[] result)
{
- refreshGenreListView.onRefreshComplete();
super.onPostExecute(result);
}
@@ -192,4 +190,4 @@ public class SelectGenreActivity extends SubsonicTabActivity implements AdapterV
return null;
}
}
-}
\ No newline at end of file
+}
diff --git a/ultrasonic/src/main/java/org/moire/ultrasonic/activity/SelectPlaylistActivity.java b/ultrasonic/src/main/java/org/moire/ultrasonic/activity/SelectPlaylistActivity.java
index 9c18b1e9..3d1ada74 100644
--- a/ultrasonic/src/main/java/org/moire/ultrasonic/activity/SelectPlaylistActivity.java
+++ b/ultrasonic/src/main/java/org/moire/ultrasonic/activity/SelectPlaylistActivity.java
@@ -40,9 +40,7 @@ import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
-import com.handmark.pulltorefresh.library.PullToRefreshBase;
-import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener;
-import com.handmark.pulltorefresh.library.PullToRefreshListView;
+import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import org.moire.ultrasonic.R;
import org.moire.ultrasonic.api.subsonic.ApiNotSupportedException;
@@ -64,7 +62,7 @@ import java.util.List;
public class SelectPlaylistActivity extends SubsonicTabActivity implements AdapterView.OnItemClickListener
{
- private PullToRefreshListView refreshPlaylistsListView;
+ private SwipeRefreshLayout refreshPlaylistsListView;
private ListView playlistsListView;
private View emptyTextView;
private PlaylistAdapter playlistAdapter;
@@ -75,13 +73,13 @@ public class SelectPlaylistActivity extends SubsonicTabActivity implements Adapt
super.onCreate(savedInstanceState);
setContentView(R.layout.select_playlist);
- refreshPlaylistsListView = (PullToRefreshListView) findViewById(R.id.select_playlist_list);
- playlistsListView = refreshPlaylistsListView.getRefreshableView();
+ refreshPlaylistsListView = findViewById(R.id.select_playlist_refresh);
+ playlistsListView = findViewById(R.id.select_playlist_list);
- refreshPlaylistsListView.setOnRefreshListener(new OnRefreshListener()
+ refreshPlaylistsListView.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener()
{
@Override
- public void onRefresh(PullToRefreshBase refreshView)
+ public void onRefresh()
{
new GetDataTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
@@ -380,7 +378,6 @@ public class SelectPlaylistActivity extends SubsonicTabActivity implements Adapt
@Override
protected void onPostExecute(String[] result)
{
- refreshPlaylistsListView.onRefreshComplete();
super.onPostExecute(result);
}
diff --git a/ultrasonic/src/main/java/org/moire/ultrasonic/activity/ShareActivity.java b/ultrasonic/src/main/java/org/moire/ultrasonic/activity/ShareActivity.java
index d7a2d237..9e012dd6 100644
--- a/ultrasonic/src/main/java/org/moire/ultrasonic/activity/ShareActivity.java
+++ b/ultrasonic/src/main/java/org/moire/ultrasonic/activity/ShareActivity.java
@@ -41,9 +41,7 @@ import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
-import com.handmark.pulltorefresh.library.PullToRefreshBase;
-import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener;
-import com.handmark.pulltorefresh.library.PullToRefreshListView;
+import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import org.moire.ultrasonic.R;
import org.moire.ultrasonic.api.subsonic.ApiNotSupportedException;
@@ -65,7 +63,7 @@ import java.util.List;
public class ShareActivity extends SubsonicTabActivity implements AdapterView.OnItemClickListener
{
- private PullToRefreshListView refreshSharesListView;
+ private SwipeRefreshLayout refreshSharesListView;
private ListView sharesListView;
private View emptyTextView;
private ShareAdapter shareAdapter;
@@ -76,13 +74,13 @@ public class ShareActivity extends SubsonicTabActivity implements AdapterView.On
super.onCreate(savedInstanceState);
setContentView(R.layout.select_share);
- refreshSharesListView = (PullToRefreshListView) findViewById(R.id.select_share_list);
- sharesListView = refreshSharesListView.getRefreshableView();
+ refreshSharesListView = findViewById(R.id.select_share_refresh);
+ sharesListView = findViewById(R.id.select_share_list);
- refreshSharesListView.setOnRefreshListener(new OnRefreshListener()
+ refreshSharesListView.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener()
{
@Override
- public void onRefresh(PullToRefreshBase refreshView)
+ public void onRefresh()
{
new GetDataTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
@@ -374,7 +372,6 @@ public class ShareActivity extends SubsonicTabActivity implements AdapterView.On
@Override
protected void onPostExecute(String[] result)
{
- refreshSharesListView.onRefreshComplete();
super.onPostExecute(result);
}
@@ -385,4 +382,4 @@ public class ShareActivity extends SubsonicTabActivity implements AdapterView.On
return null;
}
}
-}
\ No newline at end of file
+}
diff --git a/ultrasonic/src/main/res/drawable-hdpi/ic_menu_refresh_dark.png b/ultrasonic/src/main/res/drawable-hdpi/ic_menu_refresh_dark.png
new file mode 100644
index 00000000..6cae3eca
Binary files /dev/null and b/ultrasonic/src/main/res/drawable-hdpi/ic_menu_refresh_dark.png differ
diff --git a/ultrasonic/src/main/res/drawable-hdpi/ic_menu_refresh_light.png b/ultrasonic/src/main/res/drawable-hdpi/ic_menu_refresh_light.png
new file mode 100644
index 00000000..3a8c89e8
Binary files /dev/null and b/ultrasonic/src/main/res/drawable-hdpi/ic_menu_refresh_light.png differ
diff --git a/ultrasonic/src/main/res/drawable-mdpi/ic_menu_refresh_dark.png b/ultrasonic/src/main/res/drawable-mdpi/ic_menu_refresh_dark.png
new file mode 100644
index 00000000..50c5f22f
Binary files /dev/null and b/ultrasonic/src/main/res/drawable-mdpi/ic_menu_refresh_dark.png differ
diff --git a/ultrasonic/src/main/res/drawable-mdpi/ic_menu_refresh_light.png b/ultrasonic/src/main/res/drawable-mdpi/ic_menu_refresh_light.png
new file mode 100644
index 00000000..060433d3
Binary files /dev/null and b/ultrasonic/src/main/res/drawable-mdpi/ic_menu_refresh_light.png differ
diff --git a/ultrasonic/src/main/res/drawable-xhdpi/ic_menu_refresh_dark.png b/ultrasonic/src/main/res/drawable-xhdpi/ic_menu_refresh_dark.png
new file mode 100644
index 00000000..415da26a
Binary files /dev/null and b/ultrasonic/src/main/res/drawable-xhdpi/ic_menu_refresh_dark.png differ
diff --git a/ultrasonic/src/main/res/drawable-xhdpi/ic_menu_refresh_light.png b/ultrasonic/src/main/res/drawable-xhdpi/ic_menu_refresh_light.png
new file mode 100644
index 00000000..1e933514
Binary files /dev/null and b/ultrasonic/src/main/res/drawable-xhdpi/ic_menu_refresh_light.png differ
diff --git a/ultrasonic/src/main/res/drawable-xxhdpi/ic_menu_refresh_dark.png b/ultrasonic/src/main/res/drawable-xxhdpi/ic_menu_refresh_dark.png
new file mode 100644
index 00000000..c00e8404
Binary files /dev/null and b/ultrasonic/src/main/res/drawable-xxhdpi/ic_menu_refresh_dark.png differ
diff --git a/ultrasonic/src/main/res/drawable-xxhdpi/ic_menu_refresh_light.png b/ultrasonic/src/main/res/drawable-xxhdpi/ic_menu_refresh_light.png
new file mode 100644
index 00000000..0c7fa340
Binary files /dev/null and b/ultrasonic/src/main/res/drawable-xxhdpi/ic_menu_refresh_light.png differ
diff --git a/ultrasonic/src/main/res/drawable-xxxhdpi/ic_menu_refresh_dark.png b/ultrasonic/src/main/res/drawable-xxxhdpi/ic_menu_refresh_dark.png
new file mode 100644
index 00000000..3461b2a7
Binary files /dev/null and b/ultrasonic/src/main/res/drawable-xxxhdpi/ic_menu_refresh_dark.png differ
diff --git a/ultrasonic/src/main/res/drawable-xxxhdpi/ic_menu_refresh_light.png b/ultrasonic/src/main/res/drawable-xxxhdpi/ic_menu_refresh_light.png
new file mode 100644
index 00000000..a5c09db5
Binary files /dev/null and b/ultrasonic/src/main/res/drawable-xxxhdpi/ic_menu_refresh_light.png differ
diff --git a/ultrasonic/src/main/res/layout/chat.xml b/ultrasonic/src/main/res/layout/chat.xml
index 8b8ea719..55304ad2 100644
--- a/ultrasonic/src/main/res/layout/chat.xml
+++ b/ultrasonic/src/main/res/layout/chat.xml
@@ -6,16 +6,16 @@
-
-
-
+
+
+
@@ -32,20 +32,20 @@
a:layout_weight="1"
a:autoLink="all"
a:hint="@string/chat.send_a_message"
- a:inputType="textEmailAddress|textMultiLine"
+ a:inputType="textEmailAddress|textMultiLine"
a:linksClickable="true"
a:paddingBottom="10dip"
a:paddingTop="10dip" />
-
+
-
+
-
\ No newline at end of file
+
diff --git a/ultrasonic/src/main/res/layout/select_album.xml b/ultrasonic/src/main/res/layout/select_album.xml
index 1a527ee9..5a037202 100644
--- a/ultrasonic/src/main/res/layout/select_album.xml
+++ b/ultrasonic/src/main/res/layout/select_album.xml
@@ -19,16 +19,22 @@
a:text="@string/select_album.empty"
a:visibility="gone" />
-
+
+
+
+
+
-
\ No newline at end of file
+
diff --git a/ultrasonic/src/main/res/layout/select_artist.xml b/ultrasonic/src/main/res/layout/select_artist.xml
index 50fb304f..43a1a8ae 100644
--- a/ultrasonic/src/main/res/layout/select_artist.xml
+++ b/ultrasonic/src/main/res/layout/select_artist.xml
@@ -6,14 +6,20 @@
-
+
+
+
+
+
-
\ No newline at end of file
+
diff --git a/ultrasonic/src/main/res/layout/select_genre.xml b/ultrasonic/src/main/res/layout/select_genre.xml
index 57ff820d..ccfb8797 100644
--- a/ultrasonic/src/main/res/layout/select_genre.xml
+++ b/ultrasonic/src/main/res/layout/select_genre.xml
@@ -14,14 +14,20 @@
a:text="@string/select_genre.empty"
a:visibility="gone" />
-
+
+
+
+
+
-
\ No newline at end of file
+
diff --git a/ultrasonic/src/main/res/layout/select_playlist.xml b/ultrasonic/src/main/res/layout/select_playlist.xml
index aefcc934..e7176513 100644
--- a/ultrasonic/src/main/res/layout/select_playlist.xml
+++ b/ultrasonic/src/main/res/layout/select_playlist.xml
@@ -14,14 +14,20 @@
a:text="@string/select_playlist.empty"
a:visibility="gone" />
-
+
+
+
+
+
-
\ No newline at end of file
+
diff --git a/ultrasonic/src/main/res/layout/select_share.xml b/ultrasonic/src/main/res/layout/select_share.xml
index 7b0641c9..66a07823 100644
--- a/ultrasonic/src/main/res/layout/select_share.xml
+++ b/ultrasonic/src/main/res/layout/select_share.xml
@@ -1,8 +1,8 @@
+ a:layout_width="fill_parent"
+ a:layout_height="fill_parent"
+ a:orientation="vertical">
@@ -14,14 +14,21 @@
a:text="@string/select_share.empty"
a:visibility="gone" />
-
+
+
+
+
+
+
-
\ No newline at end of file
+
diff --git a/ultrasonic/src/main/res/menu/chat.xml b/ultrasonic/src/main/res/menu/chat.xml
new file mode 100644
index 00000000..288df21f
--- /dev/null
+++ b/ultrasonic/src/main/res/menu/chat.xml
@@ -0,0 +1,9 @@
+
+
\ No newline at end of file
diff --git a/ultrasonic/src/main/res/values-de/strings.xml b/ultrasonic/src/main/res/values-de/strings.xml
index 5f34f274..9174a9d4 100644
--- a/ultrasonic/src/main/res/values-de/strings.xml
+++ b/ultrasonic/src/main/res/values-de/strings.xml
@@ -480,5 +480,6 @@
anstatt einfach Elemente zu markieren / zu entfernen.
Funktionseinstellungem
+ Aktualisierung
diff --git a/ultrasonic/src/main/res/values-es/strings.xml b/ultrasonic/src/main/res/values-es/strings.xml
index 8a2e90aa..669dabd5 100644
--- a/ultrasonic/src/main/res/values-es/strings.xml
+++ b/ultrasonic/src/main/res/values-es/strings.xml
@@ -483,5 +483,6 @@
en lugar de simplemente destacar / desestimar elementos.
Banderas de características
+ Actualizar
diff --git a/ultrasonic/src/main/res/values-fr/strings.xml b/ultrasonic/src/main/res/values-fr/strings.xml
index a5929952..6ebadc50 100644
--- a/ultrasonic/src/main/res/values-fr/strings.xml
+++ b/ultrasonic/src/main/res/values-fr/strings.xml
@@ -484,5 +484,6 @@
au lieu de simplement mettre en vedette / désactiver les éléments.
Drapeaux des fonctionnalités
+ Rafraichir
diff --git a/ultrasonic/src/main/res/values-hu/strings.xml b/ultrasonic/src/main/res/values-hu/strings.xml
index 9de88b1e..d859fc9f 100644
--- a/ultrasonic/src/main/res/values-hu/strings.xml
+++ b/ultrasonic/src/main/res/values-hu/strings.xml
@@ -483,5 +483,6 @@
csillaggal jelölés helyett.
Jellemzők Zászlók
+ Refresh
diff --git a/ultrasonic/src/main/res/values-nl/strings.xml b/ultrasonic/src/main/res/values-nl/strings.xml
index f73b2faf..022b5c74 100644
--- a/ultrasonic/src/main/res/values-nl/strings.xml
+++ b/ultrasonic/src/main/res/values-nl/strings.xml
@@ -483,5 +483,6 @@
in plaats van items simpelweg in de hoofdrol te zetten / niet te verwijderen.
Experimentele functies
+ Refresh
diff --git a/ultrasonic/src/main/res/values-pl/strings.xml b/ultrasonic/src/main/res/values-pl/strings.xml
index b90ec437..22d6ca33 100644
--- a/ultrasonic/src/main/res/values-pl/strings.xml
+++ b/ultrasonic/src/main/res/values-pl/strings.xml
@@ -496,5 +496,6 @@ Obecnie nie zapisuje obrazów w pamięci urządzenia, tylko wykorzystuje tylko p
zamiast po prostu grać gwiazdkami / bez gwiazd.
Flagi funkcji
+ Refresh
diff --git a/ultrasonic/src/main/res/values-pt-rBR/strings.xml b/ultrasonic/src/main/res/values-pt-rBR/strings.xml
index d5ae2829..62349fdb 100644
--- a/ultrasonic/src/main/res/values-pt-rBR/strings.xml
+++ b/ultrasonic/src/main/res/values-pt-rBR/strings.xml
@@ -483,5 +483,6 @@
em vez de simplesmente estrelar / não estrelar itens.
Bandeiras de recursos
+ Refresh
diff --git a/ultrasonic/src/main/res/values-pt/strings.xml b/ultrasonic/src/main/res/values-pt/strings.xml
index e2ff9aba..74ca954d 100644
--- a/ultrasonic/src/main/res/values-pt/strings.xml
+++ b/ultrasonic/src/main/res/values-pt/strings.xml
@@ -483,5 +483,6 @@
em vez de simplesmente estrelar / não estrelar itens.
Bandeiras de recursos
+ Refresh
diff --git a/ultrasonic/src/main/res/values/strings.xml b/ultrasonic/src/main/res/values/strings.xml
index 9e21b7f3..18b8b528 100644
--- a/ultrasonic/src/main/res/values/strings.xml
+++ b/ultrasonic/src/main/res/values/strings.xml
@@ -487,5 +487,6 @@
instead of simply starring/unstarring items.
Feature Flags
+ Refresh
diff --git a/ultrasonic/src/main/res/values/styles.xml b/ultrasonic/src/main/res/values/styles.xml
index 7f58c571..6629d3bc 100644
--- a/ultrasonic/src/main/res/values/styles.xml
+++ b/ultrasonic/src/main/res/values/styles.xml
@@ -80,6 +80,7 @@
+
diff --git a/ultrasonic/src/main/res/values/themes.xml b/ultrasonic/src/main/res/values/themes.xml
index 9c8f76fe..84a154ba 100644
--- a/ultrasonic/src/main/res/values/themes.xml
+++ b/ultrasonic/src/main/res/values/themes.xml
@@ -36,6 +36,7 @@
- @drawable/media_shuffle_normal_dark
- @drawable/media_start_normal_dark
- @drawable/ic_menu_podcasts_dark
+ - @drawable/ic_menu_refresh_dark
- @drawable/media_play_next
- @drawable/ic_stat_play_dark
- @drawable/media_stop_normal_dark
@@ -89,6 +90,7 @@
- @drawable/media_shuffle_normal_light
- @drawable/media_start_normal_light
- @drawable/ic_menu_podcasts_light
+ - @drawable/ic_menu_refresh_light
- @drawable/media_play_next
- @drawable/ic_stat_play_light
- @drawable/media_stop_normal_light