Search in sources :

Example 96 with AbsListView

use of android.widget.AbsListView in project HeaderGridView by maurycyw.

the class HeaderGridView method onScroll.

@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
    if (this.getAdapter() != null) {
        int count = this.getChildCount();
        int totalHeaderHeight = getTotalHeaderHeight();
        if (count > 0 && firstVisibleItem == 0) {
            View child = this.getChildAt(0);
            mScrollOfsset = totalHeaderHeight - child.getTop() + initialTopPadding;
            // no need to dispatch otherwise
            if (child.getTop() >= 0) {
                mShowHeader = true;
            } else {
                mShowHeader = false;
            }
        } else {
            mShowHeader = false;
        }
        if (mShowHeader) {
            this.invalidateIfAnimating();
        }
    }
}
Also used : GridView(android.widget.GridView) AbsListView(android.widget.AbsListView) View(android.view.View) ListView(android.widget.ListView)

Example 97 with AbsListView

use of android.widget.AbsListView in project AndroidSwipeLayout by daimajia.

the class ListViewExample method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.listview);
    mListView = (ListView) findViewById(R.id.listview);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        ActionBar actionBar = getActionBar();
        if (actionBar != null) {
            actionBar.setTitle("ListView");
        }
    }
    /**
     * The following comment is the sample usage of ArraySwipeAdapter.
     */
    // String[] adapterData = new String[]{"Activity", "Service", "Content Provider", "Intent", "BroadcastReceiver", "ADT", "Sqlite3", "HttpClient",
    // "DDMS", "Android Studio", "Fragment", "Loader", "Activity", "Service", "Content Provider", "Intent",
    // "BroadcastReceiver", "ADT", "Sqlite3", "HttpClient", "Activity", "Service", "Content Provider", "Intent",
    // "BroadcastReceiver", "ADT", "Sqlite3", "HttpClient"};
    // mListView.setAdapter(new ArraySwipeAdapterSample<String>(this, R.layout.listview_item, R.id.position, adapterData));
    mAdapter = new ListViewAdapter(this);
    mListView.setAdapter(mAdapter);
    mAdapter.setMode(Attributes.Mode.Single);
    mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            ((SwipeLayout) (mListView.getChildAt(position - mListView.getFirstVisiblePosition()))).open(true);
        }
    });
    mListView.setOnTouchListener(new View.OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            Log.e("ListView", "OnTouch");
            return false;
        }
    });
    mListView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {

        @Override
        public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
            Toast.makeText(mContext, "OnItemLongClickListener", Toast.LENGTH_SHORT).show();
            return true;
        }
    });
    mListView.setOnScrollListener(new AbsListView.OnScrollListener() {

        @Override
        public void onScrollStateChanged(AbsListView view, int scrollState) {
            Log.e("ListView", "onScrollStateChanged");
        }

        @Override
        public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
        }
    });
    mListView.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            Log.e("ListView", "onItemSelected:" + position);
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {
            Log.e("ListView", "onNothingSelected:");
        }
    });
}
Also used : AbsListView(android.widget.AbsListView) AbsListView(android.widget.AbsListView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) MotionEvent(android.view.MotionEvent) ListViewAdapter(com.daimajia.swipedemo.adapter.ListViewAdapter) AdapterView(android.widget.AdapterView) ActionBar(android.app.ActionBar)

Example 98 with AbsListView

use of android.widget.AbsListView in project BGARefreshLayout-Android by bingoogolapple.

the class RefreshGridViewFragment method setListener.

