Remove unused variable

-remove VIEW_TYPE_SLIDER_LARGE_ICON
-remove MEDIA_OUTPUT_GROUP_SLICE_URI
-remove MEDIA_OUTPUT_SLICE_URI

Bug: 175850711
Test: build pass
Change-Id: Iecf987cc91934a7598762523814f5f575302dde2
This commit is contained in:
timhypeng
2020-12-17 16:43:32 +08:00
committed by tim peng
parent deb93069c3
commit 7c86980bf3
6 changed files with 3 additions and 126 deletions

View File

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

View File

@@ -240,7 +240,7 @@ public class PanelFragment extends Fragment {
final IconCompat icon = mPanel.getIcon(); final IconCompat icon = mPanel.getIcon();
final CharSequence title = mPanel.getTitle(); final CharSequence title = mPanel.getTitle();
if (icon != null || mPanel.getViewType() == PanelContent.VIEW_TYPE_SLIDER_LARGE_ICON) { if (icon != null) {
enablePanelHeader(icon, title); enablePanelHeader(icon, title);
} else { } else {
mTitleView.setVisibility(View.VISIBLE); mTitleView.setVisibility(View.VISIBLE);
@@ -248,11 +248,7 @@ public class PanelFragment extends Fragment {
mTitleView.setText(title); 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()); mSeeMoreButton.setOnClickListener(getSeeMoreListener());
mDoneButton.setOnClickListener(getCloseListener()); mDoneButton.setOnClickListener(getCloseListener());

View File

@@ -16,9 +16,7 @@
package com.android.settings.panel; 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_INDICATOR_SLICE_URI;
import static com.android.settings.slices.CustomSliceRegistry.MEDIA_OUTPUT_SLICE_URI;
import android.app.settings.SettingsEnums; import android.app.settings.SettingsEnums;
import android.content.Context; import android.content.Context;
@@ -75,8 +73,6 @@ public class PanelSlicesAdapter
View view; View view;
if (viewType == PanelContent.VIEW_TYPE_SLIDER) { if (viewType == PanelContent.VIEW_TYPE_SLIDER) {
view = inflater.inflate(R.layout.panel_slice_slider_row, viewGroup, false); 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 { } else {
view = inflater.inflate(R.layout.panel_slice_row, viewGroup, false); view = inflater.inflate(R.layout.panel_slice_row, viewGroup, false);
} }
@@ -142,15 +138,6 @@ public class PanelSlicesAdapter
final Slice slice = sliceLiveData.getValue(); final Slice slice = sliceLiveData.getValue();
if (slice == null || slice.getUri().equals(MEDIA_OUTPUT_INDICATOR_SLICE_URI)) { if (slice == null || slice.getUri().equals(MEDIA_OUTPUT_INDICATOR_SLICE_URI)) {
mDividerAllowedAbove = false; 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 // Log Panel interaction
@@ -175,7 +162,7 @@ public class PanelSlicesAdapter
@Override @Override
public boolean isDividerAllowedBelow() { public boolean isDividerAllowedBelow() {
return mPanelFragment.getPanelViewType() != PanelContent.VIEW_TYPE_SLIDER_LARGE_ICON; return true;
} }
} }
} }

View File

@@ -253,26 +253,6 @@ public class CustomSliceRegistry {
.appendPath(ZenModeButtonPreferenceController.KEY) .appendPath(ZenModeButtonPreferenceController.KEY)
.build(); .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. * Backing Uri for the Media output indicator Slice.
*/ */

View File

@@ -18,7 +18,6 @@
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;
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;
@@ -212,22 +211,6 @@ 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 @Test
public void sliderPanelType_notDisplayFooterDivider() { public void sliderPanelType_notDisplayFooterDivider() {
mFakePanelContent.setViewType(VIEW_TYPE_SLIDER); mFakePanelContent.setViewType(VIEW_TYPE_SLIDER);

View File

@@ -17,11 +17,8 @@
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;
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.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_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.android.settings.slices.CustomSliceRegistry.VOLUME_MEDIA_URI;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
@@ -143,22 +140,6 @@ 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 @Test
public void sliderPanelType_shouldAllowDividerBelow() { public void sliderPanelType_shouldAllowDividerBelow() {
addTestLiveData(VOLUME_MEDIA_URI); addTestLiveData(VOLUME_MEDIA_URI);
@@ -190,42 +171,6 @@ public class PanelSlicesAdapterTest {
assertThat(viewHolder.isDividerAllowedBelow()).isTrue(); 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 @Test
public void mediaOutputIndicatorSlice_notSliderPanel_noSliderLayout() { public void mediaOutputIndicatorSlice_notSliderPanel_noSliderLayout() {
addTestLiveData(MEDIA_OUTPUT_INDICATOR_SLICE_URI); addTestLiveData(MEDIA_OUTPUT_INDICATOR_SLICE_URI);
@@ -255,19 +200,6 @@ public class PanelSlicesAdapterTest {
assertThat(intArgumentCaptor.getValue()).isEqualTo(R.layout.panel_slice_slider_row); 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 @Test
public void onCreateViewHolder_viewTypeDefault_verifyLayout() { public void onCreateViewHolder_viewTypeDefault_verifyLayout() {
final PanelSlicesAdapter adapter = final PanelSlicesAdapter adapter =