Java Code Examples for android.widget.AbsListView#getContext()

The following examples show how to use android.widget.AbsListView#getContext() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EdgeEffectHandler.java    From Dashchan with Apache License 2.0 6 votes vote down vote up
public static EdgeEffectHandler bind(AbsListView listView, Shift shift) {
	if (EDGE_GLOW_TOP_FIELD != null && EDGE_GLOW_BOTTOM_FIELD != null) {
		try {
			Object edgeEffect = EDGE_GLOW_TOP_FIELD.get(listView);
			if (edgeEffect != null && !(edgeEffect instanceof ControlledEdgeEffect)) {
				EdgeEffectHandler handler = new EdgeEffectHandler(listView.getContext(), shift);
				EDGE_GLOW_TOP_FIELD.set(listView, handler.topEdgeEffect);
				EDGE_GLOW_BOTTOM_FIELD.set(listView, handler.bottomEdgeEffect);
				return handler;
			}
		} catch (Exception e) {
			// Ugnore
		}
	}
	return null;
}
 
Example 2
Source File: AutoLoadMoreListener.java    From YiBo with Apache License 2.0 6 votes vote down vote up
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
	switch (scrollState) {
       case OnScrollListener.SCROLL_STATE_IDLE:
	    //Log.v(TAG, "已经停止:SCROLL_STATE_IDLE" + "-->" + view.getCount());
	    Context context = view.getContext();
	    SheJiaoMaoApplication sheJiaoMao = (SheJiaoMaoApplication) context.getApplicationContext();
	    if (view.getLastVisiblePosition() == view.getCount() - 1
	    	&& sheJiaoMao.isAutoLoadMore()) {
	    	view.getChildAt(view.getChildCount() - 1).performClick();
	    }
	    break;
       case OnScrollListener.SCROLL_STATE_FLING:
	    //Log.v(TAG, "开始滚动:SCROLL_STATE_FLING");
	    break;
	case OnScrollListener.SCROLL_STATE_TOUCH_SCROLL:
	   //Log.v(TAG, "正在滚动:SCROLL_STATE_TOUCH_SCROLL");
	   break;
    }
}
 
Example 3
Source File: StatusScrollListener.java    From YiBo with Apache License 2.0 6 votes vote down vote up
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
	this.scrollState = scrollState;
	
	switch (scrollState) {
       case OnScrollListener.SCROLL_STATE_IDLE:
	    //Log.v(TAG, "已经停止:SCROLL_STATE_IDLE" + "-->" + view.getCount()); 
	    Context context = view.getContext();
	    SheJiaoMaoApplication sheJiaoMao = (SheJiaoMaoApplication) context.getApplicationContext();
	    if (view.getLastVisiblePosition() == view.getCount() - 1
	    	&& sheJiaoMao.isAutoLoadMore()) {
	    	view.getChildAt(view.getChildCount() - 1).performClick();
	    }
	    
	    displayImage(view);
	    break;
       case OnScrollListener.SCROLL_STATE_TOUCH_SCROLL:
		   //Log.v(TAG, "SCROLL_STATE_TOUCH_SCROLL:当屏幕滚动且用户使用的触碰或手指还在屏幕上时为1");
		   break;
       case OnScrollListener.SCROLL_STATE_FLING:
	    //Log.v(TAG, "SCROLL_STATE_FLING:由于用户的操作,屏幕产生惯性滑动时为2");
	    break;
    }

}
 
Example 4
Source File: BaseListAdapter.java    From CoreModule with Apache License 2.0 5 votes vote down vote up
public BaseListAdapter(AbsListView view, Collection<T> mDatas, int itemLayoutId) {
    if (mDatas == null) {
        mDatas = new ArrayList<T>(0);
    }
    this.mDatas = mDatas;
    this.mItemLayoutId = itemLayoutId;
    this.mList = view;
    mCxt = view.getContext();
    mInflater = LayoutInflater.from(mCxt);
    mList.setOnScrollListener(this);
}
 
Example 5
Source File: BaseCommonAdapter.java    From BaseProject with Apache License 2.0 5 votes vote down vote up
public BaseCommonAdapter(AbsListView listView, Collection<T> data) {
    if(data != null){
        dataList = data;
    }
    else{
        dataList = new ArrayList<T>(0);
    }
    if(listView != null){
        mContext = listView.getContext();
        listView.setOnScrollListener(this);
    }
}
 
Example 6
Source File: ImageHelper.java    From AndroidPicker with MIT License 5 votes vote down vote up
@Override
public void onScrollFling(AbsListView view) {
    if (null == context) {
        context = view.getContext();
    }
    Picasso.with(context).pauseTag(view);
}
 
Example 7
Source File: ImageHelper.java    From AndroidPicker with MIT License 5 votes vote down vote up
@Override
public void onScrollFinish(AbsListView view) {
    if (null == context) {
        context = view.getContext();
    }
    Picasso.with(context).resumeTag(view);
}
 
Example 8
Source File: KJAdapter.java    From KJFrameForAndroid with Apache License 2.0 5 votes vote down vote up
public KJAdapter(AbsListView view, Collection<T> mDatas, int itemLayoutId) {
    if (mDatas == null) {
        mDatas = new ArrayList<T>(0);
    }
    this.mDatas = mDatas;
    this.mItemLayoutId = itemLayoutId;
    this.mList = view;
    mCxt = view.getContext();
    mInflater = LayoutInflater.from(mCxt);
    mList.setOnScrollListener(this);
}
 
Example 9
Source File: ListViewFeeds.java    From rss with GNU General Public License v3.0 5 votes vote down vote up
@Override
public
void onScrollStateChanged(AbsListView view, int scrollState)
{
    FeedsActivity activity = (FeedsActivity) view.getContext();

    if(SCROLL_STATE_TOUCH_SCROLL == scrollState || SCROLL_STATE_IDLE == scrollState)
    {
        Adapter adapter = view.getAdapter();
        int first = view.getFirstVisiblePosition();
        int last = view.getLastVisiblePosition();

        for(int i = 0; last - first >= i; i++)
        {
            View viewItem = view.getChildAt(i);

            if(null != viewItem && viewItem.isShown() && 0 <= viewItem.getTop())
            {
                FeedItem item = (FeedItem) adapter.getItem(first + i);
                activity.readItem(item.m_time);
            }
        }
    }
    if(SCROLL_STATE_IDLE == scrollState)
    {
        AsyncNavigationAdapter.run(activity);
    }
}
 
Example 10
Source File: EmojiAdapter.java    From EmojiChat with Apache License 2.0 4 votes vote down vote up
public EmojiAdapter(AbsListView view, Collection<Emojicon> mDatas) {
    super();
    this.mDatas = new ArrayList<>(mDatas);
    context = view.getContext();
}
 
Example 11
Source File: FaceAdapter.java    From EmojiChat with Apache License 2.0 4 votes vote down vote up
public FaceAdapter(AbsListView view, Collection<Faceicon> mDatas) {
    super();
    this.mDatas = new ArrayList<>(mDatas);
    context = view.getContext();
}