Java Code Examples for com.github.ksoichiro.android.observablescrollview.ObservableScrollView#setTouchInterceptionViewGroup()
The following examples show how to use
com.github.ksoichiro.android.observablescrollview.ObservableScrollView#setTouchInterceptionViewGroup() .
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: HollyViewPagerAnimator.java From HollyViewPager with Apache License 2.0 | 6 votes |
public void registerScrollView(final ObservableScrollView scrollView) { scrolls.add(scrollView); if (scrollView.getParent() != null && scrollView.getParent().getParent() != null && scrollView.getParent().getParent() instanceof ViewGroup) scrollView.setTouchInterceptionViewGroup((ViewGroup) scrollView.getParent().getParent()); scrollView.setScrollViewCallbacks(new ObservableScrollViewCallbacks() { @Override public void onScrollChanged(int i, boolean b, boolean b1) { onScroll(scrollView, i); } @Override public void onDownMotionEvent() { } @Override public void onUpOrCancelMotionEvent(ScrollState scrollState) { } }); }
Example 2
Source File: ViewPagerTabFragmentScrollViewFragment.java From Android-ObservableScrollView with Apache License 2.0 | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_scrollview_noheader, container, false); final ObservableScrollView scrollView = (ObservableScrollView) view.findViewById(R.id.scroll); Fragment parentFragment = getParentFragment(); ViewGroup viewGroup = (ViewGroup) parentFragment.getView(); if (viewGroup != null) { scrollView.setTouchInterceptionViewGroup((ViewGroup) viewGroup.findViewById(R.id.container)); if (parentFragment instanceof ObservableScrollViewCallbacks) { scrollView.setScrollViewCallbacks((ObservableScrollViewCallbacks) parentFragment); } } return view; }
Example 3
Source File: ViewPagerTab2ScrollViewFragment.java From Android-ObservableScrollView with Apache License 2.0 | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_scrollview_noheader, container, false); final ObservableScrollView scrollView = (ObservableScrollView) view.findViewById(R.id.scroll); Activity parentActivity = getActivity(); scrollView.setTouchInterceptionViewGroup((ViewGroup) parentActivity.findViewById(R.id.container)); if (parentActivity instanceof ObservableScrollViewCallbacks) { scrollView.setScrollViewCallbacks((ObservableScrollViewCallbacks) parentActivity); } return view; }
Example 4
Source File: ViewPagerTabScrollViewFragment.java From Android-ObservableScrollView with Apache License 2.0 | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_scrollview, container, false); final ObservableScrollView scrollView = (ObservableScrollView) view.findViewById(R.id.scroll); Activity parentActivity = getActivity(); if (parentActivity instanceof ObservableScrollViewCallbacks) { // Scroll to the specified offset after layout Bundle args = getArguments(); if (args != null && args.containsKey(ARG_SCROLL_Y)) { final int scrollY = args.getInt(ARG_SCROLL_Y, 0); ScrollUtils.addOnGlobalLayoutListener(scrollView, new Runnable() { @Override public void run() { scrollView.scrollTo(0, scrollY); } }); } // TouchInterceptionViewGroup should be a parent view other than ViewPager. // This is a workaround for the issue #117: // https://github.com/ksoichiro/Android-ObservableScrollView/issues/117 scrollView.setTouchInterceptionViewGroup((ViewGroup) parentActivity.findViewById(R.id.root)); scrollView.setScrollViewCallbacks((ObservableScrollViewCallbacks) parentActivity); } return view; }
Example 5
Source File: FlexibleSpaceWithImageScrollViewFragment.java From Android-ObservableScrollView with Apache License 2.0 | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_flexiblespacewithimagescrollview, container, false); final ObservableScrollView scrollView = (ObservableScrollView) view.findViewById(R.id.scroll); // TouchInterceptionViewGroup should be a parent view other than ViewPager. // This is a workaround for the issue #117: // https://github.com/ksoichiro/Android-ObservableScrollView/issues/117 scrollView.setTouchInterceptionViewGroup((ViewGroup) view.findViewById(R.id.fragment_root)); // Scroll to the specified offset after layout Bundle args = getArguments(); if (args != null && args.containsKey(ARG_SCROLL_Y)) { final int scrollY = args.getInt(ARG_SCROLL_Y, 0); ScrollUtils.addOnGlobalLayoutListener(scrollView, new Runnable() { @Override public void run() { scrollView.scrollTo(0, scrollY); } }); updateFlexibleSpace(scrollY, view); } else { updateFlexibleSpace(0, view); } scrollView.setScrollViewCallbacks(this); return view; }
Example 6
Source File: ViewPagerTab2ScrollViewFragment.java From Android-ObservableScrollView with Apache License 2.0 | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_scrollview_noheader, container, false); final ObservableScrollView scrollView = (ObservableScrollView) view.findViewById(R.id.scroll); Activity parentActivity = getActivity(); scrollView.setTouchInterceptionViewGroup((ViewGroup) parentActivity.findViewById(R.id.container)); if (parentActivity instanceof ObservableScrollViewCallbacks) { scrollView.setScrollViewCallbacks((ObservableScrollViewCallbacks) parentActivity); } return view; }
Example 7
Source File: ViewPagerTabScrollViewWithFabFragment.java From Android-ObservableScrollView with Apache License 2.0 | 4 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.fragment_scrollviewwithfab, container, false); mFab = view.findViewById(R.id.fab); mFabMargin = getResources().getDimensionPixelSize(R.dimen.margin_standard); mFabIsShown = true; // Translate FAB ScrollUtils.addOnGlobalLayoutListener(mFab, new Runnable() { @Override public void run() { float fabTranslationY = view.getHeight() - mFabMargin - mFab.getHeight(); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { // On pre-honeycomb, ViewHelper.setTranslationX/Y does not set margin, // which causes FAB's OnClickListener not working. FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mFab.getLayoutParams(); lp.leftMargin = view.getWidth() - mFabMargin - mFab.getWidth(); lp.topMargin = (int) fabTranslationY; mFab.requestLayout(); } else { ViewHelper.setTranslationX(mFab, view.getWidth() - mFabMargin - mFab.getWidth()); ViewHelper.setTranslationY(mFab, fabTranslationY); } } }); final ObservableScrollView scrollView = (ObservableScrollView) view.findViewById(R.id.scroll); Activity parentActivity = getActivity(); if (parentActivity instanceof ObservableScrollViewCallbacks) { // Scroll to the specified offset after layout Bundle args = getArguments(); if (args != null && args.containsKey(ARG_SCROLL_Y)) { final int scrollY = args.getInt(ARG_SCROLL_Y, 0); ScrollUtils.addOnGlobalLayoutListener(scrollView, new Runnable() { @Override public void run() { scrollView.scrollTo(0, scrollY); } }); } // TouchInterceptionViewGroup should be a parent view other than ViewPager. // This is a workaround for the issue #117: // https://github.com/ksoichiro/Android-ObservableScrollView/issues/117 scrollView.setTouchInterceptionViewGroup((ViewGroup) parentActivity.findViewById(R.id.root)); } scrollView.setScrollViewCallbacks(this); return view; }