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


Java SlideInItemAnimator类代码示例

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


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

示例1: onCreate

import io.plaidapp.ui.recyclerview.SlideInItemAnimator; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_search);
    ButterKnife.bind(this);
    setupSearchView();

    dataManager = new SearchDataManager(this) {
        @Override
        public void onDataLoaded(List<? extends PlaidItem> data) {
            if (data != null && data.size() > 0) {
                if (results.getVisibility() != View.VISIBLE) {
                    TransitionManager.beginDelayedTransition(container,
                            getTransition(R.transition.search_show_results));
                    progress.setVisibility(View.GONE);
                    results.setVisibility(View.VISIBLE);
                    fab.setVisibility(View.VISIBLE);
                }
                adapter.addAndResort(data);
            } else {
                TransitionManager.beginDelayedTransition(
                        container, getTransition(R.transition.auto));
                progress.setVisibility(View.GONE);
                setNoResultsVisibility(View.VISIBLE);
            }
        }
    };
    adapter = new FeedAdapter(this, dataManager, columns, PocketUtils.isPocketInstalled(this));
    setExitSharedElementCallback(FeedAdapter.createSharedElementReenterCallback(this));
    results.setAdapter(adapter);
    results.setItemAnimator(new SlideInItemAnimator());
    GridLayoutManager layoutManager = new GridLayoutManager(this, columns);
    layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
        @Override
        public int getSpanSize(int position) {
            return adapter.getItemColumnSpan(position);
        }
    });
    results.setLayoutManager(layoutManager);
    results.addOnScrollListener(new InfiniteScrollListener(layoutManager, dataManager) {
        @Override
        public void onLoadMore() {
            dataManager.loadMore();
        }
    });
    results.setHasFixedSize(true);

    setupTransitions();
    onNewIntent(getIntent());
    ShortcutHelper.reportSearchUsed(this);
}
 
开发者ID:yongjhih,项目名称:android-proguards,代码行数:52,代码来源:SearchActivity.java

示例2: onCreate

import io.plaidapp.ui.recyclerview.SlideInItemAnimator; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_search);
    ButterKnife.bind(this);
    setupSearchView();

    dataManager = new SearchDataManager(this) {
        @Override
        public void onDataLoaded(List<? extends PlaidItem> data) {
            if (data != null && data.size() > 0) {
                if (results.getVisibility() != View.VISIBLE) {
                    TransitionManager.beginDelayedTransition(container,
                            getTransition(R.transition.search_show_results));
                    progress.setVisibility(View.GONE);
                    results.setVisibility(View.VISIBLE);
                    fab.setVisibility(View.VISIBLE);
                }
                adapter.addAndResort(data);
            } else {
                TransitionManager.beginDelayedTransition(
                        container, getTransition(R.transition.auto));
                progress.setVisibility(View.GONE);
                setNoResultsVisibility(View.VISIBLE);
            }
        }
    };
    ViewPreloadSizeProvider<Shot> shotPreloadSizeProvider = new ViewPreloadSizeProvider<>();
    adapter = new FeedAdapter(this, dataManager, columns, PocketUtils.isPocketInstalled(this),
            shotPreloadSizeProvider);
    setExitSharedElementCallback(FeedAdapter.createSharedElementReenterCallback(this));
    results.setAdapter(adapter);
    results.setItemAnimator(new SlideInItemAnimator());
    GridLayoutManager layoutManager = new GridLayoutManager(this, columns);
    layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
        @Override
        public int getSpanSize(int position) {
            return adapter.getItemColumnSpan(position);
        }
    });
    results.setLayoutManager(layoutManager);
    results.addOnScrollListener(new InfiniteScrollListener(layoutManager, dataManager) {
        @Override
        public void onLoadMore() {
            dataManager.loadMore();
        }
    });
    results.setHasFixedSize(true);
    RecyclerViewPreloader<Shot> shotPreloader =
            new RecyclerViewPreloader<>(this, adapter, shotPreloadSizeProvider, 4);
    results.addOnScrollListener(shotPreloader);

    setupTransitions();
    onNewIntent(getIntent());
    ShortcutHelper.reportSearchUsed(this);
}
 
开发者ID:nickbutcher,项目名称:plaid,代码行数:57,代码来源:SearchActivity.java


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