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

Commit adc88de0 authored by sallyyuen's avatar sallyyuen
Browse files

Update Reduce Bright Colors strings

Final name is Reduce Brightness. QS label removed per final strings.

Test: Manual, atest ReduceBrightColorsTileTest
Bug: b/170970602
Change-Id: I3f436c2ee14d9cf479e6806f2f1d9391568426f2
parent d12736a8
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -4530,9 +4530,8 @@
     shown in the warning dialog about the accessibility shortcut. -->
    <string name="color_correction_feature_name">Color Correction</string>

    <!-- TODO(b/170970602): remove translatable=false when RBC has official name and strings -->
    <!-- Title of Reduce Bright Colors feature, shown in the warning dialog about the accessibility shortcut. [CHAR LIMIT=none] -->
    <string name="reduce_bright_colors_feature_name" translatable="false">Reduce Bright Colors</string>
    <!-- Title of Reduce Brightness feature, shown in the warning dialog about the accessibility shortcut. [CHAR LIMIT=none] -->
    <string name="reduce_bright_colors_feature_name">Reduce Brightness</string>

    <!-- Text in toast to alert the user that the accessibility shortcut turned on an accessibility service. [CHAR LIMIT=none] -->
    <string name="accessibility_shortcut_enabling_service">Held volume keys. <xliff:g id="service_name" example="TalkBack">%1$s</xliff:g> turned on.</string>
+2 −5
Original line number Diff line number Diff line
@@ -954,11 +954,8 @@
    <string name="quick_settings_dark_mode_secondary_label_on_at">On at <xliff:g id="time" example="10 pm">%s</xliff:g></string>
    <!-- QuickSettings: Secondary text for when the Dark theme or some other tile will be on until some user-selected time. [CHAR LIMIT=20] -->
    <string name="quick_settings_dark_mode_secondary_label_until">Until <xliff:g id="time" example="7 am">%s</xliff:g></string>
    <!-- TODO(b/170970602): remove translatable=false when RBC has official name and strings -->
    <!-- QuickSettings: Label for the toggle that controls whether Reduce Bright Colors is enabled. [CHAR LIMIT=NONE] -->
    <string name="quick_settings_reduce_bright_colors_label" translatable="false">Reduce Bright Colors</string>
        <!-- QuickSettings: Secondary text for intensity level of Reduce Bright Colors. [CHAR LIMIT=NONE] -->
    <string name="quick_settings_reduce_bright_colors_secondary_label" translatable="false"> <xliff:g id="intensity" example="50">%d</xliff:g>%% reduction</string>
    <!-- QuickSettings: Label for the toggle that controls whether Reduce Brightness is enabled. [CHAR LIMIT=NONE] -->
    <string name="quick_settings_reduce_bright_colors_label">Reduce Brightness</string>

    <!-- QuickSettings: NFC tile [CHAR LIMIT=NONE] -->
    <string name="quick_settings_nfc_label">NFC</string>
+12 −0
Original line number Diff line number Diff line
@@ -16,6 +16,9 @@

package com.android.systemui.qs.dagger;

import android.content.Context;
import android.hardware.display.ColorDisplayManager;

import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.statusbar.FeatureFlags;

@@ -27,6 +30,7 @@ import dagger.Provides;
@Module
public interface QSFlagsModule {
    String QS_LABELS_FLAG = "qs_labels_flag";
    String RBC_AVAILABLE = "rbc_available";

