[Android General] wlryss:
SETTINGS OF THE TEXT OF MOBILE DATA IN THE PANEL OF QUICK SETTINGS. ANDROID 9 PIE​

I. SystemUI.apk

1. Add to SystemUI.apk - GearUtils

2. Copy to computer from decompiled SystemUI/res/layout/data_usage_view_layout.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:layout_width="fill_parent" android:layout_height="@dimen/data_usage_view_height"
xmlns:android="http://schemas.android.com/apk/res/android">
<com.android.systemui.qs.DataUsageView android:textAppearance="@style/TextAppearance.DataUsageView" android:gravity="end" android:id="@id/data_usage_view" android:paddingBottom="@dimen/data_usage_view_padding_bottom" android:visibility="visible" android:layout_width="fill_parent" android:layout_height="fill_parent" android:includeFontPadding="false" android:paddingEnd="@dimen/data_usage_view_padding_end" />
</LinearLayout>

and make xml with name data_usage_view_layout_null.xml with a zero amount of displaying:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:layout_width="0.0dip" android:layout_height="0.0dip"
xmlns:android="http://schemas.android.com/apk/res/android">
<com.android.systemui.qs.DataUsageView android:textAppearance="@style/TextAppearance.DataUsageView" android:gravity="end" android:id="@id/data_usage_view" android:paddingBottom="@dimen/data_usage_view_padding_bottom" android:visibility="visible" android:layout_width="0.0dip" android:layout_height="0.0dip" android:includeFontPadding="false" android:paddingEnd="@dimen/data_usage_view_padding_end" />
</LinearLayout>

Add this data_usage_view_layout_null.xml to SystemUI/res/layout/ folder.

3. Recompile and then decompile this SystemUI.apk to get id of new data_usage_view_layout_null.xml

4. In SystemUI/smali/com/android/bar/DataUsageBar.smali :

In .method public inflateViews(Landroid/view/ViewGroup;Z)Landroid/view/View; - increase quantity of locales from 3 to 5 and add code (from +++ to +++):

.method public inflateViews(Landroid/view/ViewGroup;Z)Landroid/view/View;
.locals 5

iget-object v0, p0, Lcom/android/systemui/bar/DataUsageBar;->mContext:Landroid/content/Context;

invoke-static {v0}, Landroid/view/LayoutInflater;->from(Landroid/content/Context;)Landroid/view/LayoutInflater;

move-result-object v0

+++ const-string v3, "wrp_datausage_enabled"

const/4 v4, 0x1

invoke-static {v3, v4}, Lcom/android/wubydax/GearUtils;->getDbIntForKey(Ljava/lang/String;I)I

move-result v3

if-eqz v3, :cond_next

const v1, 0x7f0d005b ### <public type="layout" name="data_usage_view_layout" id="0x7f0d005b" />

goto :goto_0

:cond_next
const v1, 0x7f0d0249 ### <public type="layout" name="data_usage_view_layout_null" id="0x7f0d0249" />

:goto_0+++
const/4 v2, 0x0

invoke-virtual {v0, v1, p1, v2}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;Z)Landroid/view/View;

move-result-object v0

check-cast v0, Landroid/view/ViewGroup;

iput-object v0, p0, Lcom/android/systemui/bar/DataUsageBar;->mBarRootView:Landroid/view/ViewGroup;

iget-object v0, p0, Lcom/android/systemui/bar/DataUsageBar;->mBarRootView:Landroid/view/ViewGroup;

const v1, 0x7f0a0133

invoke-virtual {v0, v1}, Landroid/view/ViewGroup;->findViewById(I)Landroid/view/View;

move-result-object v0

check-cast v0, Lcom/android/systemui/qs/DataUsageView;

iput-object v0, p0, Lcom/android/systemui/bar/DataUsageBar;->mDataUsageView:Lcom/android/systemui/qs/DataUsageView;

invoke-direct {p0}, Lcom/android/systemui/bar/DataUsageBar;->updateVisibility()V

iget-object v0, p0, Lcom/android/systemui/bar/DataUsageBar;->mBarRootView:Landroid/view/ViewGroup;

return-object v0
.end method

5. In SystemUI/smali/com/android/systemui/qs/DataUsageView.smali add to end of smali method:

.method public onWindowFocusChanged(Z)V
.locals 9

const/4 v8, 0x1

const/4 v7, 0x0

const/4 v6, 0x0

invoke-super {p0, p1}, Landroid/widget/TextView;->onWindowFocusChanged(Z)V

if-eqz p1, :cond_0

invoke-virtual {p0}, Lcom/android/systemui/qs/DataUsageView;->getVisibility()I

move-result v4

if-nez v4, :cond_0

invoke-virtual {p0}, Lcom/android/systemui/qs/DataUsageView;->getContext()Landroid/content/Context;

