1 /* 2 * Copyright (C) 2020 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 17 package com.android.settingslib; 18 19 /** 20 * Content descriptions for accessibility support. 21 */ 22 public class AccessibilityContentDescriptions { 23 AccessibilityContentDescriptions()24 private AccessibilityContentDescriptions() {} 25 26 public static final int PHONE_SIGNAL_STRENGTH_NONE = R.string.accessibility_no_phone; 27 28 public static final int[] PHONE_SIGNAL_STRENGTH = { 29 PHONE_SIGNAL_STRENGTH_NONE, 30 R.string.accessibility_phone_one_bar, 31 R.string.accessibility_phone_two_bars, 32 R.string.accessibility_phone_three_bars, 33 R.string.accessibility_phone_signal_full 34 }; 35 36 /** 37 * @param level int in range [0-4] that describes the signal level 38 * @return the appropriate content description for that signal strength, or 0 if the param is 39 * invalid 40 */ getDescriptionForLevel(int level)41 public static int getDescriptionForLevel(int level) { 42 if (level > 4 || level < 0) { 43 return 0; 44 } 45 46 return PHONE_SIGNAL_STRENGTH[level]; 47 } 48 49 public static final int[] PHONE_SIGNAL_STRENGTH_INFLATED = { 50 PHONE_SIGNAL_STRENGTH_NONE, 51 R.string.accessibility_phone_one_bar, 52 R.string.accessibility_phone_two_bars, 53 R.string.accessibility_phone_three_bars, 54 R.string.accessibility_phone_four_bars, 55 R.string.accessibility_phone_signal_full 56 }; 57 58 /** 59 * @param level int in range [0-5] that describes the inflated signal level 60 * @return the appropriate content description for that signal strength, or 0 if the param is 61 * invalid 62 */ getDescriptionForInflatedLevel(int level)63 public static int getDescriptionForInflatedLevel(int level) { 64 if (level > 5 || level < 0) { 65 return 0; 66 } 67 68 return PHONE_SIGNAL_STRENGTH_INFLATED[level]; 69 } 70 71 /** 72 * @param level int in range [0-5] that describes the inflated signal level 73 * @param numberOfLevels one of (4, 5) that describes the default number of levels, or the 74 * inflated number of levels. The level param should be relative to the 75 * number of levels. This won't do any inflation. 76 * @return the appropriate content description for that signal strength, or 0 if the param is 77 * invalid 78 */ getDescriptionForLevel(int level, int numberOfLevels)79 public static int getDescriptionForLevel(int level, int numberOfLevels) { 80 if (numberOfLevels == 5) { 81 return getDescriptionForLevel(level); 82 } else if (numberOfLevels == 6) { 83 return getDescriptionForInflatedLevel(level); 84 } else { 85 return 0; 86 } 87 } 88 89 public static final int[] DATA_CONNECTION_STRENGTH = { 90 R.string.accessibility_no_data, 91 R.string.accessibility_data_one_bar, 92 R.string.accessibility_data_two_bars, 93 R.string.accessibility_data_three_bars, 94 R.string.accessibility_data_signal_full 95 }; 96 97 public static final int[] WIFI_CONNECTION_STRENGTH = { 98 R.string.accessibility_no_wifi, 99 R.string.accessibility_wifi_one_bar, 100 R.string.accessibility_wifi_two_bars, 101 R.string.accessibility_wifi_three_bars, 102 R.string.accessibility_wifi_signal_full 103 }; 104 105 public static final int WIFI_NO_CONNECTION = R.string.accessibility_no_wifi; 106 public static final int WIFI_OTHER_DEVICE_CONNECTION = R.string.accessibility_wifi_other_device; 107 108 public static final int NO_CALLING = R.string.accessibility_no_calling; 109 110 public static final int[] ETHERNET_CONNECTION_VALUES = { 111 R.string.accessibility_ethernet_disconnected, 112 R.string.accessibility_ethernet_connected, 113 }; 114 } 115