Search in sources :

Example 21 with ObservableListView

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

the class FlexibleSpaceWithImageListViewFragment 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, (ObservableListView) view.findViewById(R.id.scroll));
    }
}
Also used : View(android.view.View) AbsListView(android.widget.AbsListView) ObservableListView(com.github.ksoichiro.android.observablescrollview.ObservableListView) SuppressLint(android.annotation.SuppressLint)

Example 22 with ObservableListView

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

the class FillGapListViewActivity method createScrollable.

@Override
protected ObservableListView createScrollable() {
    ObservableListView listView = (ObservableListView) findViewById(R.id.scroll);
    listView.setScrollViewCallbacks(this);
    setDummyDataWithHeader(listView, mFlexibleSpaceImageHeight);
    return listView;
}
Also used : ObservableListView(com.github.ksoichiro.android.observablescrollview.ObservableListView)

Example 23 with ObservableListView

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

the class HandleTouchListViewActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_handletouchlistview);
    ObservableListView listView = (ObservableListView) findViewById(R.id.scroll);
    listView.setScrollViewCallbacks(this);
    listView.setAdapter(new CustomAdapter(this, getDummyData()));
}
Also used : ObservableListView(com.github.ksoichiro.android.observablescrollview.ObservableListView)

Example 24 with ObservableListView

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

the class ActionBarControlListViewActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_actionbarcontrollistview);
    ObservableListView listView = (ObservableListView) findViewById(R.id.list);
    listView.setScrollViewCallbacks(this);
    setDummyData(listView);
    // ObservableListView uses setOnScrollListener, but it still works.
    listView.setOnScrollListener(new AbsListView.OnScrollListener() {

        @Override
        public void onScrollStateChanged(AbsListView view, int scrollState) {
            Log.v(TAG, "onScrollStateChanged: " + scrollState);
        }

        @Override
        public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
            Log.v(TAG, "onScroll: firstVisibleItem: " + firstVisibleItem + " visibleItemCount: " + visibleItemCount + " totalItemCount: " + totalItemCount);
        }
    });
}
Also used : ObservableListView(com.github.ksoichiro.android.observablescrollview.ObservableListView) AbsListView(android.widget.AbsListView)

Example 25 with ObservableListView

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

the class FillGap2ListViewActivity method createScrollable.

@Override
protected ObservableListView createScrollable() {
    ObservableListView listView = (ObservableListView) findViewById(R.id.scroll);
    listView.setScrollViewCallbacks(this);
    setDummyDataWithHeader(listView, mFlexibleSpaceImageHeight);
    return listView;
}
Also used : ObservableListView(com.github.ksoichiro.android.observablescrollview.ObservableListView)

Aggregations

ObservableListView (com.github.ksoichiro.android.observablescrollview.ObservableListView)29 View (android.view.View)18 AbsListView (android.widget.AbsListView)11 ObservableScrollViewCallbacks (com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks)7 Activity (android.app.Activity)5 Fragment (android.support.v4.app.Fragment)5 Bundle (android.os.Bundle)4 SuppressLint (android.annotation.SuppressLint)3 TextView (android.widget.TextView)3 ArrayList (java.util.ArrayList)3 ViewTreeObserver (android.view.ViewTreeObserver)2 Context (android.content.Context)1 Nullable (android.support.annotation.Nullable)1 ViewGroup (android.view.ViewGroup)1 AdapterView (android.widget.AdapterView)1 FrameLayout (android.widget.FrameLayout)1 ImageView (android.widget.ImageView)1 ListView (android.widget.ListView)1 ScrollState (com.github.ksoichiro.android.observablescrollview.ScrollState)1 MapActivity (net.osmand.plus.activities.MapActivity)1