Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a7b66f35 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Update the CarVolumeItem state when the progress is changed." into qt-dev

parents a5859117 5ca4f42f
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -609,6 +609,8 @@ public class CarVolumeDialogImpl implements VolumeDialog {
                    return;
                    return;
                }
                }
                mAvailableVolumeItems.get(mVolumeGroupId).progress = progress;
                mAvailableVolumeItems.get(mVolumeGroupId).progress = progress;
                mAvailableVolumeItems.get(
                        mVolumeGroupId).carVolumeItem.setProgress(progress);
                mCarAudioManager.setGroupVolume(mVolumeGroupId, progress, 0);
                mCarAudioManager.setGroupVolume(mVolumeGroupId, progress, 0);
            } catch (CarNotConnectedException e) {
            } catch (CarNotConnectedException e) {
                Log.e(TAG, "Car is not connected!", e);
                Log.e(TAG, "Car is not connected!", e);
+1 −16
Original line number Original line Diff line number Diff line
@@ -29,8 +29,6 @@ import com.android.systemui.R;
/** Holds all related data to represent a volume group. */
/** Holds all related data to represent a volume group. */
public class CarVolumeItem {
public class CarVolumeItem {


    private boolean mIsDirty;

    private Drawable mPrimaryIcon;
    private Drawable mPrimaryIcon;
    private Drawable mSupplementalIcon;
    private Drawable mSupplementalIcon;
    private View.OnClickListener mSupplementalIconOnClickListener;
    private View.OnClickListener mSupplementalIconOnClickListener;
@@ -41,49 +39,37 @@ public class CarVolumeItem {
    private int mProgress;
    private int mProgress;
    private SeekBar.OnSeekBarChangeListener mOnSeekBarChangeListener;
    private SeekBar.OnSeekBarChangeListener mOnSeekBarChangeListener;
    
    
    public CarVolumeItem() {
        mIsDirty = true;
    }

    /**
    /**
     * Called when {@link CarVolumeItem} is bound to its ViewHolder.
     * Called when {@link CarVolumeItem} is bound to its ViewHolder.
     */
     */
    void bind(CarVolumeItemViewHolder viewHolder) {
    void bind(CarVolumeItemViewHolder viewHolder) {
        if (mIsDirty) {
            viewHolder.bind(/* carVolumeItem= */ this);
            viewHolder.bind(/* carVolumeItem= */ this);
            mIsDirty = false;
        }
    }
    }


    /** Sets progress of seekbar. */
    /** Sets progress of seekbar. */
    public void setProgress(int progress) {
    public void setProgress(int progress) {
        mProgress = progress;
        mProgress = progress;
        mIsDirty = true;
    }
    }


    /** Sets max value of seekbar. */
    /** Sets max value of seekbar. */
    public void setMax(int max) {
    public void setMax(int max) {
        mMax = max;
        mMax = max;
        mIsDirty = true;
    }
    }


    /** Sets {@link SeekBar.OnSeekBarChangeListener}. */
    /** Sets {@link SeekBar.OnSeekBarChangeListener}. */
    public void setOnSeekBarChangeListener(SeekBar.OnSeekBarChangeListener listener) {
    public void setOnSeekBarChangeListener(SeekBar.OnSeekBarChangeListener listener) {
        mOnSeekBarChangeListener = listener;
        mOnSeekBarChangeListener = listener;
        mIsDirty = true;
    }
    }


    /** Sets the primary icon. */
    /** Sets the primary icon. */
    public void setPrimaryIcon(Drawable drawable) {
    public void setPrimaryIcon(Drawable drawable) {
        mPrimaryIcon = drawable;
        mPrimaryIcon = drawable;
        mIsDirty = true;
    }
    }


    /** Sets the supplemental icon and the visibility of the supplemental icon divider. */
    /** Sets the supplemental icon and the visibility of the supplemental icon divider. */
    public void setSupplementalIcon(Drawable drawable, boolean showSupplementalIconDivider) {
    public void setSupplementalIcon(Drawable drawable, boolean showSupplementalIconDivider) {
        mSupplementalIcon = drawable;
        mSupplementalIcon = drawable;
        mShowSupplementalIconDivider = showSupplementalIconDivider;
        mShowSupplementalIconDivider = showSupplementalIconDivider;
        mIsDirty = true;
    }
    }


    /**
    /**
@@ -103,7 +89,6 @@ public class CarVolumeItem {
    /** Sets {@code OnClickListener} for the supplemental icon. */
    /** Sets {@code OnClickListener} for the supplemental icon. */
    public void setSupplementalIconListener(View.OnClickListener listener) {
    public void setSupplementalIconListener(View.OnClickListener listener) {
        mSupplementalIconOnClickListener = listener;
        mSupplementalIconOnClickListener = listener;
        mIsDirty = true;
    }
    }


    /** Defines the view holder which shows the information held by {@link CarVolumeItem}. */
    /** Defines the view holder which shows the information held by {@link CarVolumeItem}. */