You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 8, 2018. It is now read-only.
I need to use f.e. indicator arrow drawable for pull/refresh animation and custom loading spinner for loading.
If I use "ptrDrawable" in the layout or setLoadingDrawable animation works like rotate. If I use getDefaultDrawableResId() in the LoadingLayout situation is the same.
The text was updated successfully, but these errors were encountered:
ptrDrawable or setLoadingDrawable, getDefaultDrawableResId() are used to set an image which is shown except when a current state is "refreshing".
There is no feature to support to set an image for a refreshing state yet. And, the rotating circle when refreshing is not an image but that is a progress bar.
But there is an other way to set it. Below is the way.
(I have to say that this is not the best way.)
Make a custom layout like below. �The point of below is that you make mHeaderImage be changed to a different image in refreshingImpl() method.
publicclassCustomDrawableLoadingLayoutextendsFlipLoadingLayout {
privatefinalintrefreshingHeaderImageResource = R.drawable.heart;
privateDrawablemLoadingDrawable;
/** * Default Constructor (Parameters must not be omitted in constructor). */publicCustomDrawableLoadingLayout(Contextcontext, Modemode, OrientationscrollDirection, TypedArrayattrs) {
super(context, mode, scrollDirection, attrs);
}
@OverrideprotectedvoidonLoadingDrawableSet(DrawableimageDrawable) {
super.onLoadingDrawableSet(imageDrawable);
// Save the current imageDrawablemLoadingDrawable = imageDrawable;
}
/** * Customize some part of the layout when refreshing */@OverrideprotectedvoidrefreshingImpl() {
super.refreshingImpl();
// Let's start to change a header image.updateRefreshingHeaderImage();
}
privatevoidupdateRefreshingHeaderImage() {
// Header image is set to be hidden in super class. So, we have to set it back.updateHeaderImageVisible();
// Here is the most important code. Set other image you want to change.mHeaderImage.setImageResource(refreshingHeaderImageResource);
}
privatevoidupdateHeaderImageVisible() {
mHeaderImage.setVisibility(View.VISIBLE);
mHeaderProgress.setVisibility(View.GONE);
}
@OverrideprotectedvoidresetImpl() {
super.refreshingImpl();
// Reset header imageresetRefreshingHeaderImage();
}
privatevoidresetRefreshingHeaderImage() {
mHeaderImage.setImageDrawable(mLoadingDrawable);
updateHeaderImageVisible();
}
}
Add the custom layout into assets/pulltorefresh.xml
This is done. You may also set some custom animation to mHeaderImage(But a previous animation of mHeaderImage must be restored when reset).
The more clearer way to make custom animations of icons is that you override LoadingLayout instead of FlipLoadingLayout or RotateLoadingLayout. You can make a custom loading layout by referring to the source of FlipLoadingLayout.
ps. I think that it's hard to customize LoadingLayout. I have a plan refactoring totally a structure of LoadingLayout(but not this time, because of backward compatibility).
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I need to use f.e. indicator arrow drawable for pull/refresh animation and custom loading spinner for loading.
If I use "ptrDrawable" in the layout or setLoadingDrawable animation works like rotate. If I use getDefaultDrawableResId() in the LoadingLayout situation is the same.
The text was updated successfully, but these errors were encountered: