summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author felkachang <felkachang@google.com> 2018-07-04 12:51:44 +0800
committer Felka Chang <felkachang@google.com> 2018-11-07 03:40:25 +0000
commit6d1eca3c851202efe52d2a68a0c1e4a8809198f0 (patch)
tree0a6b91a2b6064a8864f0f51ea7506d651c17ce31
parent29226627d0898713558c4e03d237d100796d7d53 (diff)
Fix EditText show wrong position when ime show
In landscape and largest density, the area that could show the heads up notification is smaller than normal density. To handle the heads up notification should be different with the normal notification in both of targetScrollForView and getScrollRange because StackScrollAlgorithm translation heads up notification as mHeadsUpInset but neither targetScrollForView nor getScrollRange has have the same consideration. The solution make the StackScrollAlgorithm to considerate scroll value to move up the heads up notification. The getScrollRange need to consider more about the difference between heads up showing and non-heads up showing. The top padding and the total content height are the major considerations. Test: manual test Test: atest SystemUITests Change-Id: I46bb960a81f6ab5be4d8e39738e8fb64245dd4eb Merged-In: I46bb960a81f6ab5be4d8e39738e8fb64245dd4eb Fixes: 110388615 (cherry picked from commit 529bfe6f0a4c5a8683b4dc6a6256b30f7e08bc16)
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java13
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java9
2 files changed, 19 insertions, 3 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
index ff4f215b482f..5727b9a0328e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
@@ -1421,7 +1421,8 @@ public class NotificationStackScrollLayout extends ViewGroup
*/
private int targetScrollForView(ExpandableView v, int positionInLinearLayout) {
return positionInLinearLayout + v.getIntrinsicHeight() +
- getImeInset() - getHeight() + getTopPadding();
+ getImeInset() - getHeight()
+ + ((!isExpanded() && isPinnedHeadsUp(v)) ? mHeadsUpInset : getTopPadding());
}
@Override
@@ -2052,9 +2053,15 @@ public class NotificationStackScrollLayout extends ViewGroup
}
private int getScrollRange() {
- int scrollRange = Math.max(0, mContentHeight - mMaxLayoutHeight);
+ // In current design, it only use the top HUN to treat all of HUNs
+ // although there are more than one HUNs
+ int contentHeight = mContentHeight;
+ if (!isExpanded() && mHeadsUpManager.hasPinnedHeadsUp()) {
+ contentHeight = mHeadsUpInset + getTopHeadsUpPinnedHeight();
+ }
+ int scrollRange = Math.max(0, contentHeight - mMaxLayoutHeight);
int imeInset = getImeInset();
- scrollRange += Math.min(imeInset, Math.max(0, mContentHeight - (getHeight() - imeInset)));
+ scrollRange += Math.min(imeInset, Math.max(0, contentHeight - (getHeight() - imeInset)));
return scrollRange;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java
index 0d50f5a9eef7..05870e851d14 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java
@@ -473,6 +473,15 @@ public class StackScrollAlgorithm {
childState.yTranslation = topState.yTranslation + topState.height
- childState.height;
}
+
+ // heads up notification show and this row is the top entry of heads up
+ // notifications. i.e. this row should be the only one row that has input field
+ // To check if the row need to do translation according to scroll Y
+ // heads up show full of row's content and any scroll y indicate that the
+ // translationY need to move up the HUN.
+ if (!mIsExpanded && isTopEntry && ambientState.getScrollY() > 0) {
+ childState.yTranslation -= ambientState.getScrollY();
+ }
}
if (row.isHeadsUpAnimatingAway()) {
childState.hidden = false;