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

Commit c40ba1db authored by Jorge Ruesga's avatar Jorge Ruesga Committed by Gerrit Code Review
Browse files

qs: fix network tile description



Fix period at the end of the network mobile description, ensure that there isn't
trailing whitespaces and only call one time to the cleaner method when
the description change. Clean up unused imports.

Change-Id: I9b965015e30e44efa00220e91da7e8b3e773a0f1
Signed-off-by: default avatarJorge Ruesga <jorge@ruesga.com>
parent d547e9d0
Loading
Loading
Loading
Loading
+7 −12
Original line number Diff line number Diff line
@@ -3,10 +3,8 @@ package com.android.systemui.quicksettings;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.net.ConnectivityManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnLongClickListener;
import android.widget.ImageView;
@@ -14,10 +12,7 @@ import android.widget.TextView;

import com.android.systemui.R;
import com.android.systemui.statusbar.phone.QuickSettingsController;
import com.android.systemui.statusbar.phone.QuickSettingsContainerView;
import com.android.systemui.statusbar.policy.MSimNetworkController;
import com.android.systemui.statusbar.policy.NetworkController;
import com.android.systemui.statusbar.policy.NetworkController.NetworkSignalChangedCallback;

import static com.android.internal.util.cm.QSUtils.deviceSupportsMobileData;

@@ -25,7 +20,6 @@ public class MobileNetworkTile extends NetworkTile {
    private static final int NO_OVERLAY = 0;
    private static final int DISABLED_OVERLAY = -1;

    private NetworkController mController;
    private boolean mEnabled;
    private String mDescription;
    private int mDataTypeIconId = NO_OVERLAY;
@@ -73,7 +67,7 @@ public class MobileNetworkTile extends NetworkTile {
                ? dataContentDescription
                : r.getString(R.string.accessibility_no_data);
        mLabel = mEnabled
                ? removeTrailingPeriod(mDescription)
                ? mDescription
                : r.getString(R.string.quick_settings_rssi_emergency_only);
    }

@@ -109,7 +103,7 @@ public class MobileNetworkTile extends NetworkTile {
            }

            mEnabled = enabled;
            mDescription = description;
            mDescription = removeTrailingPeriod(description);

            setActivity(activityIn, activityOut);
            updateResources();
@@ -148,11 +142,12 @@ public class MobileNetworkTile extends NetworkTile {
    // Remove the period from the network name
    public static String removeTrailingPeriod(String string) {
        if (string == null) return null;
        final int length = string.length();
        if (string.endsWith(".")) {
            string.substring(0, length - 1);
        final String aux = string.trim();
        final int length = aux.length();
        if (aux.endsWith(".")) {
            return aux.substring(0, length - 1);
        }
        return string;
        return aux;
    }

}