Making it so that the fab is always visible at the top of the recyclerView
Fixing #88
This commit is contained in:
parent
c8580979e8
commit
a4e3774739
|
@ -85,6 +85,8 @@ public abstract class BaseStatusListFragment<T extends DisplayItemsParent> exten
|
||||||
protected HashMap<String, Relationship> relationships=new HashMap<>();
|
protected HashMap<String, Relationship> relationships=new HashMap<>();
|
||||||
protected Rect tmpRect=new Rect();
|
protected Rect tmpRect=new Rect();
|
||||||
|
|
||||||
|
private final int THRESHHOLD = 800;
|
||||||
|
|
||||||
public BaseStatusListFragment(){
|
public BaseStatusListFragment(){
|
||||||
super(20);
|
super(20);
|
||||||
if (withComposeButton()) setListLayoutId(R.layout.recycler_fragment_with_fab);
|
if (withComposeButton()) setListLayoutId(R.layout.recycler_fragment_with_fab);
|
||||||
|
@ -299,9 +301,15 @@ public abstract class BaseStatusListFragment<T extends DisplayItemsParent> exten
|
||||||
currentPhotoViewer.offsetView(-dx, -dy);
|
currentPhotoViewer.offsetView(-dx, -dy);
|
||||||
|
|
||||||
if (fab!=null && GlobalUserPreferences.enableFabAutoHide) {
|
if (fab!=null && GlobalUserPreferences.enableFabAutoHide) {
|
||||||
if(dy > 0){
|
// This piece of code should make it so that the fab is always visible if the status list scroll view is at the item at the top
|
||||||
scrollDiff=0;
|
if(list.getChildLayoutPosition(list.getChildAt(0)) < 1){
|
||||||
|
scrollDiff=THRESHHOLD+1;
|
||||||
|
}else{
|
||||||
|
if(dy > 0){
|
||||||
|
scrollDiff=0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dy > 0 && fab.getVisibility() == View.VISIBLE) {
|
if (dy > 0 && fab.getVisibility() == View.VISIBLE) {
|
||||||
TranslateAnimation animate = new TranslateAnimation(
|
TranslateAnimation animate = new TranslateAnimation(
|
||||||
0,
|
0,
|
||||||
|
@ -314,7 +322,7 @@ public abstract class BaseStatusListFragment<T extends DisplayItemsParent> exten
|
||||||
fab.setVisibility(View.INVISIBLE);
|
fab.setVisibility(View.INVISIBLE);
|
||||||
scrollDiff = 0;
|
scrollDiff = 0;
|
||||||
} else if (dy < 0 && fab.getVisibility() != View.VISIBLE) {
|
} else if (dy < 0 && fab.getVisibility() != View.VISIBLE) {
|
||||||
if (scrollDiff > 800) {
|
if (scrollDiff > THRESHHOLD) {
|
||||||
fab.setVisibility(View.VISIBLE);
|
fab.setVisibility(View.VISIBLE);
|
||||||
TranslateAnimation animate = new TranslateAnimation(
|
TranslateAnimation animate = new TranslateAnimation(
|
||||||
0,
|
0,
|
||||||
|
|
Loading…
Reference in New Issue