Search in sources :

Example 21 with StatusBarIconView

use of com.android.systemui.statusbar.StatusBarIconView in project android_frameworks_base by AOSPA.

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();
}
Also used : ArrayList(java.util.ArrayList) StatusBarIconView(com.android.systemui.statusbar.StatusBarIconView) ImageView(android.widget.ImageView) View(android.view.View) LinearLayout(android.widget.LinearLayout) StatusBarIconView(com.android.systemui.statusbar.StatusBarIconView) NotificationData(com.android.systemui.statusbar.NotificationData)

Example 22 with StatusBarIconView

use of com.android.systemui.statusbar.StatusBarIconView in project android_frameworks_base by crdroidandroid.

the class StatusBarIconController method dump.

public void dump(PrintWriter pw) {
    int N = mStatusIcons.getChildCount();
    pw.println("  icon views: " + N);
    for (int i = 0; i < N; i++) {
        StatusBarIconView ic = (StatusBarIconView) mStatusIcons.getChildAt(i);
        pw.println("    [" + i + "] icon=" + ic);
    }
    super.dump(pw);
}
Also used : StatusBarIconView(com.android.systemui.statusbar.StatusBarIconView)

Example 23 with StatusBarIconView

use of com.android.systemui.statusbar.StatusBarIconView in project android_frameworks_base by crdroidandroid.

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);
    mClockController.setTextColor(mTintArea, mIconTint);
    mBatteryLevelView.setTextColor(getTint(mTintArea, mBatteryLevelView, mIconTint));
    mNetworkTraffic.setDarkIntensity(mDarkIntensity);
    if (Settings.System.getIntForUser(mContext.getContentResolver(), Settings.System.STATUS_BAR_CRDROID_LOGO_COLOR, 0xFFFFFFFF, UserHandle.USER_CURRENT) == 0xFFFFFFFF) {
        mCrDroidLogoRight.setImageTintList(ColorStateList.valueOf(mIconTint));
        mCrDroidLogoLeft.setImageTintList(ColorStateList.valueOf(mIconTint));
    }
    if (Settings.System.getIntForUser(mContext.getContentResolver(), Settings.System.STATUS_BAR_WEATHER_COLOR, 0xFFFFFFFF, UserHandle.USER_CURRENT) == 0xFFFFFFFF) {
        mWeather.setTextColor(mIconTint);
        mWeatherLeft.setTextColor(mIconTint);
    }
    if (Settings.System.getIntForUser(mContext.getContentResolver(), Settings.System.STATUS_BAR_WEATHER_IMAGE_COLOR, 0xFFFFFFFF, UserHandle.USER_CURRENT) == 0xFFFFFFFF) {
        mWeatherImageView.setImageTintList(ColorStateList.valueOf(mIconTint));
        mLeftWeatherImageView.setImageTintList(ColorStateList.valueOf(mIconTint));
    }
    if (Settings.System.getIntForUser(mContext.getContentResolver(), Settings.System.STATUS_BAR_CARRIER_COLOR, mContext.getResources().getColor(R.color.status_bar_clock_color), UserHandle.USER_CURRENT) == mContext.getResources().getColor(R.color.status_bar_clock_color)) {
        mCarrierLabel.setTextColor(mIconTint);
    }
}
Also used : StatusBarIconView(com.android.systemui.statusbar.StatusBarIconView)

Example 24 with StatusBarIconView

use of com.android.systemui.statusbar.StatusBarIconView in project android_frameworks_base by ResurrectionRemix.

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));
}
Also used : StatusBarIcon(com.android.internal.statusbar.StatusBarIcon) LinearLayout(android.widget.LinearLayout) StatusBarIconView(com.android.systemui.statusbar.StatusBarIconView)

Example 25 with StatusBarIconView

use of com.android.systemui.statusbar.StatusBarIconView in project android_frameworks_base by ParanoidAndroid.

the class PhoneStatusBar method dump.

