Loading packages/SystemUI/res/layout/screenshot_shelf.xml +0 −2 Original line number Diff line number Diff line Loading @@ -51,7 +51,6 @@ android:layout_marginBottom="@dimen/overlay_border_width" android:layout_gravity="center" android:elevation="4dp" android:contentDescription="@string/screenshot_edit_description" android:scaleType="fitEnd" android:background="@drawable/overlay_preview_background" android:adjustViewBounds="true" Loading @@ -67,7 +66,6 @@ android:layout_marginBottom="@dimen/overlay_border_width" android:layout_gravity="center" android:elevation="4dp" android:contentDescription="@string/screenshot_edit_description" android:scaleType="fitEnd" android:background="@drawable/overlay_preview_background" android:adjustViewBounds="true" Loading packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotActionsController.kt +3 −2 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.screenshot import android.app.assist.AssistContent import com.android.systemui.screenshot.ui.viewmodel.ActionButtonAppearance import com.android.systemui.screenshot.ui.viewmodel.PreviewAction import com.android.systemui.screenshot.ui.viewmodel.ScreenshotViewModel import dagger.assisted.Assisted import dagger.assisted.AssistedFactory Loading Loading @@ -84,9 +85,9 @@ constructor( } inner class ActionsCallback(private val screenshotId: UUID) { fun providePreviewAction(onClick: () -> Unit) { fun providePreviewAction(previewAction: PreviewAction) { if (screenshotId == currentScreenshotId) { viewModel.setPreviewAction(onClick) viewModel.setPreviewAction(previewAction) } } Loading packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotActionsProvider.kt +15 −10 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import com.android.systemui.screenshot.ScreenshotEvent.SCREENSHOT_EDIT_TAPPED import com.android.systemui.screenshot.ScreenshotEvent.SCREENSHOT_PREVIEW_TAPPED import com.android.systemui.screenshot.ScreenshotEvent.SCREENSHOT_SHARE_TAPPED import com.android.systemui.screenshot.ui.viewmodel.ActionButtonAppearance import com.android.systemui.screenshot.ui.viewmodel.PreviewAction import dagger.assisted.Assisted import dagger.assisted.AssistedFactory import dagger.assisted.AssistedInject Loading @@ -40,7 +41,9 @@ import java.util.UUID */ interface ScreenshotActionsProvider { fun onScrollChipReady(onClick: Runnable) fun onScrollChipInvalidated() fun setCompletedScreenshot(result: ScreenshotSavedResult) /** Loading Loading @@ -75,7 +78,8 @@ constructor( private var result: ScreenshotSavedResult? = null init { actionsCallback.providePreviewAction { actionsCallback.providePreviewAction( PreviewAction(context.resources.getString(R.string.screenshot_edit_description)) { debugLog(LogConfig.DEBUG_ACTIONS) { "Preview tapped" } uiEventLogger.log(SCREENSHOT_PREVIEW_TAPPED, 0, request.packageNameString) onDeferrableActionTapped { result -> Loading @@ -86,6 +90,7 @@ constructor( ) } } ) actionsCallback.provideActionButton( ActionButtonAppearance( Loading packages/SystemUI/src/com/android/systemui/screenshot/ui/binder/ScreenshotShelfViewBinder.kt +3 −2 Original line number Diff line number Diff line Loading @@ -128,8 +128,9 @@ constructor(private val buttonViewBinder: ActionButtonViewBinder) { } } launch { viewModel.previewAction.collect { onClick -> previewView.setOnClickListener { onClick?.invoke() } viewModel.previewAction.collect { action -> previewView.setOnClickListener { action?.onClick?.invoke() } previewView.contentDescription = action?.contentDescription } } launch { Loading packages/SystemUI/src/com/android/systemui/screenshot/ui/viewmodel/ScreenshotViewModel.kt +9 −4 Original line number Diff line number Diff line Loading @@ -31,8 +31,8 @@ class ScreenshotViewModel(private val accessibilityManager: AccessibilityManager val scrollingScrim: StateFlow<Bitmap?> = _scrollingScrim private val _badge = MutableStateFlow<Drawable?>(null) val badge: StateFlow<Drawable?> = _badge private val _previewAction = MutableStateFlow<(() -> Unit)?>(null) val previewAction: StateFlow<(() -> Unit)?> = _previewAction private val _previewAction = MutableStateFlow<PreviewAction?>(null) val previewAction: StateFlow<PreviewAction?> = _previewAction private val _actions = MutableStateFlow(emptyList<ActionButtonViewModel>()) val actions: StateFlow<List<ActionButtonViewModel>> = _actions private val _animationState = MutableStateFlow(AnimationState.NOT_STARTED) Loading @@ -57,8 +57,8 @@ class ScreenshotViewModel(private val accessibilityManager: AccessibilityManager _badge.value = badge } fun setPreviewAction(onClick: () -> Unit) { _previewAction.value = onClick fun setPreviewAction(previewAction: PreviewAction) { _previewAction.value = previewAction } fun addAction( Loading Loading @@ -149,6 +149,11 @@ class ScreenshotViewModel(private val accessibilityManager: AccessibilityManager } } data class PreviewAction( val contentDescription: CharSequence, val onClick: () -> Unit, ) enum class AnimationState { NOT_STARTED, ENTRANCE_STARTED, // The first 200ms of the entrance animation Loading Loading
packages/SystemUI/res/layout/screenshot_shelf.xml +0 −2 Original line number Diff line number Diff line Loading @@ -51,7 +51,6 @@ android:layout_marginBottom="@dimen/overlay_border_width" android:layout_gravity="center" android:elevation="4dp" android:contentDescription="@string/screenshot_edit_description" android:scaleType="fitEnd" android:background="@drawable/overlay_preview_background" android:adjustViewBounds="true" Loading @@ -67,7 +66,6 @@ android:layout_marginBottom="@dimen/overlay_border_width" android:layout_gravity="center" android:elevation="4dp" android:contentDescription="@string/screenshot_edit_description" android:scaleType="fitEnd" android:background="@drawable/overlay_preview_background" android:adjustViewBounds="true" Loading
packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotActionsController.kt +3 −2 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.screenshot import android.app.assist.AssistContent import com.android.systemui.screenshot.ui.viewmodel.ActionButtonAppearance import com.android.systemui.screenshot.ui.viewmodel.PreviewAction import com.android.systemui.screenshot.ui.viewmodel.ScreenshotViewModel import dagger.assisted.Assisted import dagger.assisted.AssistedFactory Loading Loading @@ -84,9 +85,9 @@ constructor( } inner class ActionsCallback(private val screenshotId: UUID) { fun providePreviewAction(onClick: () -> Unit) { fun providePreviewAction(previewAction: PreviewAction) { if (screenshotId == currentScreenshotId) { viewModel.setPreviewAction(onClick) viewModel.setPreviewAction(previewAction) } } Loading
packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotActionsProvider.kt +15 −10 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import com.android.systemui.screenshot.ScreenshotEvent.SCREENSHOT_EDIT_TAPPED import com.android.systemui.screenshot.ScreenshotEvent.SCREENSHOT_PREVIEW_TAPPED import com.android.systemui.screenshot.ScreenshotEvent.SCREENSHOT_SHARE_TAPPED import com.android.systemui.screenshot.ui.viewmodel.ActionButtonAppearance import com.android.systemui.screenshot.ui.viewmodel.PreviewAction import dagger.assisted.Assisted import dagger.assisted.AssistedFactory import dagger.assisted.AssistedInject Loading @@ -40,7 +41,9 @@ import java.util.UUID */ interface ScreenshotActionsProvider { fun onScrollChipReady(onClick: Runnable) fun onScrollChipInvalidated() fun setCompletedScreenshot(result: ScreenshotSavedResult) /** Loading Loading @@ -75,7 +78,8 @@ constructor( private var result: ScreenshotSavedResult? = null init { actionsCallback.providePreviewAction { actionsCallback.providePreviewAction( PreviewAction(context.resources.getString(R.string.screenshot_edit_description)) { debugLog(LogConfig.DEBUG_ACTIONS) { "Preview tapped" } uiEventLogger.log(SCREENSHOT_PREVIEW_TAPPED, 0, request.packageNameString) onDeferrableActionTapped { result -> Loading @@ -86,6 +90,7 @@ constructor( ) } } ) actionsCallback.provideActionButton( ActionButtonAppearance( Loading
packages/SystemUI/src/com/android/systemui/screenshot/ui/binder/ScreenshotShelfViewBinder.kt +3 −2 Original line number Diff line number Diff line Loading @@ -128,8 +128,9 @@ constructor(private val buttonViewBinder: ActionButtonViewBinder) { } } launch { viewModel.previewAction.collect { onClick -> previewView.setOnClickListener { onClick?.invoke() } viewModel.previewAction.collect { action -> previewView.setOnClickListener { action?.onClick?.invoke() } previewView.contentDescription = action?.contentDescription } } launch { Loading
packages/SystemUI/src/com/android/systemui/screenshot/ui/viewmodel/ScreenshotViewModel.kt +9 −4 Original line number Diff line number Diff line Loading @@ -31,8 +31,8 @@ class ScreenshotViewModel(private val accessibilityManager: AccessibilityManager val scrollingScrim: StateFlow<Bitmap?> = _scrollingScrim private val _badge = MutableStateFlow<Drawable?>(null) val badge: StateFlow<Drawable?> = _badge private val _previewAction = MutableStateFlow<(() -> Unit)?>(null) val previewAction: StateFlow<(() -> Unit)?> = _previewAction private val _previewAction = MutableStateFlow<PreviewAction?>(null) val previewAction: StateFlow<PreviewAction?> = _previewAction private val _actions = MutableStateFlow(emptyList<ActionButtonViewModel>()) val actions: StateFlow<List<ActionButtonViewModel>> = _actions private val _animationState = MutableStateFlow(AnimationState.NOT_STARTED) Loading @@ -57,8 +57,8 @@ class ScreenshotViewModel(private val accessibilityManager: AccessibilityManager _badge.value = badge } fun setPreviewAction(onClick: () -> Unit) { _previewAction.value = onClick fun setPreviewAction(previewAction: PreviewAction) { _previewAction.value = previewAction } fun addAction( Loading Loading @@ -149,6 +149,11 @@ class ScreenshotViewModel(private val accessibilityManager: AccessibilityManager } } data class PreviewAction( val contentDescription: CharSequence, val onClick: () -> Unit, ) enum class AnimationState { NOT_STARTED, ENTRANCE_STARTED, // The first 200ms of the entrance animation Loading