项目:GitHub
文件:PinnedSectionListView.java
int findCurrentSectionPosition(int fromPosition) {
listadapter adapter = getAdapter();
if (fromPosition >= adapter.getCount()) return -1; // dataset has changed,no candidate
if (adapter instanceof SectionIndexer) {
// try fast way by asking section indexer
SectionIndexer indexer = (SectionIndexer) adapter;
int sectionPosition = indexer.getSectionForPosition(fromPosition);
int itemPosition = indexer.getPositionForSection(sectionPosition);
int typeView = adapter.getItemViewType(itemPosition);
if (isItemViewTypePinned(adapter,typeView)) {
return itemPosition;
} // else,no luck
}
// try slow way by looking through to the next section item above
for (int position=fromPosition; position>=0; position--) {
int viewType = adapter.getItemViewType(position);
if (isItemViewTypePinned(adapter,viewType)) return position;
}
return -1; // no candidate found
}
项目:AndroidMuseumBleManager
文件:MergeAdapter.java
@Override
public int getPositionForSection(int section) {
int position = 0;
for (listadapter piece : getPieces()) {
if (piece instanceof SectionIndexer) {
Object[] sections = ((SectionIndexer) piece).getSections();
int numSections = 0;
if (sections != null) {
numSections = sections.length;
}
if (section < numSections) {
return (position + ((SectionIndexer) piece).getPositionForSection(section));
} else if (sections != null) {
section -= numSections;
}
}
position += piece.getCount();
}
return (0);
}
项目:AndroidMuseumBleManager
文件:MergeAdapter.java
@Override
public Object[] getSections() {
ArrayList<Object> sections = new ArrayList<Object>();
for (listadapter piece : getPieces()) {
if (piece instanceof SectionIndexer) {
Object[] curSections = ((SectionIndexer) piece).getSections();
if (curSections != null) {
Collections.addAll(sections,curSections);
}
}
}
if (sections.size() == 0) {
return (new String[0]);
}
return (sections.toArray(new Object[0]));
}
private int findCurrentSectionPosition(int fromPosition) {
PinnedSectionlistadapter adapter = (PinnedSectionlistadapter) getAdapter();
if (adapter instanceof SectionIndexer) {
SectionIndexer indexer = (SectionIndexer) adapter;
int itemPosition = indexer.getPositionForSection(indexer.getSectionForPosition
(fromPosition));
if (adapter.isItemViewTypePinned(adapter.getItemViewType(itemPosition))) {
return itemPosition;
}
}
for (int position = fromPosition; position >= 0; position--) {
if (adapter.isItemViewTypePinned(adapter.getItemViewType(position))) {
return position;
}
}
return -1;
}
项目:Idea-ChainSelector
文件:PinnedSectionListView.java
int findCurrentSectionPosition(int fromPosition) {
listadapter adapter = getAdapter();
if (fromPosition >= adapter.getCount()) return -1; // dataset has changed,viewType)) return position;
}
return -1; // no candidate found
}
项目:CitySelct
文件:PinnedSectionListView.java
int findCurrentSectionPosition(int fromPosition) {
listadapter adapter = getAdapter();
if (fromPosition >= adapter.getCount()) return -1; // dataset has changed,viewType)) return position;
}
return -1; // no candidate found
}
int findCurrentSectionPosition(int fromPosition) {
listadapter adapter = getAdapter();
if (adapter instanceof SectionIndexer) {
// try fast way by asking section indexer
SectionIndexer indexer = (SectionIndexer) adapter;
int sectionPosition = indexer.getSectionForPosition(fromPosition);
int itemPosition = indexer.getPositionForSection(sectionPosition);
int typeView = adapter.getItemViewType(itemPosition);
if (isItemViewTypePinned(adapter,typeView)) {
return itemPosition;
} // else,no luck
}
// try slow way by looking through to the next section item above
for (int position = fromPosition; position >= 0; position--) {
int viewType = adapter.getItemViewType(position);
if (isItemViewTypePinned(adapter,viewType)) return position;
}
return -1; // no candidate found
}
项目:MediaManager
文件:MergeAdapter.java
public int getPositionForSection(int section) {
int position = 0;
for (listadapter piece : pieces) {
if (piece instanceof SectionIndexer) {
Object[] sections = ((SectionIndexer) piece).getSections();
int numSections = 0;
if (sections != null) {
numSections = sections.length;
}
if (section < numSections) {
return (position + ((SectionIndexer) piece)
.getPositionForSection(section));
} else if (sections != null) {
section -= numSections;
}
}
position += piece.getCount();
}
return (0);
}
项目:MediaManager
文件:MergeAdapter.java
public Object[] getSections() {
ArrayList<Object> sections = new ArrayList<>();
for (listadapter piece : pieces) {
if (piece instanceof SectionIndexer) {
Object[] curSections = ((SectionIndexer) piece).getSections();
if (curSections != null) {
Collections.addAll(sections,curSections);
}
}
}
if (sections.size() == 0) {
return (null);
}
return (sections.toArray(new Object[sections.size()]));
}
项目:BLE
文件:MergeAdapter.java
public int getPositionForSection(int section) {
int position = 0;
listadapter piece;
for (Iterator i$ = this.getPieces().iterator(); i$.hasNext(); position += piece.getCount()) {
piece = (listadapter) i$.next();
if (piece instanceof SectionIndexer) {
Object[] sections = ((SectionIndexer) piece).getSections();
int numSections = 0;
if (sections != null) {
numSections = sections.length;
}
if (section < numSections) {
return position + ((SectionIndexer) piece).getPositionForSection(section);
}
if (sections != null) {
section -= numSections;
}
}
}
return 0;
}
项目:BLE
文件:MergeAdapter.java
public int getSectionForPosition(int position) {
int section = 0;
int size;
for (Iterator i$ = this.getPieces().iterator(); i$.hasNext(); position -= size) {
listadapter piece = (listadapter) i$.next();
size = piece.getCount();
if (position < size) {
if (piece instanceof SectionIndexer) {
return section + ((SectionIndexer) piece).getSectionForPosition(position);
}
return 0;
}
if (piece instanceof SectionIndexer) {
Object[] sections = ((SectionIndexer) piece).getSections();
if (sections != null) {
section += sections.length;
}
}
}
return 0;
}
项目:BLE
文件:MergeAdapter.java
public Object[] getSections() {
ArrayList sections = new ArrayList();
Iterator i$ = this.getPieces().iterator();
while (i$.hasNext()) {
listadapter piece = (listadapter) i$.next();
if (piece instanceof SectionIndexer) {
Object[] curSections = ((SectionIndexer) piece).getSections();
if (curSections != null) {
Collections.addAll(sections,curSections);
}
}
}
if (sections.size() == 0) {
return new String[0];
} else {
return sections.toArray(new Object[sections.size()]);
}
}
项目:SecretBrand
文件:PinnedSectionListView.java
int findCurrentSectionPosition(int fromPosition) {
listadapter adapter = getAdapter();
if (adapter instanceof SectionIndexer) {
// try fast way by asking section indexer
SectionIndexer indexer = (SectionIndexer) adapter;
int sectionPosition = indexer.getSectionForPosition(fromPosition);
int itemPosition = indexer.getPositionForSection(sectionPosition);
int typeView = adapter.getItemViewType(itemPosition);
if (isItemViewTypePinned(adapter,no luck
}
// try slow way by looking through to the next section item above
for (int position=Math.min(fromPosition,adapter.getCount()-1); position>=0; position--) {
int viewType = adapter.getItemViewType(position);
if (isItemViewTypePinned(adapter,viewType)) return position;
}
return -1; // no candidate found
}
项目:AndroidWeekly
文件:PinnedSectionListView.java
int findCurrentSectionPosition(int fromPosition) {
listadapter adapter = getAdapter();
if (fromPosition >= adapter.getCount()) return -1; // dataset has changed,no luck
}
// try slow way by looking through to the next section item above
for (int position = fromPosition; position >= 0; position--) {
int viewType = adapter.getItemViewType(position);
if (isItemViewTypePinned(adapter,viewType)) return position;
}
return -1; // no candidate found
}
int findCurrentSectionPosition(int fromPosition) {
listadapter adapter = getAdapter();
if (adapter instanceof SectionIndexer) {
// try fast way by asking section indexer
SectionIndexer indexer = (SectionIndexer) adapter;
int sectionPosition = indexer.getSectionForPosition(fromPosition);
int itemPosition = indexer.getPositionForSection(sectionPosition);
int typeView = adapter.getItemViewType(itemPosition);
if (isItemViewTypePinned(adapter,viewType)) return position;
}
return -1; // no candidate found
}
项目:android-open-project-demo-master
文件:PinnedSectionListView.java
int findCurrentSectionPosition(int fromPosition) {
listadapter adapter = getAdapter();
if (adapter instanceof SectionIndexer) {
// try fast way by asking section indexer
SectionIndexer indexer = (SectionIndexer) adapter;
int sectionPosition = indexer.getSectionForPosition(fromPosition);
int itemPosition = indexer.getPositionForSection(sectionPosition);
int typeView = adapter.getItemViewType(itemPosition);
if (isItemViewTypePinned(adapter,viewType)) return position;
}
return -1; // no candidate found
}
项目:AndroidBleManager
文件:MergeAdapter.java
@Override
public int getPositionForSection(int section) {
int position=0;
for (listadapter piece : getPieces()) {
if (piece instanceof SectionIndexer) {
Object[] sections=((SectionIndexer)piece).getSections();
int numSections=0;
if (sections != null) {
numSections=sections.length;
}
if (section < numSections) {
return(position + ((SectionIndexer)piece).getPositionForSection(section));
}
else if (sections != null) {
section-=numSections;
}
}
position+=piece.getCount();
}
return(0);
}
项目:AndroidBleManager
文件:MergeAdapter.java
@Override
public Object[] getSections() {
ArrayList<Object> sections=new ArrayList<Object>();
for (listadapter piece : getPieces()) {
if (piece instanceof SectionIndexer) {
Object[] curSections=((SectionIndexer)piece).getSections();
if (curSections != null) {
Collections.addAll(sections,curSections);
}
}
}
if (sections.size() == 0) {
return(new String[0]);
}
return(sections.toArray(new Object[0]));
}
项目:SelectCity-master
文件:PinnedSectionListView.java
int findCurrentSectionPosition(int fromPosition) {
listadapter adapter = getAdapter();
if (fromPosition >= adapter.getCount()) return -1; // dataset has changed,viewType)) return position;
}
return -1; // no candidate found
}
项目:eshow-android
文件:AbLetterFilterListView.java
@Override
protected void onFinishInflate() {
super.onFinishInflate();
int count = getChildCount();
if (count < 1) {
throw new IllegalArgumentException("this layout must contain 1 child views,and AdapterView must in the first position!");
}
View view = this.getChildAt(0);
AdapterView<?> adapterView = null;
if (view instanceof AdapterView<?>) {
adapterView = (AdapterView<?>) view;
listView = (ListView)adapterView;
sectionIndexter = (SectionIndexer) listView.getAdapter();
letterView = new LetterView(context);
letterView.setListView(listView);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(60,ViewGroup.LayoutParams.WRAP_CONTENT);
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT,RelativeLayout.TRUE);
layoutParams.topMargin=10;
layoutParams.rightMargin=10;
layoutParams.bottomMargin=10;
this.addView(letterView,layoutParams);
}
if (adapterView == null) {
throw new IllegalArgumentException("must contain a AdapterView in this layout!");
}
}
项目:FMTech
文件:dxb.java
final void d()
{
listadapter locallistadapter = (listadapter)this.f.getAdapter();
this.C = null;
if ((locallistadapter instanceof HeaderViewlistadapter))
{
this.w = ((HeaderViewlistadapter)locallistadapter).getHeadersCount();
locallistadapter = ((HeaderViewlistadapter)locallistadapter).getWrappedAdapter();
}
this.B = locallistadapter;
if ((locallistadapter instanceof SectionIndexer))
{
this.C = ((SectionIndexer)locallistadapter);
this.z = this.C.getSections();
return;
}
this.z = new String[] { " " };
}
int findCurrentSectionPosition(int fromPosition) {
listadapter adapter = getAdapter();
if (adapter instanceof SectionIndexer) {
// try fast way by asking section indexer
SectionIndexer indexer = (SectionIndexer) adapter;
int sectionPosition = indexer.getSectionForPosition(fromPosition);
int itemPosition = indexer.getPositionForSection(sectionPosition);
int typeView = adapter.getItemViewType(itemPosition);
if (isItemViewTypePinned(adapter,viewType)) return position;
}
return -1; // no candidate found
}
项目:shikimori
文件:PinnedSectionGridView.java
int findCurrentSectionPosition(int fromPosition) {
PinnedSectionGridAdapter adapter = getPinnedAdapter();
if (adapter instanceof SectionIndexer) {
// try fast way by asking section indexer
SectionIndexer indexer = (SectionIndexer) adapter;
int sectionPosition = indexer.getSectionForPosition(fromPosition);
int itemPosition = indexer.getPositionForSection(sectionPosition);
//int typeView = adapter.getItemViewType(itemPosition);
if (isItemViewTypePinned(adapter,itemPosition)) {
return itemPosition;
} // else,no luck
}
// try slow way by looking through to the next section item above
for (int position = fromPosition; position >= 0; position--) {
//int viewType = adapter.getItemViewType(position);
if (isItemViewTypePinned(adapter,position))
return position;
}
return -1; // no candidate found
}
项目:shikimori
文件:PinnedSectionListView.java
int findCurrentSectionPosition(int fromPosition) {
PinnedSectionlistadapter adapter = getPinnedAdapter();
if (adapter instanceof SectionIndexer) {
// try fast way by asking section indexer
SectionIndexer indexer = (SectionIndexer) adapter;
int sectionPosition = indexer.getSectionForPosition(fromPosition);
int itemPosition = indexer.getPositionForSection(sectionPosition);
//int typeView = adapter.getItemViewType(itemPosition);
if (isItemViewTypePinned(adapter,position))
return position;
}
return -1; // no candidate found
}
int findCurrentSectionPosition(int fromPosition) {
listadapter adapter = getAdapter();
if (adapter instanceof SectionIndexer) {
// try fast way by asking section indexer
SectionIndexer indexer = (SectionIndexer) adapter;
int sectionPosition = indexer.getSectionForPosition(fromPosition);
int itemPosition = indexer.getPositionForSection(sectionPosition);
int typeView = adapter.getItemViewType(itemPosition);
if (isItemViewTypePinned(adapter,viewType)) return position;
}
return -1; // no candidate found
}
项目:androidsummary
文件:AbLetterFilterListView.java
@Override
protected void onFinishInflate() {
super.onFinishInflate();
int count = getChildCount();
if (count < 1) {
throw new IllegalArgumentException("this layout must contain 1 child views,layoutParams);
}
if (adapterView == null) {
throw new IllegalArgumentException("must contain a AdapterView in this layout!");
}
}
项目:like_googleplus_layout
文件:StickyListHeadersListView.java
private AdapterWrapper wrapAdapter(listadapter adapter)
{
AdapterWrapper wrapper;
if (adapter instanceof SectionIndexer)
{
wrapper = new SectionIndexerAdapterWrapper(getContext(),(StickyHeadersAdapter) adapter);
}
else
{
wrapper = new AdapterWrapper(getContext(),(StickyHeadersAdapter) adapter);
}
wrapper.setDivider(mDivider);
wrapper.setDividerHeight(mDividerHeight);
wrapper.registerDataSetobserver(mDataSetChangedobserver);
wrapper.setonHeaderClickListener(mAdapterHeaderClickListener);
return wrapper;
}
项目:PullToRefresh-PinnedSection-ListView
文件:PinnedSectionListView.java
int findCurrentSectionPosition(int fromPosition) {
listadapter adapter = getAdapter();
if (adapter instanceof SectionIndexer) {
// try fast way by asking section indexer
SectionIndexer indexer = (SectionIndexer) adapter;
int sectionPosition = indexer.getSectionForPosition(fromPosition);
int itemPosition = indexer.getPositionForSection(sectionPosition);
int typeView = adapter.getItemViewType(itemPosition);
if (isItemViewTypePinned(adapter,viewType)) return position;
}
return -1; // no candidate found
}
项目:mimicry
文件:MergeAdapter.java
public final int getPositionForSection(int section) {
int position = 0;
for (listadapter piece : pieces) {
if (piece instanceof SectionIndexer) {
Object[] sections = ((SectionIndexer) piece).getSections();
int numSections = 0;
if (sections != null) {
numSections = sections.length;
}
if (section < numSections) {
return (position + ((SectionIndexer) piece).getPositionForSection(section));
} else if (sections != null) {
section -= numSections;
}
}
position += piece.getCount();
}
return (0);
}
项目:mimicry
文件:MergeAdapter.java
public final Object[] getSections() {
ArrayList<Object> sections = new ArrayList<Object>();
for (listadapter piece : pieces) {
if (piece instanceof SectionIndexer) {
Object[] curSections = ((SectionIndexer) piece).getSections();
if (curSections != null) {
for (Object section : curSections) {
sections.add(section);
}
}
}
}
if (sections.size() == 0) {
return (null);
}
return (sections.toArray(new Object[0]));
}
int findCurrentSectionPosition(int fromPosition) {
listadapter adapter = getAdapter();
if (adapter instanceof SectionIndexer) {
// try fast way by asking section indexer
SectionIndexer indexer = (SectionIndexer) adapter;
int sectionPosition = indexer.getSectionForPosition(fromPosition);
int itemPosition = indexer.getPositionForSection(sectionPosition);
int typeView = adapter.getItemViewType(itemPosition);
if (isItemViewTypePinned(adapter,viewType)) return position;
}
return -1; // no candidate found
}
项目:android-open-project-demo
文件:PinnedSectionListView.java
int findCurrentSectionPosition(int fromPosition) {
listadapter adapter = getAdapter();
if (adapter instanceof SectionIndexer) {
// try fast way by asking section indexer
SectionIndexer indexer = (SectionIndexer) adapter;
int sectionPosition = indexer.getSectionForPosition(fromPosition);
int itemPosition = indexer.getPositionForSection(sectionPosition);
int typeView = adapter.getItemViewType(itemPosition);
if (isItemViewTypePinned(adapter,viewType)) return position;
}
return -1; // no candidate found
}
项目:GameRecorder
文件:PinnedSectionListView.java
int findCurrentSectionPosition(int fromPosition) {
listadapter adapter = getAdapter();
if (adapter instanceof SectionIndexer) {
// try fast way by asking section indexer
SectionIndexer indexer = (SectionIndexer) adapter;
int sectionPosition = indexer.getSectionForPosition(fromPosition);
int itemPosition = indexer.getPositionForSection(sectionPosition);
int typeView = adapter.getItemViewType(itemPosition);
if (isItemViewTypePinned(adapter,no luck
}
// try slow way by looking through to the next section item above
for (int position=fromPosition; position>=0; position--) {
if(position >= adapter.getCount())break;//fix by bitjjj
int viewType = adapter.getItemViewType(position);
if (isItemViewTypePinned(adapter,viewType)) return position;
}
return -1; // no candidate found
}
项目:transdroid
文件:MergeAdapter.java
public final int getPositionForSection(int section) {
int position = 0;
for (listadapter piece : pieces) {
if (piece instanceof SectionIndexer) {
Object[] sections = ((SectionIndexer) piece).getSections();
int numSections = 0;
if (sections != null) {
numSections = sections.length;
}
if (section < numSections) {
return (position + ((SectionIndexer) piece).getPositionForSection(section));
} else if (sections != null) {
section -= numSections;
}
}
position += piece.getCount();
}
return (0);
}
项目:transdroid
文件:MergeAdapter.java
public final Object[] getSections() {
ArrayList<Object> sections = new ArrayList<Object>();
for (listadapter piece : pieces) {
if (piece instanceof SectionIndexer) {
Object[] curSections = ((SectionIndexer) piece).getSections();
if (curSections != null) {
for (Object section : curSections) {
sections.add(section);
}
}
}
}
if (sections.size() == 0) {
return (null);
}
return (sections.toArray(new Object[0]));
}
项目:SimpleExplorer
文件:MergeAdapter.java
public int getPositionForSection(int section) {
int position = 0;
for (listadapter piece : pieces) {
if (piece instanceof SectionIndexer) {
Object[] sections = ((SectionIndexer) piece).getSections();
int numSections = 0;
if (sections != null) {
numSections = sections.length;
}
if (section < numSections) {
return (position + ((SectionIndexer) piece)
.getPositionForSection(section));
} else if (sections != null) {
section -= numSections;
}
}
position += piece.getCount();
}
return 0;
}
项目:SimpleExplorer
文件:MergeAdapter.java
public Object[] getSections() {
ArrayList<Object> sections = new ArrayList<>();
for (listadapter piece : pieces) {
if (piece instanceof SectionIndexer) {
Object[] curSections = ((SectionIndexer) piece).getSections();
if (curSections != null) {
Collections.addAll(sections,curSections);
}
}
}
if (sections.isEmpty()) {
return null;
}
return sections.toArray(new Object[sections.size()]);
}
项目:ZalartAndroid
文件:MergeAdapter.java
@Override
public int getPositionForSection(int section) {
int position=0;
for (listadapter piece : pieces) {
if (piece instanceof SectionIndexer) {
Object[] sections=((SectionIndexer)piece).getSections();
int numSections=0;
if (sections!=null) {
numSections=sections.length;
}
if (section<numSections) {
return(position+((SectionIndexer)piece).getPositionForSection(section));
}
else if (sections!=null) {
section-=numSections;
}
}
position+=piece.getCount();
}
return(0);
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。