Loading packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/InternetTileViewModel.kt +14 −16 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ import com.android.systemui.common.shared.model.ContentDescription import com.android.systemui.common.shared.model.ContentDescription.Companion.loadContentDescription import com.android.systemui.common.shared.model.Text import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.qs.tileimpl.QSTileImpl import com.android.systemui.qs.tileimpl.QSTileImpl.ResourceIcon import com.android.systemui.res.R Loading Loading @@ -61,7 +61,7 @@ constructor( mobileIconsInteractor: MobileIconsInteractor, wifiInteractor: WifiInteractor, private val context: Context, @Application scope: CoroutineScope, @Background scope: CoroutineScope, ) { private val internetLabel: String = context.getString(R.string.quick_settings_internet_label) Loading Loading @@ -111,17 +111,16 @@ constructor( if (it == null) { notConnectedFlow } else { combine( it.networkName, it.signalLevelIcon, mobileDataContentName, ) { networkNameModel, signalIcon, dataContentDescription -> combine(it.networkName, it.signalLevelIcon, mobileDataContentName) { networkNameModel, signalIcon, dataContentDescription -> when (signalIcon) { is SignalIconModel.Cellular -> { val secondary = mobileDataContentConcat( networkNameModel.name, dataContentDescription dataContentDescription, ) InternetTileModel.Active( secondaryTitle = secondary, Loading @@ -147,7 +146,7 @@ constructor( private fun mobileDataContentConcat( networkName: String?, dataContentDescription: CharSequence? dataContentDescription: CharSequence?, ): CharSequence { if (dataContentDescription == null) { return networkName ?: "" Loading @@ -160,9 +159,9 @@ constructor( context.getString( R.string.mobile_carrier_text_format, networkName, dataContentDescription dataContentDescription, ), 0 0, ) } Loading Loading @@ -191,10 +190,9 @@ constructor( } private val notConnectedFlow: StateFlow<InternetTileModel> = combine( wifiInteractor.areNetworksAvailable, airplaneModeRepository.isAirplaneMode, ) { networksAvailable, isAirplaneMode -> combine(wifiInteractor.areNetworksAvailable, airplaneModeRepository.isAirplaneMode) { networksAvailable, isAirplaneMode -> when { isAirplaneMode -> { val secondary = context.getString(R.string.status_bar_airplane) Loading @@ -213,7 +211,7 @@ constructor( iconId = R.drawable.ic_qs_no_internet_available, stateDescription = null, contentDescription = ContentDescription.Loaded("$internetLabel,$secondary") ContentDescription.Loaded("$internetLabel,$secondary"), ) } else -> { Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/InternetTileViewModel.kt +14 −16 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ import com.android.systemui.common.shared.model.ContentDescription import com.android.systemui.common.shared.model.ContentDescription.Companion.loadContentDescription import com.android.systemui.common.shared.model.Text import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.qs.tileimpl.QSTileImpl import com.android.systemui.qs.tileimpl.QSTileImpl.ResourceIcon import com.android.systemui.res.R Loading Loading @@ -61,7 +61,7 @@ constructor( mobileIconsInteractor: MobileIconsInteractor, wifiInteractor: WifiInteractor, private val context: Context, @Application scope: CoroutineScope, @Background scope: CoroutineScope, ) { private val internetLabel: String = context.getString(R.string.quick_settings_internet_label) Loading Loading @@ -111,17 +111,16 @@ constructor( if (it == null) { notConnectedFlow } else { combine( it.networkName, it.signalLevelIcon, mobileDataContentName, ) { networkNameModel, signalIcon, dataContentDescription -> combine(it.networkName, it.signalLevelIcon, mobileDataContentName) { networkNameModel, signalIcon, dataContentDescription -> when (signalIcon) { is SignalIconModel.Cellular -> { val secondary = mobileDataContentConcat( networkNameModel.name, dataContentDescription dataContentDescription, ) InternetTileModel.Active( secondaryTitle = secondary, Loading @@ -147,7 +146,7 @@ constructor( private fun mobileDataContentConcat( networkName: String?, dataContentDescription: CharSequence? dataContentDescription: CharSequence?, ): CharSequence { if (dataContentDescription == null) { return networkName ?: "" Loading @@ -160,9 +159,9 @@ constructor( context.getString( R.string.mobile_carrier_text_format, networkName, dataContentDescription dataContentDescription, ), 0 0, ) } Loading Loading @@ -191,10 +190,9 @@ constructor( } private val notConnectedFlow: StateFlow<InternetTileModel> = combine( wifiInteractor.areNetworksAvailable, airplaneModeRepository.isAirplaneMode, ) { networksAvailable, isAirplaneMode -> combine(wifiInteractor.areNetworksAvailable, airplaneModeRepository.isAirplaneMode) { networksAvailable, isAirplaneMode -> when { isAirplaneMode -> { val secondary = context.getString(R.string.status_bar_airplane) Loading @@ -213,7 +211,7 @@ constructor( iconId = R.drawable.ic_qs_no_internet_available, stateDescription = null, contentDescription = ContentDescription.Loaded("$internetLabel,$secondary") ContentDescription.Loaded("$internetLabel,$secondary"), ) } else -> { Loading