OSDN Git Service

More inline reply goodness
authorAdrian Roos <roosa@google.com>
Wed, 2 Dec 2015 01:37:14 +0000 (17:37 -0800)
committerAdrian Roos <roosa@google.com>
Wed, 2 Dec 2015 01:37:14 +0000 (17:37 -0800)
- Use expanded view instead of HUN when possible
- Remember partial replies
- Back properly closes IME without closing shade
- Fix broken reorder animation

Bug: 22452379
Change-Id: Idb6ca8aed27cfb1f3d9b46f59e148b1b3b112fa7

packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java
packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java

index 5aedaf1..46bd64e 100644 (file)
@@ -426,6 +426,11 @@ public class NotificationContentView extends FrameLayout {
      */
     private int calculateVisibleType() {
         boolean noExpandedChild = mExpandedChild == null;
+
+        if (!noExpandedChild && mContentHeight == mExpandedChild.getHeight()) {
+            return VISIBLE_TYPE_EXPANDED;
+        }
+
         if (mIsHeadsUp && mHeadsUpChild != null) {
             if (mContentHeight <= mHeadsUpChild.getHeight() || noExpandedChild) {
                 return VISIBLE_TYPE_HEADSUP;
index 83dbde5..89edae3 100644 (file)
@@ -59,6 +59,7 @@ public class NotificationData {
         public RemoteViews cachedBigContentView;
         public RemoteViews cachedHeadsUpContentView;
         public RemoteViews cachedPublicContentView;
+        public CharSequence remoteInputText;
 
         public Entry(StatusBarNotification n, StatusBarIconView ic) {
             this.key = n.getKey();
index acfe54d..22c0cb9 100644 (file)
@@ -148,6 +148,7 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
 
     public void onDefocus() {
         mController.removeRemoteInput(mEntry);
+        mEntry.remoteInputText = mEditText.getText();
         setVisibility(INVISIBLE);
     }
 
@@ -171,6 +172,8 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
         mEditText.setInnerFocusable(true);
         mController.addRemoteInput(mEntry);
         mEditText.mShowImeOnInputConnection = true;
+        mEditText.setText(mEntry.remoteInputText);
+        mEditText.setSelection(mEditText.getText().length());
         mEditText.requestFocus();
     }
 
@@ -216,8 +219,11 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
 
         @Override
         public boolean onKeyPreIme(int keyCode, KeyEvent event) {
-            if (keyCode == KeyEvent.KEYCODE_BACK) {
+            if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP) {
                 defocusIfNeeded();
+                final InputMethodManager imm = InputMethodManager.getInstance();
+                imm.hideSoftInputFromWindow(getWindowToken(), 0);
+                return true;
             }
             return super.onKeyPreIme(keyCode, event);
         }
index aeca97c..5672cac 100644 (file)
@@ -1860,7 +1860,7 @@ public class NotificationStackScrollLayout extends ViewGroup
             }
             mNeedsAnimation = true;
         }
-        if (isHeadsUp(child)) {
+        if (isHeadsUp(child) && !mChangePositionInProgress) {
             mAddedHeadsUpChildren.add(child);
             mChildrenToAddAnimated.remove(child);
         }