From 5ca4f42f2ecf58213651f07d2ea961ee83ee8039 Mon Sep 17 00:00:00 2001 From: Priyank Singh Date: Fri, 26 Apr 2019 16:03:35 -0700 Subject: [PATCH] Update the CarVolumeItem state when the progress is changed. Bug: 131210648 Test: Manual Change-Id: I417541fb79c82151e9a09480a7ef443a82c7ef24 --- .../systemui/volume/CarVolumeDialogImpl.java | 2 ++ .../android/systemui/volume/CarVolumeItem.java | 17 +---------------- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/packages/CarSystemUI/src/com/android/systemui/volume/CarVolumeDialogImpl.java b/packages/CarSystemUI/src/com/android/systemui/volume/CarVolumeDialogImpl.java index 267d9f54dd8d1..94962f7c1989e 100644 --- a/packages/CarSystemUI/src/com/android/systemui/volume/CarVolumeDialogImpl.java +++ b/packages/CarSystemUI/src/com/android/systemui/volume/CarVolumeDialogImpl.java @@ -609,6 +609,8 @@ public class CarVolumeDialogImpl implements VolumeDialog { return; } mAvailableVolumeItems.get(mVolumeGroupId).progress = progress; + mAvailableVolumeItems.get( + mVolumeGroupId).carVolumeItem.setProgress(progress); mCarAudioManager.setGroupVolume(mVolumeGroupId, progress, 0); } catch (CarNotConnectedException e) { Log.e(TAG, "Car is not connected!", e); diff --git a/packages/CarSystemUI/src/com/android/systemui/volume/CarVolumeItem.java b/packages/CarSystemUI/src/com/android/systemui/volume/CarVolumeItem.java index e1ea6f6f0a41c..b83740f4259d0 100644 --- a/packages/CarSystemUI/src/com/android/systemui/volume/CarVolumeItem.java +++ b/packages/CarSystemUI/src/com/android/systemui/volume/CarVolumeItem.java @@ -29,8 +29,6 @@ import com.android.systemui.R; /** Holds all related data to represent a volume group. */ public class CarVolumeItem { - private boolean mIsDirty; - private Drawable mPrimaryIcon; private Drawable mSupplementalIcon; private View.OnClickListener mSupplementalIconOnClickListener; @@ -40,50 +38,38 @@ public class CarVolumeItem { private int mMax; private int mProgress; private SeekBar.OnSeekBarChangeListener mOnSeekBarChangeListener; - - public CarVolumeItem() { - mIsDirty = true; - } - + /** * Called when {@link CarVolumeItem} is bound to its ViewHolder. */ void bind(CarVolumeItemViewHolder viewHolder) { - if (mIsDirty) { viewHolder.bind(/* carVolumeItem= */ this); - mIsDirty = false; - } } /** Sets progress of seekbar. */ public void setProgress(int progress) { mProgress = progress; - mIsDirty = true; } /** Sets max value of seekbar. */ public void setMax(int max) { mMax = max; - mIsDirty = true; } /** Sets {@link SeekBar.OnSeekBarChangeListener}. */ public void setOnSeekBarChangeListener(SeekBar.OnSeekBarChangeListener listener) { mOnSeekBarChangeListener = listener; - mIsDirty = true; } /** Sets the primary icon. */ public void setPrimaryIcon(Drawable drawable) { mPrimaryIcon = drawable; - mIsDirty = true; } /** Sets the supplemental icon and the visibility of the supplemental icon divider. */ public void setSupplementalIcon(Drawable drawable, boolean showSupplementalIconDivider) { mSupplementalIcon = drawable; mShowSupplementalIconDivider = showSupplementalIconDivider; - mIsDirty = true; } /** @@ -103,7 +89,6 @@ public class CarVolumeItem { /** Sets {@code OnClickListener} for the supplemental icon. */ public void setSupplementalIconListener(View.OnClickListener listener) { mSupplementalIconOnClickListener = listener; - mIsDirty = true; } /** Defines the view holder which shows the information held by {@link CarVolumeItem}. */