Refactored guts inflating for notifications
Change-Id: I80f6a3cc93e107e0909034b58d0939271e54f3e2
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user