Search in sources :

Example 1 with ObservableGridView

use of com.github.ksoichiro.android.observablescrollview.ObservableGridView in project Android-ObservableScrollView by ksoichiro.

the class ActionBarControlGridViewActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_actionbarcontrolgridview);
    ObservableGridView gridView = (ObservableGridView) findViewById(R.id.grid);
    gridView.setScrollViewCallbacks(this);
    setDummyData(gridView);
}
Also used : ObservableGridView(com.github.ksoichiro.android.observablescrollview.ObservableGridView)

Example 2 with ObservableGridView

use of com.github.ksoichiro.android.observablescrollview.ObservableGridView in project Android-ObservableScrollView by ksoichiro.

the class HeaderGridViewActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_gridview);
    ObservableGridView scrollable = (ObservableGridView) findViewById(R.id.scrollable);
    // Set padding view for GridView. This is the flexible space.
    headerView = new View(this);
    final int flexibleSpaceImageHeight = getResources().getDimensionPixelSize(R.dimen.flexible_space_image_height);
    FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, flexibleSpaceImageHeight);
    headerView.setLayoutParams(lp);
    // This is required to disable header's list selector effect
    headerView.setClickable(true);
    scrollable.addHeaderView(headerView);
    // Footer is also available.
    footerView = new View(this);
    FrameLayout.LayoutParams lpf = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, flexibleSpaceImageHeight);
    footerView.setLayoutParams(lpf);
    scrollable.addFooterView(footerView);
    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 : FrameLayout(android.widget.FrameLayout) AbsListView(android.widget.AbsListView) ObservableGridView(com.github.ksoichiro.android.observablescrollview.ObservableGridView) ObservableGridView(com.github.ksoichiro.android.observablescrollview.ObservableGridView) View(android.view.View) AbsListView(android.widget.AbsListView)

Example 3 with ObservableGridView

use of com.github.ksoichiro.android.observablescrollview.ObservableGridView in project Android-ObservableScrollView by ksoichiro.

the class ViewPagerTab2GridViewFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_gridview, container, false);
    Activity parentActivity = getActivity();
    final ObservableGridView gridView = (ObservableGridView) view.findViewById(R.id.scroll);
    UiTestUtils.setDummyData(getActivity(), gridView);
    gridView.setTouchInterceptionViewGroup((ViewGroup) parentActivity.findViewById(R.id.container));
    if (parentActivity instanceof ObservableScrollViewCallbacks) {
        gridView.setScrollViewCallbacks((ObservableScrollViewCallbacks) parentActivity);
    }
    return view;
}
Also used : Activity(android.app.Activity) ObservableGridView(com.github.ksoichiro.android.observablescrollview.ObservableGridView) ObservableScrollViewCallbacks(com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks) ObservableGridView(com.github.ksoichiro.android.observablescrollview.ObservableGridView) View(android.view.View)

Example 4 with ObservableGridView

use of com.github.ksoichiro.android.observablescrollview.ObservableGridView in project Android-ObservableScrollView by ksoichiro.

the class SlidingUpGridViewActivity method createScrollable.

@Override
protected ObservableGridView createScrollable() {
    ObservableGridView gridView = (ObservableGridView) findViewById(R.id.scroll);
    gridView.setScrollViewCallbacks(this);
    setDummyData(gridView);
    gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Toast.makeText(SlidingUpGridViewActivity.this, "Item " + (position + 1) + " clicked", Toast.LENGTH_SHORT).show();
        }
    });
    return gridView;
}
Also used : ObservableGridView(com.github.ksoichiro.android.observablescrollview.ObservableGridView) AdapterView(android.widget.AdapterView) ObservableGridView(com.github.ksoichiro.android.observablescrollview.ObservableGridView) View(android.view.View) AdapterView(android.widget.AdapterView)

Example 5 with ObservableGridView

use of com.github.ksoichiro.android.observablescrollview.ObservableGridView in project Android-ObservableScrollView by ksoichiro.

the class ViewPagerTab2GridViewFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_gridview, container, false);
    Activity parentActivity = getActivity();
    final ObservableGridView gridView = (ObservableGridView) view.findViewById(R.id.scroll);
    setDummyData(gridView);
    gridView.setTouchInterceptionViewGroup((ViewGroup) parentActivity.findViewById(R.id.container));
    if (parentActivity instanceof ObservableScrollViewCallbacks) {
        gridView.setScrollViewCallbacks((ObservableScrollViewCallbacks) parentActivity);
    }
    return view;
}
Also used : Activity(android.app.Activity) ObservableGridView(com.github.ksoichiro.android.observablescrollview.ObservableGridView) ObservableScrollViewCallbacks(com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks) ObservableGridView(com.github.ksoichiro.android.observablescrollview.ObservableGridView) View(android.view.View)

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