当前位置: 首页>>代码示例>>Java>>正文


Java ObservableRecyclerView类代码示例

本文整理汇总了Java中com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView的典型用法代码示例。如果您正苦于以下问题:Java ObservableRecyclerView类的具体用法?Java ObservableRecyclerView怎么用?Java ObservableRecyclerView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ObservableRecyclerView类属于com.github.ksoichiro.android.observablescrollview包,在下文中一共展示了ObservableRecyclerView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreateView

import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_recyclerview, container, false);

    final ObservableRecyclerView recyclerView = (ObservableRecyclerView) view.findViewById(R.id.scroll);
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    recyclerView.setHasFixedSize(false);
    setDummyData(recyclerView);

    Fragment parentFragment = getParentFragment();
    ViewGroup viewGroup = (ViewGroup) parentFragment.getView();
    if (viewGroup != null) {
        recyclerView.setTouchInterceptionViewGroup((ViewGroup) viewGroup.findViewById(R.id.container));
        if (parentFragment instanceof ObservableScrollViewCallbacks) {
            recyclerView.setScrollViewCallbacks((ObservableScrollViewCallbacks) parentFragment);
        }
    }
    return view;
}
 
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:20,代码来源:ViewPagerTabFragmentRecyclerViewFragment.java

示例2: onCreateView

import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_recyclerview, container, false);

    Activity parentActivity = getActivity();
    final ObservableRecyclerView recyclerView = (ObservableRecyclerView) view.findViewById(R.id.scroll);
    recyclerView.setLayoutManager(new LinearLayoutManager(parentActivity));
    recyclerView.setHasFixedSize(false);
    setDummyData(recyclerView);
    recyclerView.setTouchInterceptionViewGroup((ViewGroup) parentActivity.findViewById(R.id.container));

    if (parentActivity instanceof ObservableScrollViewCallbacks) {
        recyclerView.setScrollViewCallbacks((ObservableScrollViewCallbacks) parentActivity);
    }
    return view;
}
 
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:17,代码来源:ViewPagerTab2RecyclerViewFragment.java

示例3: onCreate

import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_stickyheaderrecyclerview);

    setSupportActionBar((Toolbar) findViewById(R.id.toolbar));

    mHeaderView = findViewById(R.id.header);
    ViewCompat.setElevation(mHeaderView, getResources().getDimension(R.dimen.toolbar_elevation));
    mToolbarView = findViewById(R.id.toolbar);

    mRecyclerView = (ObservableRecyclerView) findViewById(R.id.recycler);
    mRecyclerView.setScrollViewCallbacks(this);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    mRecyclerView.setHasFixedSize(false);
    View headerView = LayoutInflater.from(this).inflate(R.layout.recycler_header, null);
    setDummyDataWithHeader(mRecyclerView, headerView);
}
 
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:19,代码来源:StickyHeaderRecyclerViewActivity.java

示例4: setScrollY

import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; //导入依赖的package包/类
@Override
public void setScrollY(int scrollY, int threshold) {
    View view = getView();
    if (view == null) {
        return;
    }
    ObservableRecyclerView recyclerView = (ObservableRecyclerView) view.findViewById(R.id.scroll);
    if (recyclerView == null) {
        return;
    }
    View firstVisibleChild = recyclerView.getChildAt(0);
    if (firstVisibleChild != null) {
        int offset = scrollY;
        int position = 0;
        if (threshold < scrollY) {
            int baseHeight = firstVisibleChild.getHeight();
            position = scrollY / baseHeight;
            offset = scrollY % baseHeight;
        }
        RecyclerView.LayoutManager lm = recyclerView.getLayoutManager();
        if (lm != null && lm instanceof LinearLayoutManager) {
            ((LinearLayoutManager) lm).scrollToPositionWithOffset(position, -offset);
        }
    }
}
 
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:26,代码来源:FlexibleSpaceWithImageRecyclerViewFragment.java

示例5: updateFlexibleSpace

import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; //导入依赖的package包/类
@Override
protected void updateFlexibleSpace(int scrollY, View view) {
    int flexibleSpaceImageHeight = getResources().getDimensionPixelSize(R.dimen.flexible_space_image_height);

    View recyclerViewBackground = view.findViewById(R.id.list_background);

    // Translate list background
    ViewHelper.setTranslationY(recyclerViewBackground, Math.max(0, -scrollY + flexibleSpaceImageHeight));

    // Also pass this event to parent Activity
    FlexibleSpaceWithImageWithViewPagerTabActivity parentActivity =
            (FlexibleSpaceWithImageWithViewPagerTabActivity) getActivity();
    if (parentActivity != null) {
        parentActivity.onScrollChanged(scrollY, (ObservableRecyclerView) view.findViewById(R.id.scroll));
    }
}
 
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:17,代码来源:FlexibleSpaceWithImageRecyclerViewFragment.java

示例6: onCreateView

import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_recyclerview, container, false);

    Activity parentActivity = getActivity();
    final ObservableRecyclerView recyclerView = (ObservableRecyclerView) view.findViewById(R.id.scroll);
    recyclerView.setLayoutManager(new LinearLayoutManager(parentActivity));
    recyclerView.setHasFixedSize(false);
    UiTestUtils.setDummyData(getActivity(), recyclerView);
    recyclerView.setTouchInterceptionViewGroup((ViewGroup) parentActivity.findViewById(R.id.container));

    if (parentActivity instanceof ObservableScrollViewCallbacks) {
        recyclerView.setScrollViewCallbacks((ObservableScrollViewCallbacks) parentActivity);
    }
    return view;
}
 
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:17,代码来源:ViewPagerTab2RecyclerViewFragment.java

示例7: onCreate

import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_touchinterception_recyclerview);
    ((TextView) findViewById(R.id.title)).setText(getClass().getSimpleName());
    mScrollable = (Scrollable) findViewById(R.id.scrollable);
    mScrollable.setScrollViewCallbacks(this);
    ObservableRecyclerView recyclerView = (ObservableRecyclerView) mScrollable;
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setHasFixedSize(true);
    recyclerView.setScrollViewCallbacks(this);
    UiTestUtils.setDummyData(this, recyclerView);

    mIntersectionHeight = getResources().getDimensionPixelSize(R.dimen.intersection_height);
    mHeaderBarHeight = getResources().getDimensionPixelSize(R.dimen.header_bar_height);

    mInterceptionLayout = (TouchInterceptionFrameLayout) findViewById(R.id.scroll_wrapper);
    mInterceptionLayout.setScrollInterceptionListener(mInterceptionListener);
}
 
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:20,代码来源:TouchInterceptionRecyclerViewActivity.java

示例8: updateFlexibleSpace

import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; //导入依赖的package包/类
@Override
protected void updateFlexibleSpace(int scrollY, View view) {
    int flexibleSpaceImageHeight = getResources().getDimensionPixelSize(R.dimen.flexible_space_image_height);

    View recyclerViewBackground = view.findViewById(R.id.list_background);

    // Translate list background
    ViewHelper.setTranslationY(recyclerViewBackground, Math.max(0, -scrollY + flexibleSpaceImageHeight));

    // Also pass this event to parent Activity
    MainActivity parentActivity =
            (MainActivity) getActivity();
    if (parentActivity != null) {
        parentActivity.onScrollChanged(scrollY, (ObservableRecyclerView) view.findViewById(R.id.scroll));
    }
}
 
开发者ID:DuongNTdev,项目名称:StudyMovie,代码行数:17,代码来源:FilmRecyclerViewFragment.java

示例9: onPageScrollStateChanged

import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; //导入依赖的package包/类
@Override
public void onPageScrollStateChanged(final int state) {
    findFirstActiveRecyclerView();
    if (state == SCROLL_STATE_IDLE) {
        return;
    }
    final int activeScrollY = activeHolder.getScrollY();
    for (Map.Entry<ObservableRecyclerView, RecyclerViewHolder> item : holders.entrySet()) {
        final RecyclerViewHolder holder = item.getValue();
        if (holder == activeHolder) {
            continue;
        }
        final int scrollY = holder.getScrollY();
        if (activeScrollY >= flexibleHeight - baseHeight
                && scrollY >= flexibleHeight - baseHeight) {
            continue;
        }
        holder.scrollTo(Math.min(activeScrollY, flexibleHeight - baseHeight));
    }
}
 
开发者ID:satorufujiwara,项目名称:material-scrolling,代码行数:21,代码来源:MaterialScrollingViewPager.java

示例10: findRecyclerView

import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; //导入依赖的package包/类
static ObservableRecyclerView findRecyclerView(final View view) {
    if (view instanceof ObservableRecyclerView) {
        return (ObservableRecyclerView) view;
    }
    if (!(view instanceof ViewGroup)) {
        return null;
    }
    ViewGroup group = (ViewGroup) view;
    int count = group.getChildCount();
    for (int i = 0; i < count; i++) {
        ObservableRecyclerView child = findRecyclerView(group.getChildAt(i));
        if (child != null) {
            return child;
        }
    }
    return null;
}
 
开发者ID:satorufujiwara,项目名称:material-scrolling,代码行数:18,代码来源:Utils.java

示例11: addScrollerListenerForTutorial

import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; //导入依赖的package包/类
/**
 * This is added to track the scrolling down or up to show the tutorial screen overlay
 * accordingly. its a recycler view so we need some implementation in it.
 */
private void addScrollerListenerForTutorial(final ObservableRecyclerView cardListView) {


    Bundle args = getArguments();
    if (args != null && args.containsKey(ARG_INITIAL_POSITION)) {
        ViewTreeObserver vto = cardListView.getViewTreeObserver();
        vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
            @Override
            public void onGlobalLayout() {
                if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
                    cardListView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
                } else {
                    cardListView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
                }
            }
        });
    }
    mCardListView.setScrollViewCallbacks(this);


}
 
开发者ID:yeloapp,项目名称:yelo-android,代码行数:26,代码来源:YeloBoardFragment.java

示例12: onCreate

import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_list_dapil);
    parsing();

    mRecyclerView = (ObservableRecyclerView) findViewById(R.id.re_dapil);
    mRecyclerView.setScrollViewCallbacks(this);

    mLayoutManager = new LinearLayoutManager(this);
    mRecyclerView.setLayoutManager(mLayoutManager);
    mRecyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL_LIST));
    mAdapter = new AdapterDapil(this, dataDapil);
    mRecyclerView.setAdapter(mAdapter);

    addToAdapter();
}
 
开发者ID:perludem,项目名称:DPR-KITA,代码行数:18,代码来源:ListDapilActivity.java

示例13: onCreate

import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_list_dapil);
    parsing();

    mRecyclerView = (ObservableRecyclerView) findViewById(R.id.re_dapil);
    mRecyclerView.setScrollViewCallbacks(this);

    mLayoutManager = new LinearLayoutManager(this);
    mRecyclerView.setLayoutManager(mLayoutManager);
    mRecyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL_LIST));
    mAdapter = new AdapterListKomisi(this, dataKomisi);
    mRecyclerView.setAdapter(mAdapter);

    addToAdapter();
}
 
开发者ID:perludem,项目名称:DPR-KITA,代码行数:18,代码来源:ListKomisiActivity.java

示例14: onCreateView

import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater,
                         @Nullable ViewGroup container,
                         @Nullable Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_photos, container, false);

    layoutManager = new GridLayoutManager(activity, getSpanCount());
    layoutManager.setSpanSizeLookup(new HeaderSpanSizeLookup(layoutManager));

    photos = (ObservableRecyclerView) rootView.findViewById(R.id.photos);
    photos.setHasFixedSize(true);
    photos.setLayoutManager(layoutManager);
    photos.setAdapter(adapter);
    photos.setScrollViewCallbacks(this);

    albumId = getArguments().getString("id");

    return rootView;
}
 
开发者ID:xingrz,项目名称:meizhi,代码行数:20,代码来源:AlbumFragment.java

示例15: onCreate

import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.observable_scroll_view_activity_toolbarcontrolrecyclerview);

    setSupportActionBar((Toolbar) findViewById(R.id.toolbar));

    mHeaderView = findViewById(R.id.header);
    ViewCompat.setElevation(mHeaderView, getResources().getDimension(R.dimen.toolbar_elevation));
    mToolbarView = findViewById(R.id.toolbar);

    mRecyclerView = (ObservableRecyclerView) findViewById(R.id.recycler);
    mRecyclerView.setScrollViewCallbacks(this);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    mRecyclerView.setHasFixedSize(false);

    ArrayList<String> items = new ArrayList<String>();
    for (int i = 1; i <= 100; i++) {
        items.add("Item " + i);
    }
    View headerView = LayoutInflater.from(this).inflate(R.layout.observable_scroll_view_recycler_header, null);
    mRecyclerView.setAdapter(new SimpleHeaderRecyclerAdapter(this, items, headerView));
}
 
开发者ID:cymcsg,项目名称:UltimateAndroid,代码行数:24,代码来源:ToolbarControlRecyclerViewActivity.java


注:本文中的com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。