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

Commit 55739cd5 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Remove the background color of the data usage chart" into main

parents 5eb5b95b bb8f3925
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -26,6 +26,8 @@
        android:id="@+id/data_usage"
        android:layout_width="match_parent"
        android:layout_height="@dimen/data_usage_chart_height"
        android:layout_marginStart="@dimen/content_margin_left"
        android:layout_marginEnd="@dimen/content_margin_left"
        settings:sideLabels="@array/battery_labels"
        android:colorAccent="?android:attr/colorAccent"
        android:gravity="end"
+34 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2025 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <TextView
        android:id="@+id/text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/content_margin_left"
        android:layout_marginEnd="@dimen/content_margin_left"
        android:gravity="center_vertical"
        android:minHeight="48dp"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:textColor="?android:attr/textColorSecondary"/>
</LinearLayout>
 No newline at end of file
+3 −2
Original line number Diff line number Diff line
@@ -26,8 +26,9 @@
            settings:controller="com.android.settings.datausage.ChartDataUsagePreferenceController"
            />

        <Preference
        <com.android.settingslib.widget.LayoutPreference
            android:key="warning"
            android:layout="@layout/data_usage_warning_preference"
            android:selectable="false"/>

    </PreferenceCategory>
+2 −1
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import com.android.settings.datausage.lib.NetworkCycleChartData;
import com.android.settings.datausage.lib.NetworkUsageData;
import com.android.settings.widget.UsageView;
import com.android.settingslib.spaprivileged.framework.common.BytesFormatter;
import com.android.settingslib.widget.GroupSectionDividerMixin;

import java.util.ArrayList;
import java.util.Comparator;
@@ -45,7 +46,7 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

public class ChartDataUsagePreference extends Preference {
public class ChartDataUsagePreference extends Preference implements GroupSectionDividerMixin {

    // The resolution we show on the graph so that we can squash things down to ints.
    // Set to half a meg for now.
+7 −3
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.telephony.SubscriptionManager
import android.util.EventLog
import android.util.Log
import android.view.View
import android.widget.TextView
import androidx.annotation.OpenForTesting
import androidx.annotation.VisibleForTesting
import androidx.fragment.app.viewModels
@@ -37,6 +38,7 @@ import com.android.settings.datausage.lib.NetworkUsageData
import com.android.settings.network.telephony.SubscriptionRepository
import com.android.settingslib.spa.framework.util.collectLatestWithLifecycle
import com.android.settingslib.spaprivileged.framework.common.userManager
import com.android.settingslib.widget.LayoutPreference
import kotlin.jvm.optionals.getOrNull

/**
@@ -97,11 +99,13 @@ open class DataUsageList : DashboardFragment() {

    private fun updateWarning() {
        val template = template ?: return
        val warningPreference = findPreference<Preference>(KEY_WARNING)!!
        val preference = findPreference<LayoutPreference>(KEY_WARNING) ?: return
        val textView = preference.findViewById<TextView>(R.id.text) ?: return
        val context = requireContext()
        if (template.matchRule != NetworkTemplate.MATCH_WIFI) {
            warningPreference.setSummary(R.string.operator_warning)
            textView.text = context.getString(R.string.operator_warning)
        } else if (Utils.isMobileDataCapable(context)) {
            warningPreference.setSummary(R.string.non_carrier_data_usage_warning)
            textView.text = context.getString(R.string.non_carrier_data_usage_warning)
        }
    }

Loading