Search in sources :

Example 1 with StickyListHeadersListView

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);
}
Also used : AlphaInAnimationAdapter(com.nhaarman.listviewanimations.appearance.simple.AlphaInAnimationAdapter) StickyListHeadersListView(se.emilsjolander.stickylistheaders.StickyListHeadersListView) StickyListHeadersAdapterDecorator(com.nhaarman.listviewanimations.appearance.StickyListHeadersAdapterDecorator) StickyListHeadersListViewWrapper(com.nhaarman.listviewanimations.util.StickyListHeadersListViewWrapper)

Example 2 with StickyListHeadersListView

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;
}
Also used : OnItemClickListener(android.widget.AdapterView.OnItemClickListener) AbsListView(android.widget.AbsListView) Intent(android.content.Intent) Cursor(android.database.Cursor) SearchView(android.support.v7.widget.SearchView) View(android.view.View) AdapterView(android.widget.AdapterView) AbsListView(android.widget.AbsListView) StickyListHeadersListView(se.emilsjolander.stickylistheaders.StickyListHeadersListView) TextView(android.widget.TextView) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) KeyEvent(android.view.KeyEvent)

Aggregations

StickyListHeadersListView (se.emilsjolander.stickylistheaders.StickyListHeadersListView)2 Intent (android.content.Intent)1 Cursor (android.database.Cursor)1 SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)1 SearchView (android.support.v7.widget.SearchView)1 KeyEvent (android.view.KeyEvent)1 View (android.view.View)1 AbsListView (android.widget.AbsListView)1 AdapterView (android.widget.AdapterView)1 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)1 TextView (android.widget.TextView)1 StickyListHeadersAdapterDecorator (com.nhaarman.listviewanimations.appearance.StickyListHeadersAdapterDecorator)1 AlphaInAnimationAdapter (com.nhaarman.listviewanimations.appearance.simple.AlphaInAnimationAdapter)1 StickyListHeadersListViewWrapper (com.nhaarman.listviewanimations.util.StickyListHeadersListViewWrapper)1