• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ObservableRecyclerView类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: 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);

    ScrollUtils.addOnGlobalLayoutListener(mRecyclerView, new Runnable() {
        @Override
        public void run() {
            int count = mRecyclerView.getAdapter().getItemCount() - 1;
            int position = count == 0 ? 1 : count > 0 ? count : 0;
            mRecyclerView.scrollToPosition(position);
        }
    });
}
 
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:28,代码来源:ScrollFromBottomRecyclerViewActivity.java


示例17: createScrollable

import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; //导入依赖的package包/类
@Override
protected ObservableRecyclerView createScrollable() {
    ObservableRecyclerView recyclerView = (ObservableRecyclerView) findViewById(R.id.scroll);
    recyclerView.setScrollViewCallbacks(this);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setHasFixedSize(true);
    recyclerView.setAdapter(new CustomAdapter(this, getDummyData()));
    return recyclerView;
}
 
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:10,代码来源:SlidingUpRecyclerViewActivity.java


示例18: createScrollable

import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; //导入依赖的package包/类
@Override
protected ObservableRecyclerView createScrollable() {
    ObservableRecyclerView recyclerView = (ObservableRecyclerView) findViewById(R.id.scroll);
    recyclerView.setScrollViewCallbacks(this);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setHasFixedSize(false);
    setDummyDataWithHeader(recyclerView, mFlexibleSpaceImageHeight);
    return recyclerView;
}
 
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:10,代码来源:FillGap2RecyclerViewActivity.java


示例19: createScrollable

import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; //导入依赖的package包/类
@Override
protected ObservableRecyclerView createScrollable() {
    ObservableRecyclerView recyclerView = (ObservableRecyclerView) findViewById(R.id.scrollable);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setHasFixedSize(true);
    setDummyData(recyclerView);
    return recyclerView;
}
 
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:9,代码来源:ToolbarControlRecyclerViewActivity.java


示例20: createScrollable

import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; //导入依赖的package包/类
@Override
protected ObservableRecyclerView createScrollable() {
    ObservableRecyclerView recyclerView = (ObservableRecyclerView) findViewById(R.id.scroll);
    recyclerView.setScrollViewCallbacks(this);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setHasFixedSize(true);
    setDummyDataFew(recyclerView);
    return recyclerView;
}
 
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:10,代码来源:FillGap3RecyclerViewActivity.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MissingNode类代码示例发布时间:2022-05-21
下一篇:
Java RSABlindedEngine类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap