Remove divider above device switcher in panel

Remove the divider above the media device switcher Slice per the request.

Do a little refactor in Panel View, to use DividerItemDecoration instead of adding
divider views in layout file as the recycler view items divider.

Since dividers should be shown in most cases, we are setting DividerCondition to
DIVIDER_CONDITION_BOTH and default true to allow divider.  For the slice we don't
need divider (media device switch in this case) we are setting the the target
direction of isDividerAllowed (above in this case) to false.  Since we have
DIVIDER_CONDITION_BOTH, if one of the item view set the divider not allow, the
divider won't be shown.

Test: Visual/Manual inspection
Fixes: 126205139
Change-Id: Ic857705c90819ef9375f877a44bb32987b5d4438
This commit is contained in:
lindatseng
2019-04-04 18:43:20 -07:00
parent e323b40f4e
commit cf93c8bc92
5 changed files with 95 additions and 12 deletions

View File

@@ -37,6 +37,7 @@ import com.android.settings.R;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.panel.PanelLoggingContract.PanelClosedKeys;
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
import com.google.android.setupdesign.DividerItemDecoration;
public class PanelFragment extends Fragment {
@@ -93,6 +94,10 @@ public class PanelFragment extends Fragment {
mPanelSlices.setLayoutManager(new LinearLayoutManager((activity)));
mPanelSlices.setAdapter(mAdapter);
DividerItemDecoration itemDecoration = new DividerItemDecoration(getActivity());
itemDecoration.setDividerCondition(DividerItemDecoration.DIVIDER_CONDITION_BOTH);
mPanelSlices.addItemDecoration(itemDecoration);
mTitleView.setText(mPanel.getTitle());
mSeeMoreButton.setOnClickListener(getSeeMoreListener());