diff --git a/app/src/main/java/dev/aldi/sayuti/editor/manage/ManageLocalLibraryActivity.java b/app/src/main/java/dev/aldi/sayuti/editor/manage/ManageLocalLibraryActivity.java index cdbcbbc24f..707bc35686 100644 --- a/app/src/main/java/dev/aldi/sayuti/editor/manage/ManageLocalLibraryActivity.java +++ b/app/src/main/java/dev/aldi/sayuti/editor/manage/ManageLocalLibraryActivity.java @@ -67,7 +67,8 @@ protected void onCreate(Bundle savedInstanceState) { binding = ManageLocallibrariesBinding.inflate(getLayoutInflater()); setContentView(binding.getRoot()); - ViewCompat.setOnApplyWindowInsetsListener(binding.downloadLibraryButton, new AddMarginOnApplyWindowInsetsListener(WindowInsetsCompat.Type.navigationBars(), WindowInsetsCompat.CONSUMED)); + ViewCompat.setOnApplyWindowInsetsListener(binding.downloadLibraryButton, + new AddMarginOnApplyWindowInsetsListener(WindowInsetsCompat.Type.navigationBars() | WindowInsetsCompat.Type.ime())); if (getIntent().hasExtra("sc_id")) { String scId = Objects.requireNonNull(getIntent().getStringExtra("sc_id")); diff --git a/app/src/main/java/mod/jbk/util/AddMarginOnApplyWindowInsetsListener.java b/app/src/main/java/mod/jbk/util/AddMarginOnApplyWindowInsetsListener.java index ffbe9f9b13..8772f4c599 100644 --- a/app/src/main/java/mod/jbk/util/AddMarginOnApplyWindowInsetsListener.java +++ b/app/src/main/java/mod/jbk/util/AddMarginOnApplyWindowInsetsListener.java @@ -15,6 +15,13 @@ public class AddMarginOnApplyWindowInsetsListener implements OnApplyWindowInsets private final int insetsTypeMask; private final WindowInsetsCompat returnValue; + /** + * @param insetsTypeMask Bit mask of {@link WindowInsetsCompat.Type}s to query the insets for. + */ + public AddMarginOnApplyWindowInsetsListener(int insetsTypeMask) { + this(insetsTypeMask, null); + } + /** * @param insetsTypeMask Bit mask of {@link WindowInsetsCompat.Type}s to query the insets for. * @param returnValue What {@link #onApplyWindowInsets(View, WindowInsetsCompat)} should return. @@ -36,6 +43,6 @@ public WindowInsetsCompat onApplyWindowInsets(@NonNull View v, @NonNull WindowIn } else { throw new IllegalArgumentException("View's layout params must extend ViewGroup.MarginLayoutParams"); } - return returnValue; + return returnValue != null ? returnValue : insets; } }