本文整理匯總了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();
}
}
}