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();
}
}
}
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:");
}
});
}
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);
}
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);
}
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);
}
Aggregations