@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); }
@Override public void onThemeChange(int color) { mStartScanView.setBackgroundColor(color); if (mSongAdapter != null) { mSongAdapter.notifyDataSetChanged(); } }
private View getFooterView() { if (mFooterView == null) { FrameLayout fl = new FrameLayout(getActivity()); TextView tv = new TextView(getActivity()); tv.setGravity(Gravity.CENTER); tv.setTextColor(0xFFaaaaaa); tv.setBackgroundColor(0xFFffffff); FrameLayout.LayoutParams params = new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, (int) CommonUtils.dpToPx(getActivity(), 50)); fl.addView(tv, params); mFooterView = fl; } TextView tv = (TextView) mFooterView.getChildAt(0); tv.setText("共有" + SongManager.with(getActivity()).getSongSize() + "首歌"); return mFooterView; }