Skip to content

Commit e1d4efc

Browse files
committed
Fix: Fix issue due to edge-to-edge enforcement on Android V
1 parent 6f901ba commit e1d4efc

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

app/src/main/java/me/zhanghai/android/textselectionwebsearch/SettingsActivity.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@
66
package me.zhanghai.android.textselectionwebsearch;
77

88
import android.content.SharedPreferences;
9+
import android.os.Build;
910
import android.os.Bundle;
1011
import android.preference.Preference;
1112
import android.preference.PreferenceActivity;
1213
import android.preference.PreferenceScreen;
1314
import android.text.TextUtils;
15+
import android.view.ViewGroup;
1416

1517
import androidx.annotation.NonNull;
1618
import androidx.annotation.Nullable;
@@ -27,6 +29,14 @@ public class SettingsActivity extends PreferenceActivity
2729
protected void onCreate(@Nullable Bundle savedInstanceState) {
2830
super.onCreate(savedInstanceState);
2931

32+
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.VANILLA_ICE_CREAM) {
33+
// Work around the issue that the fix for edge-to-edge enforcement
34+
// https://android.googlesource.com/platform/frameworks/base/+/213033ecf41f17aebd766abfa7af7c789f245ff7
35+
// is only available on V QPR2 and above.
36+
final ViewGroup contentView = requireViewById(android.R.id.content);
37+
contentView.getChildAt(0).setFitsSystemWindows(true);
38+
}
39+
3040
addPreferencesFromResource(R.xml.settings);
3141

3242
// android.R.attr.preferenceListStyle isn't a public API.

0 commit comments

Comments
 (0)