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

Commit 31dbbd4c authored by Sam Mortimer's avatar Sam Mortimer Committed by Bruno Martins
Browse files

SystemUI: Network Traffic [1/3]

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

Change-Id: Ib947832860970a3bccfac70d27a4761f6164d3d5
parent 53e546cc
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
+16 −0
Original line number Diff line number Diff line
@@ -109,6 +109,22 @@
            android:clipChildren="false"
            android:gravity="center_horizontal|center_vertical"/>

        <com.android.systemui.statusbar.LineageStatusBarItemHolder
            android:id="@+id/network_traffic_holder"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:gravity="start|center_vertical"
            >

            <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_vertical|start" />

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

        <com.android.keyguard.AlphaOptimizedLinearLayout android:id="@+id/system_icon_area"
            android:layout_width="0dp"
            android:layout_height="match_parent"
+4 −0
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue
    private LinearLayout mSystemIconArea;
    private View mClockView;
    private View mNotificationIconAreaInner;
    private View mNetworkTrafficHolder;
    private View mCenteredIconArea;
    private int mDisabled1;
    private StatusBar mStatusBarComponent;
@@ -104,6 +105,7 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue
        mDarkIconManager.setShouldLog(true);
        Dependency.get(StatusBarIconController.class).addIconGroup(mDarkIconManager);
        mSystemIconArea = mStatusBar.findViewById(R.id.system_icon_area);
        mNetworkTrafficHolder = mStatusBar.findViewById(R.id.network_traffic_holder);
        mClockView = mStatusBar.findViewById(R.id.clock);
        showSystemIconArea(false);
        showClock(false);
@@ -249,10 +251,12 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue

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

    public void showSystemIconArea(boolean animate) {
        animateShow(mSystemIconArea, animate);
        animateShow(mNetworkTrafficHolder, animate);
    }

    public void hideClock(boolean animate) {
+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);
        }
    }