mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-20 21:27:07 +00:00
Cannot scroll vertical anymore
This commit is contained in:
parent
e5e71f6023
commit
bb9900e1e8
3 changed files with 43 additions and 7 deletions
|
@ -834,8 +834,13 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
|
|||
return super.shouldUpRecreateTask(targetIntent);
|
||||
}
|
||||
|
||||
public boolean abShowing = true;
|
||||
public ValueAnimator abAnimator = null;
|
||||
|
||||
public boolean isActionBarShown() {
|
||||
return abShowing;
|
||||
}
|
||||
|
||||
public void showActionBar(boolean show) {
|
||||
ViewGroup abv = findViewById(R.id.action_bar);
|
||||
if (abv == null) {
|
||||
|
@ -847,6 +852,10 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
|
|||
else
|
||||
ab.hide();
|
||||
} else {
|
||||
if (abShowing == show)
|
||||
return;
|
||||
abShowing = show;
|
||||
|
||||
int height = Helper.getActionBarHeight(this);
|
||||
int current = abv.getLayoutParams().height;
|
||||
int target = (show ? height : 0);
|
||||
|
|
|
@ -106,6 +106,14 @@ public class FragmentBase extends Fragment {
|
|||
return null;
|
||||
}
|
||||
|
||||
protected boolean isActionBarShown() {
|
||||
FragmentActivity activity = getActivity();
|
||||
if (activity instanceof ActivityBase)
|
||||
return ((ActivityBase) activity).isActionBarShown();
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void showActionBar(boolean show) {
|
||||
FragmentActivity activity = getActivity();
|
||||
if (activity instanceof ActivityBase)
|
||||
|
|
|
@ -771,6 +771,21 @@ public class FragmentMessages extends FragmentBase
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLayoutCompleted(RecyclerView.State state) {
|
||||
super.onLayoutCompleted(state);
|
||||
if (!isActionBarShown())
|
||||
try {
|
||||
int range = computeVerticalScrollRange(state);
|
||||
int extend = computeVerticalScrollExtent(state);
|
||||
boolean canScrollVertical = (range > extend);
|
||||
if (!canScrollVertical) // anymore
|
||||
showActionBar(true);
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemsAdded(@NonNull RecyclerView recyclerView, int positionStart, int itemCount) {
|
||||
iProperties.layoutChanged();
|
||||
|
@ -1122,13 +1137,17 @@ public class FragmentMessages extends FragmentBase
|
|||
}
|
||||
}
|
||||
|
||||
if (hide_toolbar && dy != 0) {
|
||||
int range = rv.computeVerticalScrollRange();
|
||||
int extend = rv.computeVerticalScrollExtent();
|
||||
int offset = rv.computeVerticalScrollOffset();
|
||||
boolean canScrollVertical = (range > extend);
|
||||
show = (!canScrollVertical || (offset == 0 || dy < 0));
|
||||
}
|
||||
if (hide_toolbar && dy != 0)
|
||||
try {
|
||||
int range = rv.computeVerticalScrollRange();
|
||||
int extend = rv.computeVerticalScrollExtent();
|
||||
boolean canScrollVertical = (range > extend);
|
||||
show = (!canScrollVertical ||
|
||||
(dy < 0 || rv.computeVerticalScrollOffset() == 0));
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
show = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue