1 /* 2 * Copyright (C) 2008 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.systemui.statusbar.connectivity; 18 19 import static com.android.settingslib.flags.Flags.newStatusBarIcons; 20 21 import com.android.settingslib.AccessibilityContentDescriptions; 22 import com.android.settingslib.R; 23 import com.android.settingslib.SignalIcon.IconGroup; 24 25 /** */ 26 public class WifiIcons { 27 28 public static final int[] WIFI_FULL_ICONS = getIconsBasedOnFlag(); 29 30 /** 31 * Check the aconfig flag to decide on which icons to use. Can be removed once the flag is gone 32 */ getIconsBasedOnFlag()33 private static int[] getIconsBasedOnFlag() { 34 if (newStatusBarIcons()) { 35 return new int[] { 36 R.drawable.ic_wifi_0, 37 R.drawable.ic_wifi_1, 38 R.drawable.ic_wifi_2, 39 R.drawable.ic_wifi_3, 40 R.drawable.ic_wifi_4 41 }; 42 } else { 43 return new int[] { 44 com.android.internal.R.drawable.ic_wifi_signal_0, 45 com.android.internal.R.drawable.ic_wifi_signal_1, 46 com.android.internal.R.drawable.ic_wifi_signal_2, 47 com.android.internal.R.drawable.ic_wifi_signal_3, 48 com.android.internal.R.drawable.ic_wifi_signal_4 49 }; 50 } 51 } 52 53 public static final int[] WIFI_NO_INTERNET_ICONS = getErrorIconsBasedOnFlag(); 54 getErrorIconsBasedOnFlag()55 private static int [] getErrorIconsBasedOnFlag() { 56 if (newStatusBarIcons()) { 57 return new int[] { 58 R.drawable.ic_wifi_0_error, 59 R.drawable.ic_wifi_1_error, 60 R.drawable.ic_wifi_2_error, 61 R.drawable.ic_wifi_3_error, 62 R.drawable.ic_wifi_4_error 63 }; 64 } else { 65 return new int[] { 66 R.drawable.ic_no_internet_wifi_signal_0, 67 R.drawable.ic_no_internet_wifi_signal_1, 68 R.drawable.ic_no_internet_wifi_signal_2, 69 R.drawable.ic_no_internet_wifi_signal_3, 70 R.drawable.ic_no_internet_wifi_signal_4 71 }; 72 } 73 } 74 75 public static final int[][] QS_WIFI_SIGNAL_STRENGTH = { 76 WIFI_NO_INTERNET_ICONS, 77 WIFI_FULL_ICONS 78 }; 79 80 static final int[][] WIFI_SIGNAL_STRENGTH = QS_WIFI_SIGNAL_STRENGTH; 81 82 public static final int QS_WIFI_DISABLED = com.android.internal.R.drawable.ic_wifi_signal_0; 83 public static final int QS_WIFI_NO_NETWORK = com.android.internal.R.drawable.ic_wifi_signal_0; 84 public static final int WIFI_NO_NETWORK = QS_WIFI_NO_NETWORK; 85 86 static final int WIFI_LEVEL_COUNT = WIFI_SIGNAL_STRENGTH[0].length; 87 88 public static final IconGroup UNMERGED_WIFI = new IconGroup( 89 "Wi-Fi Icons", 90 WifiIcons.WIFI_SIGNAL_STRENGTH, 91 WifiIcons.QS_WIFI_SIGNAL_STRENGTH, 92 AccessibilityContentDescriptions.WIFI_CONNECTION_STRENGTH, 93 WifiIcons.WIFI_NO_NETWORK, 94 WifiIcons.QS_WIFI_NO_NETWORK, 95 WifiIcons.WIFI_NO_NETWORK, 96 WifiIcons.QS_WIFI_NO_NETWORK, 97 AccessibilityContentDescriptions.WIFI_NO_CONNECTION 98 ); 99 } 100