本文整理汇总了Java中android.widget.HeaderViewListAdapter.getWrappedAdapter方法的典型用法代码示例。如果您正苦于以下问题:Java HeaderViewListAdapter.getWrappedAdapter方法的具体用法?Java HeaderViewListAdapter.getWrappedAdapter怎么用?Java HeaderViewListAdapter.getWrappedAdapter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.HeaderViewListAdapter
的用法示例。
在下文中一共展示了HeaderViewListAdapter.getWrappedAdapter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onItemClick
import android.widget.HeaderViewListAdapter; //导入方法依赖的package包/类
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int rawPosition, long id) {
SectionedBaseAdapter adapter;
if (adapterView.getAdapter().getClass().equals(HeaderViewListAdapter.class)) {
HeaderViewListAdapter wrapperAdapter = (HeaderViewListAdapter) adapterView.getAdapter();
adapter = (SectionedBaseAdapter) wrapperAdapter.getWrappedAdapter();
} else {
adapter = (SectionedBaseAdapter) adapterView.getAdapter();
}
int section = adapter.getSectionForPosition(rawPosition);
int position = adapter.getPositionInSectionForPosition(rawPosition);
if (position == -1) {
onSectionClick(adapterView, view, section, id);
} else {
onItemClick(adapterView, view, section, position, id);
}
}
示例2: onScroll
import android.widget.HeaderViewListAdapter; //导入方法依赖的package包/类
@Override
public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount)
{
if (firstVisibleItem < this.topVisibleItem - DISTANCE_TO_HIDE_ACTIONBAR)
{
setActionbarVisibility(true);
this.topVisibleItem = firstVisibleItem;
}
else if (firstVisibleItem > this.topVisibleItem + DISTANCE_TO_HIDE_ACTIONBAR)
{
setActionbarVisibility(false);
this.topVisibleItem = firstVisibleItem;
}
ListAdapter adapter = view.getAdapter();
if (adapter instanceof HeaderViewListAdapter)
{
HeaderViewListAdapter headerViewListAdapter = (HeaderViewListAdapter) adapter;
if (headerViewListAdapter.getWrappedAdapter() instanceof FileCardAdapter)
{
int startPrefetch = firstVisibleItem + visibleItemCount-headerViewListAdapter.getHeadersCount();
((FileCardAdapter) headerViewListAdapter.getWrappedAdapter()).prefetchImages(startPrefetch, visibleItemCount);
}
}
}
示例3: getAdapter
import android.widget.HeaderViewListAdapter; //导入方法依赖的package包/类
public static BaseAdapter getAdapter(Adapter adapter) {
if (adapter == null) {
return null;
}
BaseAdapter baseAdapter = null;
if (adapter instanceof BaseAdapter) {
baseAdapter = (BaseAdapter)adapter;
} else if (adapter instanceof HeaderViewListAdapter) {
HeaderViewListAdapter headerViewAdapter = (HeaderViewListAdapter)adapter;
if (headerViewAdapter.getWrappedAdapter() instanceof BaseAdapter) {
baseAdapter = (BaseAdapter)headerViewAdapter.getWrappedAdapter();
}
}
return baseAdapter;
}
示例4: getCacheAdapter
import android.widget.HeaderViewListAdapter; //导入方法依赖的package包/类
public static CacheAdapter<?> getCacheAdapter(Adapter adapter) {
if (adapter == null) {
return null;
}
CacheAdapter<?> cacheAdapter = null;
if (adapter instanceof CacheAdapter<?>) {
cacheAdapter = (CacheAdapter<?>)adapter;
} else if (adapter instanceof HeaderViewListAdapter) {
HeaderViewListAdapter headerViewAdapter = (HeaderViewListAdapter)adapter;
if (headerViewAdapter.getWrappedAdapter() instanceof CacheAdapter<?>) {
cacheAdapter = (CacheAdapter<?>)headerViewAdapter.getWrappedAdapter();
}
}
return cacheAdapter;
}
示例5: getAdapter
import android.widget.HeaderViewListAdapter; //导入方法依赖的package包/类
public static BaseAdapter getAdapter(Adapter adapter) {
if (adapter == null) {
return null;
}
BaseAdapter baseAdapter = null;
if (adapter instanceof BaseAdapter) {
baseAdapter = (BaseAdapter)adapter;
} else if (adapter instanceof HeaderViewListAdapter) {
HeaderViewListAdapter headerViewAdapter = (HeaderViewListAdapter)adapter;
if (headerViewAdapter.getWrappedAdapter() instanceof BaseAdapter) {
baseAdapter = (BaseAdapter)headerViewAdapter.getWrappedAdapter();
}
}
return baseAdapter;
}
示例6: getBaseListAdapter
import android.widget.HeaderViewListAdapter; //导入方法依赖的package包/类
public static BaseListAdapter<?> getBaseListAdapter(Adapter adapter) {
if (adapter == null) {
return null;
}
BaseListAdapter<?> baseListAdapter = null;
if (adapter instanceof BaseListAdapter<?>) {
baseListAdapter = (BaseListAdapter<?>)adapter;
} else if (adapter instanceof HeaderViewListAdapter) {
HeaderViewListAdapter headerViewAdapter = (HeaderViewListAdapter)adapter;
if (headerViewAdapter.getWrappedAdapter() instanceof BaseListAdapter<?>) {
baseListAdapter = (BaseListAdapter<?>)headerViewAdapter.getWrappedAdapter();
}
}
return baseListAdapter;
}
示例7: getInternalAdapter
import android.widget.HeaderViewListAdapter; //导入方法依赖的package包/类
public ATableViewAdapter getInternalAdapter() {
// fixes bugs for tables which includes headers or footers.
ATableViewAdapter adapter = null;
if (getAdapter() instanceof HeaderViewListAdapter) {
HeaderViewListAdapter headerAdapter = (HeaderViewListAdapter) getAdapter();
adapter = (ATableViewAdapter) headerAdapter.getWrappedAdapter();
} else {
adapter = (ATableViewAdapter) getAdapter();
}
return adapter;
}
示例8: onPostExecute
import android.widget.HeaderViewListAdapter; //导入方法依赖的package包/类
@Override
protected void onPostExecute(Void param) {
HeaderViewListAdapter t = (HeaderViewListAdapter)mListView.getAdapter();
MyListAdapter adapter = (MyListAdapter)t.getWrappedAdapter();
adapter.addLoadedData(mData);
mListView.notifyLoaded();
}
示例9: onPostExecute
import android.widget.HeaderViewListAdapter; //导入方法依赖的package包/类
@Override
protected void onPostExecute(Void param) {
HeaderViewListAdapter t = (HeaderViewListAdapter)mListView.getAdapter();
MyListAdapter adapter = (MyListAdapter)t.getWrappedAdapter();
adapter.addUpdatedData(mData);
mListView.notifyUpdated();
}
示例10: loadImage
import android.widget.HeaderViewListAdapter; //导入方法依赖的package包/类
/**
* 加载从位置start开始到end之间所有的图片<br>
* 滚动停止时调用,若存在图片则加载,若不存在则从硬盘获取或网络下载
*
* @param start 可见新闻项的开始位置
* @param end 可见新闻项的结束位置
* @param listView 对应的ListView
*/
public void loadImage(int start, int end, ListView listView, BaseFragmentAdapter adapter) {
LogUtils.d(CommonInfo.TAG, "ImageLoader-->loadImage--->start = " + start + " end = " + end);
for (int i = start; i < end; i++) {
//找到对应的图片url地址
String url = null;
if (adapter instanceof WeiChatDetailFragmentAdapter) {
if (listView.getAdapter() instanceof HeaderViewListAdapter) {
HeaderViewListAdapter adapter1 = (HeaderViewListAdapter) listView.getAdapter();
url = ((BaseFragmentAdapter) adapter1.getWrappedAdapter()).IMAGE_URLS[i];
LogUtils.d(CommonInfo.TAG, "WeiChat i" + i + "url");
}
} else {
url = adapter.IMAGE_URLS[i];
}
//根据url从一级缓存中找是否有该图片
Bitmap bitmap = getBitmapFromCache(url);
//根据图片控件Ta属性上绑定的url从listview中找到图片控件
ImageView imageView = (ImageView) listView.findViewWithTag(url);
LogUtils.d(CommonInfo.TAG, "ImageLoader---->loadImage " + imageView + " url = " + url);
if (bitmap != null && imageView != null) {
//若成功从缓存中找到图片
imageView.setImageBitmap(bitmap);
LogUtils.d(CommonInfo.TAG, "ImageLoader-->loadImage--->bitmap from cache");
} else {
//找不到图片则从SD卡或者网络下载图片
LogUtils.d(CommonInfo.TAG, "LoadImage download");
downLoadImage(url, imageView);
}
}
LogUtils.d(CommonInfo.TAG, "ImageLoader-->loadimage finished");
}
示例11: onItemClick
import android.widget.HeaderViewListAdapter; //导入方法依赖的package包/类
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
GoodTreeViewAdapter adapter = null;
int tempPosition = (int) parent.getItemIdAtPosition(position);
if(xListView.getAdapter() instanceof HeaderViewListAdapter) {
HeaderViewListAdapter listAdapter=(HeaderViewListAdapter)xListView.getAdapter();
adapter = (GoodTreeViewAdapter) listAdapter.getWrappedAdapter();
}else{
adapter = ((GoodTreeViewAdapter) parent.getAdapter());
}
GoodElement element = (GoodElement) adapter.getItem(tempPosition);
Toast.makeText(MainActivity.this, element.getContent(), Toast.LENGTH_SHORT).show();
view.setBackgroundColor(Color.parseColor("#eaeaea"));
if (frontPosition != -1 && frontPosition != tempPosition) {
frontView.setBackgroundColor(Color.parseColor("#ffffff"));
}
frontView = view;
frontPosition = tempPosition;
if(element != null){
if (!element.isHasChildView()) {
return;
}else{
FolderSettings folderSettings = new FolderSettings(element, elements, elementsData, tempPosition, adapter);
folderManager.foldOrUnFoldFunction(folderSettings);
}
}else{
return;
}
}
示例12: getAdapter
import android.widget.HeaderViewListAdapter; //导入方法依赖的package包/类
private NavAdapter getAdapter() {
if (getListView().getAdapter() instanceof HeaderViewListAdapter) {
HeaderViewListAdapter hvla = (HeaderViewListAdapter) getListView().getAdapter();
return (NavAdapter) hvla.getWrappedAdapter();
} else {
return (NavAdapter) getListView().getAdapter();
}
}
示例13: onItemClick
import android.widget.HeaderViewListAdapter; //导入方法依赖的package包/类
@Override
public final void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
PinnedHeaderAdapter adapter = null;
int headerCount = 0;
int footerCount = 0;
// 如果设置过header view,注意会有一个包装的adapter返回,并不是原来设置的adapter
if (adapterView.getAdapter() instanceof HeaderViewListAdapter) {
HeaderViewListAdapter wrapperAdapter = (HeaderViewListAdapter) adapterView.getAdapter();
headerCount = wrapperAdapter.getHeadersCount();
footerCount = wrapperAdapter.getFootersCount();
if (wrapperAdapter.getWrappedAdapter() instanceof PinnedHeaderAdapter)
adapter = (PinnedHeaderAdapter) wrapperAdapter.getWrappedAdapter();
} else {
if (adapterView.getAdapter() instanceof PinnedHeaderAdapter)
adapter = (PinnedHeaderAdapter) adapterView.getAdapter();
}
if (adapter == null)
return;
// 如果点击的是header view,则不响应
if (position < headerCount) {
onHeaderClick(adapterView, position);
return;
}
// 如果点击的是footer view,也不响应
if (footerCount > 0 && position >= adapterView.getAdapter().getCount() - footerCount) {
onFooterClick(adapterView, position - (adapterView.getAdapter().getCount() - footerCount));
return;
}
int adjustPosition = position - headerCount;
int section = adapter.getSectionForPosition(adjustPosition);
if (adapter.isSectionHeader(adjustPosition)) {
onSectionHeaderClick(adapterView, section, id);
} else {
int positionInSection = adapter.getPositionInSectionForPosition(adjustPosition);
onItemClick(adapterView, section, positionInSection, id);
}
}
示例14: onItemLongClick
import android.widget.HeaderViewListAdapter; //导入方法依赖的package包/类
@Override
public final boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
PinnedHeaderAdapter adapter = null;
int headerCount = 0;
int footerCount = 0;
// 如果设置过header view,注意会有一个包装的adapter返回,并不是原来设置的adapter
if (parent.getAdapter() instanceof HeaderViewListAdapter) {
HeaderViewListAdapter wrapperAdapter = (HeaderViewListAdapter) parent.getAdapter();
headerCount = wrapperAdapter.getHeadersCount();
footerCount = wrapperAdapter.getFootersCount();
if (wrapperAdapter.getWrappedAdapter() instanceof PinnedHeaderAdapter)
adapter = (PinnedHeaderAdapter) wrapperAdapter.getWrappedAdapter();
} else {
if (parent.getAdapter() instanceof PinnedHeaderAdapter)
adapter = (PinnedHeaderAdapter) parent.getAdapter();
}
if (adapter == null)
return false;
// 如果点击的是header view,则不响应
if (position < headerCount) {
onHeaderLongClick(parent, position);
return false;
}
// 如果点击的是footer view,也不响应
if (footerCount > 0 && position >= parent.getAdapter().getCount() - footerCount) {
onFooterLongClick(parent, position - (parent.getAdapter().getCount() - footerCount));
return false;
}
int adjustPosition = position - headerCount;
int section = adapter.getSectionForPosition(adjustPosition);
if (adapter.isSectionHeader(adjustPosition)) {
onSectionHeaderLongClick(parent, section, id);
} else {
int positionInSection = adapter.getPositionInSectionForPosition(adjustPosition);
onItemLongClick(parent, section, positionInSection, id);
}
return false;
}
示例15: refreshContactList
import android.widget.HeaderViewListAdapter; //导入方法依赖的package包/类
private void refreshContactList() {
for (int j = 0, count = mNavigationView.getChildCount(); j < count; j++) {
final View child = mNavigationView.getChildAt(j);
if (child != null && child instanceof ListView) {
final ListView menuView = (ListView) child;
final HeaderViewListAdapter adapter = (HeaderViewListAdapter) menuView.getAdapter();
final BaseAdapter wrapped = (BaseAdapter) adapter.getWrappedAdapter();
wrapped.notifyDataSetChanged();
}
}
}