summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author shaoweishen <shaoweishen@google.com> 2022-04-15 00:55:13 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2022-04-15 00:55:13 +0000
commitdb8caaa2b6514b71f88e3869f95ced000e5f1c3c (patch)
treee4a4ea0bc1d01a46928def04047a97d00465d567
parent96ad6b757fc719e88efe32025314a470935818aa (diff)
parenta7524e8efaa2fc195f061da5e43949c81dfe3e93 (diff)
DO NOT MERGE: Downbranch merge conflict [Output Switcher] Update volume control behavior am: ca9a784d89 am: a7524e8efa
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17741624 Change-Id: I39e5da04182c6b1bea255f2651726559434a5a03 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--packages/SystemUI/res/layout/media_output_list_item.xml15
-rw-r--r--packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapter.java12
-rw-r--r--packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBaseAdapter.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputSeekbar.java57
4 files changed, 24 insertions, 62 deletions
diff --git a/packages/SystemUI/res/layout/media_output_list_item.xml b/packages/SystemUI/res/layout/media_output_list_item.xml
index d39b0d53c743..b85ea598dbb4 100644
--- a/packages/SystemUI/res/layout/media_output_list_item.xml
+++ b/packages/SystemUI/res/layout/media_output_list_item.xml
@@ -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> \ No newline at end of file
diff --git a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapter.java b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapter.java
index 0edadcc82a24..997ea0ef5ab6 100644
--- a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapter.java
+++ b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapter.java
@@ -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 */,
diff --git a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBaseAdapter.java b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBaseAdapter.java
index 5c536d469212..9dc29bd6e090 100644
--- a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBaseAdapter.java
+++ b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBaseAdapter.java
@@ -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) {
diff --git a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputSeekbar.java b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputSeekbar.java
deleted file mode 100644
index 72f308e4f6b1..000000000000
--- a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputSeekbar.java
+++ /dev/null
@@ -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();
- }
-}