Methods Summary |
---|
public void | addSection(com.android.documentsui.SectionedListAdapter$SectionAdapter adapter)After mutating sections, you must
{@link AdapterView#setAdapter(android.widget.Adapter)} to correctly
recount view types.
mSections.add(adapter);
notifyDataSetChanged();
|
public boolean | areAllItemsEnabled()
return false;
|
public void | clearSections()
mSections.clear();
notifyDataSetChanged();
|
public int | getCount()
int count = 0;
final int size = mSections.size();
for (int i = 0; i < size; i++) {
count += mSections.get(i).getCount() + 1;
}
return count;
|
public java.lang.Object | getItem(int position)
final int size = mSections.size();
for (int i = 0; i < size; i++) {
final SectionAdapter section = mSections.get(i);
final int sectionSize = section.getCount() + 1;
// Check if position inside this section
if (position == 0) {
return section;
} else if (position < sectionSize) {
return section.getItem(position - 1);
}
// Otherwise jump into next section
position -= sectionSize;
}
throw new IllegalStateException("Unknown position " + position);
|
public long | getItemId(int position)
return position;
|
public int | getItemViewType(int position)
int type = 1;
final int size = mSections.size();
for (int i = 0; i < size; i++) {
final SectionAdapter section = mSections.get(i);
final int sectionSize = section.getCount() + 1;
// Check if position inside this section
if (position == 0) {
return 0;
} else if (position < sectionSize) {
return type + section.getItemViewType(position - 1);
}
// Otherwise jump into next section
position -= sectionSize;
type += section.getViewTypeCount();
}
throw new IllegalStateException("Unknown position " + position);
|
public android.view.View | getView(int position, android.view.View convertView, android.view.ViewGroup parent)
final int size = mSections.size();
for (int i = 0; i < size; i++) {
final SectionAdapter section = mSections.get(i);
final int sectionSize = section.getCount() + 1;
// Check if position inside this section
if (position == 0) {
return section.getHeaderView(convertView, parent);
} else if (position < sectionSize) {
return section.getView(position - 1, convertView, parent);
}
// Otherwise jump into next section
position -= sectionSize;
}
throw new IllegalStateException("Unknown position " + position);
|
public int | getViewTypeCount()
int count = 1;
final int size = mSections.size();
for (int i = 0; i < size; i++) {
count += mSections.get(i).getViewTypeCount();
}
return count;
|
public boolean | isEnabled(int position)
final int size = mSections.size();
for (int i = 0; i < size; i++) {
final SectionAdapter section = mSections.get(i);
final int sectionSize = section.getCount() + 1;
// Check if position inside this section
if (position == 0) {
return false;
} else if (position < sectionSize) {
return section.isEnabled(position - 1);
}
// Otherwise jump into next section
position -= sectionSize;
}
throw new IllegalStateException("Unknown position " + position);
|