Update updateEmptyView
Also consider the visiblity of list container, when list container is invisible, we should show the empty view. Bug: 62062415 Test: RunSettingsRoboTests Change-Id: I065e70386242c425ef3cbfb2b703a5433dbe40c1
This commit is contained in:
@@ -312,12 +312,15 @@ public abstract class SettingsPreferenceFragment extends InstrumentedPreferenceF
|
||||
}
|
||||
}
|
||||
|
||||
private void updateEmptyView() {
|
||||
@VisibleForTesting
|
||||
void updateEmptyView() {
|
||||
if (mEmptyView == null) return;
|
||||
if (getPreferenceScreen() != null) {
|
||||
final View listContainer = getActivity().findViewById(android.R.id.list_container);
|
||||
boolean show = (getPreferenceScreen().getPreferenceCount()
|
||||
- (mHeader != null ? 1 : 0)
|
||||
- (mFooterPreferenceMixin.hasFooter() ? 1 : 0)) <= 0;
|
||||
- (mFooterPreferenceMixin.hasFooter() ? 1 : 0)) <= 0
|
||||
|| (listContainer != null && listContainer.getVisibility() != View.VISIBLE);
|
||||
mEmptyView.setVisibility(show ? View.VISIBLE : View.GONE);
|
||||
} else {
|
||||
mEmptyView.setVisibility(View.VISIBLE);
|
||||
|
Reference in New Issue
Block a user