@Override
protected void setListener() {
    mRefreshLayout.setDelegate(this);
    mRefreshLayout.setRefreshScaleDelegate(new BGARefreshLayout.BGARefreshScaleDelegate() {

        @Override
        public void onRefreshScaleChanged(float scale, int moveYDistance) {
            Log.i(TAG, "scale:" + scale + " moveYDistance:" + moveYDistance);
        }
    });
    mDataGv.setOnItemClickListener(this);
    mDataGv.setOnItemLongClickListener(this);
    mDataGv.setOnScrollListener(new AbsListView.OnScrollListener() {

        @Override
        public void onScrollStateChanged(AbsListView view, int scrollState) {
            Log.i(TAG, "滚动状态变化");
        }

        @Override
        public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
            Log.i(TAG, "正在滚动");
        }
    });
    mAdapter = new NormalAdapterViewAdapter(mApp);
    mAdapter.setOnItemChildClickListener(this);
    mAdapter.setOnItemChildLongClickListener(this);
    getViewById(R.id.beginRefreshing).setOnClickListener(this);
    getViewById(R.id.beginLoadingMore).setOnClickListener(this);
}
Also used : NormalAdapterViewAdapter(cn.bingoogolapple.refreshlayout.demo.adapter.NormalAdapterViewAdapter) AbsListView(android.widget.AbsListView) BGARefreshLayout(cn.bingoogolapple.refreshlayout.BGARefreshLayout)

Example 99 with AbsListView

use of android.widget.AbsListView in project BGARefreshLayout-Android by bingoogolapple.

the class RefreshSwipeListViewFragment method setListener.

@Override
protected void setListener() {
    mRefreshLayout.setDelegate(this);
    mDataLv.setOnItemClickListener(this);
    mDataLv.setOnItemLongClickListener(this);
    mDataLv.setOnScrollListener(new AbsListView.OnScrollListener() {

        @Override
        public void onScrollStateChanged(AbsListView view, int scrollState) {
            if (AbsListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL == scrollState) {
                mAdapter.closeOpenedSwipeItemLayoutWithAnim();
            }
        }

        @Override
        public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
        }
    });
    mAdapter = new SwipeAdapterViewAdapter(mApp);
    mAdapter.setOnItemChildClickListener(this);
    mAdapter.setOnItemChildLongClickListener(this);
}
Also used : AbsListView(android.widget.AbsListView) SwipeAdapterViewAdapter(cn.bingoogolapple.refreshlayout.demo.adapter.SwipeAdapterViewAdapter)

Example 100 with AbsListView

use of android.widget.AbsListView in project BGARefreshLayout-Android by bingoogolapple.

the class RefreshListViewFragment method setListener.

@Override
protected void setListener() {
    mRefreshLayout.setDelegate(this);
    // 设置正在加载更多时不显示加载更多控件
    // mRefreshLayout.setIsShowLoadingMoreView(false);
    mDataLv.setOnItemClickListener(this);
    mDataLv.setOnItemLongClickListener(this);
    mDataLv.setOnScrollListener(new AbsListView.OnScrollListener() {

        @Override
        public void onScrollStateChanged(AbsListView view, int scrollState) {
        // Log.i(TAG, "滚动状态变化");
        }

        @Override
        public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
        // Log.i(TAG, "正在滚动");
        }
    });
    mAdapter = new NormalAdapterViewAdapter(mApp);
    mAdapter.setOnItemChildClickListener(this);
    mAdapter.setOnItemChildLongClickListener(this);
}
Also used : NormalAdapterViewAdapter(cn.bingoogolapple.refreshlayout.demo.adapter.NormalAdapterViewAdapter) AbsListView(android.widget.AbsListView)

Aggregations

AbsListView (android.widget.AbsListView)223 View (android.view.View)126 ListView (android.widget.ListView)80 AdapterView (android.widget.AdapterView)54 TextView (android.widget.TextView)46 ViewGroup (android.view.ViewGroup)33 ImageView (android.widget.ImageView)29 ScrollView (android.widget.ScrollView)23 RecyclerView (android.support.v7.widget.RecyclerView)21 GridView (android.widget.GridView)21 SuppressLint (android.annotation.SuppressLint)20 OnScrollListener (android.widget.AbsListView.OnScrollListener)19 Intent (android.content.Intent)17 ArrayList (java.util.ArrayList)16 Context (android.content.Context)12 Point (android.graphics.Point)12 Handler (android.os.Handler)12 WebView (android.webkit.WebView)12 ExpandableListView (android.widget.ExpandableListView)12 ArrayListLoader (com.klinker.android.twitter.adapters.ArrayListLoader)10