Java 类android.widget.HeaderViewListAdapter 实例源码

项目:chromium-for-android-56-debug-video    文件:NavigationPopup.java   
/**
 * 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);
}
项目:boohee_v5.6    文件:PinnedHeaderListView.java   
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);
    }
}
项目:AndroidChromium    文件:NavigationPopup.java   
/**
 * 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);
}
项目:mobile_app_android    文件:ProjectDetailFragment.java   
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);
}
项目:Vafrinn    文件:NavigationPopup.java   
/**
 * 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);
}
项目:umeng_community_android    文件:RefreshLvLayout.java   
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);
        }
    }
}
项目:oschinaframework    文件:MySwipeRefreshLayout.java   
/**
 * @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;

    }
}
项目: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[] { " " };
}
项目:AndroidGeek    文件:RefreshLvLayout.java   
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);
        }
    }
}
项目:SwipeRefreshLayout    文件:RefreshLayout.java   
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;
    }
}
项目:XSwipeRefresh    文件:RefreshLayout.java   
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;
    }
}
项目:mobile-android-studio    文件:SectionListView.java   
@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;
  }
}
项目:ShoppingMall    文件:PinnedHeaderListView.java   
@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);
    }
}
项目:365browser    文件:NavigationPopup.java   
/**
 * 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);
}
项目:Raven-Messenger    文件:SMSMainActivity.java   
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);

    }
项目:Raven-Messenger    文件:NewFbContactActivity.java   
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);
}
项目:Raven-Messenger    文件:NewSMSContactActivity.java   
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);
        }
    }
}
项目:PinnedHeaderView    文件:PinnedHeaderListView.java   
/**
 * 得到当前绑定的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;
}
项目:filemanager    文件:FolderFragment.java   
@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);
        }
    }
}
项目:like_googleplus_layout    文件:ExtendableListView.java   
/**
 * 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();
    }
}
项目:like_googleplus_layout    文件:ExtendableListView.java   
/**
 * Removes a previously-added header view.
 * 
 * @param v
 *            The view to remove
 * @return true if the view was removed, false if the view was not a header
 *         view
 */
public boolean removeHeaderView(View v)
{
    if (mHeaderViewInfos.size() > 0)
    {
        boolean result = false;
        if (mAdapter != null && ((HeaderViewListAdapter) mAdapter).removeHeader(v))
        {
            if (mObserver != null)
            {
                mObserver.onChanged();
            }
            result = true;
        }
        removeFixedViewInfo(v, mHeaderViewInfos);
        return result;
    }
    return false;
}
项目:like_googleplus_layout    文件:ExtendableListView.java   
/**
 * Removes a previously-added footer view.
 * 
 * @param v
 *            The view to remove
 * @return true if the view was removed, false if the view was not a footer view
 */
public boolean removeFooterView(View v)
{
    if (mFooterViewInfos.size() > 0)
    {
        boolean result = false;
        if (mAdapter != null && ((HeaderViewListAdapter) mAdapter).removeFooter(v))
        {
            if (mObserver != null)
            {
                mObserver.onChanged();
            }
            result = true;
        }
        removeFixedViewInfo(v, mFooterViewInfos);
        return result;
    }
    return false;
}
项目:RowAdapter    文件:RowClickHandler.java   
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    Adapter adapter = parent.getAdapter();
    if (adapter instanceof HeaderViewListAdapter) {
        adapter = ((HeaderViewListAdapter) adapter).getWrappedAdapter();
    }

    RowType rowType;
    if (adapter instanceof CursorRowAdapter) {
        CursorRowAdapter cursorAdapter = (CursorRowAdapter) adapter;
        rowType = cursorAdapter.getItem(position);
    } else {
        rowType = (RowType) adapter.getItem(position);
    }

    onRowClick(rowType, view, position);
}
项目:YiBo    文件:ConversationItemClickListener.java   
@SuppressWarnings("unchecked")
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
        long id) {
    Adapter adapter = parent.getAdapter();
    message = (DirectMessage)adapter.getItem(position);
       if (message == null 
        || (message instanceof LocalDirectMessage
            && ((LocalDirectMessage)message).isDivider())) {
        return;
       }

       if (adapter instanceof HeaderViewListAdapter) {
        adapter = ((HeaderViewListAdapter)adapter).getWrappedAdapter();
       }
    CacheAdapter<DirectMessage> cacheAdapter = (CacheAdapter<DirectMessage>)adapter;

       Dialog dialog = onCreateDialog(cacheAdapter, position);
       if (dialog != null) {
        dialog.show();
       }
}
项目:YiBo    文件:CommentsItemClickListener.java   
@SuppressWarnings("unchecked")
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
        long id) {
    Adapter adapter = parent.getAdapter();
       comment = (Comment)adapter.getItem(position);
       if (comment == null
        || (comment instanceof LocalComment
            && ((LocalComment)comment).isDivider())) {
        return;
       }

       if (adapter instanceof HeaderViewListAdapter) {
        adapter = ((HeaderViewListAdapter)adapter).getWrappedAdapter();
       }
       CacheAdapter<Comment> cacheAdapter = (CacheAdapter<Comment>)adapter;

       Dialog dialog = onCreateDialog(cacheAdapter, position);
       if (dialog != null) {
        dialog.show();
       }
}
项目:YiBo    文件:DirectMessagesItemClickListener.java   
@SuppressWarnings("unchecked")
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
        long id) {
    Adapter adapter = parent.getAdapter();
    message = (DirectMessage)adapter.getItem(position);
       if (message == null 
        || (message instanceof LocalDirectMessage
            && ((LocalDirectMessage)message).isDivider())) {
        return;
       }

       if (adapter instanceof HeaderViewListAdapter) {
        adapter = ((HeaderViewListAdapter)adapter).getWrappedAdapter();
       }
    CacheAdapter<DirectMessage> cacheAdapter = (CacheAdapter<DirectMessage>)adapter;

       Dialog dialog = onCreateDialog(cacheAdapter, position);
       if (dialog != null) {
        dialog.show();
       }
}
项目:YiBo    文件:AdapterUtil.java   
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;
}
项目:YiBo    文件:AdapterUtil.java   
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;
}
项目:YiBo    文件:AdapterUtil.java   
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;
}
项目:YiBo    文件:AdapterUtil.java   
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;
}
项目:android-chromium    文件:NavigationPopup.java   
/**
 * Constructs a new popup with the given history information.
 *
 * @param context The context used for building the popup.
 * @param navigationClient The owner of the history being displayed.
 * @param isForward Whether to request forward navigation entries.
 */
public NavigationPopup(
        Context context, NavigationClient navigationClient, boolean isForward) {
    super(context, null, android.R.attr.popupMenuStyle);
    mContext = context;
    mNavigationClient = navigationClient;
    mHistory = mNavigationClient.getDirectedNavigationHistory(
            isForward, MAXIMUM_HISTORY_ITEMS);
    mAdapter = new NavigationAdapter();

    float density = mContext.getResources().getDisplayMetrics().density;
    mFaviconSize = (int) (density * FAVICON_SIZE_DP);

    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);
}
项目:cordova-android-chromium    文件:NavigationPopup.java   
/**
 * Constructs a new popup with the given history information.
 *
 * @param context The context used for building the popup.
 * @param navigationClient The owner of the history being displayed.
 * @param isForward Whether to request forward navigation entries.
 */
public NavigationPopup(
        Context context, NavigationClient navigationClient, boolean isForward) {
    super(context, null, android.R.attr.popupMenuStyle);
    mContext = context;
    mNavigationClient = navigationClient;
    mHistory = mNavigationClient.getDirectedNavigationHistory(
            isForward, MAXIMUM_HISTORY_ITEMS);
    mAdapter = new NavigationAdapter();

    float density = mContext.getResources().getDisplayMetrics().density;
    mFaviconSize = (int) (density * FAVICON_SIZE_DP);

    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);
}
项目:bst    文件:CursorEmptyChoiceDialogBuilder.java   
@Override
public Builder setSingleChoiceItems(Cursor cursor, int checkedItem,
        String labelColumn, OnClickListener listener) {
    ListAdapter sourceAdapter = new SimpleCursorAdapter(activity,
            android.R.layout.select_dialog_singlechoice, cursor,
            new String[] { labelColumn }, new int[] { android.R.id.text1 });
    View view = activity.getLayoutInflater().inflate(
            android.R.layout.select_dialog_singlechoice, null, false);
    ((TextView) view.findViewById(android.R.id.text1))
            .setText(R.string.nothing);
    FixedViewInfo info = new ExtendedListView(activity).info;
    info.view = view;
    info.data = null;
    info.isSelectable = true;
    ArrayList<FixedViewInfo> header = new ArrayList<FixedViewInfo>();
    ArrayList<FixedViewInfo> footer = new ArrayList<FixedViewInfo>();
    footer.add(info);
    adapter = new HeaderViewListAdapter(header, footer, sourceAdapter);
    if (checkedItem == -1)
        checkedItem = adapter.getWrappedAdapter().getCount();
    return setSingleChoiceItems(adapter, checkedItem, this);
}
项目:android_xcore    文件:XListFragment.java   
@Override
public void onLoaderReset(Loader<Cursor> loader) {
       //isLoaderWork = false;
    if (getView() != null) {
           if (IS_CHECK_STATUS_LOG_ENABLED)
           Log.d("empty_view", loader.isAbandoned() + " " + loader.isReset() + " " + loader.isStarted());
           Adapter adapter = getListView().getAdapter();
           if (adapter != null) {
               if (adapter instanceof HeaderViewListAdapter) {
                   adapter = ((HeaderViewListAdapter) adapter).getWrappedAdapter();
               }
               if (adapter instanceof CursorAdapter) {
                   ((CursorAdapter) adapter).swapCursor(null);
               }
           }
    }
       checkStatus("onLoaderReset");
}
项目:ShangHanLun    文件:ATableView.java   
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;
    }
项目:SetupWizardLibCompat    文件:GlifListLayout.java   
public ListAdapter getAdapter() {
    final ListAdapter adapter = getListView().getAdapter();
    if (adapter instanceof HeaderViewListAdapter) {
        return ((HeaderViewListAdapter) adapter).getWrappedAdapter();
    }
    return adapter;
}
项目:apps-for-android    文件:FastScrollView.java   
private void getSections() {
    Adapter adapter = mList.getAdapter();
    if (adapter instanceof HeaderViewListAdapter) {
        mListOffset = ((HeaderViewListAdapter)adapter).getHeadersCount();
        adapter = ((HeaderViewListAdapter)adapter).getWrappedAdapter();
    }
    if (adapter instanceof SectionIndexer) {
        mListAdapter = (BaseAdapter) adapter;
        mSections = ((SectionIndexer) mListAdapter).getSections();
    }
}
项目:joy-library    文件:BaseHttpLvFragment.java   
protected ExAdapter getAdapter() {

        ListAdapter adapter = mListView.getAdapter();
        if (adapter instanceof HeaderViewListAdapter)
            return (ExAdapter) ((HeaderViewListAdapter) adapter).getWrappedAdapter();
        else
            return (ExAdapter) adapter;
    }
项目:joy-library    文件:BaseHttpLvActivity.java   
protected ExAdapter getAdapter() {

        ListAdapter adapter = mListView.getAdapter();
        if (adapter instanceof HeaderViewListAdapter)
            return (ExAdapter) ((HeaderViewListAdapter) adapter).getWrappedAdapter();
        else
            return (ExAdapter) adapter;
    }
项目:android-ElasticListView    文件:MyLoadTask.java   
@Override
protected void onPostExecute(Void param) {
    HeaderViewListAdapter t = (HeaderViewListAdapter)mListView.getAdapter();
    MyListAdapter adapter = (MyListAdapter)t.getWrappedAdapter();
    adapter.addLoadedData(mData);
    mListView.notifyLoaded();
}