Skip to content

Commit

Permalink
Merge pull request #3985 from seelchen/bugfix/fab-confirm-scrolling
Browse files Browse the repository at this point in the history
Fix "Confirm Selection" FAB scrolling bug
  • Loading branch information
VishalNehra authored Nov 26, 2023
2 parents 6a6080a + da96e8a commit 65e196a
Showing 1 changed file with 19 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1531,21 +1531,27 @@ public SpeedDialView getFAB() {
}

public void showFab() {
getFAB().setVisibility(View.VISIBLE);
getFAB().show();
CoordinatorLayout.LayoutParams params =
(CoordinatorLayout.LayoutParams) getFAB().getLayoutParams();
showFab(getFAB());
}

private void showFab(SpeedDialView fab) {
fab.setVisibility(View.VISIBLE);
fab.show();
CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) fab.getLayoutParams();
params.setBehavior(new SpeedDialView.ScrollingViewSnackbarBehavior());
getFAB().requestLayout();
fab.requestLayout();
}

public void hideFab() {
getFAB().setVisibility(View.GONE);
getFAB().hide();
CoordinatorLayout.LayoutParams params =
(CoordinatorLayout.LayoutParams) getFAB().getLayoutParams();
hideFab(getFAB());
}

private void hideFab(SpeedDialView fab) {
fab.setVisibility(View.GONE);
fab.hide();
CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) fab.getLayoutParams();
params.setBehavior(new SpeedDialView.NoBehavior());
getFAB().requestLayout();
fab.requestLayout();
}

public AppBar getAppbar() {
Expand Down Expand Up @@ -1917,7 +1923,7 @@ private FabWithLabelView initFabTitle(

private void initialiseFabConfirmSelection() {
fabConfirmSelection = findViewById(R.id.fabs_confirm_selection);
fabConfirmSelection.hide();
hideFabConfirmSelection();
if (mReturnIntent) {
int colorAccent = getAccent();
fabConfirmSelection.setMainFabClosedBackgroundColor(colorAccent);
Expand Down Expand Up @@ -1952,13 +1958,13 @@ public void onToggleChanged(boolean isOpen) {}
*/
public void showFabConfirmSelection() {
if (mReturnIntent) {
fabConfirmSelection.show();
showFab(fabConfirmSelection);
}
}

/** Hides the floating action button which confirms the selection */
public void hideFabConfirmSelection() {
fabConfirmSelection.hide();
hideFab(fabConfirmSelection);
}

public boolean copyToClipboard(Context context, String text) {
Expand Down

0 comments on commit 65e196a

Please sign in to comment.