@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mListView = (ListView) mView.findViewById(R.id.lv); mListView.setOnScrollListener( new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView view, int scrollState) { if (scrollState == AbsListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) { PullRightLayout.collapseAll(); } } @Override public void onScroll( AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {} }); mStartScanView = (TextView) mView.findViewById(R.id.tv_start_scan); mStartScanView.setBackgroundColor(ThemeManager.with(getActivity()).getCurrentColor()); mStartScanView.setOnClickListener(this); mPullLayout = (PullLayout) mView.findViewById(R.id.pull_layout); mPullLayout.addOnPullListener(this); if (mListener != null) { mPullLayout.addOnPullListener(mListener); mListener = null; } mIvScan = (ImageView) mView.findViewById(R.id.iv_scan); IntentFilter filter = new IntentFilter(ScanService.ACTION_SCAN_FINISH); LocalBroadcastManager.getInstance(getActivity()).registerReceiver(receiver, filter); }
public void addOnPullListener(PullLayout.IPullListener listener) { if (mPullLayout == null) { this.mListener = listener; return; } mPullLayout.addOnPullListener(listener); }