Skip to content

Commit 2ea2bb7

Browse files
Haus1darknius09
authored andcommitted
base: Statusbar Network Traffic [1/2]
----- abc ezio84: use O darkintensity api use arrows vectors from aosp net arrows commit (thanks @Mazda-- for this find!): ezio84/abc_frameworks_base@ad71ae1 fix visual glitch on statusbar expand (arrows showing and quickly hiding again) don't show arrows when no data remove unit settings (KB is good) remove interval (set to 1sec by def) and single arrow options don't get settings values again when not needed fix padding between arrows and speed values and expose the padding value code cleanup ----- Change-Id: I026f67caec69a09c0c1969a09fbe99aa6b6f0510 Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
1 parent a79deb9 commit 2ea2bb7

6 files changed

Lines changed: 359 additions & 2 deletions

File tree

core/java/android/provider/Settings.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4703,6 +4703,18 @@ public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean
47034703
*/
47044704
public static final String FOD_ANIM = "fod_recognizing_animation_list";
47054705

4706+
4707+
/**
4708+
* Wheter to show network traffic indicator in statusbar
4709+
* @hide
4710+
*/
4711+
public static final String NETWORK_TRAFFIC_STATE = "network_traffic_state";
4712+
/**
4713+
* Network traffic inactivity threshold (default is 1 kBs)
4714+
* @hide
4715+
*/
4716+
public static final String NETWORK_TRAFFIC_AUTOHIDE_THRESHOLD = "network_traffic_autohide_threshold";
4717+
47064718
/**
47074719
* Show pointer location on screen?
47084720
* 0 = no
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Copyright (C) 2017 The Android Open Source Project
4+
Copyright (C) 2017 ABC rom
5+
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
-->
18+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
19+
android:width="5dp"
20+
android:height="17.0dp"
21+
android:viewportWidth="7.1"
22+
android:viewportHeight="24.0">
23+
<path
24+
android:fillColor="#ffffff"
25+
android:pathData="M3.6000004,10.8l3.5,0.0 -3.5,-7.3 0.0,0.0 0.0,0.0 0.0,0.0 0.0,0.0 -3.6,7.3z"/>
26+
<path
27+
android:fillColor="#ffffff"
28+
android:pathData="M3.6000004,13.2l-3.6,0.0 3.6,7.3 0.0,0.0 0.0,0.0 0.0,0.0 0.0,0.0 3.5,-7.3z"/>
29+
</vector>

packages/SystemUI/res/layout/status_bar.xml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,23 @@
112112
android:gravity="center_horizontal|center_vertical"/>
113113

114114
<com.android.keyguard.AlphaOptimizedLinearLayout android:id="@+id/system_icon_area"
115-
android:layout_width="0dp"
115+
android:layout_width="wrap_content"
116116
android:layout_height="match_parent"
117117
android:layout_weight="1"
118118
android:orientation="horizontal"
119119
android:gravity="center_vertical|end"
120120
>
121121

122+
<com.android.systemui.statusbar.policy.NetworkTraffic
123+
android:id="@+id/networkTraffic"
124+
android:layout_width="wrap_content"
125+
android:layout_height="match_parent"
126+
android:layout_marginStart="2dp"
127+
android:layout_marginEnd="2dp"
128+
android:singleLine="false"
129+
android:fontFamily="sans-serif-condensed"
130+
android:gravity="right|center_vertical"/>
131+
122132
<include layout="@layout/system_icons" />
123133

124134
</com.android.keyguard.AlphaOptimizedLinearLayout>

packages/SystemUI/res/values/custom_dimens.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,9 @@
106106
<dimen name="status_bar_battery_icon_circle_width">13.5dp</dimen>
107107

108108
<dimen name="qs_clock_start_20">20dp</dimen>
109+
110+
<!-- Network traffic monitor -->
111+
<dimen name="net_traffic_multi_text_size">8dp</dimen>
112+
<dimen name="net_traffic_txt_img_padding">2dp</dimen>
113+
109114
</resources>

packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarTransitions.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public final class PhoneStatusBarTransitions extends BarTransitions {
3131

3232
private final float mIconAlphaWhenOpaque;
3333

34-
private View mLeftSide, mStatusIcons, mBattery, mClock, mCenterClock, mRightClock;
34+
private View mLeftSide, mStatusIcons, mBattery, mClock, mCenterClock, mRightClock, mNetworkTraffic;
3535

3636
private Animator mCurrentAnimation;
3737

@@ -48,6 +48,7 @@ public PhoneStatusBarTransitions(PhoneStatusBarView statusBarView, View backgrou
4848
mClock = statusBarView.findViewById(R.id.clock);
4949
mCenterClock = statusBarView.findViewById(R.id.center_clock);
5050
mRightClock = statusBarView.findViewById(R.id.right_clock);
51+
mNetworkTraffic = statusBarView.findViewById(R.id.networkTraffic);
5152
applyModeBackground(-1, getMode(), false /*animate*/);
5253
applyMode(getMode(), false /*animate*/);
5354
}
@@ -94,6 +95,7 @@ private void applyMode(int mode, boolean animate) {
9495
animateTransitionTo(mClock, newAlphaBC),
9596
animateTransitionTo(mCenterClock, newAlphaBC),
9697
animateTransitionTo(mRightClock, newAlphaBC)
98+
animateTransitionTo(mNetworkTraffic, newAlpha)
9799
);
98100
if (isLightsOut(mode)) {
99101
anims.setDuration(LIGHTS_OUT_DURATION);
@@ -107,6 +109,7 @@ private void applyMode(int mode, boolean animate) {
107109
mClock.setAlpha(newAlphaBC);
108110
mCenterClock.setAlpha(newAlphaBC);
109111
mRightClock.setAlpha(newAlphaBC);
112+
mNetworkTraffic.setAlpha(newAlpha);
110113
}
111114
}
112115
}

0 commit comments

Comments
 (0)