use of se.emilsjolander.stickylistheaders.StickyListHeadersListView in project ListViewAnimations by nhaarman.
the class StickyListHeadersActivity method onCreate.
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_stickylistheaders);
StickyListHeadersListView listView = (StickyListHeadersListView) findViewById(R.id.activity_stickylistheaders_listview);
listView.setFitsSystemWindows(true);
MyListAdapter adapter = new MyListAdapter(this);
AlphaInAnimationAdapter animationAdapter = new AlphaInAnimationAdapter(adapter);
StickyListHeadersAdapterDecorator stickyListHeadersAdapterDecorator = new StickyListHeadersAdapterDecorator(animationAdapter);
stickyListHeadersAdapterDecorator.setListViewWrapper(new StickyListHeadersListViewWrapper(listView));
assert animationAdapter.getViewAnimator() != null;
animationAdapter.getViewAnimator().setInitialDelayMillis(500);
assert stickyListHeadersAdapterDecorator.getViewAnimator() != null;
stickyListHeadersAdapterDecorator.getViewAnimator().setInitialDelayMillis(500);
listView.setAdapter(stickyListHeadersAdapterDecorator);
}
use of se.emilsjolander.stickylistheaders.StickyListHeadersListView in project XposedInstaller by rovo89.
the class DownloadFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.tab_downloader, container, false);
mRefreshHint = v.findViewById(R.id.refresh_hint);
final SwipeRefreshLayout refreshLayout = (SwipeRefreshLayout) v.findViewById(R.id.swiperefreshlayout);
refreshLayout.setColorSchemeColors(getResources().getColor(R.color.colorPrimary));
mRepoLoader.addListener(this);
mRepoLoader.setSwipeRefreshLayout(refreshLayout);
mModuleUtil.addListener(this);
mListView = (StickyListHeadersListView) v.findViewById(R.id.listModules);
mListView.setAdapter(mAdapter);
mListView.setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
if (view.getChildAt(0) != null) {
refreshLayout.setEnabled(view.getFirstVisiblePosition() == 0 && view.getChildAt(0).getTop() == 0);
}
}
});
reloadItems();
mListView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Cursor cursor = (Cursor) mAdapter.getItem(position);
String packageName = cursor.getString(OverviewColumnsIndexes.PKGNAME);
Intent detailsIntent = new Intent(getActivity(), DownloadDetailsActivity.class);
detailsIntent.setData(Uri.fromParts("package", packageName, null));
startActivity(detailsIntent);
}
});
mListView.setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
// Expand the search view when the SEARCH key is triggered
if (keyCode == KeyEvent.KEYCODE_SEARCH && event.getAction() == KeyEvent.ACTION_UP && (event.getFlags() & KeyEvent.FLAG_CANCELED) == 0) {
if (mSearchView != null)
mSearchView.setIconified(false);
return true;
}
return false;
}
});
setHasOptionsMenu(true);
return v;
}
Aggregations