public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
    synchronized (mQueueLock) {
        pw.println("Current Status Bar state:");
        pw.println("  mExpandedVisible=" + mExpandedVisible + ", mTrackingPosition=" + mTrackingPosition);
        pw.println("  mTicking=" + mTicking);
        pw.println("  mTracking=" + mTracking);
        pw.println("  mDisplayMetrics=" + mDisplayMetrics);
        pw.println("  mPile: " + viewInfo(mPile));
        pw.println("  mTickerView: " + viewInfo(mTickerView));
        pw.println("  mScrollView: " + viewInfo(mScrollView) + " scroll " + mScrollView.getScrollX() + "," + mScrollView.getScrollY());
    }
    pw.print("  mNavigationBarView=");
    if (mNavigationBarView == null) {
        pw.println("null");
    } else {
        mNavigationBarView.dump(fd, pw, args);
    }
    pw.println("  Panels: ");
    if (mNotificationPanel != null) {
        pw.println("    mNotificationPanel=" + mNotificationPanel + " params=" + mNotificationPanel.getLayoutParams().debug(""));
        pw.print("      ");
        mNotificationPanel.dump(fd, pw, args);
    }
    if (mSettingsPanel != null) {
        pw.println("    mSettingsPanel=" + mSettingsPanel + " params=" + mSettingsPanel.getLayoutParams().debug(""));
        pw.print("      ");
        mSettingsPanel.dump(fd, pw, args);
    }
    if (DUMPTRUCK) {
        synchronized (mNotificationData) {
            int N = mNotificationData.size();
            pw.println("  notification icons: " + N);
            for (int i = 0; i < N; i++) {
                NotificationData.Entry e = mNotificationData.get(i);
                pw.println("    [" + i + "] key=" + e.key + " icon=" + e.icon);
                StatusBarNotification n = e.notification;
                pw.println("         pkg=" + n.getPackageName() + " id=" + n.getId() + " score=" + n.getScore());
                pw.println("         notification=" + n.getNotification());
                pw.println("         tickerText=\"" + n.getNotification().tickerText + "\"");
            }
        }
        int N = mStatusIcons.getChildCount();
        pw.println("  system icons: " + N);
        for (int i = 0; i < N; i++) {
            StatusBarIconView ic = (StatusBarIconView) mStatusIcons.getChildAt(i);
            pw.println("    [" + i + "] icon=" + ic);
        }
        if (false) {
            pw.println("see the logcat for a dump of the views we have created.");
            // must happen on ui thread
            mHandler.post(new Runnable() {

                public void run() {
                    mStatusBarView.getLocationOnScreen(mAbsPos);
                    Slog.d(TAG, "mStatusBarView: ----- (" + mAbsPos[0] + "," + mAbsPos[1] + ") " + mStatusBarView.getWidth() + "x" + getStatusBarHeight());
                    mStatusBarView.debug();
                }
            });
        }
    }
    if (DEBUG_GESTURES) {
        pw.print("  status bar gestures: ");
        mGestureRec.dump(fd, pw, args);
    }
    mNetworkController.dump(fd, pw, args);
}
Also used : Entry(com.android.systemui.statusbar.NotificationData.Entry) StatusBarNotification(android.service.notification.StatusBarNotification) Point(android.graphics.Point) NotificationData(com.android.systemui.statusbar.NotificationData) StatusBarIconView(com.android.systemui.statusbar.StatusBarIconView)

Aggregations

StatusBarIconView (com.android.systemui.statusbar.StatusBarIconView)42 LinearLayout (android.widget.LinearLayout)17 NotificationData (com.android.systemui.statusbar.NotificationData)8 StatusBarIcon (com.android.internal.statusbar.StatusBarIcon)7 ArrayList (java.util.ArrayList)7 View (android.view.View)6 ImageView (android.widget.ImageView)6 Point (android.graphics.Point)4 StatusBarNotification (android.service.notification.StatusBarNotification)4 ColorDrawable (android.graphics.drawable.ColorDrawable)3 Drawable (android.graphics.drawable.Drawable)3 Notification (android.app.Notification)2 NinePatchDrawable (android.graphics.drawable.NinePatchDrawable)2 Entry (com.android.systemui.statusbar.NotificationData.Entry)2 PendingIntent (android.app.PendingIntent)1 Paint (android.graphics.Paint)1 Path (android.graphics.Path)1 BitmapDrawable (android.graphics.drawable.BitmapDrawable)1 IBinder (android.os.IBinder)1 RemoteException (android.os.RemoteException)1