Merge "[Output Switcher] Fix layout for ongoing session" into udc-dev
This commit is contained in:
@@ -205,7 +205,8 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter {
|
|||||||
&& mController.isSubStatusSupported()
|
&& mController.isSubStatusSupported()
|
||||||
&& mController.isAdvancedLayoutSupported() && device.hasSubtext()) {
|
&& mController.isAdvancedLayoutSupported() && device.hasSubtext()) {
|
||||||
boolean isActiveWithOngoingSession =
|
boolean isActiveWithOngoingSession =
|
||||||
(device.hasOngoingSession() && currentlyConnected);
|
(device.hasOngoingSession() && (currentlyConnected || isDeviceIncluded(
|
||||||
|
mController.getSelectedMediaDevice(), device)));
|
||||||
boolean isHost = device.isHostForOngoingSession()
|
boolean isHost = device.isHostForOngoingSession()
|
||||||
&& isActiveWithOngoingSession;
|
&& isActiveWithOngoingSession;
|
||||||
if (isHost) {
|
if (isHost) {
|
||||||
@@ -224,10 +225,17 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter {
|
|||||||
if (isActiveWithOngoingSession) {
|
if (isActiveWithOngoingSession) {
|
||||||
//Selected device which has ongoing session, disable seekbar since we
|
//Selected device which has ongoing session, disable seekbar since we
|
||||||
//only allow volume control on Host
|
//only allow volume control on Host
|
||||||
initSeekbar(device, isCurrentSeekbarInvisible);
|
|
||||||
mCurrentActivePosition = position;
|
mCurrentActivePosition = position;
|
||||||
}
|
}
|
||||||
|
boolean showSeekbar =
|
||||||
|
(!device.hasOngoingSession() && currentlyConnected);
|
||||||
|
if (showSeekbar) {
|
||||||
|
updateTitleIcon(R.drawable.media_output_icon_volume,
|
||||||
|
mController.getColorItemContent());
|
||||||
|
initSeekbar(device, isCurrentSeekbarInvisible);
|
||||||
|
} else {
|
||||||
setUpDeviceIcon(device);
|
setUpDeviceIcon(device);
|
||||||
|
}
|
||||||
mSubTitleText.setText(device.getSubtextString());
|
mSubTitleText.setText(device.getSubtextString());
|
||||||
Drawable deviceStatusIcon =
|
Drawable deviceStatusIcon =
|
||||||
device.hasOngoingSession() ? mContext.getDrawable(
|
device.hasOngoingSession() ? mContext.getDrawable(
|
||||||
@@ -241,8 +249,8 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter {
|
|||||||
updateTwoLineLayoutContentAlpha(
|
updateTwoLineLayoutContentAlpha(
|
||||||
updateClickActionBasedOnSelectionBehavior(device)
|
updateClickActionBasedOnSelectionBehavior(device)
|
||||||
? DEVICE_CONNECTED_ALPHA : DEVICE_DISCONNECTED_ALPHA);
|
? DEVICE_CONNECTED_ALPHA : DEVICE_DISCONNECTED_ALPHA);
|
||||||
setTwoLineLayout(device, isActiveWithOngoingSession /* bFocused */,
|
setTwoLineLayout(device, currentlyConnected /* bFocused */,
|
||||||
isActiveWithOngoingSession /* showSeekBar */,
|
showSeekbar /* showSeekBar */,
|
||||||
false /* showProgressBar */, true /* showSubtitle */,
|
false /* showProgressBar */, true /* showSubtitle */,
|
||||||
deviceStatusIcon != null /* showStatus */,
|
deviceStatusIcon != null /* showStatus */,
|
||||||
isActiveWithOngoingSession /* isFakeActive */);
|
isActiveWithOngoingSession /* isFakeActive */);
|
||||||
|
|||||||
@@ -270,10 +270,10 @@ public abstract class MediaOutputBaseAdapter extends
|
|||||||
final Drawable backgroundDrawable;
|
final Drawable backgroundDrawable;
|
||||||
if (mController.isAdvancedLayoutSupported() && mController.isSubStatusSupported()) {
|
if (mController.isAdvancedLayoutSupported() && mController.isSubStatusSupported()) {
|
||||||
backgroundDrawable = mContext.getDrawable(
|
backgroundDrawable = mContext.getDrawable(
|
||||||
showSeekBar ? R.drawable.media_output_item_background_active
|
showSeekBar || isFakeActive ? R.drawable.media_output_item_background_active
|
||||||
: R.drawable.media_output_item_background).mutate();
|
: R.drawable.media_output_item_background).mutate();
|
||||||
backgroundDrawable.setTint(
|
backgroundDrawable.setTint(
|
||||||
showSeekBar ? mController.getColorConnectedItemBackground()
|
showSeekBar || isFakeActive ? mController.getColorConnectedItemBackground()
|
||||||
: mController.getColorItemBackground());
|
: mController.getColorItemBackground());
|
||||||
mIconAreaLayout.setBackgroundTintList(
|
mIconAreaLayout.setBackgroundTintList(
|
||||||
ColorStateList.valueOf(showProgressBar || isFakeActive
|
ColorStateList.valueOf(showProgressBar || isFakeActive
|
||||||
|
|||||||
@@ -532,7 +532,7 @@ public class MediaOutputAdapterTest extends SysuiTestCase {
|
|||||||
mMediaOutputAdapter.onBindViewHolder(mViewHolder, 0);
|
mMediaOutputAdapter.onBindViewHolder(mViewHolder, 0);
|
||||||
|
|
||||||
assertThat(mViewHolder.mTitleText.getVisibility()).isEqualTo(View.GONE);
|
assertThat(mViewHolder.mTitleText.getVisibility()).isEqualTo(View.GONE);
|
||||||
assertThat(mViewHolder.mSeekBar.getVisibility()).isEqualTo(View.VISIBLE);
|
assertThat(mViewHolder.mSeekBar.getVisibility()).isEqualTo(View.GONE);
|
||||||
assertThat(mViewHolder.mProgressBar.getVisibility()).isEqualTo(View.GONE);
|
assertThat(mViewHolder.mProgressBar.getVisibility()).isEqualTo(View.GONE);
|
||||||
assertThat(mViewHolder.mCheckBox.getVisibility()).isEqualTo(View.GONE);
|
assertThat(mViewHolder.mCheckBox.getVisibility()).isEqualTo(View.GONE);
|
||||||
assertThat(mViewHolder.mStatusIcon.getVisibility()).isEqualTo(View.VISIBLE);
|
assertThat(mViewHolder.mStatusIcon.getVisibility()).isEqualTo(View.VISIBLE);
|
||||||
|
|||||||
Reference in New Issue
Block a user