refactor(compose-fab): code cleanup
This commit is contained in:
parent
327426e443
commit
e9cd29c59e
|
@ -71,7 +71,7 @@ public class AccountTimelineFragment extends StatusListFragment{
|
||||||
@Override
|
@Override
|
||||||
public void onViewCreated(View view, Bundle savedInstanceState){
|
public void onViewCreated(View view, Bundle savedInstanceState){
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
// fab = ((ProfileFragment) getParentFragment()).getFab();
|
fab = ((ProfileFragment) getParentFragment()).getFab();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -400,29 +400,6 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
|
||||||
});
|
});
|
||||||
|
|
||||||
scrollView.setOnScrollChangeListener(this::onScrollChanged);
|
scrollView.setOnScrollChangeListener(this::onScrollChanged);
|
||||||
scrollView.setNestedScrollListener((target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed) -> {
|
|
||||||
if (dyConsumed > 0) {
|
|
||||||
fab.setVisibility(View.INVISIBLE);
|
|
||||||
TranslateAnimation animate = new TranslateAnimation(
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
fab.getHeight() * 2);
|
|
||||||
animate.setDuration(300);
|
|
||||||
animate.setFillAfter(true);
|
|
||||||
fab.startAnimation(animate);
|
|
||||||
} else {
|
|
||||||
fab.setVisibility(View.VISIBLE);
|
|
||||||
TranslateAnimation animate = new TranslateAnimation(
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
fab.getHeight() * 2,
|
|
||||||
0);
|
|
||||||
animate.setDuration(300);
|
|
||||||
animate.setFillAfter(true);
|
|
||||||
fab.startAnimation(animate);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
titleTransY=getToolbar().getLayoutParams().height;
|
titleTransY=getToolbar().getLayoutParams().height;
|
||||||
if(toolbarTitleView!=null){
|
if(toolbarTitleView!=null){
|
||||||
toolbarTitleView.setTranslationY(titleTransY);
|
toolbarTitleView.setTranslationY(titleTransY);
|
||||||
|
|
|
@ -10,12 +10,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
public class NestedRecyclerScrollView extends CustomScrollView{
|
public class NestedRecyclerScrollView extends CustomScrollView{
|
||||||
|
|
||||||
public interface NestedScrollListener{
|
|
||||||
public void onNestedScroll(View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed);
|
|
||||||
}
|
|
||||||
private Supplier<RecyclerView> scrollableChildSupplier;
|
private Supplier<RecyclerView> scrollableChildSupplier;
|
||||||
private NestedScrollListener nestedScrollListener;
|
|
||||||
|
|
||||||
public NestedRecyclerScrollView(Context context){
|
public NestedRecyclerScrollView(Context context){
|
||||||
super(context);
|
super(context);
|
||||||
|
@ -29,18 +24,6 @@ public class NestedRecyclerScrollView extends CustomScrollView{
|
||||||
super(context, attrs, defStyleAttr);
|
super(context, attrs, defStyleAttr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onNestedScroll(View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) {
|
|
||||||
super.onNestedScroll(target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
|
|
||||||
if (nestedScrollListener != null) {
|
|
||||||
nestedScrollListener.onNestedScroll(target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNestedScrollListener(NestedScrollListener listener) {
|
|
||||||
this.nestedScrollListener = listener;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNestedPreScroll(View target, int dx, int dy, int[] consumed) {
|
public void onNestedPreScroll(View target, int dx, int dy, int[] consumed) {
|
||||||
final RecyclerView rv = (RecyclerView) target;
|
final RecyclerView rv = (RecyclerView) target;
|
||||||
|
|
Loading…
Reference in New Issue