mirror of
https://github.com/M66B/FairEmail.git
synced 2026-05-18 13:08:16 +02:00
Apply insets for snackbar
This commit is contained in:
@@ -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();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user