Merge "[Sound panel] Update Ui layout to match with mertial next" into sc-v2-dev
This commit is contained in:
@@ -100,10 +100,8 @@ public class PanelFragment extends Fragment {
|
||||
private TextView mHeaderTitle;
|
||||
private TextView mHeaderSubtitle;
|
||||
private int mMaxHeight;
|
||||
private View mFooterDivider;
|
||||
private boolean mPanelCreating;
|
||||
private ProgressBar mProgressBar;
|
||||
private View mHeaderDivider;
|
||||
|
||||
private final Map<Uri, LiveData<Slice>> mSliceLiveData = new LinkedHashMap<>();
|
||||
|
||||
@@ -210,9 +208,7 @@ public class PanelFragment extends Fragment {
|
||||
mHeaderLayout = mLayoutView.findViewById(R.id.header_layout);
|
||||
mHeaderTitle = mLayoutView.findViewById(R.id.header_title);
|
||||
mHeaderSubtitle = mLayoutView.findViewById(R.id.header_subtitle);
|
||||
mFooterDivider = mLayoutView.findViewById(R.id.footer_divider);
|
||||
mProgressBar = mLayoutView.findViewById(R.id.progress_bar);
|
||||
mHeaderDivider = mLayoutView.findViewById(R.id.header_divider);
|
||||
|
||||
// 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.
|
||||
@@ -257,8 +253,6 @@ public class PanelFragment extends Fragment {
|
||||
enableTitle(title);
|
||||
}
|
||||
|
||||
mFooterDivider.setVisibility(View.GONE);
|
||||
|
||||
mSeeMoreButton.setOnClickListener(getSeeMoreListener());
|
||||
mDoneButton.setOnClickListener(getCloseListener());
|
||||
|
||||
@@ -324,10 +318,8 @@ public class PanelFragment extends Fragment {
|
||||
private void updateProgressBar() {
|
||||
if (mPanel.isProgressBarVisible()) {
|
||||
mProgressBar.setVisibility(View.VISIBLE);
|
||||
mHeaderDivider.setVisibility(View.GONE);
|
||||
} else {
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
mHeaderDivider.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
|
||||
package com.android.settings.panel;
|
||||
|
||||
import static com.android.settings.slices.CustomSliceRegistry.MEDIA_OUTPUT_INDICATOR_SLICE_URI;
|
||||
import static android.app.slice.Slice.HINT_ERROR;
|
||||
import static android.app.slice.SliceItem.FORMAT_SLICE;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
@@ -31,6 +32,7 @@ import androidx.annotation.VisibleForTesting;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.slice.Slice;
|
||||
import androidx.slice.SliceItem;
|
||||
import androidx.slice.widget.SliceView;
|
||||
|
||||
import com.android.settings.R;
|
||||
@@ -113,8 +115,6 @@ public class PanelSlicesAdapter
|
||||
public class SliceRowViewHolder extends RecyclerView.ViewHolder
|
||||
implements DividerItemDecoration.DividedViewHolder {
|
||||
|
||||
private boolean mDividerAllowedAbove = true;
|
||||
|
||||
@VisibleForTesting
|
||||
final SliceView sliceView;
|
||||
@VisibleForTesting
|
||||
@@ -137,8 +137,10 @@ public class PanelSlicesAdapter
|
||||
|
||||
// Do not show the divider above media devices switcher slice per request
|
||||
final Slice slice = sliceLiveData.getValue();
|
||||
if (slice == null || slice.getUri().equals(MEDIA_OUTPUT_INDICATOR_SLICE_URI)) {
|
||||
mDividerAllowedAbove = false;
|
||||
|
||||
// Hides slice which reports with error hint or not contain any slice sub-item.
|
||||
if (slice == null || !isValidSlice(slice)) {
|
||||
sliceView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
// Log Panel interaction
|
||||
@@ -156,14 +158,26 @@ public class PanelSlicesAdapter
|
||||
);
|
||||
}
|
||||
|
||||
private boolean isValidSlice(Slice slice) {
|
||||
if (slice.getHints().contains(HINT_ERROR)) {
|
||||
return false;
|
||||
}
|
||||
for (SliceItem item : slice.getItems()) {
|
||||
if (item.getFormat().equals(FORMAT_SLICE)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDividerAllowedAbove() {
|
||||
return mDividerAllowedAbove;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDividerAllowedBelow() {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user