    @Provides
    @SysUISingleton
@@ -34,4 +38,12 @@ public interface QSFlagsModule {
    static boolean provideQSFlag(FeatureFlags featureFlags) {
        return featureFlags.isQSLabelsEnabled();
    }

    /** */
    @Provides
    @SysUISingleton
    @Named(RBC_AVAILABLE)
    static boolean isReduceBrightColorsAvailable(Context context) {
        return ColorDisplayManager.isReduceBrightColorsAvailable(context);
    }
}
+8 −12
Original line number Diff line number Diff line
@@ -16,12 +16,13 @@

package com.android.systemui.qs.tiles;

import static com.android.systemui.qs.dagger.QSFlagsModule.RBC_AVAILABLE;

import android.content.Intent;
import android.os.Handler;
import android.os.Looper;
import android.provider.Settings;
import android.service.quicksettings.Tile;
import android.text.TextUtils;
import android.widget.Switch;

import com.android.internal.logging.MetricsLogger;
@@ -39,6 +40,7 @@ import com.android.systemui.settings.UserTracker;
import com.android.systemui.util.settings.SecureSettings;

import javax.inject.Inject;
import javax.inject.Named;

/** Quick settings tile: Reduce Bright Colors **/
public class ReduceBrightColorsTile extends QSTileImpl<QSTile.BooleanState> {
@@ -46,9 +48,11 @@ public class ReduceBrightColorsTile extends QSTileImpl<QSTile.BooleanState> {
    //TODO(b/170973645): get icon drawable
    private final Icon mIcon = null;
    private final SecureSetting mActivatedSetting;
    private final boolean mIsAvailable;

    @Inject
    public ReduceBrightColorsTile(
            @Named(RBC_AVAILABLE) boolean isAvailable,
            QSHost host,
            @Background Looper backgroundLooper,
            @Main Handler mainHandler,
@@ -69,11 +73,12 @@ public class ReduceBrightColorsTile extends QSTileImpl<QSTile.BooleanState> {
                refreshState();
            }
        };
        mIsAvailable = isAvailable;

    }
    @Override
    public boolean isAvailable() {
        // TODO(b/170970675): Call into ColorDisplayService to get availability/config status
        return true;
        return mIsAvailable;
    }

    @Override
@@ -121,15 +126,6 @@ public class ReduceBrightColorsTile extends QSTileImpl<QSTile.BooleanState> {
        state.label = mContext.getString(R.string.quick_settings_reduce_bright_colors_label);
        state.expandedAccessibilityClassName = Switch.class.getName();
        state.contentDescription = state.label;

        final int intensity = Settings.Secure.getIntForUser(mContext.getContentResolver(),
                Settings.Secure.REDUCE_BRIGHT_COLORS_LEVEL, 0, mActivatedSetting.getCurrentUser());
        state.secondaryLabel = state.value ? mContext.getString(
                R.string.quick_settings_reduce_bright_colors_secondary_label, intensity) : "";

        state.contentDescription = TextUtils.isEmpty(state.secondaryLabel)
                ? state.label
                : TextUtils.concat(state.label, ", ", state.secondaryLabel);
    }

    @Override
+1 −9
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ public class ReduceBrightColorsTileTest extends SysuiTestCase {
        mFakeSettings = new FakeSettings();

        mTile = new ReduceBrightColorsTile(
                true,
                mHost,
                mTestableLooper.getLooper(),
                new Handler(mTestableLooper.getLooper()),
@@ -95,7 +96,6 @@ public class ReduceBrightColorsTileTest extends SysuiTestCase {
        assertEquals(Tile.STATE_INACTIVE, mTile.getState().state);
        assertEquals(mTile.getState().label.toString(),
                mContext.getString(R.string.quick_settings_reduce_bright_colors_label));
        assertEquals(mTile.getState().secondaryLabel.toString(), "");
    }

    @Test
@@ -128,13 +128,5 @@ public class ReduceBrightColorsTileTest extends SysuiTestCase {
        assertEquals(Tile.STATE_ACTIVE, mTile.getState().state);
        assertEquals(mTile.getState().label.toString(),
                mContext.getString(R.string.quick_settings_reduce_bright_colors_label));

        final int intensity = Settings.Secure.getIntForUser(mContext.getContentResolver(),
                Settings.Secure.REDUCE_BRIGHT_COLORS_LEVEL, 0, mUserTracker.getUserId());

        assertEquals(
                mContext.getString(
                        R.string.quick_settings_reduce_bright_colors_secondary_label, intensity),
                mTile.getState().secondaryLabel.toString());
    }
}