Search in sources :

Example 11 with ObservableGridView

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);
}
Also used : AbsListView(android.widget.AbsListView) ObservableGridView(com.github.ksoichiro.android.observablescrollview.ObservableGridView) AbsListView(android.widget.AbsListView) TextView(android.widget.TextView) ObservableGridView(com.github.ksoichiro.android.observablescrollview.ObservableGridView) View(android.view.View)

Example 12 with ObservableGridView

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));
    }
}
Also used : ObservableGridView(com.github.ksoichiro.android.observablescrollview.ObservableGridView) View(android.view.View) SuppressLint(android.annotation.SuppressLint)

Example 13 with ObservableGridView

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()));
}
Also used : ObservableGridView(com.github.ksoichiro.android.observablescrollview.ObservableGridView)

Example 14 with ObservableGridView

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);
}
Also used : AbsListView(android.widget.AbsListView) ObservableGridView(com.github.ksoichiro.android.observablescrollview.ObservableGridView) View(android.view.View) AbsListView(android.widget.AbsListView)

Example 15 with ObservableGridView

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) {
        }
    });
}
Also used : AbsListView(android.widget.AbsListView) ObservableGridView(com.github.ksoichiro.android.observablescrollview.ObservableGridView)

Aggregations

ObservableGridView (com.github.ksoichiro.android.observablescrollview.ObservableGridView)16 View (android.view.View)11 AbsListView (android.widget.AbsListView)4 ObservableScrollViewCallbacks (com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks)4 SuppressLint (android.annotation.SuppressLint)3 Activity (android.app.Activity)3 Bundle (android.os.Bundle)2 FrameLayout (android.widget.FrameLayout)2 Fragment (android.support.v4.app.Fragment)1 ViewGroup (android.view.ViewGroup)1 AdapterView (android.widget.AdapterView)1 TextView (android.widget.TextView)1 ArrayList (java.util.ArrayList)1