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 17 package com.android.systemui.statusbar.pipeline.shared.ui.binder 18 19 import android.view.View 20 import com.android.systemui.statusbar.StatusBarIconView 21 import com.android.systemui.statusbar.pipeline.mobile.ui.binder.MobileIconBinder 22 import com.android.systemui.statusbar.pipeline.wifi.ui.binder.WifiViewBinder 23 24 /** 25 * The helper to update the groupView and dotView visibility based on given visibility state, only 26 * used for [MobileIconBinder] and [WifiViewBinder] now. 27 */ 28 class ModernStatusBarViewVisibilityHelper { 29 companion object { 30 setVisibilityStatenull31 fun setVisibilityState( 32 @StatusBarIconView.VisibleState state: Int, 33 groupView: View, 34 dotView: View, 35 ) { 36 when (state) { 37 StatusBarIconView.STATE_ICON -> { 38 groupView.visibility = View.VISIBLE 39 dotView.visibility = View.GONE 40 } 41 StatusBarIconView.STATE_DOT -> { 42 groupView.visibility = View.INVISIBLE 43 dotView.visibility = View.VISIBLE 44 } 45 StatusBarIconView.STATE_HIDDEN -> { 46 groupView.visibility = View.INVISIBLE 47 dotView.visibility = View.INVISIBLE 48 } 49 } 50 } 51 } 52 } 53