Java Code Examples for android.widget.AbsListView#setOnScrollListener()
The following examples show how to use
android.widget.AbsListView#setOnScrollListener() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RefreshContentWrapper.java From CollapsingRefresh with Apache License 2.0 | 6 votes |
void attach(AbsListView listView) { //获得原始监听器,用作转发 Field[] declaredFields = AbsListView.class.getDeclaredFields(); if (declaredFields != null) { for (Field field : declaredFields) { if (AbsListView.OnScrollListener.class.equals(field.getType())) { try { field.setAccessible(true); Object listener = field.get(listView); if (listener != null && !listView.equals(listener)) { mScrollListener = (AbsListView.OnScrollListener) listener; } } catch (IllegalAccessException e) { e.printStackTrace(); } } } } listView.setOnScrollListener(this); }
Example 2
Source File: FloatingView.java From BigApp_Discuz_Android with Apache License 2.0 | 5 votes |
public void listenTo(AbsListView listView) { ZogUtils.printLog(FloatingView.class, "listenTo listView: " + listView); if (null != listView) { listView.setOnScrollListener(new DirectionScrollListener(this)); } }
Example 3
Source File: ContextualUndoAdapter.java From ALLGO with Apache License 2.0 | 5 votes |
@Override public void setAbsListView(AbsListView listView) { super.setAbsListView(listView); mContextualUndoListViewTouchListener = new ContextualUndoListViewTouchListener(listView, this); mContextualUndoListViewTouchListener.setIsParentHorizontalScrollContainer(isParentHorizontalScrollContainer()); mContextualUndoListViewTouchListener.setTouchChild(getTouchChild()); listView.setOnTouchListener(mContextualUndoListViewTouchListener); listView.setOnScrollListener(mContextualUndoListViewTouchListener.makeScrollListener()); listView.setRecyclerListener(new RecycleViewListener()); }
Example 4
Source File: SearchList.java From moviedb-android with Apache License 2.0 | 5 votes |
/** * Makes a new request to the server with the given query. */ public void search() { if (getActivity() != null) { listView = (AbsListView) getActivity().findViewById(R.id.movieslist); searchList = new ArrayList<>(); searchAdapter = new SearchAdapter(getActivity(), R.layout.row, searchList); listView.setAdapter(searchAdapter); endlessScrollListener = new EndlessScrollListener(); listView.setOnScrollListener(endlessScrollListener); final JSONAsyncTask request = new JSONAsyncTask(); new Thread(new Runnable() { public void run() { try { request.execute(MovieDB.url + "search/multi?query=" + getQuery() + "?&api_key=" + MovieDB.key).get(10000, TimeUnit.MILLISECONDS); } catch (TimeoutException | ExecutionException | InterruptedException e) { request.cancel(true); // we abort the http request, else it will cause problems and slow connection later if (conn != null) conn.disconnect(); toastLoadingMore.cancel(); if (getActivity() != null) { getActivity().runOnUiThread(new Runnable() { public void run() { Toast.makeText(getActivity(), getResources().getString(R.string.timeout), Toast.LENGTH_SHORT).show(); } }); } } } }).start(); } }
Example 5
Source File: AbsListViewHelper.java From AbsListViewHelper with MIT License | 5 votes |
public AbsListViewHelper(final AbsListView absListView, final Bundle savedState) { this.absListView = absListView; this.savedState = savedState; absListView.setClipToPadding(false); absListView.setOnScrollListener(scrollListener); if (savedState != null) { paddingTop = savedState.getInt("ABS_LIST_VIEW_HELPER_PADDING_TOP"); paddingBottom = savedState.getInt("ABS_LIST_VIEW_HELPER_PADDING_BOTTOM"); absListView.setPadding( absListView.getPaddingLeft(), paddingTop, absListView.getPaddingRight(), paddingBottom); } }
Example 6
Source File: BaseCommonAdapter.java From BaseProject with Apache License 2.0 | 5 votes |
public BaseCommonAdapter(AbsListView listView, Collection<T> data) { if(data != null){ dataList = data; } else{ dataList = new ArrayList<T>(0); } if(listView != null){ mContext = listView.getContext(); listView.setOnScrollListener(this); } }
Example 7
Source File: FloatingActionButton.java From LLApp with Apache License 2.0 | 5 votes |
public void attachToListView(@NonNull AbsListView listView, ScrollDirectionListener scrollDirectionListener, AbsListView.OnScrollListener onScrollListener) { AbsListViewScrollDetectorImpl scrollDetector = new AbsListViewScrollDetectorImpl(); scrollDetector.setScrollDirectionListener(scrollDirectionListener); scrollDetector.setOnScrollListener(onScrollListener); scrollDetector.setListView(listView); scrollDetector.setScrollThreshold(mScrollThreshold); listView.setOnScrollListener(scrollDetector); }
Example 8
Source File: FloatActionButtonScrollDetectorHelper.java From talk-android with MIT License | 5 votes |
public void attachToListView(@NonNull AbsListView listView, ScrollDirectionListener scrollDirectionListener, AbsListView.OnScrollListener onScrollListener) { AbsListViewScrollDetectorImpl scrollDetector = new AbsListViewScrollDetectorImpl(); scrollDetector.setScrollDirectionListener(scrollDirectionListener); scrollDetector.setOnScrollListener(onScrollListener); scrollDetector.setListView(listView); scrollDetector.setScrollThreshold(DensityUtil.dip2px(MainApp.CONTEXT, 4)); listView.setOnScrollListener(scrollDetector); }
Example 9
Source File: ScrollTriggeredAnimator.java From UTubeTV with The Unlicense | 5 votes |
public ScrollTriggeredAnimator(AbsListView absListView, View animationTarget) { super(); mAnimationTarget = animationTarget; int scrollBarPanelFadeDuration = 250; // ViewConfiguration.getScrollBarFadeDuration(); mInDuration = scrollBarPanelFadeDuration; mOutDuration = scrollBarPanelFadeDuration * 4; absListView.setOnScrollListener(setupListener()); }
Example 10
Source File: ContextualUndoAdapter.java From UltimateAndroid with Apache License 2.0 | 5 votes |
@Override public void setAbsListView(final AbsListView listView) { super.setAbsListView(listView); mContextualUndoListViewTouchListener = new ContextualUndoListViewTouchListener(listView, this); mContextualUndoListViewTouchListener.setIsParentHorizontalScrollContainer(isParentHorizontalScrollContainer()); mContextualUndoListViewTouchListener.setTouchChild(getTouchChild()); listView.setOnTouchListener(mContextualUndoListViewTouchListener); listView.setOnScrollListener(mContextualUndoListViewTouchListener.makeScrollListener()); listView.setOnHierarchyChangeListener(new HierarchyChangeListener()); }
Example 11
Source File: FloatingActionButton.java From FireFiles with Apache License 2.0 | 5 votes |
public void attachToListView(@NonNull AbsListView listView, ScrollDirectionListener listener) { AbsListViewScrollDetectorImpl scrollDetector = new AbsListViewScrollDetectorImpl(); scrollDetector.setListener(listener); scrollDetector.setListView(listView); scrollDetector.setScrollThreshold(mScrollThreshold); listView.setOnScrollListener(scrollDetector); }
Example 12
Source File: FloatingActionsMenu.java From FireFiles with Apache License 2.0 | 5 votes |
public void attachToListView(@NonNull AbsListView listView, ScrollDirectionListener listener) { AbsListViewScrollDetectorImpl scrollDetector = new AbsListViewScrollDetectorImpl(); scrollDetector.setListener(listener); scrollDetector.setListView(listView); scrollDetector.setScrollThreshold(mScrollThreshold); listView.setOnScrollListener(scrollDetector); }
Example 13
Source File: FloatingActionButton.java From FireFiles with Apache License 2.0 | 5 votes |
public void attachToListView(@NonNull AbsListView listView, ScrollDirectionListener listener) { AbsListViewScrollDetectorImpl scrollDetector = new AbsListViewScrollDetectorImpl(); scrollDetector.setListener(listener); scrollDetector.setListView(listView); scrollDetector.setScrollThreshold(mScrollThreshold); listView.setOnScrollListener(scrollDetector); }
Example 14
Source File: FloatingActionButton.java From BigApp_Discuz_Android with Apache License 2.0 | 4 votes |
public void listenTo(AbsListView listView) { if (null != listView) { listView.setOnScrollListener(new DirectionScrollListener(this)); } }
Example 15
Source File: FloatingActionButton.java From Fabulous with MIT License | 4 votes |
public void listenTo(AbsListView listView) { if (null != listView) { listView.setOnScrollListener(new DirectionScrollListener(this)); } }
Example 16
Source File: ListDemoActivity.java From android-Stupid-Adapter with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getIntent() != null) type = getIntent().getIntExtra(LIST_TYPE_INT, 0); switch (type) { case type_grid_view: setContentView(R.layout.activity_grid_demo); VlistViewHolder.type = R.layout.vlist_view_holder2; break; default: case type_list_view: setContentView(R.layout.activity_list_demo); VlistViewHolder.type = R.layout.vlist_view_holder; } adapter = new XAdapter2<Vlist>(this, null, VlistViewHolder.class); adapter.setClickItemListener(this);// 设置item的点击事件; adapter.setLongClickItemListener(this);// 设置item的长按事件; adapter.setOnDataChang(new IXDataListener() { TextView textView = new TextView(getBaseContext()); { textView.setGravity(Gravity.CENTER); textView.setText("没有数据"); ViewGroup v = (ViewGroup) findViewById(getLayoutId()); v.addView(textView, 0); } @Override public void onDataEmpty() { textView.setVisibility(View.VISIBLE); } @Override public void onDataChange() { if (textView.getVisibility() == View.VISIBLE) textView.setVisibility(View.GONE); } }); listView = (AbsListView) findViewById(R.id.bton_listview); listView.setAdapter(adapter); listView.setOnScrollListener(adapter.getOnScrollListener(null)); swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swrefresh); swipeRefreshLayout.setOnRefreshListener(this); onRefresh(); }
Example 17
Source File: FileListAdapter.java From GreenDamFileExploere with Apache License 2.0 | 4 votes |
public void setOnScrollListenerToListView(AbsListView view) { if (view != null) { view.setOnScrollListener(mOnScrollListener); } }
Example 18
Source File: AbsListViewQuickReturnAttacher.java From QuickReturn with MIT License | 4 votes |
public AbsListViewQuickReturnAttacher(AbsListView listView) { this.absListView = listView; listView.setOnScrollListener(onScrollListener); listView.setOnItemClickListener(this); listView.setOnItemLongClickListener(this); }
Example 19
Source File: ScrollLayout.java From ScrollLayout with Apache License 2.0 | 2 votes |
/** * Set associated list view, then this layout will only be able to drag down when the list * view is scrolled to top. * * @param listView */ public void setAssociatedListView(AbsListView listView) { listView.setOnScrollListener(associatedListViewListener); updateListViewScrollState(listView); }
Example 20
Source File: ScrollDownLayout.java From ScrollDownLayout with Apache License 2.0 | 2 votes |
/** * Set associated list view, then this layout will only be able to drag down when the list * view is scrolled to top. * * @param listView */ public void setAssociatedListView(AbsListView listView) { listView.setOnScrollListener(associatedListViewListener); updateListViewScrollState(listView); }