mirror of
https://gitlab.com/oeffi/oeffi.git
synced 2025-07-07 06:08:51 +00:00
MyActionBar: Use window inset listener for top inset, rather than the status bar height dimension.
This commit is contained in:
parent
fcd08d55c8
commit
0d9fb4abd4
1 changed files with 5 additions and 5 deletions
|
@ -67,6 +67,11 @@ public class MyActionBar extends LinearLayout {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.res = getResources();
|
this.res = getResources();
|
||||||
inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
|
|
||||||
|
setOnApplyWindowInsetsListener((v, insets) -> {
|
||||||
|
v.setPadding(0, insets.getSystemWindowInsetTop(), 0, 0);
|
||||||
|
return insets;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -81,11 +86,6 @@ public class MyActionBar extends LinearLayout {
|
||||||
progressView = findViewById(R.id.action_bar_progress);
|
progressView = findViewById(R.id.action_bar_progress);
|
||||||
progressButton = findViewById(R.id.action_bar_progress_button);
|
progressButton = findViewById(R.id.action_bar_progress_button);
|
||||||
progressImage = findViewById(R.id.action_bar_progress_image);
|
progressImage = findViewById(R.id.action_bar_progress_image);
|
||||||
|
|
||||||
// Make sure action bar isn't stuck under a transparent status bar.
|
|
||||||
final int statusHeight = res
|
|
||||||
.getDimensionPixelSize(res.getIdentifier("status_bar_height", "dimen", "android"));
|
|
||||||
setPadding(getPaddingLeft(), getPaddingTop() + statusHeight, getPaddingRight(), getPaddingBottom());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDrawer(final OnClickListener onClickListener) {
|
public void setDrawer(final OnClickListener onClickListener) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue