Merge "Output switcher panel requires large title icon for Slice slider style" into rvc-dev am: c21406a0a2 am: de8b0ada5f am: 1d4e2258a2

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/11818502

Change-Id: I5d521387bd686ef446856442ca177193d56a12cd
This commit is contained in:
tim peng
2020-06-12 05:46:59 +00:00
committed by Automerger Merge Worker
10 changed files with 74 additions and 2 deletions

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2020 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.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/slice_slider_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.slice.widget.SliceView
android:id="@+id/slice_view"
style="@style/Widget.SliceView.Panel.Slider.LargeIcon"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="0dp"
android:paddingEnd="0dp"/>
</LinearLayout>

View File

@@ -533,6 +533,10 @@
<item name="rowStyle">@style/SliceRow.Slider</item>
</style>
<style name="Widget.SliceView.Panel.Slider.LargeIcon">
<item name="rowStyle">@style/SliceRow.Slider.LargeIcon</item>
</style>
<style name="SliceRow">
<!-- 2dp start padding for the start icon -->
<item name="titleItemStartPadding">2dp</item>
@@ -580,6 +584,11 @@
<item name="progressBarEndPadding">16dp</item>
</style>
<style name="SliceRow.Slider.LargeIcon">
<!-- Layout is 48dp and actual icon size is 48-(iconSize/2) -->
<item name="iconSize">12dp</item>
</style>
<style name="DisclaimerPositiveButton" parent="@style/SudGlifButton.Primary">
<item name="android:layout_margin">16dp</item>
<item name="android:paddingStart">8dp</item>

View File

@@ -159,6 +159,6 @@ public class MediaOutputGroupPanel implements PanelContent, LocalMediaManager.De
@Override
public int getViewType() {
return PanelContent.VIEW_TYPE_SLIDER;
return PanelContent.VIEW_TYPE_SLIDER_LARGE_ICON;
}
}

View File

@@ -246,7 +246,7 @@ public class MediaOutputPanel implements PanelContent, LocalMediaManager.DeviceC
@Override
public int getViewType() {
return PanelContent.VIEW_TYPE_SLIDER;
return PanelContent.VIEW_TYPE_SLIDER_LARGE_ICON;
}
private final MediaController.Callback mCb = new MediaController.Callback() {

View File

@@ -31,6 +31,7 @@ import java.util.List;
public interface PanelContent extends Instrumentable {
int VIEW_TYPE_SLIDER = 1;
int VIEW_TYPE_SLIDER_LARGE_ICON = 2;
/**
* @return a icon for the title of the Panel.

View File

@@ -75,6 +75,8 @@ public class PanelSlicesAdapter
View view;
if (viewType == PanelContent.VIEW_TYPE_SLIDER) {
view = inflater.inflate(R.layout.panel_slice_slider_row, viewGroup, false);
} else if (viewType == PanelContent.VIEW_TYPE_SLIDER_LARGE_ICON) {
view = inflater.inflate(R.layout.panel_slice_slider_row_large_icon, viewGroup, false);
} else {
view = inflater.inflate(R.layout.panel_slice_row, viewGroup, false);
}

View File

@@ -72,4 +72,9 @@ public class MediaOutputGroupPanelTest {
public void getSeeMoreIntent_isNull() {
assertThat(mPanel.getSeeMoreIntent()).isNull();
}
@Test
public void getViewType_checkType() {
assertThat(mPanel.getViewType()).isEqualTo(PanelContent.VIEW_TYPE_SLIDER_LARGE_ICON);
}
}

View File

@@ -312,4 +312,9 @@ public class MediaOutputPanelTest {
verify(mCallback).forceClose();
}
@Test
public void getViewType_checkType() {
assertThat(mPanel.getViewType()).isEqualTo(PanelContent.VIEW_TYPE_SLIDER_LARGE_ICON);
}
}

View File

@@ -17,6 +17,7 @@
package com.android.settings.panel;
import static com.android.settings.panel.PanelContent.VIEW_TYPE_SLIDER;
import static com.android.settings.panel.PanelContent.VIEW_TYPE_SLIDER_LARGE_ICON;
import static com.android.settings.panel.PanelSlicesAdapter.MAX_NUM_OF_SLICES;
import static com.android.settings.slices.CustomSliceRegistry.MEDIA_OUTPUT_GROUP_SLICE_URI;
import static com.android.settings.slices.CustomSliceRegistry.MEDIA_OUTPUT_INDICATOR_SLICE_URI;
@@ -206,6 +207,19 @@ public class PanelSlicesAdapterTest {
assertThat(intArgumentCaptor.getValue()).isEqualTo(R.layout.panel_slice_slider_row);
}
@Test
public void onCreateViewHolder_viewTypeSliderLargeIcon_verifyLayout() {
final PanelSlicesAdapter adapter = new PanelSlicesAdapter(mPanelFragment, mData, 0);
final ViewGroup view = new FrameLayout(mContext);
final ArgumentCaptor<Integer> intArgumentCaptor = ArgumentCaptor.forClass(Integer.class);
adapter.onCreateViewHolder(view, VIEW_TYPE_SLIDER_LARGE_ICON);
verify(sLayoutInflater).inflate(intArgumentCaptor.capture(), eq(view), eq(false));
assertThat(intArgumentCaptor.getValue()).isEqualTo(
R.layout.panel_slice_slider_row_large_icon);
}
@Test
public void onCreateViewHolder_viewTypeDefault_verifyLayout() {
final PanelSlicesAdapter adapter =

View File

@@ -70,4 +70,9 @@ public class VolumePanelTest {
public void getSeeMoreIntent_notNull() {
assertThat(mPanel.getSeeMoreIntent()).isNotNull();
}
@Test
public void getViewType_checkType() {
assertThat(mPanel.getViewType()).isEqualTo(PanelContent.VIEW_TYPE_SLIDER);
}
}