Update dependencies
Settings activity refactor
This commit is contained in:
248 files changed
+8700
-8980
No files matched your search
@@ -19,8 +19,10 @@ package com.hippo.widget;
|
||||
import android.animation.Animator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.hippo.yorozuya.MathUtils;
|
||||
import com.hippo.yorozuya.SimpleAnimatorListener;
|
||||
import com.hippo.yorozuya.ViewUtils;
|
||||
@@ -28,16 +30,15 @@ import com.hippo.yorozuya.ViewUtils;
|
||||
public class SearchBarMover extends RecyclerView.OnScrollListener {
|
||||
|
||||
private static final long ANIMATE_TIME = 300L;
|
||||
|
||||
private boolean mShow;
|
||||
private ValueAnimator mSearchBarMoveAnimator;
|
||||
private final Helper mHelper;
|
||||
private final View mSearchBar;
|
||||
private boolean mShow;
|
||||
private ValueAnimator mSearchBarMoveAnimator;
|
||||
|
||||
public SearchBarMover(Helper helper, View searchBar, RecyclerView... recyclerViews) {
|
||||
mHelper = helper;
|
||||
mSearchBar = searchBar;
|
||||
for (RecyclerView recyclerView: recyclerViews) {
|
||||
for (RecyclerView recyclerView : recyclerViews) {
|
||||
recyclerView.addOnScrollListener(this);
|
||||
}
|
||||
}
|
||||
@@ -49,7 +50,7 @@ public class SearchBarMover extends RecyclerView.OnScrollListener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScrollStateChanged(RecyclerView recyclerView, int newState){
|
||||
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
|
||||
if (newState == RecyclerView.SCROLL_STATE_IDLE && mHelper.isValidView(recyclerView)) {
|
||||
returnSearchBarPosition();
|
||||
}
|
||||
@@ -87,7 +88,7 @@ public class SearchBarMover extends RecyclerView.OnScrollListener {
|
||||
}
|
||||
if (!recyclerView.isShown()) {
|
||||
show = true;
|
||||
} else if (recyclerView.computeVerticalScrollOffset() < mSearchBar.getBottom()){
|
||||
} else if (recyclerView.computeVerticalScrollOffset() < mSearchBar.getBottom()) {
|
||||
show = true;
|
||||
} else {
|
||||
show = (int) ViewUtils.getY2(mSearchBar) > (mSearchBar.getHeight()) / 2;
|
||||
@@ -129,6 +130,7 @@ public class SearchBarMover extends RecyclerView.OnScrollListener {
|
||||
});
|
||||
va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||
int lastValue;
|
||||
|
||||
@Override
|
||||
public void onAnimationUpdate(ValueAnimator animation) {
|
||||
int value = (Integer) animation.getAnimatedValue();
|
||||
@@ -187,6 +189,7 @@ public class SearchBarMover extends RecyclerView.OnScrollListener {
|
||||
});
|
||||
va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||
int lastValue;
|
||||
|
||||
@Override
|
||||
public void onAnimationUpdate(ValueAnimator animation) {
|
||||
int value = (Integer) animation.getAnimatedValue();
|
||||
|
||||
Reference in new issue
Block a user