mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-03 05:34:51 +00:00
Apply insets for snackbar
This commit is contained in:
parent
01431c4538
commit
30da5ecb3a
2 changed files with 19 additions and 2 deletions
|
@ -152,6 +152,25 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
|
|||
holder.removeView(placeholder);
|
||||
holder.addView(view, placeholder.getLayoutParams());
|
||||
|
||||
if (edge_to_edge)
|
||||
holder.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
|
||||
private boolean has = false;
|
||||
|
||||
@Override
|
||||
public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
|
||||
try {
|
||||
Snackbar.SnackbarLayout sl = Helper.findSnackbarLayout(v.getRootView());
|
||||
boolean h = (sl != null);
|
||||
if (has != h) {
|
||||
has = h;
|
||||
v.requestApplyInsets();
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
int abh = Helper.getActionBarHeight(this);
|
||||
appbar.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
|
||||
@Override
|
||||
|
|
|
@ -1577,7 +1577,6 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
ViewGroup.MarginLayoutParams lparam = (ViewGroup.MarginLayoutParams) content.getLayoutParams();
|
||||
lparam.bottomMargin = snackbar.getView().getHeight();
|
||||
content.setLayoutParams(lparam);
|
||||
content.requestApplyInsets();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1585,7 +1584,6 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
ViewGroup.MarginLayoutParams lparam = (ViewGroup.MarginLayoutParams) content.getLayoutParams();
|
||||
lparam.bottomMargin = 0;
|
||||
content.setLayoutParams(lparam);
|
||||
content.requestApplyInsets();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue