Merge "Use label instead of cast icon in output switcher" into sc-qpr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
19a2adb33b
16
packages/SystemUI/res/drawable/ic_media_home_devices.xml
Normal file
16
packages/SystemUI/res/drawable/ic_media_home_devices.xml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24"
|
||||||
|
android:tint="?attr/colorControlNormal">
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/white"
|
||||||
|
android:pathData="M20,4H4c-1.1,0 -2,0.9 -2,2v11c0,1.1 0.9,2 2,2h4v2h3v-4H4V6h16v1h2V6c0,-1.1 -0.9,-2 -2,-2z"/>
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/white"
|
||||||
|
android:pathData="M17.5,16.5m-2.33,0a2.33,2.33 0,1 1,4.66 0a2.33,2.33 0,1 1,-4.66 0"/>
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/white"
|
||||||
|
android:pathData="M21,8h-7c-0.55,0 -1,0.45 -1,1v11c0,0.55 0.45,1 1,1h7c0.55,0 1,-0.45 1,-1L22,9c0,-0.55 -0.45,-1 -1,-1zM17.5,9c0.83,0 1.5,0.67 1.5,1.5s-0.67,1.5 -1.5,1.5 -1.5,-0.67 -1.5,-1.5 0.67,-1.5 1.5,-1.5zM17.5,20c-1.93,0 -3.5,-1.57 -3.5,-3.5s1.57,-3.5 3.5,-3.5 3.5,1.57 3.5,3.5 -1.57,3.5 -3.5,3.5z"/>
|
||||||
|
</vector>
|
||||||
@@ -163,18 +163,6 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/media_seamless_fallback"
|
|
||||||
android:layout_width="@dimen/qs_seamless_fallback_icon_size"
|
|
||||||
android:layout_height="@dimen/qs_seamless_fallback_icon_size"
|
|
||||||
android:layout_marginTop="@dimen/qs_media_padding"
|
|
||||||
android:layout_marginBottom="@dimen/qs_media_padding"
|
|
||||||
android:layout_marginStart="@dimen/qs_center_guideline_padding"
|
|
||||||
android:layout_marginEnd="@dimen/qs_seamless_fallback_margin"
|
|
||||||
android:tint="?android:attr/textColor"
|
|
||||||
android:src="@drawable/ic_cast_connected"
|
|
||||||
android:forceHasOverlappingRendering="false" />
|
|
||||||
|
|
||||||
<!-- Seek Bar -->
|
<!-- Seek Bar -->
|
||||||
<!-- As per Material Design on Biderectionality, this is forced to LTR in code -->
|
<!-- As per Material Design on Biderectionality, this is forced to LTR in code -->
|
||||||
<SeekBar
|
<SeekBar
|
||||||
|
|||||||
@@ -1298,8 +1298,6 @@
|
|||||||
<dimen name="qs_media_action_margin">12dp</dimen>
|
<dimen name="qs_media_action_margin">12dp</dimen>
|
||||||
<dimen name="qs_seamless_height">24dp</dimen>
|
<dimen name="qs_seamless_height">24dp</dimen>
|
||||||
<dimen name="qs_seamless_icon_size">12dp</dimen>
|
<dimen name="qs_seamless_icon_size">12dp</dimen>
|
||||||
<dimen name="qs_seamless_fallback_icon_size">@dimen/qs_seamless_icon_size</dimen>
|
|
||||||
<dimen name="qs_seamless_fallback_margin">20dp</dimen>
|
|
||||||
<dimen name="qs_footer_horizontal_margin">22dp</dimen>
|
<dimen name="qs_footer_horizontal_margin">22dp</dimen>
|
||||||
<dimen name="qs_media_disabled_seekbar_height">1dp</dimen>
|
<dimen name="qs_media_disabled_seekbar_height">1dp</dimen>
|
||||||
<dimen name="qs_media_enabled_seekbar_height">2dp</dimen>
|
<dimen name="qs_media_enabled_seekbar_height">2dp</dimen>
|
||||||
|
|||||||
@@ -1008,7 +1008,7 @@
|
|||||||
<string name="sensor_privacy_start_use_mic_camera_dialog_content">This unblocks access for all apps and services allowed to use your camera or microphone.</string>
|
<string name="sensor_privacy_start_use_mic_camera_dialog_content">This unblocks access for all apps and services allowed to use your camera or microphone.</string>
|
||||||
|
|
||||||
<!-- Default name for the media device shown in the output switcher when the name is not available [CHAR LIMIT=30] -->
|
<!-- Default name for the media device shown in the output switcher when the name is not available [CHAR LIMIT=30] -->
|
||||||
<string name="media_seamless_remote_device">Device</string>
|
<string name="media_seamless_other_device">Other device</string>
|
||||||
|
|
||||||
<!-- QuickStep: Accessibility to toggle overview [CHAR LIMIT=40] -->
|
<!-- QuickStep: Accessibility to toggle overview [CHAR LIMIT=40] -->
|
||||||
<string name="quick_step_accessibility_toggle_overview">Toggle Overview</string>
|
<string name="quick_step_accessibility_toggle_overview">Toggle Overview</string>
|
||||||
|
|||||||
@@ -43,23 +43,6 @@
|
|||||||
android:layout_marginStart="@dimen/qs_center_guideline_padding"
|
android:layout_marginStart="@dimen/qs_center_guideline_padding"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Constraint
|
|
||||||
android:id="@+id/media_seamless_fallback"
|
|
||||||
android:layout_width="@dimen/qs_seamless_fallback_icon_size"
|
|
||||||
android:layout_height="@dimen/qs_seamless_fallback_icon_size"
|
|
||||||
android:layout_marginTop="@dimen/qs_media_padding"
|
|
||||||
android:layout_marginBottom="@dimen/qs_media_padding"
|
|
||||||
android:layout_marginStart="@dimen/qs_center_guideline_padding"
|
|
||||||
android:layout_marginEnd="@dimen/qs_seamless_fallback_margin"
|
|
||||||
android:alpha="0.5"
|
|
||||||
android:visibility="gone"
|
|
||||||
app:layout_constraintHorizontal_bias="1"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintBottom_toTopOf="@id/center_horizontal_guideline"
|
|
||||||
app:layout_constraintStart_toEndOf="@id/center_vertical_guideline"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Constraint
|
<Constraint
|
||||||
android:id="@+id/album_art"
|
android:id="@+id/album_art"
|
||||||
android:layout_width="@dimen/qs_media_album_size_small"
|
android:layout_width="@dimen/qs_media_album_size_small"
|
||||||
|
|||||||
@@ -44,22 +44,6 @@
|
|||||||
android:layout_marginStart="@dimen/qs_center_guideline_padding"
|
android:layout_marginStart="@dimen/qs_center_guideline_padding"
|
||||||
android:layout_marginBottom="4dp" />
|
android:layout_marginBottom="4dp" />
|
||||||
|
|
||||||
<Constraint
|
|
||||||
android:id="@+id/media_seamless_fallback"
|
|
||||||
android:layout_width="@dimen/qs_seamless_fallback_icon_size"
|
|
||||||
android:layout_height="@dimen/qs_seamless_fallback_icon_size"
|
|
||||||
android:layout_marginTop="@dimen/qs_media_padding"
|
|
||||||
android:layout_marginBottom="16dp"
|
|
||||||
android:layout_marginStart="@dimen/qs_center_guideline_padding"
|
|
||||||
android:layout_marginEnd="@dimen/qs_seamless_fallback_margin"
|
|
||||||
android:alpha="0.5"
|
|
||||||
android:visibility="gone"
|
|
||||||
app:layout_constraintHorizontal_bias="1"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintStart_toEndOf="@id/center_vertical_guideline"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Constraint
|
<Constraint
|
||||||
android:id="@+id/album_art"
|
android:id="@+id/album_art"
|
||||||
android:layout_width="@dimen/qs_media_album_size"
|
android:layout_width="@dimen/qs_media_album_size"
|
||||||
|
|||||||
@@ -370,27 +370,16 @@ public class MediaControlPanel {
|
|||||||
|
|
||||||
final MediaDeviceData device = data.getDevice();
|
final MediaDeviceData device = data.getDevice();
|
||||||
final int seamlessId = mPlayerViewHolder.getSeamless().getId();
|
final int seamlessId = mPlayerViewHolder.getSeamless().getId();
|
||||||
final int seamlessFallbackId = mPlayerViewHolder.getSeamlessFallback().getId();
|
// Disable clicking on output switcher for invalid devices and resumption controls
|
||||||
final boolean showFallback = device != null && !device.getEnabled();
|
final boolean seamlessDisabled = (device != null && !device.getEnabled())
|
||||||
final int seamlessFallbackVisibility = showFallback ? View.VISIBLE : View.GONE;
|
|| data.getResumption();
|
||||||
mPlayerViewHolder.getSeamlessFallback().setVisibility(seamlessFallbackVisibility);
|
final float seamlessAlpha = seamlessDisabled ? DISABLED_ALPHA : 1.0f;
|
||||||
expandedSet.setVisibility(seamlessFallbackId, seamlessFallbackVisibility);
|
|
||||||
collapsedSet.setVisibility(seamlessFallbackId, seamlessFallbackVisibility);
|
|
||||||
final int seamlessVisibility = showFallback ? View.GONE : View.VISIBLE;
|
|
||||||
mPlayerViewHolder.getSeamless().setVisibility(seamlessVisibility);
|
|
||||||
expandedSet.setVisibility(seamlessId, seamlessVisibility);
|
|
||||||
collapsedSet.setVisibility(seamlessId, seamlessVisibility);
|
|
||||||
final float seamlessAlpha = data.getResumption() ? DISABLED_ALPHA : 1.0f;
|
|
||||||
expandedSet.setAlpha(seamlessId, seamlessAlpha);
|
expandedSet.setAlpha(seamlessId, seamlessAlpha);
|
||||||
collapsedSet.setAlpha(seamlessId, seamlessAlpha);
|
collapsedSet.setAlpha(seamlessId, seamlessAlpha);
|
||||||
// Disable clicking on output switcher for resumption controls.
|
mPlayerViewHolder.getSeamless().setEnabled(!seamlessDisabled);
|
||||||
mPlayerViewHolder.getSeamless().setEnabled(!data.getResumption());
|
|
||||||
String deviceString = null;
|
String deviceString = null;
|
||||||
if (showFallback) {
|
if (device != null && device.getEnabled()) {
|
||||||
iconView.setImageDrawable(null);
|
|
||||||
} else if (device != null) {
|
|
||||||
Drawable icon = device.getIcon();
|
Drawable icon = device.getIcon();
|
||||||
iconView.setVisibility(View.VISIBLE);
|
|
||||||
if (icon instanceof AdaptiveIcon) {
|
if (icon instanceof AdaptiveIcon) {
|
||||||
AdaptiveIcon aIcon = (AdaptiveIcon) icon;
|
AdaptiveIcon aIcon = (AdaptiveIcon) icon;
|
||||||
aIcon.setBackgroundColor(mBackgroundColor);
|
aIcon.setBackgroundColor(mBackgroundColor);
|
||||||
@@ -401,10 +390,9 @@ public class MediaControlPanel {
|
|||||||
deviceString = device.getName();
|
deviceString = device.getName();
|
||||||
} else {
|
} else {
|
||||||
// Reset to default
|
// Reset to default
|
||||||
Log.w(TAG, "device is null. Not binding output chip.");
|
Log.w(TAG, "Device is null or not enabled: " + device + ", not binding output chip.");
|
||||||
iconView.setVisibility(View.GONE);
|
iconView.setImageResource(R.drawable.ic_media_home_devices);
|
||||||
deviceString = mContext.getString(
|
deviceString = mContext.getString(R.string.media_seamless_other_device);
|
||||||
com.android.internal.R.string.ext_media_seamless_action);
|
|
||||||
}
|
}
|
||||||
deviceName.setText(deviceString);
|
deviceName.setText(deviceString);
|
||||||
seamlessView.setContentDescription(deviceString);
|
seamlessView.setContentDescription(deviceString);
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ class PlayerViewHolder private constructor(itemView: View) {
|
|||||||
val seamless = itemView.requireViewById<ViewGroup>(R.id.media_seamless)
|
val seamless = itemView.requireViewById<ViewGroup>(R.id.media_seamless)
|
||||||
val seamlessIcon = itemView.requireViewById<ImageView>(R.id.media_seamless_image)
|
val seamlessIcon = itemView.requireViewById<ImageView>(R.id.media_seamless_image)
|
||||||
val seamlessText = itemView.requireViewById<TextView>(R.id.media_seamless_text)
|
val seamlessText = itemView.requireViewById<TextView>(R.id.media_seamless_text)
|
||||||
val seamlessFallback = itemView.requireViewById<ImageView>(R.id.media_seamless_fallback)
|
|
||||||
|
|
||||||
// Seek bar
|
// Seek bar
|
||||||
val seekBar = itemView.requireViewById<SeekBar>(R.id.media_progress_bar)
|
val seekBar = itemView.requireViewById<SeekBar>(R.id.media_progress_bar)
|
||||||
@@ -124,7 +123,6 @@ class PlayerViewHolder private constructor(itemView: View) {
|
|||||||
R.id.header_title,
|
R.id.header_title,
|
||||||
R.id.header_artist,
|
R.id.header_artist,
|
||||||
R.id.media_seamless,
|
R.id.media_seamless,
|
||||||
R.id.media_seamless_fallback,
|
|
||||||
R.id.notification_media_progress_time,
|
R.id.notification_media_progress_time,
|
||||||
R.id.media_progress_bar,
|
R.id.media_progress_bar,
|
||||||
R.id.action0,
|
R.id.action0,
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import android.widget.TextView
|
|||||||
import androidx.constraintlayout.widget.ConstraintSet
|
import androidx.constraintlayout.widget.ConstraintSet
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.test.filters.SmallTest
|
import androidx.test.filters.SmallTest
|
||||||
|
import com.android.systemui.R
|
||||||
import com.android.systemui.SysuiTestCase
|
import com.android.systemui.SysuiTestCase
|
||||||
import com.android.systemui.media.dialog.MediaOutputDialogFactory
|
import com.android.systemui.media.dialog.MediaOutputDialogFactory
|
||||||
import com.android.systemui.plugins.ActivityStarter
|
import com.android.systemui.plugins.ActivityStarter
|
||||||
@@ -101,7 +102,6 @@ public class MediaControlPanelTest : SysuiTestCase() {
|
|||||||
private lateinit var seamless: ViewGroup
|
private lateinit var seamless: ViewGroup
|
||||||
private lateinit var seamlessIcon: ImageView
|
private lateinit var seamlessIcon: ImageView
|
||||||
private lateinit var seamlessText: TextView
|
private lateinit var seamlessText: TextView
|
||||||
private lateinit var seamlessFallback: ImageView
|
|
||||||
private lateinit var seekBar: SeekBar
|
private lateinit var seekBar: SeekBar
|
||||||
private lateinit var elapsedTimeView: TextView
|
private lateinit var elapsedTimeView: TextView
|
||||||
private lateinit var totalTimeView: TextView
|
private lateinit var totalTimeView: TextView
|
||||||
@@ -154,8 +154,6 @@ public class MediaControlPanelTest : SysuiTestCase() {
|
|||||||
whenever(holder.seamlessIcon).thenReturn(seamlessIcon)
|
whenever(holder.seamlessIcon).thenReturn(seamlessIcon)
|
||||||
seamlessText = TextView(context)
|
seamlessText = TextView(context)
|
||||||
whenever(holder.seamlessText).thenReturn(seamlessText)
|
whenever(holder.seamlessText).thenReturn(seamlessText)
|
||||||
seamlessFallback = ImageView(context)
|
|
||||||
whenever(holder.seamlessFallback).thenReturn(seamlessFallback)
|
|
||||||
seekBar = SeekBar(context)
|
seekBar = SeekBar(context)
|
||||||
whenever(holder.seekBar).thenReturn(seekBar)
|
whenever(holder.seekBar).thenReturn(seekBar)
|
||||||
elapsedTimeView = TextView(context)
|
elapsedTimeView = TextView(context)
|
||||||
@@ -239,21 +237,19 @@ public class MediaControlPanelTest : SysuiTestCase() {
|
|||||||
@Test
|
@Test
|
||||||
fun bindDisabledDevice() {
|
fun bindDisabledDevice() {
|
||||||
seamless.id = 1
|
seamless.id = 1
|
||||||
seamlessFallback.id = 2
|
val fallbackString = context.getString(R.string.media_seamless_other_device)
|
||||||
player.attachPlayer(holder)
|
player.attachPlayer(holder)
|
||||||
val state = MediaData(USER_ID, true, BG_COLOR, APP, null, ARTIST, TITLE, null, emptyList(),
|
val state = MediaData(USER_ID, true, BG_COLOR, APP, null, ARTIST, TITLE, null, emptyList(),
|
||||||
emptyList(), PACKAGE, session.getSessionToken(), null, disabledDevice, true, null)
|
emptyList(), PACKAGE, session.getSessionToken(), null, disabledDevice, true, null)
|
||||||
player.bindPlayer(state, PACKAGE)
|
player.bindPlayer(state, PACKAGE)
|
||||||
verify(expandedSet).setVisibility(seamless.id, View.GONE)
|
assertThat(seamless.isEnabled()).isFalse()
|
||||||
verify(expandedSet).setVisibility(seamlessFallback.id, View.VISIBLE)
|
assertThat(seamlessText.getText()).isEqualTo(fallbackString)
|
||||||
verify(collapsedSet).setVisibility(seamless.id, View.GONE)
|
assertThat(seamless.contentDescription).isEqualTo(fallbackString)
|
||||||
verify(collapsedSet).setVisibility(seamlessFallback.id, View.VISIBLE)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun bindNullDevice() {
|
fun bindNullDevice() {
|
||||||
val fallbackString = context.getResources().getString(
|
val fallbackString = context.getResources().getString(R.string.media_seamless_other_device)
|
||||||
com.android.internal.R.string.ext_media_seamless_action)
|
|
||||||
player.attachPlayer(holder)
|
player.attachPlayer(holder)
|
||||||
val state = MediaData(USER_ID, true, BG_COLOR, APP, null, ARTIST, TITLE, null, emptyList(),
|
val state = MediaData(USER_ID, true, BG_COLOR, APP, null, ARTIST, TITLE, null, emptyList(),
|
||||||
emptyList(), PACKAGE, session.getSessionToken(), null, null, true, null)
|
emptyList(), PACKAGE, session.getSessionToken(), null, null, true, null)
|
||||||
|
|||||||
Reference in New Issue
Block a user