Skip to content

Commit c14bbf3

Browse files
committed
Optimization at the footer when finishLoadmore() is invoked.
1 parent 3eab11f commit c14bbf3

File tree

4 files changed

+35
-4
lines changed

4 files changed

+35
-4
lines changed

TODO_list.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
## 存在的问题
2+
1. 三星、酷派手机的兼容问题
3+
2. 依赖太旧的问题->选择去除依赖还是更新依赖 done 以去除依赖
4+
3. 自动刷新动画生硬 todo 问题待验证
5+
4. 加载更多闪烁问题 done 做了优化
6+
5. layout_behavior支持问题
7+
6. 是否要支持ViewPager回弹问题
8+
7. 是否要支持所有的View
9+
8. 测试事件监听冲突问题
10+
9. 内存溢出问题
11+
10. 仿QQ视差效果
12+
13+
## 新发现的问题
14+
1. beizierlayout主动调用刷新时会一片白
15+
2. BallPulseView引入了内存泄漏
16+
3. 新的方案,怎么让scroll更平滑;计算Footer降低与TargetView显示距离是否一致:结论,一致,问题在每次滚动的距离上
17+
4. requestLayout时提示 **improperly called by android.support.v7.widget.AppCompatTextView**
18+

library/src/main/java/com/lcodecore/tkrefreshlayout/TwinklingRefreshLayout.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,6 @@ public void finishRefreshAfterAnim() {
803803
public void finishLoadmore() {
804804
onFinishLoadMore();
805805
if (isLoadingVisible() && mChildView != null) {
806-
ScrollingUtil.scrollAViewBy(mChildView, (int) mBottomHeight);
807806
setLoadingMore(false);
808807
animProcessor.animBottomBack();
809808
}

library/src/main/java/com/lcodecore/tkrefreshlayout/processor/AnimProcessor.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
import android.animation.AnimatorListenerAdapter;
66
import android.animation.ValueAnimator;
77
import android.animation.ValueAnimator.AnimatorUpdateListener;
8+
import android.support.v7.widget.RecyclerView;
89
import android.view.animation.DecelerateInterpolator;
910

1011
import com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout;
12+
import com.lcodecore.tkrefreshlayout.utils.ScrollingUtil;
1113

1214
import static android.view.View.GONE;
1315
import static android.view.View.VISIBLE;
@@ -139,7 +141,19 @@ public void onAnimationEnd(Animator animation) {
139141
*/
140142
public void animBottomBack() {
141143
isAnimBottomBack = true;
142-
animLayoutByTime(getVisibleFootHeight(), 0, animBottomUpListener, new AnimatorListenerAdapter() {
144+
animLayoutByTime(getVisibleFootHeight(), 0, new AnimatorUpdateListener() {
145+
@Override
146+
public void onAnimationUpdate(ValueAnimator animation) {
147+
int dy = getVisibleFootHeight() - (int) animation.getAnimatedValue();
148+
//可以让TargetView滚动dy高度,但这样两个方向上滚动感觉画面闪烁,改为dy/2是为了消除闪烁
149+
if (dy > 0) {
150+
if (cp.getContent() instanceof RecyclerView)ScrollingUtil.scrollAViewBy(cp.getContent(), dy);
151+
else ScrollingUtil.scrollAViewBy(cp.getContent(), dy/2);
152+
}
153+
//decorate the AnimatorUpdateListener
154+
animBottomUpListener.onAnimationUpdate(animation);
155+
}
156+
}, new AnimatorListenerAdapter() {
143157
@Override
144158
public void onAnimationEnd(Animator animation) {
145159
isAnimBottomBack = false;

library/src/main/java/com/lcodecore/tkrefreshlayout/utils/ScrollingUtil.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,9 @@ public static boolean isRecyclerViewToBottom(RecyclerView recyclerView) {
249249
}
250250

251251
public static void scrollAViewBy(View view, int height) {
252-
if (view instanceof RecyclerView) ((RecyclerView) view).smoothScrollBy(0, height);
252+
if (view instanceof RecyclerView) ((RecyclerView) view).scrollBy(0, height);
253253
else if (view instanceof ScrollView) ((ScrollView) view).smoothScrollBy(0, height);
254-
else if (view instanceof AbsListView) ((AbsListView) view).smoothScrollBy(height, 150);
254+
else if (view instanceof AbsListView) ((AbsListView) view).smoothScrollBy(height, 0);
255255
else {
256256
try {
257257
Method method = view.getClass().getDeclaredMethod("smoothScrollBy", Integer.class, Integer.class);

0 commit comments

Comments
 (0)