本文整理汇总了Java中com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView.setTouchInterceptionViewGroup方法的典型用法代码示例。如果您正苦于以下问题:Java ObservableRecyclerView.setTouchInterceptionViewGroup方法的具体用法?Java ObservableRecyclerView.setTouchInterceptionViewGroup怎么用?Java ObservableRecyclerView.setTouchInterceptionViewGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView
的用法示例。
在下文中一共展示了ObservableRecyclerView.setTouchInterceptionViewGroup方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateView
import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_recyclerview, container, false);
final ObservableRecyclerView recyclerView = (ObservableRecyclerView) view.findViewById(R.id.scroll);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
recyclerView.setHasFixedSize(false);
setDummyData(recyclerView);
Fragment parentFragment = getParentFragment();
ViewGroup viewGroup = (ViewGroup) parentFragment.getView();
if (viewGroup != null) {
recyclerView.setTouchInterceptionViewGroup((ViewGroup) viewGroup.findViewById(R.id.container));
if (parentFragment instanceof ObservableScrollViewCallbacks) {
recyclerView.setScrollViewCallbacks((ObservableScrollViewCallbacks) parentFragment);
}
}
return view;
}
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:20,代码来源:ViewPagerTabFragmentRecyclerViewFragment.java
示例2: onCreateView
import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_recyclerview, container, false);
Activity parentActivity = getActivity();
final ObservableRecyclerView recyclerView = (ObservableRecyclerView) view.findViewById(R.id.scroll);
recyclerView.setLayoutManager(new LinearLayoutManager(parentActivity));
recyclerView.setHasFixedSize(false);
setDummyData(recyclerView);
recyclerView.setTouchInterceptionViewGroup((ViewGroup) parentActivity.findViewById(R.id.container));
if (parentActivity instanceof ObservableScrollViewCallbacks) {
recyclerView.setScrollViewCallbacks((ObservableScrollViewCallbacks) parentActivity);
}
return view;
}
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:17,代码来源:ViewPagerTab2RecyclerViewFragment.java
示例3: onCreateView
import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_recyclerview, container, false);
Activity parentActivity = getActivity();
final ObservableRecyclerView recyclerView = (ObservableRecyclerView) view.findViewById(R.id.scroll);
recyclerView.setLayoutManager(new LinearLayoutManager(parentActivity));
recyclerView.setHasFixedSize(false);
UiTestUtils.setDummyData(getActivity(), recyclerView);
recyclerView.setTouchInterceptionViewGroup((ViewGroup) parentActivity.findViewById(R.id.container));
if (parentActivity instanceof ObservableScrollViewCallbacks) {
recyclerView.setScrollViewCallbacks((ObservableScrollViewCallbacks) parentActivity);
}
return view;
}
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:17,代码来源:ViewPagerTab2RecyclerViewFragment.java
示例4: onCreateView
import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_recyclerview, container, false);
Activity parentActivity = getActivity();
final ObservableRecyclerView recyclerView = (ObservableRecyclerView) view.findViewById(R.id.scroll);
recyclerView.setLayoutManager(new LinearLayoutManager(parentActivity));
recyclerView.setHasFixedSize(false);
View headerView = LayoutInflater.from(parentActivity).inflate(R.layout.padding, null);
setDummyDataWithHeader(recyclerView, headerView);
if (parentActivity instanceof ObservableScrollViewCallbacks) {
// Scroll to the specified offset after layout
Bundle args = getArguments();
if (args != null && args.containsKey(ARG_INITIAL_POSITION)) {
final int initialPosition = args.getInt(ARG_INITIAL_POSITION, 0);
ScrollUtils.addOnGlobalLayoutListener(recyclerView, new Runnable() {
@Override
public void run() {
recyclerView.scrollVerticallyToPosition(initialPosition);
}
});
}
// 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
recyclerView.setTouchInterceptionViewGroup((ViewGroup) parentActivity.findViewById(R.id.root));
recyclerView.setScrollViewCallbacks((ObservableScrollViewCallbacks) parentActivity);
}
return view;
}
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:34,代码来源:ViewPagerTabRecyclerViewFragment.java
示例5: onCreateView
import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_flexiblespacewithimagerecyclerview, container, false);
final ObservableRecyclerView recyclerView = (ObservableRecyclerView) view.findViewById(R.id.scroll);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
recyclerView.setHasFixedSize(false);
final View headerView = LayoutInflater.from(getActivity()).inflate(R.layout.recycler_header, null);
final int flexibleSpaceImageHeight = getResources().getDimensionPixelSize(R.dimen.flexible_space_image_height);
headerView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, flexibleSpaceImageHeight));
setDummyDataWithHeader(recyclerView, headerView);
// 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
recyclerView.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(recyclerView, new Runnable() {
@Override
public void run() {
int offset = scrollY % flexibleSpaceImageHeight;
RecyclerView.LayoutManager lm = recyclerView.getLayoutManager();
if (lm != null && lm instanceof LinearLayoutManager) {
((LinearLayoutManager) lm).scrollToPositionWithOffset(0, -offset);
}
}
});
updateFlexibleSpace(scrollY, view);
} else {
updateFlexibleSpace(0, view);
}
recyclerView.setScrollViewCallbacks(this);
return view;
}
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:41,代码来源:FlexibleSpaceWithImageRecyclerViewFragment.java
示例6: onCreateView
import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_film_recycler_view, container, false);
imgAdd = ImageView.class.cast(view.findViewById(R.id.imgAdd));
final ObservableRecyclerView recyclerView = (ObservableRecyclerView) view.findViewById(R.id.scroll);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
recyclerView.setHasFixedSize(false);
final View headerView = LayoutInflater.from(getActivity()).inflate(R.layout.recycler_header, null);
final int flexibleSpaceImageHeight = getResources().getDimensionPixelSize(R.dimen.flexible_space_image_height);
headerView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, flexibleSpaceImageHeight));
adapter = new FilmHeaderRecyclerAdapter(this, films, headerView, new FilmHeaderRecyclerAdapter.EditAtPositionCallback() {
@Override
public void onWillEdit(FilmModel f) {
showDialogEdit(f);
}
});
recyclerView.setAdapter(adapter);
loadFilmData();
imgAdd.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showDialogEdit();
}
});
// 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
recyclerView.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(recyclerView, new Runnable() {
@Override
public void run() {
int offset = scrollY % flexibleSpaceImageHeight;
RecyclerView.LayoutManager lm = recyclerView.getLayoutManager();
if (lm != null && lm instanceof LinearLayoutManager) {
((LinearLayoutManager) lm).scrollToPositionWithOffset(0, -offset);
}
}
});
updateFlexibleSpace(scrollY, view);
} else {
updateFlexibleSpace(0, view);
}
recyclerView.setScrollViewCallbacks(this);
return view;
}