DO NOT MERGE: Downbranch merge conflict [Output Switcher] Update volume control behavior
Update volume control and click area to meet new spec. Bug: 228606471 Test: verified on device Change-Id: I3d3155b3ba26ae50d0e5c718eef7e1d2cd2aa52f
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/media_output_item_background"
|
||||
android:layout_gravity="center_vertical|start">
|
||||
<com.android.systemui.media.dialog.MediaOutputSeekbar
|
||||
<SeekBar
|
||||
android:id="@+id/volume_seekbar"
|
||||
android:splitTrack="false"
|
||||
android:visibility="gone"
|
||||
@@ -119,15 +119,24 @@
|
||||
android:importantForAccessibility="no"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/end_action_area"
|
||||
android:visibility="gone"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="64dp"
|
||||
android:layout_gravity="right|center"
|
||||
android:gravity="center_vertical">
|
||||
<CheckBox
|
||||
android:id="@+id/check_box"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_gravity="right|center"
|
||||
android:layout_gravity="right"
|
||||
android:button="@drawable/ic_circle_check_box"
|
||||
android:visibility="gone"
|
||||
android:clickable="false"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
@@ -117,6 +117,7 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter {
|
||||
}
|
||||
mCheckBox.setVisibility(View.GONE);
|
||||
mStatusIcon.setVisibility(View.GONE);
|
||||
mEndTouchArea.setVisibility(View.GONE);
|
||||
mContainerLayout.setOnClickListener(null);
|
||||
mTitleText.setTextColor(mController.getColorItemContent());
|
||||
mSubTitleText.setTextColor(mController.getColorItemContent());
|
||||
@@ -168,12 +169,16 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter {
|
||||
setSingleLineLayout(getItemTitle(device), true /* bFocused */,
|
||||
true /* showSeekBar */,
|
||||
false /* showProgressBar */, false /* showStatus */);
|
||||
mCheckBox.setOnCheckedChangeListener(null);
|
||||
mCheckBox.setVisibility(View.VISIBLE);
|
||||
mCheckBox.setChecked(true);
|
||||
mSeekBar.setOnClickListener(null);
|
||||
mSeekBar.setOnClickListener(v -> onGroupActionTriggered(false, device));
|
||||
mCheckBox.setOnCheckedChangeListener(
|
||||
(buttonView, isChecked) -> onGroupActionTriggered(false, device));
|
||||
setCheckBoxColor(mCheckBox, mController.getColorItemContent());
|
||||
initSeekbar(device);
|
||||
mEndTouchArea.setVisibility(View.VISIBLE);
|
||||
mEndTouchArea.setOnClickListener(null);
|
||||
mEndTouchArea.setOnClickListener((v) -> mCheckBox.performClick());
|
||||
} else if (!mController.hasAdjustVolumeUserRestriction() && currentlyConnected) {
|
||||
mStatusIcon.setImageDrawable(
|
||||
mContext.getDrawable(R.drawable.media_output_status_check));
|
||||
@@ -185,8 +190,11 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter {
|
||||
initSeekbar(device);
|
||||
mCurrentActivePosition = position;
|
||||
} else if (isDeviceIncluded(mController.getSelectableMediaDevice(), device)) {
|
||||
mCheckBox.setOnCheckedChangeListener(null);
|
||||
mCheckBox.setVisibility(View.VISIBLE);
|
||||
mCheckBox.setChecked(false);
|
||||
mCheckBox.setOnCheckedChangeListener(
|
||||
(buttonView, isChecked) -> onGroupActionTriggered(true, device));
|
||||
mContainerLayout.setOnClickListener(v -> onGroupActionTriggered(true, device));
|
||||
setCheckBoxColor(mCheckBox, mController.getColorItemContent());
|
||||
setSingleLineLayout(getItemTitle(device), false /* bFocused */,
|
||||
|
||||
@@ -144,6 +144,7 @@ public abstract class MediaOutputBaseAdapter extends
|
||||
final LinearLayout mTwoLineLayout;
|
||||
final ImageView mStatusIcon;
|
||||
final CheckBox mCheckBox;
|
||||
final LinearLayout mEndTouchArea;
|
||||
private String mDeviceId;
|
||||
|
||||
MediaDeviceBaseViewHolder(View view) {
|
||||
@@ -159,6 +160,7 @@ public abstract class MediaOutputBaseAdapter extends
|
||||
mSeekBar = view.requireViewById(R.id.volume_seekbar);
|
||||
mStatusIcon = view.requireViewById(R.id.media_output_item_status);
|
||||
mCheckBox = view.requireViewById(R.id.check_box);
|
||||
mEndTouchArea = view.requireViewById(R.id.end_action_area);
|
||||
}
|
||||
|
||||
void onBind(MediaDevice device, boolean topMargin, boolean bottomMargin, int position) {
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.systemui.media.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.widget.SeekBar;
|
||||
|
||||
/**
|
||||
* Customized seekbar used by MediaOutputDialog, which only changes progress when dragging,
|
||||
* otherwise performs click.
|
||||
*/
|
||||
public class MediaOutputSeekbar extends SeekBar {
|
||||
private int mLastDownPosition = -1;
|
||||
|
||||
public MediaOutputSeekbar(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public MediaOutputSeekbar(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
if (event.getAction() == MotionEvent.ACTION_DOWN) {
|
||||
mLastDownPosition = Math.round(event.getX());
|
||||
} else if (event.getAction() == MotionEvent.ACTION_UP) {
|
||||
if (mLastDownPosition == event.getX()) {
|
||||
performClick();
|
||||
return true;
|
||||
}
|
||||
mLastDownPosition = -1;
|
||||
}
|
||||
return super.onTouchEvent(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean performClick() {
|
||||
return super.performClick();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user