Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit bda0a068 authored by Sam Mortimer's avatar Sam Mortimer Committed by Michael Bestas
Browse files

SystemUI: Network Traffic [1/3]

*) Add lineage-sdk internal NetworkTraffic to the statusbar
   using the LineageStatusBarItemHolder helper.

Author: LuK1337 <priv.luk@gmail.com>
Date:   Thu May 6 13:50:05 2021 +0200

    SystemUI: Force left-to-right for network traffic monitor holder

    Fixes: https://gitlab.com/LineageOS/issues/android/-/issues/3445
    Change-Id: I19ea852cedfd2a69a47006977f1b74a172008058

Author: LuK1337 <priv.luk@gmail.com>
Date:   Sun Apr 11 09:58:09 2021 +0200

    SystemUI: Hide centered_area when showing heads up

    Needed for network traffic monitor.

    Change-Id: Ib96a75a936cf4d71e23a575e012741b812ed2aa1

Author: LuK1337 <priv.luk@gmail.com>
Date:   Sun Apr 11 09:47:17 2021 +0200

    SystemUI: Move network traffic monitor under same layout as clock

    This effectively fixes wrongly network monitor layout on
    devices with side notch / hole punch.

    Change-Id: I217b886d8da75eab7636066f4822f5fd6dbc9aff

Author: Sam Mortimer <sam@mortimer.me.uk>
Date:   Sat Jan 13 23:26:48 2018 -0800

    SystemUI: Network Traffic [1/3]

    *) Add lineage-sdk internal NetworkTraffic to the statusbar
       using the LineageStatusBarItemHolder helper.

    Change-Id: Ib947832860970a3bccfac70d27a4761f6164d3d5

Change-Id: Ib947832860970a3bccfac70d27a4761f6164d3d5
parent 9cb1ff00
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
 * Copyright (c) 2017 The LineageOS Project
 * Copyright (c) 2017-2020 The LineageOS Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -19,6 +19,9 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.android.systemui">

    <!-- Network traffic monitor -->
    <uses-permission android:name="android.permission.MAINLINE_NETWORK_STACK" />

    <!-- SystemUI Tuner -->
    <application>
        <activity-alias
+17 −0
Original line number Diff line number Diff line
@@ -139,6 +139,23 @@
            android:gravity="center"
            android:visibility="gone"
        />

        <com.android.systemui.statusbar.LineageStatusBarItemHolder
            android:id="@+id/network_traffic_holder"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layoutDirection="ltr"
            android:gravity="center"
            >

            <org.lineageos.internal.statusbar.NetworkTraffic
                android:id="@+id/network_traffic"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:maxLines="2"
                android:gravity="center" />

        </com.android.systemui.statusbar.LineageStatusBarItemHolder>
    </com.android.keyguard.AlphaOptimizedLinearLayout>

    <ViewStub
+4 −0
Original line number Diff line number Diff line
@@ -83,6 +83,7 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue
    private LinearLayout mSystemIconArea;
    private View mOngoingCallChip;
    private View mNotificationIconAreaInner;
    private View mNetworkTrafficHolder;
    private View mCenteredIconArea;
    private int mDisabled1;
    private int mDisabled2;
@@ -166,6 +167,7 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue
        mDarkIconManager.setBlockList(mBlockedIcons);
        mStatusBarIconController.addIconGroup(mDarkIconManager);
        mSystemIconArea = mStatusBar.findViewById(R.id.system_icon_area);
        mNetworkTrafficHolder = mStatusBar.findViewById(R.id.network_traffic_holder);
        mClockController = mStatusBar.getClockController();
        mOngoingCallChip = mStatusBar.findViewById(R.id.ongoing_call_chip);
        showSystemIconArea(false);
@@ -370,6 +372,7 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue

    private void hideSystemIconArea(boolean animate) {
        animateHide(mSystemIconArea, animate);
        animateHide(mNetworkTrafficHolder, animate);
    }

    private void showSystemIconArea(boolean animate) {
@@ -377,6 +380,7 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue
        int state = mAnimationScheduler.getAnimationState();
        if (state == IDLE || state == SHOWING_PERSISTENT_DOT) {
            animateShow(mSystemIconArea, animate);
            animateShow(mNetworkTrafficHolder, animate);
        }
    }