move-result-object v4

invoke-virtual {v4}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v1

const-string v4, "wrp_data_usage_text_color"

const-string v5, "#e61e4e78"

invoke-static {v5}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I

move-result v5

invoke-static {v1, v4, v5}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

move-result v0

invoke-virtual {p0, v0}, Lcom/android/systemui/qs/DataUsageView;->setTextColor(I)V

const-string v4, "wrp_data_usage_text_gravity"

invoke-static {v1, v4, v7}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

move-result v2

packed-switch v2, :pswitch_data_0

const v4, 0x800005

invoke-virtual {p0, v4}, Lcom/android/systemui/qs/DataUsageView;->setGravity(I)V

:goto_0
const-string v4, "wrp_data_usage_view_text_style"

invoke-static {v1, v4, v7}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

move-result v3

packed-switch v3, :pswitch_data_1

invoke-virtual {p0, v6, v7}, Lcom/android/systemui/qs/DataUsageView;->setTypeface(Landroid/graphics/Typeface;I)V

:cond_0
:goto_1
return-void

:pswitch_0
invoke-virtual {p0, v8}, Lcom/android/systemui/qs/DataUsageView;->setGravity(I)V

goto :goto_0

:pswitch_1
const v4, 0x800003

invoke-virtual {p0, v4}, Lcom/android/systemui/qs/DataUsageView;->setGravity(I)V

goto :goto_0

:pswitch_2
invoke-virtual {p0, v6, v8}, Lcom/android/systemui/qs/DataUsageView;->setTypeface(Landroid/graphics/Typeface;I)V

goto :goto_1

:pswitch_3
const/4 v4, 0x2

invoke-virtual {p0, v6, v4}, Lcom/android/systemui/qs/DataUsageView;->setTypeface(Landroid/graphics/Typeface;I)V

goto :goto_1

:pswitch_4
const/4 v4, 0x3

invoke-virtual {p0, v6, v4}, Lcom/android/systemui/qs/DataUsageView;->setTypeface(Landroid/graphics/Typeface;I)V

goto :goto_1

:pswitch_data_0
.packed-switch 0x1
:pswitch_0
:pswitch_1
.end packed-switch

:pswitch_data_1
.packed-switch 0x1
:pswitch_2
:pswitch_3
:pswitch_4
.end packed-switch
.end method

II. Rom Control

1. In right xml:

<PreferenceScreen android:title="Mobile Data in Quick Settings">
<com.wubydax.romcontrol.v2.prefs.MySwitchPreference android:title="Show Text of Mobile Data" android:key="wrp_datausage_enabled" android:defaultValue="true" android:summaryOn="Showed" android:summaryOff="Hidden" app:packageNameToKill="com.android.systemui" app:isSilent="false" />
<com.wubydax.romcontrol.v2.prefs.ColorPickerPreference android:title="Text Color" android:key="wrp_data_usage_text_color" android:dependency="wrp_datausage_enabled" android:defaultValue="\#e61e4e78" />
<com.wubydax.romcontrol.v2.prefs.MyListPreference android:entries="@array/data_usage_gravity_entries" android:title="Gravity" android:key="wrp_data_usage_text_gravity" android:dependency="wrp_datausage_enabled" android:defaultValue="0" android:entryValues="@array/data_usage_gravity_values" />
<com.wubydax.romcontrol.v2.prefs.MyListPreference android:entries="@array/data_usage_text_style_entries" android:title="Font Style" android:key="wrp_data_usage_view_text_style" android:dependency="wrp_datausage_enabled" android:defaultValue="0" android:entryValues="@array/data_usage_text_style_values" />
</PreferenceScreen>

Add to RomControl/res/values/arrays.xml:

<string-array name="data_usage_gravity_entries">
<item>On the right</item>
<item>Center</item>
<item>On the left</item>
</string-array>
<string-array name="data_usage_gravity_values">
<item>0</item>
<item>1</item>
<item>2</item>
</string-array>
<string-array name="data_usage_text_style_entries">
<item>Normal</item>
<item>Bold</item>
<item>Italic</item>
<item>Bold italic</item>
</string-array>
<string-array name="data_usage_text_style_values">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
</string-array>

For the Android 9 it was necessary to make Switching on/Switching off of displaying on another in comparison with the Android 8 as switching methods through Rune.smali (at me) weren't earned.

Only this switching - with reboot of SystemUI, remaining switchings - on the fly. On Default - is switched On as by default is On state in smali

Color on Default - in SystemUI and in RomControl - it is possible to make any substitution of any color instead of const-string v5, "#e61e4e78" in SystemUI (.method public onWindowFocusChanged(Z)V) and RomControl (android:defaultValue="\#e61e4e78" /)