本文整理汇总了Java中android.widget.HeaderViewListAdapter类的典型用法代码示例。如果您正苦于以下问题:Java HeaderViewListAdapter类的具体用法?Java HeaderViewListAdapter怎么用?Java HeaderViewListAdapter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HeaderViewListAdapter类属于android.widget包,在下文中一共展示了HeaderViewListAdapter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: NavigationPopup
import android.widget.HeaderViewListAdapter; //导入依赖的package包/类
/**
* Constructs a new popup with the given history information.
*
* @param profile The profile used for fetching favicons.
* @param context The context used for building the popup.
* @param navigationController The controller which takes care of page navigations.
* @param isForward Whether to request forward navigation entries.
*/
public NavigationPopup(Profile profile, Context context,
NavigationController navigationController, boolean isForward) {
super(context, null, android.R.attr.popupMenuStyle);
mProfile = profile;
mContext = context;
mNavigationController = navigationController;
mHistory = mNavigationController.getDirectedNavigationHistory(
isForward, MAXIMUM_HISTORY_ITEMS);
mAdapter = new NavigationAdapter();
mFaviconSize = mContext.getResources().getDimensionPixelSize(R.dimen.default_favicon_size);
setModal(true);
setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);
setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
setOnItemClickListener(this);
setAdapter(new HeaderViewListAdapter(null, null, mAdapter));
mListItemFactory = new ListItemFactory(context);
}
示例2: onItemClick
import android.widget.HeaderViewListAdapter; //导入依赖的package包/类
public void onItemClick(AdapterView<?> adapterView, View view, int rawPosition, long id) {
SectionedBaseAdapter adapter;
if (adapterView.getAdapter().getClass().equals(HeaderViewListAdapter.class)) {
adapter = (SectionedBaseAdapter) ((HeaderViewListAdapter) adapterView.getAdapter
()).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);
}
}
示例3: setListAdapter
import android.widget.HeaderViewListAdapter; //导入依赖的package包/类
public void setListAdapter(ListAdapter adapter) {
headerInfo = list.new FixedViewInfo();
headerInfo.view = LayoutInflater.from(getActivity()).inflate(R.layout.layout_header_project,
null);
headerInfo.isSelectable = false;
ArrayList<ListView.FixedViewInfo> headers = new ArrayList<>(1);
ArrayList<ListView.FixedViewInfo> footers = new ArrayList<>(0);
headers.add(headerInfo);
HeaderViewListAdapter wrapper = new HeaderViewListAdapter(headers, footers, adapter) {
@Override
public boolean areAllItemsEnabled() {
return false;
}
};
list.setAdapter(wrapper);
}
示例4: disposeFooterView
import android.widget.HeaderViewListAdapter; //导入依赖的package包/类
private void disposeFooterView() {
if (mFooterView == null || mAbsListView == null) {
return;
}
if (canAddFooter()) {
mFooterView.setVisibility(View.VISIBLE);
mAbsListView.addFooterView(mFooterView);
} else {
if (mAbsListView.getAdapter() instanceof HeaderViewListAdapter) {
Log.d(VIEW_LOG_TAG, "### 移除footer ");
mFooterView.setVisibility(View.GONE);
mAbsListView.removeFooterView(mFooterView);
} else {
Log.d(VIEW_LOG_TAG, "### 隐藏footer ");
mFooterView.setVisibility(View.GONE);
}
}
}
示例5: setLoading
import android.widget.HeaderViewListAdapter; //导入依赖的package包/类
/**
* @param loading
*/
public void setLoading(boolean loading) {
isLoading = loading;
if (isLoading && mListView.getFooterViewsCount() == 0) {
mListView.addFooterView(mListViewFooter);
} else {
if (mListView.getAdapter() instanceof HeaderViewListAdapter) {
mListView.removeFooterView(mListViewFooter);
} else {
mListViewFooter.setVisibility(View.GONE);
}
mYDown = 0;
mLastY = 0;
}
}
示例6: d
import android.widget.HeaderViewListAdapter; //导入依赖的package包/类
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[] { " " };
}
示例7: setLoading
import android.widget.HeaderViewListAdapter; //导入依赖的package包/类
public void setLoading(boolean loading) {
isLoading = loading;
if (isLoading) {
if (isRefreshing()) setRefreshing(false);
if (mListView.getFooterViewsCount() == 0) {
mListView.addFooterView(mListViewFooter);
mListView.setSelection(mListView.getAdapter().getCount() - 1);
} else {
mListViewFooter.setVisibility(VISIBLE);
//mListView.addFooterView(mListViewFooter);
}
} else {
if (mListView.getAdapter() instanceof HeaderViewListAdapter) {
mListView.removeFooterView(mListViewFooter);
} else {
mListViewFooter.setVisibility(View.GONE);
}
mYDown = 0;
mLastY = 0;
}
}
示例8: onScroll
import android.widget.HeaderViewListAdapter; //导入依赖的package包/类
@Override
public void onScroll(final AbsListView view,
final int firstVisibleItem,
final int visibleItemCount,
final int totalItemCount) {
ListAdapter a = getAdapter();
SectionListAdapter adapter = null;
if (a instanceof HeaderViewListAdapter)
adapter = (SectionListAdapter)((HeaderViewListAdapter) a).getWrappedAdapter();
else
adapter = (SectionListAdapter) getAdapter();
if (adapter != null) {
adapter.makeSectionInvisibleIfFirstInList(firstVisibleItem);
}
// More activities will be automatically loaded if:
// - the user has scrolled AND
// - the user has reached the bottom of the list
if (hasScrolled && totalItemCount > 0 && firstVisibleItem+visibleItemCount==totalItemCount) {
autoLoadProgress.setVisibility(View.VISIBLE);
parentFragment.onLoadMore(ExoConstants.NUMBER_OF_ACTIVITY, totalItemCount-1, firstVisibleItem);
// set back to false to avoid multiple calls to the onLoadMore(...) method
hasScrolled = false;
}
}
示例9: 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);
}
}
示例10: updateContacts
import android.widget.HeaderViewListAdapter; //导入依赖的package包/类
public void updateContacts(MainActivity activity) {
if (MainActivity.getContacts() == null)
MainActivity.setContacts(readSMSContacts(getActivity()));
if (MainActivity.getListItems() == null || MainActivity.getListItems().size() == 0)
MainActivity.setListItems(getNames(MainActivity.getContacts(), activity));
if (contactList != null && contactList.getAdapter() == null) {
ContactAdapter arrayAdapter = new ContactAdapter(activity, MainActivity.getListItems(), 0);
arrayAdapter.notifyDataSetChanged();
contactList.setAdapter(arrayAdapter);
contactList.setSelection(0);
} else if (MainActivity.getListItems().size() > 0 && contactList != null) {
((ContactAdapter) ((HeaderViewListAdapter) contactList.getAdapter()).getWrappedAdapter()).refill(
MainActivity.getListItems(), 0);
}
if (swipe != null)
swipe.setRefreshing(false);
if (progressbar != null)
progressbar.setVisibility(View.INVISIBLE);
}
示例11: updateContacts
import android.widget.HeaderViewListAdapter; //导入依赖的package包/类
public void updateContacts(ArrayList<FacebookContact> fbcontacts) {
if (fbcontacts == null) {
return;
}
for (FacebookContact contact : fbcontacts) {
contacts.add(new ContactModel(fb_img.get(contact.getName()), contact.getName(), contact.getLastMessage(),
"", false).drawOnline(false));
}
if (contactList != null && contactList.getAdapter() == null) {
ContactAdapter arrayAdapter = new ContactAdapter(this, contacts, 1);
contactList.setAdapter(arrayAdapter);
contactList.setSelection(0);
} else {
if (contactList != null) {
((ContactAdapter) ((HeaderViewListAdapter) contactList.getAdapter()).getWrappedAdapter()).refill(
contacts, 1);
}
}
progressbar.setVisibility(View.INVISIBLE);
}
示例12: updateContacts
import android.widget.HeaderViewListAdapter; //导入依赖的package包/类
public void updateContacts() {
if (contacts == null)
contacts = readSMSContacts(this);
if (contactList != null && contactList.getAdapter() != null) {
if (contacts.size() > 0 && contactList != null) {
((ContactAdapter) ((HeaderViewListAdapter) contactList.getAdapter()).getWrappedAdapter()).refill(
contacts, 0);
}
} else {
if (contactList != null) {
ContactAdapter arrayAdapter = new ContactAdapter(this, contacts, 0);
contactList.setAdapter(arrayAdapter);
}
}
}
示例13: getCurrAdapter
import android.widget.HeaderViewListAdapter; //导入依赖的package包/类
/**
* 得到当前绑定的adapter对象
*
* @return
*/
private PinnedHeaderAdapter getCurrAdapter() {
// 如果该ListView有addHeaderView()或addFooterView()时,在ListView.setAdapter()时,会将原本的adapter包装成一个HeaderViewListAdapter对象
ListAdapter adapter = getAdapter();
if (adapter == null)
return null;
PinnedHeaderAdapter pinnedHeaderAdapter = null;
if (adapter instanceof HeaderViewListAdapter) {
if (((HeaderViewListAdapter) adapter).getWrappedAdapter() instanceof PinnedHeaderAdapter)
pinnedHeaderAdapter = (PinnedHeaderAdapter) ((HeaderViewListAdapter) adapter).getWrappedAdapter();
} else {
if (adapter instanceof PinnedHeaderAdapter)
pinnedHeaderAdapter = (PinnedHeaderAdapter) adapter;
}
return pinnedHeaderAdapter;
}
示例14: 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);
}
}
}
示例15: addHeaderView
import android.widget.HeaderViewListAdapter; //导入依赖的package包/类
/**
* Add a fixed view to appear at the top of the list. If addHeaderView is
* called more than once, the views will appear in the order they were
* added. Views added using this call can take focus if they want.
* <p/>
* NOTE: Call this before calling setAdapter. This is so ListView can wrap the supplied cursor with one that will also account for header and footer views.
*
* @param v
* The view to add.
* @param data
* Data to associate with this view
* @param isSelectable
* whether the item is selectable
*/
public void addHeaderView(View v, Object data, boolean isSelectable)
{
if (mAdapter != null && !(mAdapter instanceof HeaderViewListAdapter))
{
throw new IllegalStateException("Cannot add header view to list -- setAdapter has already been called.");
}
FixedViewInfo info = new FixedViewInfo();
info.view = v;
info.data = data;
info.isSelectable = isSelectable;
mHeaderViewInfos.add(info);
// in the case of re-adding a header view, or adding one later on,
// we need to notify the observer
if (mAdapter != null && mObserver != null)
{
mObserver.onChanged();
}
}