Code example for GestureDetector

0
		if (transformer instanceof DefaultHeaderTransformer) {
			final DefaultHeaderTransformer t = (DefaultHeaderTransformer) transformer;
			t.setProgressBarColor(ThemeUtils.getThemeColor(activity));
			t.setProgressBarColorEnabled(ThemeUtils.shouldApplyColorFilter(activity));
		} 
		mGestureDector = new GestureDetector(getActivity(), this);
	} 
 
	@Override 
	public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
		final View view = super.onCreateView(inflater, container, savedInstanceState);
		final Activity activity = getActivity();
		if (activity instanceof PullToRefreshAttacherActivity) {
			mPullToRefreshAttacher = ((PullToRefreshAttacherActivity) activity).getPullToRefreshAttacher();
			// Set the Refreshable View to be the ListView and the refresh 
			// listener 
			// to be this. 
			mPullToRefreshAttacher.addRefreshableView(view.findViewById(android.R.id.list), this);
		} else 
			throw new IllegalStateException("Activity class must implement PullToRefreshAttacherActivity");
		return view;