diff options
author | Selim Cinek <cinek@google.com> | 2015-03-13 21:49:12 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-03-13 21:49:29 +0000 |
commit | 920752e98af46e272f1b592e5aed690905e0495a (patch) | |
tree | 2c5180ed54333f42afb56c866f148ff63db58b0b /packages/SystemUI | |
parent | a8670ff3df722668806b854dfcd719aff3639807 (diff) | |
parent | ab29aebf00a0ebd286a92d129f35c182b6888f3b (diff) | |
download | frameworks_base-920752e98af46e272f1b592e5aed690905e0495a.zip frameworks_base-920752e98af46e272f1b592e5aed690905e0495a.tar.gz frameworks_base-920752e98af46e272f1b592e5aed690905e0495a.tar.bz2 |
Merge "Refactored guts inflating for notifications"
Diffstat (limited to 'packages/SystemUI')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java | 16 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java | 16 |
2 files changed, 20 insertions, 12 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index 6b2e546..d92ae44 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -73,7 +73,6 @@ import android.view.ViewAnimationUtils; import android.view.ViewGroup; import android.view.ViewGroup.LayoutParams; import android.view.ViewParent; -import android.view.ViewStub; import android.view.WindowManager; import android.view.WindowManagerGlobal; import android.view.accessibility.AccessibilityManager; @@ -846,16 +845,13 @@ public abstract class BaseStatusBar extends SystemUI implements }, false /* afterKeyguardGone */); } - private void inflateGuts(ExpandableNotificationRow row) { - ViewStub stub = (ViewStub) row.findViewById(R.id.notification_guts_stub); - if (stub != null) { - stub.inflate(); - } + private void bindGuts(ExpandableNotificationRow row) { + row.inflateGuts(); final StatusBarNotification sbn = row.getStatusBarNotification(); PackageManager pmUser = getPackageManagerForUser( sbn.getUser().getIdentifier()); row.setTag(sbn.getPackageName()); - final View guts = row.findViewById(R.id.notification_guts); + final View guts = row.getGuts(); final String pkg = sbn.getPackageName(); String appname = pkg; Drawable pkgicon = null; @@ -933,11 +929,11 @@ public abstract class BaseStatusBar extends SystemUI implements return false; } - inflateGuts((ExpandableNotificationRow) v); + ExpandableNotificationRow row = (ExpandableNotificationRow) v; + bindGuts(row); // Assume we are a status_bar_notification_row - final NotificationGuts guts = (NotificationGuts) v.findViewById( - R.id.notification_guts); + final NotificationGuts guts = row.getGuts(); if (guts == null) { // This view has no guts. Examples are the more card or the dismiss all view return false; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java index 0766549..788db29 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java @@ -69,6 +69,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { private StatusBarNotification mStatusBarNotification; private boolean mIsHeadsUp; + private ViewStub mGutsStub; public void setIconAnimationRunning(boolean running) { setIconAnimationRunning(running, mPublicLayout); @@ -128,6 +129,10 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { mIsHeadsUp = isHeadsUp; } + public NotificationGuts getGuts() { + return mGuts; + } + public interface ExpansionLogger { public void logNotificationExpansion(String key, boolean userAction, boolean expanded); } @@ -179,18 +184,25 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { super.onFinishInflate(); mPublicLayout = (NotificationContentView) findViewById(R.id.expandedPublic); mPrivateLayout = (NotificationContentView) findViewById(R.id.expanded); - ViewStub gutsStub = (ViewStub) findViewById(R.id.notification_guts_stub); - gutsStub.setOnInflateListener(new ViewStub.OnInflateListener() { + mGutsStub = (ViewStub) findViewById(R.id.notification_guts_stub); + mGutsStub.setOnInflateListener(new ViewStub.OnInflateListener() { @Override public void onInflate(ViewStub stub, View inflated) { mGuts = (NotificationGuts) inflated; mGuts.setClipTopAmount(getClipTopAmount()); mGuts.setActualHeight(getActualHeight()); + mGutsStub = null; } }); mVetoButton = findViewById(R.id.veto); } + public void inflateGuts() { + if (mGuts == null) { + mGutsStub.inflate(); + } + } + @Override public boolean onRequestSendAccessibilityEventInternal(View child, AccessibilityEvent event) { if (super.onRequestSendAccessibilityEventInternal(child, event)) { |