use of com.android.systemui.statusbar.StatusBarIconView in project android_frameworks_base by ResurrectionRemix.
the class NotificationIconAreaController method applyNotificationIconsTint.
/**
* Applies {@link #mIconTint} to the notification icons.
*/
private void applyNotificationIconsTint() {
for (int i = 0; i < mNotificationIcons.getChildCount(); i++) {
StatusBarIconView v = (StatusBarIconView) mNotificationIcons.getChildAt(i);
boolean isPreL = Boolean.TRUE.equals(v.getTag(R.id.icon_is_pre_L));
boolean colorize = !isPreL || NotificationUtils.isGrayscale(v, mNotificationColorUtil);
if (colorize) {
v.setImageTintList(ColorStateList.valueOf(StatusBarIconController.getTint(mTintArea, v, mIconTint)));
}
}
}
use of com.android.systemui.statusbar.StatusBarIconView in project android_frameworks_base by ResurrectionRemix.
the class NotificationIconAreaController method updateNotificationIcons.
/**
* Updates the notifications with the given list of notifications to display.
*/
public void updateNotificationIcons(NotificationData notificationData) {
final LinearLayout.LayoutParams params = generateIconLayoutParams();
ArrayList<NotificationData.Entry> activeNotifications = notificationData.getActiveNotifications();
final int size = activeNotifications.size();
ArrayList<StatusBarIconView> toShow = new ArrayList<>(size);
// Filter out ambient notifications and notification children.
for (int i = 0; i < size; i++) {
NotificationData.Entry ent = activeNotifications.get(i);
if (shouldShowNotification(ent, notificationData)) {
toShow.add(ent.icon);
}
}
ArrayList<View> toRemove = new ArrayList<>();
for (int i = 0; i < mNotificationIcons.getChildCount(); i++) {
View child = mNotificationIcons.getChildAt(i);
if (!toShow.contains(child)) {
toRemove.add(child);
}
}
final int toRemoveCount = toRemove.size();
for (int i = 0; i < toRemoveCount; i++) {
mNotificationIcons.removeView(toRemove.get(i));
}
for (int i = 0; i < toShow.size(); i++) {
View v = toShow.get(i);
if (v.getParent() == null) {
mNotificationIcons.addView(v, i, params);
}
}
// Re-sort notification icons
final int childCount = mNotificationIcons.getChildCount();
for (int i = 0; i < childCount; i++) {
View actual = mNotificationIcons.getChildAt(i);
StatusBarIconView expected = toShow.get(i);
if (actual == expected) {
continue;
}
mNotificationIcons.removeView(expected);
mNotificationIcons.addView(expected, i);
}
applyNotificationIconsTint();
}
use of com.android.systemui.statusbar.StatusBarIconView in project android_frameworks_base by DirtyUnicorns.
the class StatusBarIconController method applyIconTint.
private void applyIconTint() {
for (int i = 0; i < mStatusIcons.getChildCount(); i++) {
StatusBarIconView v = (StatusBarIconView) mStatusIcons.getChildAt(i);
v.setImageTintList(ColorStateList.valueOf(getTint(mTintArea, v, mIconTint)));
}
mSignalCluster.setIconTint(mIconTint, mDarkIntensity, mTintArea);
mBatteryMeterView.setDarkIntensity(isInArea(mTintArea, mBatteryMeterView) ? mDarkIntensity : 0);
mClock.setTextColor(getTint(mTintArea, mClock, mIconTint));
mCenterClock.setTextColor(getTint(mTintArea, mCenterClock, mIconTint));
mLeftClock.setTextColor(getTint(mTintArea, mLeftClock, mIconTint));
mNetworkTraffic.setDarkIntensity(mDarkIntensity);
mCarrierLabel.setTextColor(getTint(mTintArea, mCarrierLabel, mIconTint));
mDuLogo.setImageTintList(ColorStateList.valueOf(mIconTint));
mBatteryLevelView.setTextColor(getTint(mTintArea, mBatteryLevelView, mIconTint));
if (mNotificationTicker != null)
mNotificationTicker.setDarkIntensity(mDarkIntensity);
}
use of com.android.systemui.statusbar.StatusBarIconView in project android_frameworks_base by DirtyUnicorns.
the class StatusBarIconController method addSystemIcon.
private void addSystemIcon(int index, StatusBarIcon icon) {
String slot = getSlot(index);
int viewIndex = getViewIndex(index);
boolean blocked = mIconBlacklist.contains(slot);
StatusBarIconView view = new StatusBarIconView(mContext, slot, null, blocked);
view.set(icon);
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, mIconSize);
lp.setMargins(mIconHPadding, 0, mIconHPadding, 0);
mStatusIcons.addView(view, viewIndex, lp);
view = new StatusBarIconView(mContext, slot, null, blocked);
view.set(icon);
mStatusIconsKeyguard.addView(view, viewIndex, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, mIconSize));
applyIconTint();
}
use of com.android.systemui.statusbar.StatusBarIconView in project android_frameworks_base by DirtyUnicorns.
the class DemoStatusIcons method updateSlot.
private void updateSlot(String slot, String iconPkg, int iconId) {
if (!mDemoMode)
return;
if (iconPkg == null) {
iconPkg = mContext.getPackageName();
}
int removeIndex = -1;
for (int i = 0; i < getChildCount(); i++) {
StatusBarIconView v = (StatusBarIconView) getChildAt(i);
if (slot.equals(v.getTag())) {
if (iconId == 0) {
removeIndex = i;
break;
} else {
StatusBarIcon icon = v.getStatusBarIcon();
icon.icon = Icon.createWithResource(icon.icon.getResPackage(), iconId);
v.set(icon);
v.updateDrawable();
return;
}
}
}
if (iconId == 0) {
if (removeIndex != -1) {
removeViewAt(removeIndex);
}
return;
}
StatusBarIcon icon = new StatusBarIcon(iconPkg, UserHandle.SYSTEM, iconId, 0, 0, "Demo");
StatusBarIconView v = new StatusBarIconView(getContext(), null, null);
v.setTag(slot);
v.set(icon);
addView(v, 0, new LinearLayout.LayoutParams(mIconSize, mIconSize));
}
Aggregations