Search in sources :

Example 1 with SpeedyQuickReturnListViewOnScrollListener

use of com.etiennelawlor.quickreturn.library.listeners.SpeedyQuickReturnListViewOnScrollListener in project QuickReturn by lawloretienne.

the class QuickReturnFooterListViewFragment method onViewCreated.

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    mValues = getResources().getStringArray(R.array.countries);
    ArrayAdapter<String> adapter = new ArrayAdapter<>(getActivity(), R.layout.list_item, R.id.item_tv, mValues);
    mListView.setAdapter(adapter);
    int footerHeight = getActivity().getResources().getDimensionPixelSize(R.dimen.footer_height);
    QuickReturnListViewOnScrollListener scrollListener;
    SpeedyQuickReturnListViewOnScrollListener scrollListener2;
    switch(mQuickReturnAnimationType) {
        case TRANSLATION_SIMPLE:
            scrollListener = new QuickReturnListViewOnScrollListener.Builder(QuickReturnViewType.FOOTER).footer(mQuickReturnTextView).minFooterTranslation(footerHeight).build();
            mListView.setOnScrollListener(scrollListener);
            break;
        case TRANSLATION_SNAP:
            scrollListener = new QuickReturnListViewOnScrollListener.Builder(QuickReturnViewType.FOOTER).footer(mQuickReturnTextView).minFooterTranslation(footerHeight).isSnappable(true).build();
            mListView.setOnScrollListener(scrollListener);
            break;
        case TRANSLATION_ANTICIPATE_OVERSHOOT:
            scrollListener2 = new SpeedyQuickReturnListViewOnScrollListener.Builder(getActivity(), QuickReturnViewType.FOOTER).footer(mQuickReturnTextView).build();
            mListView.setOnScrollListener(scrollListener2);
            break;
        default:
            scrollListener = new QuickReturnListViewOnScrollListener.Builder(QuickReturnViewType.FOOTER).footer(mQuickReturnTextView).minFooterTranslation(footerHeight).build();
            mListView.setOnScrollListener(scrollListener);
            break;
    }
}
Also used : SpeedyQuickReturnListViewOnScrollListener(com.etiennelawlor.quickreturn.library.listeners.SpeedyQuickReturnListViewOnScrollListener) QuickReturnListViewOnScrollListener(com.etiennelawlor.quickreturn.library.listeners.QuickReturnListViewOnScrollListener) SpeedyQuickReturnListViewOnScrollListener(com.etiennelawlor.quickreturn.library.listeners.SpeedyQuickReturnListViewOnScrollListener) ArrayAdapter(android.widget.ArrayAdapter)

Example 2 with SpeedyQuickReturnListViewOnScrollListener

use of com.etiennelawlor.quickreturn.library.listeners.SpeedyQuickReturnListViewOnScrollListener in project QuickReturn by lawloretienne.

the class QuickReturnHeaderListViewFragment method onViewCreated.

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    mValues = getResources().getStringArray(R.array.countries);
    ArrayAdapter<String> adapter = new ArrayAdapter<>(getActivity(), R.layout.list_item, R.id.item_tv, mValues);
    mListView.setAdapter(adapter);
    int headerHeight = getActivity().getResources().getDimensionPixelSize(R.dimen.header_height2);
    SpeedyQuickReturnListViewOnScrollListener scrollListener2;
    switch(mQuickReturnAnimationType) {
        case TRANSLATION_SIMPLE:
            mScrollListener = new QuickReturnListViewOnScrollListener.Builder(QuickReturnViewType.HEADER).header(mQuickReturnTextView).minHeaderTranslation(-headerHeight).build();
            mListView.setOnScrollListener(mScrollListener);
            break;
        case TRANSLATION_SNAP:
            mScrollListener = new QuickReturnListViewOnScrollListener.Builder(QuickReturnViewType.HEADER).header(mQuickReturnTextView).minHeaderTranslation(-headerHeight).isSnappable(true).build();
            mListView.setOnScrollListener(mScrollListener);
            break;
        case TRANSLATION_ANTICIPATE_OVERSHOOT:
            scrollListener2 = new SpeedyQuickReturnListViewOnScrollListener.Builder(getActivity(), QuickReturnViewType.HEADER).header(mQuickReturnTextView).build();
            mListView.setOnScrollListener(scrollListener2);
            break;
        default:
            mScrollListener = new QuickReturnListViewOnScrollListener.Builder(QuickReturnViewType.HEADER).header(mQuickReturnTextView).minHeaderTranslation(-headerHeight).build();
            mListView.setOnScrollListener(mScrollListener);
            break;
    }
}
Also used : SpeedyQuickReturnListViewOnScrollListener(com.etiennelawlor.quickreturn.library.listeners.SpeedyQuickReturnListViewOnScrollListener) QuickReturnListViewOnScrollListener(com.etiennelawlor.quickreturn.library.listeners.QuickReturnListViewOnScrollListener) SpeedyQuickReturnListViewOnScrollListener(com.etiennelawlor.quickreturn.library.listeners.SpeedyQuickReturnListViewOnScrollListener) ArrayAdapter(android.widget.ArrayAdapter)

Aggregations

ArrayAdapter (android.widget.ArrayAdapter)2 QuickReturnListViewOnScrollListener (com.etiennelawlor.quickreturn.library.listeners.QuickReturnListViewOnScrollListener)2 SpeedyQuickReturnListViewOnScrollListener (com.etiennelawlor.quickreturn.library.listeners.SpeedyQuickReturnListViewOnScrollListener)2