+10 −0
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener,
    private final HeadsUpManagerPhone mHeadsUpManager;
    private final NotificationStackScrollLayoutController mStackScrollerController;
    private final HeadsUpStatusBarView mHeadsUpStatusBarView;
    private final View mCenteredView;
    private final View mCenteredIconView;
    private final ClockController mClockController;
    private final View mOperatorNameView;
@@ -101,6 +102,7 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener,
                statusBarView.findViewById(R.id.clock),
                new ClockController(statusBarView.getContext(), statusBarView),
                statusBarView.findViewById(R.id.operator_name_frame),
                statusBarView.findViewById(R.id.centered_area),
                statusBarView.findViewById(R.id.centered_icon_area));
    }

@@ -119,11 +121,13 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener,
            View clockView,
            ClockController clockController,
            View operatorNameView,
            View centeredView,
            View centeredIconView) {
        mNotificationIconAreaController = notificationIconAreaController;
        mHeadsUpManager = headsUpManager;
        mHeadsUpManager.addListener(this);
        mHeadsUpStatusBarView = headsUpStatusBarView;
        mCenteredView = centeredView;
        mCenteredIconView = centeredIconView;
        headsUpStatusBarView.setOnDrawingRectChangedListener(
                () -> updateIsolatedIconLocation(true /* requireUpdate */));
@@ -220,6 +224,9 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener,
                if (!isRightClock) {
                    hide(clockView, View.INVISIBLE);
                }
                if (mCenteredView.getVisibility() != View.GONE) {
                    hide(mCenteredView, View.INVISIBLE);
                }
                if (mCenteredIconView.getVisibility() != View.GONE) {
                    hide(mCenteredIconView, View.INVISIBLE);
                }
@@ -230,6 +237,9 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener,
                if (!isRightClock) {
                    show(clockView);
                }
                if (mCenteredView.getVisibility() != View.GONE) {
                    show(mCenteredView);
                }
                if (mCenteredIconView.getVisibility() != View.GONE) {
                    show(mCenteredIconView);
                }
+4 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ public final class PhoneStatusBarTransitions extends BarTransitions {

    private final float mIconAlphaWhenOpaque;

    private View mLeftSide, mStatusIcons, mBattery;
    private View mLeftSide, mStatusIcons, mNetworkTraffic, mBattery;
    private Animator mCurrentAnimation;

    /**
@@ -43,6 +43,7 @@ public final class PhoneStatusBarTransitions extends BarTransitions {
        mIconAlphaWhenOpaque = res.getFraction(R.dimen.status_bar_icon_drawing_alpha, 1, 1);
        mLeftSide = statusBarView.findViewById(R.id.status_bar_left_side);
        mStatusIcons = statusBarView.findViewById(R.id.statusIcons);
        mNetworkTraffic = statusBarView.findViewById(R.id.network_traffic);
        mBattery = statusBarView.findViewById(R.id.battery);
        applyModeBackground(-1, getMode(), false /*animate*/);
        applyMode(getMode(), false /*animate*/);
@@ -86,6 +87,7 @@ public final class PhoneStatusBarTransitions extends BarTransitions {
            anims.playTogether(
                    animateTransitionTo(mLeftSide, newAlpha),
                    animateTransitionTo(mStatusIcons, newAlpha),
                    animateTransitionTo(mNetworkTraffic, newAlpha),
                    animateTransitionTo(mBattery, newAlphaBC)
                    );
            if (isLightsOut(mode)) {
@@ -96,6 +98,7 @@ public final class PhoneStatusBarTransitions extends BarTransitions {
        } else {
            mLeftSide.setAlpha(newAlpha);
            mStatusIcons.setAlpha(newAlpha);
            mNetworkTraffic.setAlpha(newAlpha);
            mBattery.setAlpha(newAlphaBC);
        }
    }
Loading