Merge "Hide the divider in list mode."
This commit is contained in:
@@ -18,22 +18,33 @@ package com.android.documentsui.dirlist;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.view.View;
|
||||
import android.widget.Space;
|
||||
|
||||
import com.android.documentsui.R;
|
||||
import com.android.documentsui.State;
|
||||
|
||||
final class EmptyDocumentHolder extends DocumentHolder {
|
||||
final int mVisibleHeight;
|
||||
|
||||
public EmptyDocumentHolder(Context context) {
|
||||
super(context, new Space(context));
|
||||
|
||||
// Per UX spec, this puts a bigger gap between the folders and documents in the grid.
|
||||
final int gridMargin = context.getResources().getDimensionPixelSize(R.dimen.grid_item_margin);
|
||||
itemView.setMinimumHeight(gridMargin * 2);
|
||||
mVisibleHeight = context.getResources().getDimensionPixelSize(R.dimen.grid_item_margin) * 2;
|
||||
}
|
||||
|
||||
public void bind(State state) {
|
||||
bind(null, null, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bind(Cursor cursor, String modelId, State state) {
|
||||
// Nothing to bind.
|
||||
if (state.derivedMode == State.MODE_GRID) {
|
||||
itemView.setMinimumHeight(mVisibleHeight);
|
||||
} else {
|
||||
itemView.setMinimumHeight(0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,6 +76,8 @@ final class SectionBreakDocumentsAdapterWrapper extends DocumentsAdapter {
|
||||
public void onBindViewHolder(DocumentHolder holder, int p, List<Object> payload) {
|
||||
if (holder.getItemViewType() != ITEM_TYPE_SECTION_BREAK) {
|
||||
mDelegate.onBindViewHolder(holder, toDelegatePosition(p), payload);
|
||||
} else {
|
||||
((EmptyDocumentHolder)holder).bind(mEnv.getDisplayState());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,6 +85,8 @@ final class SectionBreakDocumentsAdapterWrapper extends DocumentsAdapter {
|
||||
public void onBindViewHolder(DocumentHolder holder, int p) {
|
||||
if (holder.getItemViewType() != ITEM_TYPE_SECTION_BREAK) {
|
||||
mDelegate.onBindViewHolder(holder, toDelegatePosition(p));
|
||||
} else {
|
||||
((EmptyDocumentHolder)holder).bind(mEnv.getDisplayState());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user