mirror of
https://github.com/Docile-Alligator/Infinity-For-Reddit.git
synced 2026-02-05 01:25:37 +00:00
ViewCompat.setOnApplyWindowInsetsListener in SearchActivity.
This commit is contained in:
@ -20,6 +20,10 @@ import androidx.activity.result.ActivityResultLauncher;
|
||||
import androidx.activity.result.contract.ActivityResultContracts;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.OnApplyWindowInsetsListener;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
import androidx.core.view.inputmethod.EditorInfoCompat;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
@ -139,6 +143,38 @@ public class SearchActivity extends BaseActivity {
|
||||
Slidr.attach(this);
|
||||
}
|
||||
|
||||
if (isImmersiveInterface()) {
|
||||
if (isChangeStatusBarIconColor()) {
|
||||
addOnOffsetChangedListener(binding.appbarLayoutSearchActivity);
|
||||
}
|
||||
|
||||
ViewCompat.setOnApplyWindowInsetsListener(binding.getRoot(), new OnApplyWindowInsetsListener() {
|
||||
@NonNull
|
||||
@Override
|
||||
public WindowInsetsCompat onApplyWindowInsets(@NonNull View v, @NonNull WindowInsetsCompat insets) {
|
||||
Insets allInsets = insets.getInsets(
|
||||
WindowInsetsCompat.Type.systemBars()
|
||||
| WindowInsetsCompat.Type.displayCutout()
|
||||
);
|
||||
|
||||
setMargins(binding.toolbar,
|
||||
allInsets.left,
|
||||
allInsets.top,
|
||||
allInsets.right,
|
||||
BaseActivity.IGNORE_MARGIN);
|
||||
|
||||
binding.nestedScrollViewSearchActivity.setPadding(
|
||||
allInsets.left,
|
||||
0,
|
||||
allInsets.right,
|
||||
allInsets.bottom
|
||||
);
|
||||
|
||||
return WindowInsetsCompat.CONSUMED;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setSupportActionBar(binding.toolbar);
|
||||
|
||||
binding.clearSearchEditViewSearchActivity.setVisibility(View.GONE);
|
||||
|
||||
@ -67,8 +67,10 @@
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/nested_scroll_view_search_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clipToPadding="false"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<LinearLayout
|
||||
|
||||
Reference in New Issue
Block a user