本文整理汇总了Java中com.github.ksoichiro.android.observablescrollview.Scrollable类的典型用法代码示例。如果您正苦于以下问题:Java Scrollable类的具体用法?Java Scrollable怎么用?Java Scrollable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Scrollable类属于com.github.ksoichiro.android.observablescrollview包,在下文中一共展示了Scrollable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: adjustToolbar
import com.github.ksoichiro.android.observablescrollview.Scrollable; //导入依赖的package包/类
private void adjustToolbar(ScrollState scrollState) {
int toolbarHeight = mToolbarView.getHeight();
final Scrollable scrollable = getCurrentScrollable();
if (scrollable == null) {
return;
}
int scrollY = scrollable.getCurrentScrollY();
if (scrollState == ScrollState.DOWN) {
showToolbar();
} else if (scrollState == ScrollState.UP) {
if (toolbarHeight <= scrollY) {
hideToolbar();
} else {
showToolbar();
}
} else if (!toolbarIsShown() && !toolbarIsHidden()) {
// Toolbar is moving but doesn't know which to move:
// you can change this to hideToolbar()
showToolbar();
}
}
示例2: onScrollChanged
import com.github.ksoichiro.android.observablescrollview.Scrollable; //导入依赖的package包/类
/**
* Called by children Fragments when their scrollY are changed.
* They all call this method even when they are inactive
* but this Activity should listen only the active child,
* so each Fragments will pass themselves for Activity to check if they are active.
*
* @param scrollY scroll position of Scrollable
* @param s caller Scrollable view
*/
public void onScrollChanged(int scrollY, Scrollable s) {
FlexibleSpaceWithImageBaseFragment fragment =
(FlexibleSpaceWithImageBaseFragment) mPagerAdapter.getItemAt(mPager.getCurrentItem());
if (fragment == null) {
return;
}
View view = fragment.getView();
if (view == null) {
return;
}
Scrollable scrollable = (Scrollable) view.findViewById(R.id.scroll);
if (scrollable == null) {
return;
}
if (scrollable == s) {
// This method is called by not only the current fragment but also other fragments
// when their scrollY is changed.
// So we need to check the caller(S) is the current fragment.
int adjustedScrollY = Math.min(scrollY, mFlexibleSpaceHeight - mTabHeight);
translateTab(adjustedScrollY, false);
propagateScroll(adjustedScrollY);
}
}
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:33,代码来源:FlexibleSpaceWithImageWithViewPagerTabActivity.java
示例3: adjustToolbar
import com.github.ksoichiro.android.observablescrollview.Scrollable; //导入依赖的package包/类
private void adjustToolbar(ScrollState scrollState) {
View toolbarView = getActivity().findViewById(R.id.toolbar);
int toolbarHeight = toolbarView.getHeight();
final Scrollable scrollable = getCurrentScrollable();
if (scrollable == null) {
return;
}
int scrollY = scrollable.getCurrentScrollY();
if (scrollState == ScrollState.DOWN) {
showToolbar();
} else if (scrollState == ScrollState.UP) {
if (toolbarHeight <= scrollY) {
hideToolbar();
} else {
showToolbar();
}
} else if (!toolbarIsShown() && !toolbarIsHidden()) {
// Toolbar is moving but doesn't know which to move:
// you can change this to hideToolbar()
showToolbar();
}
}
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:23,代码来源:ViewPagerTabFragmentParentFragment.java
示例4: propagateToolbarState
import com.github.ksoichiro.android.observablescrollview.Scrollable; //导入依赖的package包/类
private void propagateToolbarState(boolean isShown, View view, int toolbarHeight) {
Scrollable scrollView = (Scrollable) view.findViewById(R.id.scroll);
if (scrollView == null) {
return;
}
if (isShown) {
// Scroll up
if (0 < scrollView.getCurrentScrollY()) {
scrollView.scrollVerticallyTo(0);
}
} else {
// Scroll down (to hide padding)
if (scrollView.getCurrentScrollY() < toolbarHeight) {
scrollView.scrollVerticallyTo(toolbarHeight);
}
}
}
示例5: onCreate
import com.github.ksoichiro.android.observablescrollview.Scrollable; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_touchinterception_recyclerview);
((TextView) findViewById(R.id.title)).setText(getClass().getSimpleName());
mScrollable = (Scrollable) findViewById(R.id.scrollable);
mScrollable.setScrollViewCallbacks(this);
ObservableRecyclerView recyclerView = (ObservableRecyclerView) mScrollable;
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setHasFixedSize(true);
recyclerView.setScrollViewCallbacks(this);
UiTestUtils.setDummyData(this, recyclerView);
mIntersectionHeight = getResources().getDimensionPixelSize(R.dimen.intersection_height);
mHeaderBarHeight = getResources().getDimensionPixelSize(R.dimen.header_bar_height);
mInterceptionLayout = (TouchInterceptionFrameLayout) findViewById(R.id.scroll_wrapper);
mInterceptionLayout.setScrollInterceptionListener(mInterceptionListener);
}
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:20,代码来源:TouchInterceptionRecyclerViewActivity.java
示例6: adjustToolbar
import com.github.ksoichiro.android.observablescrollview.Scrollable; //导入依赖的package包/类
public void adjustToolbar(ScrollState scrollState, View view) {
int toolbarHeight = mToolbar.getHeight();
final Scrollable scrollView = (Scrollable) view.findViewById(R.id.yelo_board_list);
if (scrollView == null) {
return;
}
mView = view;
if (scrollState == ScrollState.UP) {
if (toolbarHeight < scrollView.getCurrentScrollY()) {
hideToolbar();
} else if (scrollView.getCurrentScrollY() < toolbarHeight) {
showToolbar();
}
} else if (scrollState == ScrollState.DOWN) {
if (toolbarHeight < scrollView.getCurrentScrollY()) {
showToolbar();
}
}
}
示例7: propagateToolbarState
import com.github.ksoichiro.android.observablescrollview.Scrollable; //导入依赖的package包/类
private void propagateToolbarState(boolean isShown, View view, int toolbarHeight) {
Scrollable scrollView = (Scrollable) view.findViewById(R.id.yelo_board_list);
if (scrollView == null) {
return;
}
if (isShown) {
// Scroll up
if (0 < scrollView.getCurrentScrollY()) {
scrollView.scrollVerticallyTo(0);
}
} else {
// Scroll down (to hide padding)
if (scrollView.getCurrentScrollY() < toolbarHeight) {
scrollView.scrollVerticallyTo(toolbarHeight);
}
}
}
示例8: propagateToolbarState
import com.github.ksoichiro.android.observablescrollview.Scrollable; //导入依赖的package包/类
private void propagateToolbarState(boolean isShown, View view, int toolbarHeight) {
Scrollable scrollView = (Scrollable) view.findViewById(R.id.scroll);
if (scrollView == null) {
return;
}
if (isShown) {
// Scroll up
if (0 < scrollView.getCurrentScrollY()) {
scrollView.scrollVerticallyTo(0);
}
} else {
// Scroll down (to hide padding)
if (scrollView.getCurrentScrollY() < toolbarHeight) {
scrollView.scrollVerticallyTo(toolbarHeight);
}
}
}
示例9: adjustToolbar
import com.github.ksoichiro.android.observablescrollview.Scrollable; //导入依赖的package包/类
private void adjustToolbar(ScrollState scrollState) {
int toolbarHeight = mToolbarView.getHeight();
final Scrollable scrollable = getCurrentScrollable();
if (scrollable == null) {
return;
}
int scrollY = scrollable.getCurrentScrollY();
if (scrollState == ScrollState.DOWN) {
showToolbar();
} else if (scrollState == ScrollState.UP) {
if (toolbarHeight <= scrollY) {
hideToolbar();
} else {
hideToolbar();
}
} else if (!toolbarIsShown() && !toolbarIsHidden()) {
hideToolbar();
}
}
示例10: adjustToolbar
import com.github.ksoichiro.android.observablescrollview.Scrollable; //导入依赖的package包/类
private void adjustToolbar(ScrollState scrollState) {
int toolbarHeight = mToolbarView.getHeight();
final Scrollable scrollable = getCurrentScrollable();
if (scrollable == null) {
return;
}
int scrollY = scrollable.getCurrentScrollY();
if (scrollState == ScrollState.DOWN) {
showToolbar();
fabpanel.show(true);
} else if (scrollState == ScrollState.UP) {
if (toolbarHeight <= scrollY) {
hideToolbar();
} else {
if (!passed) {
hideToolbar();
}
}
fabpanel.hide(true);
} else if (!toolbarIsShown() && !toolbarIsHidden()) {
hideToolbar();
fabpanel.hide(true);
}
}
示例11: SimpleObservableScrollHandler
import com.github.ksoichiro.android.observablescrollview.Scrollable; //导入依赖的package包/类
/**
* @param shouldStayViews 不隨layout滑動的Views
* @param scrollView 可滑動的ScrollView
* @param touchInterceptionFrameLayout
*/
public SimpleObservableScrollHandler(View[] shouldStayViews, View[] hasClickEventViews, Scrollable scrollView, TouchInterceptionFrameLayout touchInterceptionFrameLayout) {
ViewConfiguration vc = ViewConfiguration.get(touchInterceptionFrameLayout.getContext());
mHandler = new Handler();
mSlop = vc.getScaledTouchSlop();
this.shouldStayViews = shouldStayViews;
this.hasClickEventViews = hasClickEventViews;
this.scrollView = scrollView;
this.touchInterceptionFrameLayout = touchInterceptionFrameLayout;
touchInterceptionFrameLayout.setScrollInterceptionListener(interceptionListener);
scrollView.setScrollViewCallbacks(this);
scrollView.setTouchInterceptionViewGroup(touchInterceptionFrameLayout);
getHeights();
}
示例12: adjustScrollableView
import com.github.ksoichiro.android.observablescrollview.Scrollable; //导入依赖的package包/类
private void adjustScrollableView(ScrollState scrollState) {
if (!adjustEnable) {
return;
}
final Scrollable scrollable = scrollView;
if (scrollable == null) {
return;
}
int scrollY = scrollable.getCurrentScrollY();
if (scrollState == ScrollState.DOWN) {
//此處為往上滑到一半的動作
scrollToFull();
} else if (scrollState == ScrollState.UP) {
if (scrollViewCanScrollHeight <= scrollY) {
scrollToFull();
} else {
scrollToDefault();
}
//hideAdFrame();
} else if (!scrollViewOnDefault() && !scrollViewOnFull()) {
// Toolbar is moving but doesn't know which to move:
// you can change this to hideToolbar()
scrollToDefault();
}
//Config.loge("LogoBarIs Hidden:" + adFrameIsHidden());
}
示例13: shouldInterceptTouchEvent
import com.github.ksoichiro.android.observablescrollview.Scrollable; //导入依赖的package包/类
@Override
public boolean shouldInterceptTouchEvent(MotionEvent ev, boolean moving, float diffX, float diffY) {
if (!mScrolled && mSlop < Math.abs(diffX) && Math.abs(diffY) < Math.abs(diffX)) {
// Horizontal scroll is maybe handled by ViewPager
return false;
}
Scrollable scrollable = getCurrentScrollable();
if (scrollable == null) {
mScrolled = false;
return false;
}
// If interceptionLayout can move, it should intercept.
// And once it begins to move, horizontal scroll shouldn't work any longer.
int toolbarHeight = mToolbarView.getHeight();
int translationY = (int) ViewHelper.getTranslationY(mInterceptionLayout);
boolean scrollingUp = 0 < diffY;
boolean scrollingDown = diffY < 0;
if (scrollingUp) {
if (translationY < 0) {
mScrolled = true;
mLastScrollState = ScrollState.UP;
return true;
}
} else if (scrollingDown) {
if (-toolbarHeight < translationY) {
mScrolled = true;
mLastScrollState = ScrollState.DOWN;
return true;
}
}
mScrolled = false;
return false;
}
示例14: getCurrentScrollable
import com.github.ksoichiro.android.observablescrollview.Scrollable; //导入依赖的package包/类
private Scrollable getCurrentScrollable() {
Fragment fragment = getCurrentFragment();
if (fragment == null) {
return null;
}
View view = fragment.getView();
if (view == null) {
return null;
}
return (Scrollable) view.findViewById(R.id.scroll);
}
示例15: setScrollY
import com.github.ksoichiro.android.observablescrollview.Scrollable; //导入依赖的package包/类
public void setScrollY(int scrollY, int threshold) {
View view = getView();
if (view == null) {
return;
}
Scrollable scrollView = (Scrollable) view.findViewById(R.id.scroll);
if (scrollView == null) {
return;
}
scrollView.scrollVerticallyTo(scrollY);
}
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:12,代码来源:FlexibleSpaceWithImageBaseFragment.java