use of com.github.ksoichiro.android.observablescrollview.ObservableScrollView in project Android-ObservableScrollView by ksoichiro.
the class FlexibleSpaceToolbarScrollViewActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_flexiblespacetoolbarscrollview);
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
ActionBar ab = getSupportActionBar();
if (ab != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
mFlexibleSpaceView = findViewById(R.id.flexible_space);
mTitleView = (TextView) findViewById(R.id.title);
mTitleView.setText(getTitle());
setTitle(null);
mToolbarView = findViewById(R.id.toolbar);
final ObservableScrollView scrollView = (ObservableScrollView) findViewById(R.id.scroll);
scrollView.setScrollViewCallbacks(this);
mFlexibleSpaceHeight = getResources().getDimensionPixelSize(R.dimen.flexible_space_height);
int flexibleSpaceAndToolbarHeight = mFlexibleSpaceHeight + getActionBarSize();
findViewById(R.id.body).setPadding(0, flexibleSpaceAndToolbarHeight, 0, 0);
mFlexibleSpaceView.getLayoutParams().height = flexibleSpaceAndToolbarHeight;
ScrollUtils.addOnGlobalLayoutListener(mTitleView, new Runnable() {
@Override
public void run() {
updateFlexibleSpaceText(scrollView.getCurrentScrollY());
}
});
}
use of com.github.ksoichiro.android.observablescrollview.ObservableScrollView in project Android-ObservableScrollView by ksoichiro.
the class FlexibleSpaceToolbarWebViewActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_flexiblespacetoolbarwebview);
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
ActionBar ab = getSupportActionBar();
if (ab != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
mFlexibleSpaceView = findViewById(R.id.flexible_space);
mTitleView = (TextView) findViewById(R.id.title);
mTitleView.setText(getTitle());
setTitle(null);
mToolbarView = findViewById(R.id.toolbar);
mWebViewContainer = findViewById(R.id.webViewContainer);
final ObservableScrollView scrollView = (ObservableScrollView) findViewById(R.id.scroll);
scrollView.setScrollViewCallbacks(this);
WebView webView = (WebView) findViewById(R.id.webView);
webView.loadUrl("file:///android_asset/lipsum.html");
mFlexibleSpaceHeight = getResources().getDimensionPixelSize(R.dimen.flexible_space_height);
int flexibleSpaceAndToolbarHeight = mFlexibleSpaceHeight + getActionBarSize();
final FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) webView.getLayoutParams();
layoutParams.topMargin = flexibleSpaceAndToolbarHeight;
webView.setLayoutParams(layoutParams);
mFlexibleSpaceView.getLayoutParams().height = flexibleSpaceAndToolbarHeight;
ScrollUtils.addOnGlobalLayoutListener(mTitleView, new Runnable() {
@Override
public void run() {
updateFlexibleSpaceText(scrollView.getCurrentScrollY());
}
});
}
use of com.github.ksoichiro.android.observablescrollview.ObservableScrollView in project Android-ObservableScrollView by ksoichiro.
the class SlidingUpScrollViewActivity method createScrollable.
@Override
protected ObservableScrollView createScrollable() {
ObservableScrollView scrollView = (ObservableScrollView) findViewById(R.id.scroll);
scrollView.setScrollViewCallbacks(this);
return scrollView;
}
use of com.github.ksoichiro.android.observablescrollview.ObservableScrollView in project Android-ObservableScrollView by ksoichiro.
the class FlexibleSpaceWithImageScrollViewFragment method updateFlexibleSpace.
@Override
protected void updateFlexibleSpace(int scrollY, View view) {
ObservableScrollView scrollView = (ObservableScrollView) view.findViewById(R.id.scroll);
// Also pass this event to parent Activity
FlexibleSpaceWithImageWithViewPagerTabActivity parentActivity = (FlexibleSpaceWithImageWithViewPagerTabActivity) getActivity();
if (parentActivity != null) {
parentActivity.onScrollChanged(scrollY, scrollView);
}
}
use of com.github.ksoichiro.android.observablescrollview.ObservableScrollView 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;
}
Aggregations