Loading packages/SystemUI/plugin/src/com/android/systemui/plugins/WeatherData.kt +7 −2 Original line number Diff line number Diff line Loading @@ -2,14 +2,18 @@ package com.android.systemui.plugins import android.os.Bundle import android.util.Log import android.view.View import androidx.annotation.VisibleForTesting typealias WeatherTouchAction = (View) -> Unit class WeatherData constructor( val description: String, val state: WeatherStateIcon, val useCelsius: Boolean, val temperature: Int, val touchAction: WeatherTouchAction? = null, ) { companion object { const val DEBUG = true Loading @@ -20,7 +24,7 @@ constructor( @VisibleForTesting const val TEMPERATURE_KEY = "temperature" private const val INVALID_WEATHER_ICON_STATE = -1 fun fromBundle(extras: Bundle): WeatherData? { fun fromBundle(extras: Bundle, touchAction: WeatherTouchAction? = null): WeatherData? { val description = extras.getString(DESCRIPTION_KEY) val state = WeatherStateIcon.fromInt(extras.getInt(STATE_KEY, INVALID_WEATHER_ICON_STATE)) Loading @@ -41,7 +45,8 @@ constructor( description = description, state = state, useCelsius = extras.getBoolean(USE_CELSIUS_KEY), temperature = temperature temperature = temperature, touchAction = touchAction ) if (DEBUG) { Log.i(TAG, "Weather data parsed $result from $extras") Loading packages/SystemUI/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceController.kt +10 −1 Original line number Diff line number Diff line Loading @@ -176,7 +176,16 @@ constructor( now.isBefore(Instant.ofEpochMilli(t.expiryTimeMillis)) } if (weatherTarget != null) { val weatherData = WeatherData.fromBundle(weatherTarget.baseAction.extras) val clickIntent = weatherTarget.headerAction?.intent val weatherData = WeatherData.fromBundle(weatherTarget.baseAction.extras, { v -> if (!falsingManager.isFalseTap(FalsingManager.LOW_PENALTY)) { activityStarter.startActivity( clickIntent, true, /* dismissShade */ null, false) } }) if (weatherData != null) { keyguardUpdateMonitor.sendWeatherData(weatherData) } Loading Loading
packages/SystemUI/plugin/src/com/android/systemui/plugins/WeatherData.kt +7 −2 Original line number Diff line number Diff line Loading @@ -2,14 +2,18 @@ package com.android.systemui.plugins import android.os.Bundle import android.util.Log import android.view.View import androidx.annotation.VisibleForTesting typealias WeatherTouchAction = (View) -> Unit class WeatherData constructor( val description: String, val state: WeatherStateIcon, val useCelsius: Boolean, val temperature: Int, val touchAction: WeatherTouchAction? = null, ) { companion object { const val DEBUG = true Loading @@ -20,7 +24,7 @@ constructor( @VisibleForTesting const val TEMPERATURE_KEY = "temperature" private const val INVALID_WEATHER_ICON_STATE = -1 fun fromBundle(extras: Bundle): WeatherData? { fun fromBundle(extras: Bundle, touchAction: WeatherTouchAction? = null): WeatherData? { val description = extras.getString(DESCRIPTION_KEY) val state = WeatherStateIcon.fromInt(extras.getInt(STATE_KEY, INVALID_WEATHER_ICON_STATE)) Loading @@ -41,7 +45,8 @@ constructor( description = description, state = state, useCelsius = extras.getBoolean(USE_CELSIUS_KEY), temperature = temperature temperature = temperature, touchAction = touchAction ) if (DEBUG) { Log.i(TAG, "Weather data parsed $result from $extras") Loading
packages/SystemUI/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceController.kt +10 −1 Original line number Diff line number Diff line Loading @@ -176,7 +176,16 @@ constructor( now.isBefore(Instant.ofEpochMilli(t.expiryTimeMillis)) } if (weatherTarget != null) { val weatherData = WeatherData.fromBundle(weatherTarget.baseAction.extras) val clickIntent = weatherTarget.headerAction?.intent val weatherData = WeatherData.fromBundle(weatherTarget.baseAction.extras, { v -> if (!falsingManager.isFalseTap(FalsingManager.LOW_PENALTY)) { activityStarter.startActivity( clickIntent, true, /* dismissShade */ null, false) } }) if (weatherData != null) { keyguardUpdateMonitor.sendWeatherData(weatherData) } Loading