use of com.github.ksoichiro.android.observablescrollview.ObservableGridView in project Android-ObservableScrollView by ksoichiro.
the class FlexibleSpaceWithImageGridViewActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_flexiblespacewithimagegridview);
mFlexibleSpaceImageHeight = getResources().getDimensionPixelSize(R.dimen.flexible_space_image_height);
mFlexibleSpaceShowFabOffset = getResources().getDimensionPixelSize(R.dimen.flexible_space_show_fab_offset);
mActionBarSize = getActionBarSize();
mImageView = findViewById(R.id.image);
mOverlayView = findViewById(R.id.overlay);
ObservableGridView gridView = (ObservableGridView) findViewById(R.id.list);
gridView.setScrollViewCallbacks(this);
// Set padding view for ListView. This is the flexible space.
View paddingView = new View(this);
AbsListView.LayoutParams lp = new AbsListView.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT, mFlexibleSpaceImageHeight);
paddingView.setLayoutParams(lp);
// This is required to disable header's list selector effect
paddingView.setClickable(true);
gridView.addHeaderView(paddingView);
setDummyData(gridView);
mTitleView = (TextView) findViewById(R.id.title);
mTitleView.setText(getTitle());
setTitle(null);
mFab = findViewById(R.id.fab);
mFab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(FlexibleSpaceWithImageGridViewActivity.this, "FAB is clicked", Toast.LENGTH_SHORT).show();
}
});
mFabMargin = getResources().getDimensionPixelSize(R.dimen.margin_standard);
ViewHelper.setScaleX(mFab, 0);
ViewHelper.setScaleY(mFab, 0);
// mListBackgroundView makes ListView's background except header view.
mListBackgroundView = findViewById(R.id.list_background);
}
use of com.github.ksoichiro.android.observablescrollview.ObservableGridView in project Android-ObservableScrollView by ksoichiro.
the class FlexibleSpaceWithImageGridViewFragment method updateFlexibleSpace.
@Override
protected void updateFlexibleSpace(int scrollY, View view) {
int flexibleSpaceImageHeight = getResources().getDimensionPixelSize(R.dimen.flexible_space_image_height);
View listBackgroundView = view.findViewById(R.id.list_background);
// Translate list background
ViewHelper.setTranslationY(listBackgroundView, Math.max(0, -scrollY + flexibleSpaceImageHeight));
// Also pass this event to parent Activity
FlexibleSpaceWithImageWithViewPagerTabActivity parentActivity = (FlexibleSpaceWithImageWithViewPagerTabActivity) getActivity();
if (parentActivity != null) {
parentActivity.onScrollChanged(scrollY, (ObservableGridView) view.findViewById(R.id.scroll));
}
}
use of com.github.ksoichiro.android.observablescrollview.ObservableGridView in project Android-ObservableScrollView by ksoichiro.
the class HandleTouchGridViewActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_handletouchgridview);
ObservableGridView gridView = (ObservableGridView) findViewById(R.id.scroll);
gridView.setScrollViewCallbacks(this);
gridView.setAdapter(new CustomAdapter(this, getDummyData()));
}
use of com.github.ksoichiro.android.observablescrollview.ObservableGridView in project Android-ObservableScrollView by ksoichiro.
the class ParallaxToolbarGridViewActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_parallaxtoolbargridview);
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
mImageView = findViewById(R.id.image);
mToolbarView = findViewById(R.id.toolbar);
mToolbarView.setBackgroundColor(ScrollUtils.getColorWithAlpha(0, getResources().getColor(R.color.primary)));
mParallaxImageHeight = getResources().getDimensionPixelSize(R.dimen.parallax_image_height);
mGridView = (ObservableGridView) findViewById(R.id.list);
mGridView.setScrollViewCallbacks(this);
// Set padding view for ListView. This is the flexible space.
View paddingView = new View(this);
AbsListView.LayoutParams lp = new AbsListView.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT, mParallaxImageHeight);
paddingView.setLayoutParams(lp);
// This is required to disable header's list selector effect
paddingView.setClickable(true);
mGridView.addHeaderView(paddingView);
setDummyData(mGridView);
// mListBackgroundView makes ListView's background except header view.
mListBackgroundView = findViewById(R.id.list_background);
}
use of com.github.ksoichiro.android.observablescrollview.ObservableGridView in project Android-ObservableScrollView by ksoichiro.
the class GridViewActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_gridview);
ObservableGridView scrollable = (ObservableGridView) findViewById(R.id.scrollable);
scrollable.setScrollViewCallbacks(this);
UiTestUtils.setDummyData(this, scrollable);
scrollable.setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
}
});
}
Aggregations