diff --git a/src/com/android/settings/panel/PanelContent.java b/src/com/android/settings/panel/PanelContent.java index 9fa43164ecd..6c271fd11d9 100644 --- a/src/com/android/settings/panel/PanelContent.java +++ b/src/com/android/settings/panel/PanelContent.java @@ -31,7 +31,6 @@ 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. diff --git a/src/com/android/settings/panel/PanelFragment.java b/src/com/android/settings/panel/PanelFragment.java index 133e0fc9e0d..cc27683933e 100644 --- a/src/com/android/settings/panel/PanelFragment.java +++ b/src/com/android/settings/panel/PanelFragment.java @@ -240,7 +240,7 @@ public class PanelFragment extends Fragment { final IconCompat icon = mPanel.getIcon(); final CharSequence title = mPanel.getTitle(); - if (icon != null || mPanel.getViewType() == PanelContent.VIEW_TYPE_SLIDER_LARGE_ICON) { + if (icon != null) { enablePanelHeader(icon, title); } else { mTitleView.setVisibility(View.VISIBLE); @@ -248,11 +248,7 @@ public class PanelFragment extends Fragment { mTitleView.setText(title); } - if (mPanel.getViewType() == PanelContent.VIEW_TYPE_SLIDER_LARGE_ICON) { - mFooterDivider.setVisibility(View.VISIBLE); - } else { - mFooterDivider.setVisibility(View.GONE); - } + mFooterDivider.setVisibility(View.GONE); mSeeMoreButton.setOnClickListener(getSeeMoreListener()); mDoneButton.setOnClickListener(getCloseListener()); diff --git a/src/com/android/settings/panel/PanelSlicesAdapter.java b/src/com/android/settings/panel/PanelSlicesAdapter.java index a055dbbe73b..4c8698a93b5 100644 --- a/src/com/android/settings/panel/PanelSlicesAdapter.java +++ b/src/com/android/settings/panel/PanelSlicesAdapter.java @@ -16,9 +16,7 @@ package com.android.settings.panel; -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_SLICE_URI; import android.app.settings.SettingsEnums; import android.content.Context; @@ -75,8 +73,6 @@ 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); } @@ -142,15 +138,6 @@ public class PanelSlicesAdapter final Slice slice = sliceLiveData.getValue(); if (slice == null || slice.getUri().equals(MEDIA_OUTPUT_INDICATOR_SLICE_URI)) { mDividerAllowedAbove = false; - } else if (position == 0 && (slice.getUri().equals(MEDIA_OUTPUT_SLICE_URI) - || slice.getUri().equals(MEDIA_OUTPUT_GROUP_SLICE_URI))) { - sliceView.setClickable(false); - // Customize output switcher slice padding - final int padding = mPanelFragment.getResources().getDimensionPixelSize( - R.dimen.output_switcher_slice_padding_top); - mSliceSliderLayout.setPadding(mSliceSliderLayout.getPaddingLeft(), padding, - mSliceSliderLayout.getPaddingRight(), - padding); } // Log Panel interaction @@ -175,7 +162,7 @@ public class PanelSlicesAdapter @Override public boolean isDividerAllowedBelow() { - return mPanelFragment.getPanelViewType() != PanelContent.VIEW_TYPE_SLIDER_LARGE_ICON; + return true; } } } diff --git a/src/com/android/settings/slices/CustomSliceRegistry.java b/src/com/android/settings/slices/CustomSliceRegistry.java index 14a79f6586d..cf23cbdf1e0 100644 --- a/src/com/android/settings/slices/CustomSliceRegistry.java +++ b/src/com/android/settings/slices/CustomSliceRegistry.java @@ -253,26 +253,6 @@ public class CustomSliceRegistry { .appendPath(ZenModeButtonPreferenceController.KEY) .build(); - /** - * Backing Uri for the Media output Slice. - */ - public static Uri MEDIA_OUTPUT_SLICE_URI = new Uri.Builder() - .scheme(ContentResolver.SCHEME_CONTENT) - .authority(SettingsSliceProvider.SLICE_AUTHORITY) - .appendPath(SettingsSlicesContract.PATH_SETTING_ACTION) - .appendPath(MediaOutputSliceConstants.KEY_MEDIA_OUTPUT) - .build(); - - /** - * Backing Uri for the Media output group Slice. - */ - public static Uri MEDIA_OUTPUT_GROUP_SLICE_URI = new Uri.Builder() - .scheme(ContentResolver.SCHEME_CONTENT) - .authority(SettingsSliceProvider.SLICE_AUTHORITY) - .appendPath(SettingsSlicesContract.PATH_SETTING_ACTION) - .appendPath(MediaOutputSliceConstants.KEY_MEDIA_OUTPUT_GROUP) - .build(); - /** * Backing Uri for the Media output indicator Slice. */ diff --git a/tests/robotests/src/com/android/settings/panel/PanelFragmentTest.java b/tests/robotests/src/com/android/settings/panel/PanelFragmentTest.java index 405e4c3090e..41935c4c875 100644 --- a/tests/robotests/src/com/android/settings/panel/PanelFragmentTest.java +++ b/tests/robotests/src/com/android/settings/panel/PanelFragmentTest.java @@ -18,7 +18,6 @@ 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; @@ -212,22 +211,6 @@ public class PanelFragmentTest { assertThat(titleView.getVisibility()).isEqualTo(View.VISIBLE); } - @Test - public void sliderLargeIconPanelType_displayFooterDivider() { - mFakePanelContent.setViewType(VIEW_TYPE_SLIDER_LARGE_ICON); - final ActivityController 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); diff --git a/tests/robotests/src/com/android/settings/panel/PanelSlicesAdapterTest.java b/tests/robotests/src/com/android/settings/panel/PanelSlicesAdapterTest.java index f8c2f84d564..ac74fe539ae 100644 --- a/tests/robotests/src/com/android/settings/panel/PanelSlicesAdapterTest.java +++ b/tests/robotests/src/com/android/settings/panel/PanelSlicesAdapterTest.java @@ -17,11 +17,8 @@ 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; -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; @@ -143,22 +140,6 @@ public class PanelSlicesAdapterTest { 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); @@ -190,42 +171,6 @@ public class PanelSlicesAdapterTest { assertThat(viewHolder.isDividerAllowedBelow()).isTrue(); } - @Test - public void outputSwitcherSlice_shouldAddFirstItemPadding() { - addTestLiveData(MEDIA_OUTPUT_SLICE_URI); - - 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.mSliceSliderLayout.getPaddingTop()).isEqualTo( - mPanelFragment.getResources().getDimensionPixelSize( - R.dimen.output_switcher_slice_padding_top)); - } - - @Test - public void outputSwitcherGroupSlice_shouldAddFirstItemPadding() { - addTestLiveData(MEDIA_OUTPUT_GROUP_SLICE_URI); - - 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.mSliceSliderLayout.getPaddingTop()).isEqualTo( - mPanelFragment.getResources().getDimensionPixelSize( - R.dimen.output_switcher_slice_padding_top)); - } - @Test public void mediaOutputIndicatorSlice_notSliderPanel_noSliderLayout() { addTestLiveData(MEDIA_OUTPUT_INDICATOR_SLICE_URI); @@ -255,19 +200,6 @@ 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 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 =