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

Commit 75e2c74b authored by ronish's avatar ronish
Browse files

Add a quick settings entry point for QR Code Scanner

This change adds a new quick settings tile for QR Code scanner. The
visiblity of this tile controlled by QRCodeScannerController.

Bug: 200536509
Test: atest QRCodeScannerTileTest

Change-Id: I5d2e05a8231352bc79ac340a881de013abc546bb
parent c94f29e4
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2021 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"
        android:tint="?attr/colorControlNormal">

    <path
        android:pathData="M3,9H9V3H3V9ZM5,5H7V7H5V5ZM15,3V9H21V3H15ZM19,7H17V5H19V7ZM3,21H9V15H3V21ZM5,17H7V19H5V17ZM13,15V17H11V15V13V11H13V13H15V11H17V13V15H13ZM17,19H21V21H17H15V19V17H17V19ZM19,11H21V17H19V11ZM7,11H9V13H7V11ZM11,19H13V21H11V19ZM5,13H3V11H5V13ZM13,9H11V3H13V9Z"
        android:fillColor="@android:color/white"/>
</vector>
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -82,7 +82,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
        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
    </string>

    <!-- The tiles to display in QuickSettings -->
+6 −0
Original line number Diff line number Diff line
@@ -1196,6 +1196,12 @@
    <!-- Overflow menu item label to open the lockscreen settings in wallet activity. [CHAR LIMIT=NONE] -->
    <string name="wallet_lockscreen_settings_label">Lock screen settings</string>

    <!-- QR Code Scanner label, title [CHAR LIMIT=32] -->
    <string name="qr_code_scanner_title">Scan QR</string>

    <!-- QR Code Scanner description [CHAR LIMIT=NONE] -->
    <string name="qr_code_scanner_description">Click to scan a QR code</string>

    <!-- Name of the work status bar icon. -->
    <string name="status_bar_work">Work profile</string>

+10 −0
Original line number Diff line number Diff line
@@ -272,6 +272,16 @@
        <item>On</item>
    </string-array>

    <!-- State names for qr code scanner 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_qr_code_scanner">
        <item>Unavailable</item>
        <item>Off</item>
        <item>On</item>
    </string-array>

    <!-- State names for alarm 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
+7 −1
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ import com.android.systemui.qs.tiles.LocationTile;
import com.android.systemui.qs.tiles.MicrophoneToggleTile;
import com.android.systemui.qs.tiles.NfcTile;
import com.android.systemui.qs.tiles.NightDisplayTile;
import com.android.systemui.qs.tiles.QRCodeScannerTile;
import com.android.systemui.qs.tiles.QuickAccessWalletTile;
import com.android.systemui.qs.tiles.ReduceBrightColorsTile;
import com.android.systemui.qs.tiles.RotationLockTile;
@@ -90,6 +91,7 @@ public class QSFactoryImpl implements QSFactory {
    private final Provider<DeviceControlsTile> mDeviceControlsTileProvider;
    private final Provider<AlarmTile> mAlarmTileProvider;
    private final Provider<QuickAccessWalletTile> mQuickAccessWalletTileProvider;
    private final Provider<QRCodeScannerTile> mQRCodeScannerTileProvider;

    private final Lazy<QSHost> mQsHostLazy;
    private final Provider<CustomTile.Builder> mCustomTileBuilderProvider;
@@ -124,7 +126,8 @@ public class QSFactoryImpl implements QSFactory {
            Provider<MicrophoneToggleTile> microphoneToggleTileProvider,
            Provider<DeviceControlsTile> deviceControlsTileProvider,
            Provider<AlarmTile> alarmTileProvider,
            Provider<QuickAccessWalletTile> quickAccessWalletTileProvider) {
            Provider<QuickAccessWalletTile> quickAccessWalletTileProvider,
            Provider<QRCodeScannerTile> qrCodeScannerTileProvider) {
        mQsHostLazy = qsHostLazy;
        mCustomTileBuilderProvider = customTileBuilderProvider;

@@ -155,6 +158,7 @@ public class QSFactoryImpl implements QSFactory {
        mDeviceControlsTileProvider = deviceControlsTileProvider;
        mAlarmTileProvider = alarmTileProvider;
        mQuickAccessWalletTileProvider = quickAccessWalletTileProvider;
        mQRCodeScannerTileProvider = qrCodeScannerTileProvider;
    }

    public QSTile createTile(String tileSpec) {
@@ -221,6 +225,8 @@ public class QSFactoryImpl implements QSFactory {
                return mAlarmTileProvider.get();
            case "wallet":
                return mQuickAccessWalletTileProvider.get();
            case "qr_code_scanner":
                return mQRCodeScannerTileProvider.get();
        }

        // Custom tiles
Loading