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

Commit c336f2d4 authored by Candice Lo's avatar Candice Lo
Browse files

Implement Font Scaling Quick Settings Tile (2/n)

Font scaling quick settings tile provides a quick access for users to
change the Font Size in quick settings panel.

In this modification, we create the FontScalingTile and set the icon and
title for the tile. Only the appearance of the tile is set.

Disabling the tile with setting isAvailable to false.

Bug: 242326166
Test: Attach a video to the bug
Test: atest TilesStatesTextTest QSTileViewImplTest QSFactoryImplTest
Change-Id: I5d4d3ddc97eb1db90db48f23e362136b002d4b2d
parent 7476d942
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
<!--
   Copyright (C) 2023 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.
  -->

<vector xmlns:android="http://schemas.android.com/apk/res/android"
         android:width="24dp"
         android:height="24dp"
         android:viewportWidth="24"
         android:viewportHeight="24">
<path
    android:pathData="M7,20L7,7L2,7L2,4h13v3h-5v13ZM16,20v-8h-3L13,9h9v3h-3v8Z"
    android:fillColor="#041E49"/>
</vector>
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@

    <!-- Tiles native to System UI. Order should match "quick_settings_tiles_default" -->
    <string name="quick_settings_tiles_stock" translatable="false">
        internet,bt,flashlight,dnd,alarm,airplane,controls,wallet,rotation,battery,cast,screenrecord,mictoggle,cameratoggle,location,hotspot,inversion,saver,dark,work,night,reverse,reduce_brightness,qr_code_scanner,onehanded,color_correction,dream
        internet,bt,flashlight,dnd,alarm,airplane,controls,wallet,rotation,battery,cast,screenrecord,mictoggle,cameratoggle,location,hotspot,inversion,saver,dark,work,night,reverse,reduce_brightness,qr_code_scanner,onehanded,color_correction,dream,font_scaling
    </string>

    <!-- The tiles to display in QuickSettings -->
+2 −0
Original line number Diff line number Diff line
@@ -660,6 +660,8 @@
    <string name="quick_settings_inversion_label">Color inversion</string>
    <!-- QuickSettings: Label for the toggle that controls whether display color correction is enabled. [CHAR LIMIT=NONE] -->
    <string name="quick_settings_color_correction_label">Color correction</string>
    <!-- QuickSettings: Label for font size scaling. [CHAR LIMIT=NONE] -->
    <string name="quick_settings_font_scaling_label">Font size</string>
    <!-- QuickSettings: Control panel: Label for button that navigates to user settings. [CHAR LIMIT=NONE] -->
    <string name="quick_settings_more_user_settings">Manage users</string>
    <!-- QuickSettings: Control panel: Label for button that dismisses control panel. [CHAR LIMIT=NONE] -->
+10 −0
Original line number Diff line number Diff line
@@ -318,4 +318,14 @@
        <item>Off</item>
        <item>On</item>
    </string-array>

    <!-- State names for font scaling tile: unavailable, off, on.
         This subtitle is shown when the tile is in that particular state but does not set its own
         subtitle, so some of these may never appear on screen. They should still be translated as
         if they could appear. [CHAR LIMIT=32] -->
    <string-array name="tile_states_font_scaling">
        <item>Unavailable</item>
        <item>Off</item>
        <item>On</item>
    </string-array>
</resources>
 No newline at end of file
+7 −1
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import com.android.systemui.qs.tiles.DeviceControlsTile;
import com.android.systemui.qs.tiles.DndTile;
import com.android.systemui.qs.tiles.DreamTile;
import com.android.systemui.qs.tiles.FlashlightTile;
import com.android.systemui.qs.tiles.FontScalingTile;
import com.android.systemui.qs.tiles.HotspotTile;
import com.android.systemui.qs.tiles.InternetTile;
import com.android.systemui.qs.tiles.LocationTile;
@@ -94,6 +95,7 @@ public class QSFactoryImpl implements QSFactory {
    private final Provider<QRCodeScannerTile> mQRCodeScannerTileProvider;
    private final Provider<OneHandedModeTile> mOneHandedModeTileProvider;
    private final Provider<DreamTile> mDreamTileProvider;
    private final Provider<FontScalingTile> mFontScalingTileProvider;

    private final Lazy<QSHost> mQsHostLazy;
    private final Provider<CustomTile.Builder> mCustomTileBuilderProvider;
@@ -129,7 +131,8 @@ public class QSFactoryImpl implements QSFactory {
            Provider<QRCodeScannerTile> qrCodeScannerTileProvider,
            Provider<OneHandedModeTile> oneHandedModeTileProvider,
            Provider<ColorCorrectionTile> colorCorrectionTileProvider,
            Provider<DreamTile> dreamTileProvider) {
            Provider<DreamTile> dreamTileProvider,
            Provider<FontScalingTile> fontScalingTileProvider) {
        mQsHostLazy = qsHostLazy;
        mCustomTileBuilderProvider = customTileBuilderProvider;

@@ -161,6 +164,7 @@ public class QSFactoryImpl implements QSFactory {
        mOneHandedModeTileProvider = oneHandedModeTileProvider;
        mColorCorrectionTileProvider = colorCorrectionTileProvider;
        mDreamTileProvider = dreamTileProvider;
        mFontScalingTileProvider = fontScalingTileProvider;
    }

    /** Creates a tile with a type based on {@code tileSpec} */
@@ -232,6 +236,8 @@ public class QSFactoryImpl implements QSFactory {
                return mColorCorrectionTileProvider.get();
            case "dream":
                return mDreamTileProvider.get();
            case "font_scaling":
                return mFontScalingTileProvider.get();
        }

        // Custom tiles
Loading