Merge "Set background of legacy custom notifications views to dark."
This commit is contained in:
@@ -15,7 +15,9 @@
|
||||
~ limitations under the License
|
||||
-->
|
||||
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#ffcccccc" />
|
||||
<corners android:radius="2dp" />
|
||||
</shape>
|
||||
<touch-feedback
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:tint="#ff444444"
|
||||
>
|
||||
<item android:drawable="@drawable/notification_bg_normal" />
|
||||
</touch-feedback>
|
||||
@@ -1092,6 +1092,7 @@
|
||||
<java-symbol type="drawable" name="unlock_ring" />
|
||||
<java-symbol type="drawable" name="unlock_wave" />
|
||||
<java-symbol type="drawable" name="notification_bg" />
|
||||
<java-symbol type="drawable" name="notification_bg_dim" />
|
||||
<java-symbol type="drawable" name="notification_bg_low" />
|
||||
<java-symbol type="drawable" name="notification_template_icon_bg" />
|
||||
<java-symbol type="drawable" name="notification_template_icon_low_bg" />
|
||||
|
||||
@@ -423,9 +423,9 @@ public abstract class BaseStatusBar extends SystemUI implements
|
||||
}
|
||||
|
||||
|
||||
protected void applyLegacyRowBackground(StatusBarNotification sbn, View content) {
|
||||
if (sbn.getNotification().contentView.getLayoutId() !=
|
||||
com.android.internal.R.layout.notification_template_base) {
|
||||
protected void applyLegacyRowBackground(StatusBarNotification sbn,
|
||||
NotificationData.Entry entry) {
|
||||
if (entry.expanded.getId() != com.android.internal.R.id.status_bar_latest_event_content) {
|
||||
int version = 0;
|
||||
try {
|
||||
ApplicationInfo info = mContext.getPackageManager().getApplicationInfo(sbn.getPackageName(), 0);
|
||||
@@ -434,7 +434,11 @@ public abstract class BaseStatusBar extends SystemUI implements
|
||||
Log.e(TAG, "Failed looking up ApplicationInfo for " + sbn.getPackageName(), ex);
|
||||
}
|
||||
if (version > 0 && version < Build.VERSION_CODES.GINGERBREAD) {
|
||||
content.setBackgroundResource(R.drawable.notification_row_legacy_bg);
|
||||
entry.row.setBackgroundResource(R.drawable.notification_row_legacy_bg);
|
||||
} else if (version < Build.VERSION_CODES.L) {
|
||||
entry.row.setBackgroundResourceIds(
|
||||
com.android.internal.R.drawable.notification_bg,
|
||||
com.android.internal.R.drawable.notification_bg_dim);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -869,8 +873,6 @@ public abstract class BaseStatusBar extends SystemUI implements
|
||||
|
||||
row.setDrawingCacheEnabled(true);
|
||||
|
||||
applyLegacyRowBackground(sbn, content);
|
||||
|
||||
if (MULTIUSER_DEBUG) {
|
||||
TextView debug = (TextView) row.findViewById(R.id.debug_info);
|
||||
if (debug != null) {
|
||||
@@ -885,6 +887,8 @@ public abstract class BaseStatusBar extends SystemUI implements
|
||||
entry.expandedPublic = publicViewLocal;
|
||||
entry.setBigContentView(bigContentViewLocal);
|
||||
|
||||
applyLegacyRowBackground(sbn, entry);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -219,4 +219,14 @@ public class ExpandableNotificationRow extends FrameLayout {
|
||||
public void setLocked(boolean locked) {
|
||||
mLatestItemView.setLocked(locked);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the resource id for the background of this notification.
|
||||
*
|
||||
* @param bgResId The background resource to use in normal state.
|
||||
* @param dimmedBgResId The background resource to use in dimmed state.
|
||||
*/
|
||||
public void setBackgroundResourceIds(int bgResId, int dimmedBgResId) {
|
||||
mLatestItemView.setBackgroundResourceIds(bgResId, dimmedBgResId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@ import android.view.ViewConfiguration;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import com.android.internal.R;
|
||||
|
||||
public class LatestItemView extends FrameLayout {
|
||||
|
||||
private static final long DOUBLETAP_TIMEOUT_MS = 1000;
|
||||
@@ -32,6 +34,9 @@ public class LatestItemView extends FrameLayout {
|
||||
private boolean mDimmed;
|
||||
private boolean mLocked;
|
||||
|
||||
private int mBgResId = R.drawable.notification_quantum_bg;
|
||||
private int mDimmedBgResId = R.drawable.notification_quantum_bg_dim;
|
||||
|
||||
/**
|
||||
* Flag to indicate that the notification has been touched once and the second touch will
|
||||
* click it.
|
||||
@@ -148,11 +153,7 @@ public class LatestItemView extends FrameLayout {
|
||||
public void setDimmed(boolean dimmed) {
|
||||
if (mDimmed != dimmed) {
|
||||
mDimmed = dimmed;
|
||||
if (dimmed) {
|
||||
setBackgroundResource(com.android.internal.R.drawable.notification_quantum_bg_dim);
|
||||
} else {
|
||||
setBackgroundResource(com.android.internal.R.drawable.notification_quantum_bg);
|
||||
}
|
||||
updateBackgroundResource();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,4 +164,20 @@ public class LatestItemView extends FrameLayout {
|
||||
public void setLocked(boolean locked) {
|
||||
mLocked = locked;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the resource id for the background of this notification.
|
||||
*
|
||||
* @param bgResId The background resource to use in normal state.
|
||||
* @param dimmedBgResId The background resource to use in dimmed state.
|
||||
*/
|
||||
public void setBackgroundResourceIds(int bgResId, int dimmedBgResId) {
|
||||
mBgResId = bgResId;
|
||||
mDimmedBgResId = dimmedBgResId;
|
||||
updateBackgroundResource();
|
||||
}
|
||||
|
||||
private void updateBackgroundResource() {
|
||||
setBackgroundResource(mDimmed ? mDimmedBgResId : mBgResId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user