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

Commit 43216489 authored by Rohan Shah's avatar Rohan Shah
Browse files

Remove battery from bluetooth tile icon

Removing the battery info from the tile icon for bluetooth since it
doesn't really fit anymore thanks to the updated secondary label text.

Test: visually, tried dark mode as well
Change-Id: Ia9ba91789f0271a8b967ee0f5e25064b7463d49a
parent c9bb8570
Loading
Loading
Loading
Loading
+20 −12
Original line number Diff line number Diff line
@@ -131,21 +131,10 @@ public class BluetoothTile extends QSTileImpl<BooleanState> {

        if (enabled) {
            if (connected) {
                state.icon = ResourceIcon.get(R.drawable.ic_qs_bluetooth_connected);
                state.icon = new BluetoothConnectedTileIcon();
                state.contentDescription = mContext.getString(
                        R.string.accessibility_bluetooth_name, state.label);

                final CachedBluetoothDevice lastDevice = mController.getLastDevice();
                if (lastDevice != null) {
                    final int batteryLevel = lastDevice.getBatteryLevel();
                    if (batteryLevel != BluetoothDevice.BATTERY_LEVEL_UNKNOWN) {
                        state.icon = new BluetoothBatteryTileIcon(
                                batteryLevel,
                                mContext.getResources().getFraction(
                                        R.fraction.bt_battery_scale_fraction, 1, 1));
                    }
                }

                state.label = mController.getLastDeviceName();
            } else if (state.isTransient) {
                state.icon = ResourceIcon.get(R.drawable.ic_bluetooth_transient_animation);
@@ -281,6 +270,25 @@ public class BluetoothTile extends QSTileImpl<BooleanState> {
        }
    }


    /**
     * Bluetooth icon wrapper (when connected with no battery indicator) for Quick Settings. This is
     * used instead of {@link com.android.systemui.qs.tileimpl.QSTileImpl.DrawableIcon} in order to
     * use a context that reflects dark/light theme attributes.
     */
    private class BluetoothConnectedTileIcon extends Icon {

        BluetoothConnectedTileIcon() {
            // Do nothing. Default constructor to limit visibility.
        }

        @Override
        public Drawable getDrawable(Context context) {
            // This method returns Pair<Drawable, String> - the first value is the drawable.
            return context.getDrawable(R.drawable.ic_qs_bluetooth_connected);
        }
    }

    protected class BluetoothDetailAdapter implements DetailAdapter, QSDetailItems.Callback {
        // We probably won't ever have space in the UI for more than 20 devices, so don't
        // get info for them.