Loading packages/SystemUI/src/com/android/systemui/controls/ui/ControlViewHolder.kt +7 −0 Original line number Original line Diff line number Diff line Loading @@ -128,6 +128,8 @@ class ControlViewHolder( val controlTemplate: ControlTemplate val controlTemplate: ControlTemplate get() = cws.control?.let { it.controlTemplate } ?: ControlTemplate.NO_TEMPLATE get() = cws.control?.let { it.controlTemplate } ?: ControlTemplate.NO_TEMPLATE var userInteractionInProgress = false init { init { val ld = layout.getBackground() as LayerDrawable val ld = layout.getBackground() as LayerDrawable ld.mutate() ld.mutate() Loading @@ -139,6 +141,11 @@ class ControlViewHolder( } } fun bindData(cws: ControlWithState) { fun bindData(cws: ControlWithState) { // If an interaction is in progress, the update may visually interfere with the action the // action the user wants to make. Don't apply the update, and instead assume a new update // will coming from when the user interaction is complete. if (userInteractionInProgress) return this.cws = cws this.cws = cws cancelUpdate?.run() cancelUpdate?.run() Loading packages/SystemUI/src/com/android/systemui/controls/ui/ToggleRangeBehavior.kt +2 −0 Original line number Original line Diff line number Diff line Loading @@ -216,6 +216,7 @@ class ToggleRangeBehavior : Behavior { } } fun beginUpdateRange() { fun beginUpdateRange() { cvh.userInteractionInProgress = true cvh.setStatusTextSize(context.getResources() cvh.setStatusTextSize(context.getResources() .getDimensionPixelSize(R.dimen.control_status_expanded).toFloat()) .getDimensionPixelSize(R.dimen.control_status_expanded).toFloat()) } } Loading Loading @@ -296,6 +297,7 @@ class ToggleRangeBehavior : Behavior { cvh.setStatusText("$currentStatusText $currentRangeValue", /* immediately */ true) cvh.setStatusText("$currentStatusText $currentRangeValue", /* immediately */ true) cvh.controlActionCoordinator.setValue(cvh, rangeTemplate.getTemplateId(), cvh.controlActionCoordinator.setValue(cvh, rangeTemplate.getTemplateId(), findNearestStep(levelToRangeValue(clipLayer.getLevel()))) findNearestStep(levelToRangeValue(clipLayer.getLevel()))) cvh.userInteractionInProgress = false } } fun findNearestStep(value: Float): Float { fun findNearestStep(value: Float): Float { Loading Loading
packages/SystemUI/src/com/android/systemui/controls/ui/ControlViewHolder.kt +7 −0 Original line number Original line Diff line number Diff line Loading @@ -128,6 +128,8 @@ class ControlViewHolder( val controlTemplate: ControlTemplate val controlTemplate: ControlTemplate get() = cws.control?.let { it.controlTemplate } ?: ControlTemplate.NO_TEMPLATE get() = cws.control?.let { it.controlTemplate } ?: ControlTemplate.NO_TEMPLATE var userInteractionInProgress = false init { init { val ld = layout.getBackground() as LayerDrawable val ld = layout.getBackground() as LayerDrawable ld.mutate() ld.mutate() Loading @@ -139,6 +141,11 @@ class ControlViewHolder( } } fun bindData(cws: ControlWithState) { fun bindData(cws: ControlWithState) { // If an interaction is in progress, the update may visually interfere with the action the // action the user wants to make. Don't apply the update, and instead assume a new update // will coming from when the user interaction is complete. if (userInteractionInProgress) return this.cws = cws this.cws = cws cancelUpdate?.run() cancelUpdate?.run() Loading
packages/SystemUI/src/com/android/systemui/controls/ui/ToggleRangeBehavior.kt +2 −0 Original line number Original line Diff line number Diff line Loading @@ -216,6 +216,7 @@ class ToggleRangeBehavior : Behavior { } } fun beginUpdateRange() { fun beginUpdateRange() { cvh.userInteractionInProgress = true cvh.setStatusTextSize(context.getResources() cvh.setStatusTextSize(context.getResources() .getDimensionPixelSize(R.dimen.control_status_expanded).toFloat()) .getDimensionPixelSize(R.dimen.control_status_expanded).toFloat()) } } Loading Loading @@ -296,6 +297,7 @@ class ToggleRangeBehavior : Behavior { cvh.setStatusText("$currentStatusText $currentRangeValue", /* immediately */ true) cvh.setStatusText("$currentStatusText $currentRangeValue", /* immediately */ true) cvh.controlActionCoordinator.setValue(cvh, rangeTemplate.getTemplateId(), cvh.controlActionCoordinator.setValue(cvh, rangeTemplate.getTemplateId(), findNearestStep(levelToRangeValue(clipLayer.getLevel()))) findNearestStep(levelToRangeValue(clipLayer.getLevel()))) cvh.userInteractionInProgress = false } } fun findNearestStep(value: Float): Float { fun findNearestStep(value: Float): Float { Loading