OSDN Git Service

The row is now labeling the expand button
authorSelim Cinek <cinek@google.com>
Thu, 6 Apr 2017 00:06:02 +0000 (17:06 -0700)
committerSelim Cinek <cinek@google.com>
Mon, 17 Apr 2017 21:55:52 +0000 (14:55 -0700)
To create a clear connection between the expand button
and the notification.

Test: manual, listen to expand button
Change-Id: I399c66af1252f1078895c65603eaa83003a3a819
Fixes: 35064589

core/java/com/android/internal/widget/NotificationExpandButton.java
packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationHeaderViewWrapper.java

index c64ace4..b702898 100644 (file)
@@ -20,6 +20,7 @@ import android.annotation.Nullable;
 import android.content.Context;
 import android.graphics.Rect;
 import android.util.AttributeSet;
+import android.view.View;
 import android.view.accessibility.AccessibilityNodeInfo;
 import android.widget.Button;
 import android.widget.ImageView;
@@ -30,6 +31,8 @@ import android.widget.RemoteViews;
  */
 @RemoteViews.RemoteView
 public class NotificationExpandButton extends ImageView {
+    private View mLabeledBy;
+
     public NotificationExpandButton(Context context) {
         super(context);
     }
@@ -66,5 +69,12 @@ public class NotificationExpandButton extends ImageView {
     public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
         super.onInitializeAccessibilityNodeInfo(info);
         info.setClassName(Button.class.getName());
+        if (mLabeledBy != null) {
+            info.setLabeledBy(mLabeledBy);
+        }
+    }
+
+    public void setLabeledBy(View labeledBy) {
+        mLabeledBy = labeledBy;
     }
 }
index 1ffc944..0b9244a 100644 (file)
@@ -29,6 +29,7 @@ import android.view.animation.PathInterpolator;
 import android.widget.ImageView;
 import android.widget.TextView;
 
+import com.android.internal.widget.NotificationExpandButton;
 import com.android.systemui.Interpolators;
 import com.android.systemui.ViewInvertHelper;
 import com.android.systemui.statusbar.ExpandableNotificationRow;
@@ -54,7 +55,7 @@ public class NotificationHeaderViewWrapper extends NotificationViewWrapper {
     protected int mColor;
     private ImageView mIcon;
 
-    private ImageView mExpandButton;
+    private NotificationExpandButton mExpandButton;
     private NotificationHeaderView mNotificationHeader;
     private TextView mHeaderText;
     private ImageView mWorkProfileImage;
@@ -106,13 +107,13 @@ public class NotificationHeaderViewWrapper extends NotificationViewWrapper {
     }
 
     protected void resolveHeaderViews() {
-        mIcon = (ImageView) mView.findViewById(com.android.internal.R.id.icon);
-        mHeaderText = (TextView) mView.findViewById(com.android.internal.R.id.header_text);
-        mExpandButton = (ImageView) mView.findViewById(com.android.internal.R.id.expand_button);
-        mWorkProfileImage = (ImageView) mView.findViewById(com.android.internal.R.id.profile_badge);
+        mIcon = mView.findViewById(com.android.internal.R.id.icon);
+        mHeaderText = mView.findViewById(com.android.internal.R.id.header_text);
+        mExpandButton = mView.findViewById(com.android.internal.R.id.expand_button);
+        mExpandButton.setLabeledBy(mRow);
+        mWorkProfileImage = mView.findViewById(com.android.internal.R.id.profile_badge);
         mColor = resolveColor(mExpandButton);
-        mNotificationHeader = (NotificationHeaderView) mView.findViewById(
-                com.android.internal.R.id.notification_header);
+        mNotificationHeader = mView.findViewById(com.android.internal.R.id.notification_header);
         getDozer().setColor(mColor);
     }