1 /* 2 * Copyright (C) 2023 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package com.android.systemui.qs.tileimpl 17 18 import com.android.systemui.res.R 19 20 /** Return the subtitle resource Id of the given tile. */ 21 object SubtitleArrayMapping { 22 private val subtitleIdsMap: HashMap<String, Int> = HashMap() 23 init { 24 subtitleIdsMap["internet"] = R.array.tile_states_internet 25 subtitleIdsMap["wifi"] = R.array.tile_states_wifi 26 subtitleIdsMap["cell"] = R.array.tile_states_cell 27 subtitleIdsMap["battery"] = R.array.tile_states_battery 28 subtitleIdsMap["dnd"] = R.array.tile_states_dnd 29 subtitleIdsMap["flashlight"] = R.array.tile_states_flashlight 30 subtitleIdsMap["rotation"] = R.array.tile_states_rotation 31 subtitleIdsMap["bt"] = R.array.tile_states_bt 32 subtitleIdsMap["airplane"] = R.array.tile_states_airplane 33 subtitleIdsMap["location"] = R.array.tile_states_location 34 subtitleIdsMap["hotspot"] = R.array.tile_states_hotspot 35 subtitleIdsMap["inversion"] = R.array.tile_states_inversion 36 subtitleIdsMap["saver"] = R.array.tile_states_saver 37 subtitleIdsMap["dark"] = R.array.tile_states_dark 38 subtitleIdsMap["work"] = R.array.tile_states_work 39 subtitleIdsMap["cast"] = R.array.tile_states_cast 40 subtitleIdsMap["night"] = R.array.tile_states_night 41 subtitleIdsMap["screenrecord"] = R.array.tile_states_screenrecord 42 subtitleIdsMap["record_issue"] = R.array.tile_states_record_issue 43 subtitleIdsMap["reverse"] = R.array.tile_states_reverse 44 subtitleIdsMap["reduce_brightness"] = R.array.tile_states_reduce_brightness 45 subtitleIdsMap["cameratoggle"] = R.array.tile_states_cameratoggle 46 subtitleIdsMap["mictoggle"] = R.array.tile_states_mictoggle 47 subtitleIdsMap["controls"] = R.array.tile_states_controls 48 subtitleIdsMap["wallet"] = R.array.tile_states_wallet 49 subtitleIdsMap["qr_code_scanner"] = R.array.tile_states_qr_code_scanner 50 subtitleIdsMap["alarm"] = R.array.tile_states_alarm 51 subtitleIdsMap["onehanded"] = R.array.tile_states_onehanded 52 subtitleIdsMap["color_correction"] = R.array.tile_states_color_correction 53 subtitleIdsMap["dream"] = R.array.tile_states_dream 54 subtitleIdsMap["font_scaling"] = R.array.tile_states_font_scaling 55 subtitleIdsMap["hearing_devices"] = R.array.tile_states_hearing_devices 56 } 57 58 /** Get the subtitle resource id of the given tile */ getSubtitleIdnull59 fun getSubtitleId(spec: String?): Int { 60 return if (spec == null) { 61 R.array.tile_states_default 62 } else subtitleIdsMap[spec] ?: R.array.tile_states_default 63 } 64 } 65