Merge "Add a separate line at the bottom of list area in output switcher" into rvc-dev am: 02e311e537
am: 9ff43d2fa3
am: 593d62d992
am: 826cd4f88f
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/11900663 Change-Id: I7caf8d437cfd45979b1e33882c38d65c4fa43f63
This commit is contained in:
@@ -86,6 +86,11 @@
|
|||||||
<!-- Note: There is a landscape version of panel_slice_list which supports scrolling. -->
|
<!-- Note: There is a landscape version of panel_slice_list which supports scrolling. -->
|
||||||
<include layout="@layout/panel_slice_list"/>
|
<include layout="@layout/panel_slice_list"/>
|
||||||
|
|
||||||
|
<include
|
||||||
|
android:id="@+id/footer_divider"
|
||||||
|
layout="@layout/horizontal_divider"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@@ -96,6 +96,7 @@ public class PanelFragment extends Fragment {
|
|||||||
private TextView mHeaderTitle;
|
private TextView mHeaderTitle;
|
||||||
private TextView mHeaderSubtitle;
|
private TextView mHeaderSubtitle;
|
||||||
private int mMaxHeight;
|
private int mMaxHeight;
|
||||||
|
private View mFooterDivider;
|
||||||
|
|
||||||
private final Map<Uri, LiveData<Slice>> mSliceLiveData = new LinkedHashMap<>();
|
private final Map<Uri, LiveData<Slice>> mSliceLiveData = new LinkedHashMap<>();
|
||||||
|
|
||||||
@@ -192,6 +193,7 @@ public class PanelFragment extends Fragment {
|
|||||||
mTitleIcon = mLayoutView.findViewById(R.id.title_icon);
|
mTitleIcon = mLayoutView.findViewById(R.id.title_icon);
|
||||||
mHeaderTitle = mLayoutView.findViewById(R.id.header_title);
|
mHeaderTitle = mLayoutView.findViewById(R.id.header_title);
|
||||||
mHeaderSubtitle = mLayoutView.findViewById(R.id.header_subtitle);
|
mHeaderSubtitle = mLayoutView.findViewById(R.id.header_subtitle);
|
||||||
|
mFooterDivider = mLayoutView.findViewById(R.id.footer_divider);
|
||||||
|
|
||||||
// Make the panel layout gone here, to avoid janky animation when updating from old panel.
|
// Make the panel layout gone here, to avoid janky animation when updating from old panel.
|
||||||
// We will make it visible once the panel is ready to load.
|
// We will make it visible once the panel is ready to load.
|
||||||
@@ -247,6 +249,13 @@ public class PanelFragment extends Fragment {
|
|||||||
mTitleIcon.setLayoutParams(new LinearLayout.LayoutParams(size, size));
|
mTitleIcon.setLayoutParams(new LinearLayout.LayoutParams(size, size));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mPanel.getViewType() == PanelContent.VIEW_TYPE_SLIDER_LARGE_ICON) {
|
||||||
|
mFooterDivider.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
mFooterDivider.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
mSeeMoreButton.setOnClickListener(getSeeMoreListener());
|
mSeeMoreButton.setOnClickListener(getSeeMoreListener());
|
||||||
mDoneButton.setOnClickListener(getCloseListener());
|
mDoneButton.setOnClickListener(getCloseListener());
|
||||||
|
|
||||||
|
@@ -175,7 +175,7 @@ public class PanelSlicesAdapter
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDividerAllowedBelow() {
|
public boolean isDividerAllowedBelow() {
|
||||||
return true;
|
return mPanelFragment.getPanelViewType() != PanelContent.VIEW_TYPE_SLIDER_LARGE_ICON;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -17,6 +17,9 @@
|
|||||||
|
|
||||||
package com.android.settings.panel;
|
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.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
@@ -209,6 +212,54 @@ public class PanelFragmentTest {
|
|||||||
assertThat(titleView.getVisibility()).isEqualTo(View.VISIBLE);
|
assertThat(titleView.getVisibility()).isEqualTo(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void sliderLargeIconPanelType_displayFooterDivider() {
|
||||||
|
mFakePanelContent.setViewType(VIEW_TYPE_SLIDER_LARGE_ICON);
|
||||||
|
final ActivityController<FakeSettingsPanelActivity> activityController =
|
||||||
|
Robolectric.buildActivity(FakeSettingsPanelActivity.class);
|
||||||
|
activityController.setup();
|
||||||
|
final PanelFragment panelFragment = (PanelFragment)
|
||||||
|
Objects.requireNonNull(activityController
|
||||||
|
.get()
|
||||||
|
.getSupportFragmentManager()
|
||||||
|
.findFragmentById(R.id.main_content));
|
||||||
|
final View footerDivider = panelFragment.mLayoutView.findViewById(R.id.footer_divider);
|
||||||
|
// Check visibility
|
||||||
|
assertThat(footerDivider.getVisibility()).isEqualTo(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void sliderPanelType_notDisplayFooterDivider() {
|
||||||
|
mFakePanelContent.setViewType(VIEW_TYPE_SLIDER);
|
||||||
|
final ActivityController<FakeSettingsPanelActivity> activityController =
|
||||||
|
Robolectric.buildActivity(FakeSettingsPanelActivity.class);
|
||||||
|
activityController.setup();
|
||||||
|
final PanelFragment panelFragment = (PanelFragment)
|
||||||
|
Objects.requireNonNull(activityController
|
||||||
|
.get()
|
||||||
|
.getSupportFragmentManager()
|
||||||
|
.findFragmentById(R.id.main_content));
|
||||||
|
final View footerDivider = panelFragment.mLayoutView.findViewById(R.id.footer_divider);
|
||||||
|
// Check visibility
|
||||||
|
assertThat(footerDivider.getVisibility()).isEqualTo(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void defaultPanelType_notDisplayFooterDivider() {
|
||||||
|
mFakePanelContent.setViewType(0 /* viewType */);
|
||||||
|
final ActivityController<FakeSettingsPanelActivity> activityController =
|
||||||
|
Robolectric.buildActivity(FakeSettingsPanelActivity.class);
|
||||||
|
activityController.setup();
|
||||||
|
final PanelFragment panelFragment = (PanelFragment)
|
||||||
|
Objects.requireNonNull(activityController
|
||||||
|
.get()
|
||||||
|
.getSupportFragmentManager()
|
||||||
|
.findFragmentById(R.id.main_content));
|
||||||
|
final View footerDivider = panelFragment.mLayoutView.findViewById(R.id.footer_divider);
|
||||||
|
// Check visibility
|
||||||
|
assertThat(footerDivider.getVisibility()).isEqualTo(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onHeaderChanged_updateHeader_verifyTitle() {
|
public void onHeaderChanged_updateHeader_verifyTitle() {
|
||||||
mFakePanelContent.setIcon(IconCompat.createWithResource(mContext, R.drawable.ic_android));
|
mFakePanelContent.setIcon(IconCompat.createWithResource(mContext, R.drawable.ic_android));
|
||||||
|
@@ -22,6 +22,7 @@ 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_GROUP_SLICE_URI;
|
||||||
import static com.android.settings.slices.CustomSliceRegistry.MEDIA_OUTPUT_INDICATOR_SLICE_URI;
|
import static com.android.settings.slices.CustomSliceRegistry.MEDIA_OUTPUT_INDICATOR_SLICE_URI;
|
||||||
import static com.android.settings.slices.CustomSliceRegistry.MEDIA_OUTPUT_SLICE_URI;
|
import static com.android.settings.slices.CustomSliceRegistry.MEDIA_OUTPUT_SLICE_URI;
|
||||||
|
import static com.android.settings.slices.CustomSliceRegistry.VOLUME_MEDIA_URI;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
@@ -142,6 +143,53 @@ public class PanelSlicesAdapterTest {
|
|||||||
assertThat(viewHolder.isDividerAllowedAbove()).isFalse();
|
assertThat(viewHolder.isDividerAllowedAbove()).isFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void sliderLargeIconPanel_shouldNotAllowDividerBelow() {
|
||||||
|
addTestLiveData(MEDIA_OUTPUT_SLICE_URI);
|
||||||
|
mFakePanelContent.setViewType(PanelContent.VIEW_TYPE_SLIDER_LARGE_ICON);
|
||||||
|
|
||||||
|
final PanelSlicesAdapter adapter =
|
||||||
|
new PanelSlicesAdapter(mPanelFragment, mData, 0 /* metrics category */);
|
||||||
|
final int position = 0;
|
||||||
|
final ViewGroup view = new FrameLayout(mContext);
|
||||||
|
final SliceRowViewHolder viewHolder =
|
||||||
|
adapter.onCreateViewHolder(view, PanelContent.VIEW_TYPE_SLIDER_LARGE_ICON);
|
||||||
|
adapter.onBindViewHolder(viewHolder, position);
|
||||||
|
|
||||||
|
assertThat(viewHolder.isDividerAllowedBelow()).isFalse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void sliderPanelType_shouldAllowDividerBelow() {
|
||||||
|
addTestLiveData(VOLUME_MEDIA_URI);
|
||||||
|
mFakePanelContent.setViewType(PanelContent.VIEW_TYPE_SLIDER);
|
||||||
|
|
||||||
|
final PanelSlicesAdapter adapter =
|
||||||
|
new PanelSlicesAdapter(mPanelFragment, mData, 0 /* metrics category */);
|
||||||
|
final int position = 0;
|
||||||
|
final ViewGroup view = new FrameLayout(mContext);
|
||||||
|
final SliceRowViewHolder viewHolder =
|
||||||
|
adapter.onCreateViewHolder(view, PanelContent.VIEW_TYPE_SLIDER);
|
||||||
|
adapter.onBindViewHolder(viewHolder, position);
|
||||||
|
|
||||||
|
assertThat(viewHolder.isDividerAllowedBelow()).isTrue();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void defaultPanelType_shouldAllowDividerBelow() {
|
||||||
|
addTestLiveData(VOLUME_MEDIA_URI);
|
||||||
|
mFakePanelContent.setViewType(0 /* viewType */);
|
||||||
|
|
||||||
|
final PanelSlicesAdapter adapter =
|
||||||
|
new PanelSlicesAdapter(mPanelFragment, mData, 0 /* metrics category */);
|
||||||
|
final int position = 0;
|
||||||
|
final ViewGroup view = new FrameLayout(mContext);
|
||||||
|
final SliceRowViewHolder viewHolder = adapter.onCreateViewHolder(view, 0/* viewType */);
|
||||||
|
adapter.onBindViewHolder(viewHolder, position);
|
||||||
|
|
||||||
|
assertThat(viewHolder.isDividerAllowedBelow()).isTrue();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void outputSwitcherSlice_shouldAddFirstItemPadding() {
|
public void outputSwitcherSlice_shouldAddFirstItemPadding() {
|
||||||
addTestLiveData(MEDIA_OUTPUT_SLICE_URI);
|
addTestLiveData(MEDIA_OUTPUT_SLICE_URI);
|
||||||
@@ -151,7 +199,7 @@ public class PanelSlicesAdapterTest {
|
|||||||
final int position = 0;
|
final int position = 0;
|
||||||
final ViewGroup view = new FrameLayout(mContext);
|
final ViewGroup view = new FrameLayout(mContext);
|
||||||
final SliceRowViewHolder viewHolder =
|
final SliceRowViewHolder viewHolder =
|
||||||
adapter.onCreateViewHolder(view, PanelContent.VIEW_TYPE_SLIDER);
|
adapter.onCreateViewHolder(view, PanelContent.VIEW_TYPE_SLIDER_LARGE_ICON);
|
||||||
|
|
||||||
adapter.onBindViewHolder(viewHolder, position);
|
adapter.onBindViewHolder(viewHolder, position);
|
||||||
|
|
||||||
@@ -169,7 +217,7 @@ public class PanelSlicesAdapterTest {
|
|||||||
final int position = 0;
|
final int position = 0;
|
||||||
final ViewGroup view = new FrameLayout(mContext);
|
final ViewGroup view = new FrameLayout(mContext);
|
||||||
final SliceRowViewHolder viewHolder =
|
final SliceRowViewHolder viewHolder =
|
||||||
adapter.onCreateViewHolder(view, PanelContent.VIEW_TYPE_SLIDER);
|
adapter.onCreateViewHolder(view, PanelContent.VIEW_TYPE_SLIDER_LARGE_ICON);
|
||||||
|
|
||||||
adapter.onBindViewHolder(viewHolder, position);
|
adapter.onBindViewHolder(viewHolder, position);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user