mirror of
https://github.com/Docile-Alligator/Infinity-For-Reddit.git
synced 2025-10-29 19:44:40 +00:00
Fix UI issues related to insets in AcknowledgementFragment and TranslationFragment.
This commit is contained in:
parent
8ac338ef44
commit
dd081e543f
@ -9,6 +9,10 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.OnApplyWindowInsetsListener;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -117,6 +121,21 @@ public class AcknowledgementFragment extends Fragment {
|
||||
|
||||
binding.getRoot().setBackgroundColor(activity.customThemeWrapper.getBackgroundColor());
|
||||
|
||||
if (activity.isImmersiveInterface()) {
|
||||
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()
|
||||
);
|
||||
binding.getRoot().setPadding(allInsets.left, 0, allInsets.right, allInsets.bottom);
|
||||
return WindowInsetsCompat.CONSUMED;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
|
||||
@ -7,6 +7,10 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.OnApplyWindowInsetsListener;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@ -40,6 +44,21 @@ public class TranslationFragment extends Fragment {
|
||||
|
||||
binding.getRoot().setBackgroundColor(customThemeWrapper.getBackgroundColor());
|
||||
|
||||
if (activity.isImmersiveInterface()) {
|
||||
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()
|
||||
);
|
||||
binding.getRoot().setPadding(allInsets.left, 0, allInsets.right, allInsets.bottom);
|
||||
return WindowInsetsCompat.CONSUMED;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
|
||||
@ -2,4 +2,5 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clipToPadding="false"
|
||||
tools:context="ml.docilealligator.infinityforreddit.settings.AcknowledgementFragment" />
|
||||
|
||||
@ -5,4 +5,5 @@
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
app:layoutManager="ml.docilealligator.infinityforreddit.customviews.LinearLayoutManagerBugFixed"
|
||||
android:clipToPadding="false"
|
||||
tools:context=".settings.TranslationFragment" />
|
||||
Loading…
x
Reference in New Issue
Block a user