diff options
| author | 2019-12-09 13:54:13 +0000 | |
|---|---|---|
| committer | 2019-12-09 13:54:13 +0000 | |
| commit | d6c8280a7d55f88a55bb7f72426cd1b4ee79c683 (patch) | |
| tree | 8bdab941d8f140736cc27948787d966341567f34 | |
| parent | 1222d756d14cce83b4fa44e776fbb3caef0f04c4 (diff) | |
| parent | 95ede7fb5380a2f862175114f9e74916652d1fa8 (diff) | |
[DO NOT MERGE] Resolver/Chooser - Window inset fixes am: 95ede7fb53
Change-Id: I77a948f5599ee8c3453b758136ea13c62ad95e69
| -rw-r--r-- | core/java/com/android/internal/app/ChooserActivity.java | 6 | ||||
| -rw-r--r-- | core/java/com/android/internal/app/ResolverActivity.java | 20 |
2 files changed, 23 insertions, 3 deletions
diff --git a/core/java/com/android/internal/app/ChooserActivity.java b/core/java/com/android/internal/app/ChooserActivity.java index dfb266827903..346361a5120e 100644 --- a/core/java/com/android/internal/app/ChooserActivity.java +++ b/core/java/com/android/internal/app/ChooserActivity.java @@ -2566,6 +2566,12 @@ public class ChooserActivity extends ResolverActivity { } } + @Override + protected boolean shouldAddFooterView() { + // To accommodate for window insets + return true; + } + public class ChooserListAdapter extends ResolveListAdapter { public static final int TARGET_BAD = -1; public static final int TARGET_CALLER = 0; diff --git a/core/java/com/android/internal/app/ResolverActivity.java b/core/java/com/android/internal/app/ResolverActivity.java index 77f37e31a087..4c379d280616 100644 --- a/core/java/com/android/internal/app/ResolverActivity.java +++ b/core/java/com/android/internal/app/ResolverActivity.java @@ -386,14 +386,30 @@ public class ResolverActivity extends Activity { finish(); } + /** + * Numerous layouts are supported, each with optional ViewGroups. + * Make sure the inset gets added to the correct View, using + * a footer for Lists so it can properly scroll under the navbar. + */ + protected boolean shouldAddFooterView() { + if (useLayoutWithDefault()) return true; + + View buttonBar = findViewById(R.id.button_bar); + if (buttonBar == null || buttonBar.getVisibility() == View.GONE) return true; + + return false; + } + protected WindowInsets onApplyWindowInsets(View v, WindowInsets insets) { mSystemWindowInsets = insets.getSystemWindowInsets(); mResolverDrawerLayout.setPadding(mSystemWindowInsets.left, mSystemWindowInsets.top, mSystemWindowInsets.right, 0); + resetButtonBar(); + // Need extra padding so the list can fully scroll up - if (useLayoutWithDefault()) { + if (shouldAddFooterView()) { if (mFooterSpacer == null) { mFooterSpacer = new Space(getApplicationContext()); } else { @@ -411,8 +427,6 @@ public class ResolverActivity extends Activity { } } - resetButtonBar(); - return insets.consumeSystemWindowInsets(); } |