Merge "Remove divider above device switcher in panel" into qt-dev
This commit is contained in:
@@ -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());
|
||||
|
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.settings.panel;
|
||||
|
||||
import static com.android.settings.slices.CustomSliceRegistry.MEDIA_OUTPUT_INDICATOR_SLICE_URI;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
@@ -33,6 +35,7 @@ import androidx.slice.widget.SliceView;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.google.android.setupdesign.DividerItemDecoration;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -80,10 +83,13 @@ public class PanelSlicesAdapter
|
||||
/**
|
||||
* ViewHolder for binding Slices to SliceViews.
|
||||
*/
|
||||
public static class SliceRowViewHolder extends RecyclerView.ViewHolder {
|
||||
public static class SliceRowViewHolder extends RecyclerView.ViewHolder
|
||||
implements DividerItemDecoration.DividedViewHolder {
|
||||
|
||||
private final PanelContent mPanelContent;
|
||||
|
||||
private boolean mDividerAllowedAbove = true;
|
||||
|
||||
@VisibleForTesting
|
||||
LiveData<Slice> sliceLiveData;
|
||||
|
||||
@@ -103,6 +109,11 @@ public class PanelSlicesAdapter
|
||||
sliceLiveData = SliceLiveData.fromUri(context, sliceUri);
|
||||
sliceLiveData.observe(fragment.getViewLifecycleOwner(), sliceView);
|
||||
|
||||
// Do not show the divider above media devices switcher slice per request
|
||||
if (sliceUri.equals(MEDIA_OUTPUT_INDICATOR_SLICE_URI)) {
|
||||
mDividerAllowedAbove = false;
|
||||
}
|
||||
|
||||
// Log Panel interaction
|
||||
sliceView.setOnSliceActionListener(
|
||||
((eventInfo, sliceItem) -> {
|
||||
@@ -116,5 +127,15 @@ public class PanelSlicesAdapter
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDividerAllowedAbove() {
|
||||
return mDividerAllowedAbove;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDividerAllowedBelow() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user