use of com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks in project Android-ObservableScrollView by ksoichiro.
the class ViewPagerTabScrollViewFragment method onCreateView.
@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;
}
use of com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks in project Android-ObservableScrollView by ksoichiro.
the class ViewPagerTab2WebViewFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_webview, container, false);
final ObservableWebView webView = (ObservableWebView) view.findViewById(R.id.scroll);
webView.loadUrl("file:///android_asset/lipsum.html");
Activity parentActivity = getActivity();
webView.setTouchInterceptionViewGroup((ViewGroup) parentActivity.findViewById(R.id.container));
if (parentActivity instanceof ObservableScrollViewCallbacks) {
webView.setScrollViewCallbacks((ObservableScrollViewCallbacks) parentActivity);
}
return view;
}
use of com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks in project Android-ObservableScrollView by ksoichiro.
the class ViewPagerTabFragmentScrollViewFragment method onCreateView.
@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;
}
use of com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks in project Android-ObservableScrollView by ksoichiro.
the class ViewPagerTab2ScrollViewFragment method onCreateView.
@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;
}
use of com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks in project Android-ObservableScrollView by ksoichiro.
the class ViewPagerTab2WebViewFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_webview, container, false);
final ObservableWebView webView = (ObservableWebView) view.findViewById(R.id.scroll);
webView.loadUrl("file:///android_asset/lipsum.html");
Activity parentActivity = getActivity();
webView.setTouchInterceptionViewGroup((ViewGroup) parentActivity.findViewById(R.id.container));
if (parentActivity instanceof ObservableScrollViewCallbacks) {
webView.setScrollViewCallbacks((ObservableScrollViewCallbacks) parentActivity);
}
return view;
}
Aggregations