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

Java SmoothScrollLinearLayoutManager类代码示例

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

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



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

示例1: initializeRecyclerView

import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager; //导入依赖的package包/类
private void initializeRecyclerView() {
	// Initialize Adapter and RecyclerView
	// Use of stableIds, I strongly suggest to implement 'item.hashCode()'
	mAdapter = new FlexibleAdapter<>(createList(50, 5), getActivity(), true);
	// Experimenting NEW features (v5.0.0)
	mAdapter.setAnimationOnScrolling(DatabaseConfiguration.animateOnScrolling);

	RecyclerView mRecyclerView = (RecyclerView) getView().findViewById(R.id.recycler_view);
	mRecyclerView.setLayoutManager(new SmoothScrollLinearLayoutManager(getActivity()));
	mRecyclerView.setAdapter(mAdapter);
	mRecyclerView.setHasFixedSize(true); //Size of RV will not change
	// NOTE: Use default item animator 'canReuseUpdatedViewHolder()' will return true if
	// a Payload is provided. FlexibleAdapter is actually sending Payloads onItemChange.
	mRecyclerView.setItemAnimator(new DefaultItemAnimator());

	// Add FastScroll to the RecyclerView, after the Adapter has been attached the RecyclerView!!!
	FastScroller fastScroller = (FastScroller) getView().findViewById(R.id.fast_scroller);
	mAdapter.setFastScroller(fastScroller, Utils.getColorAccent(getActivity()));
	mAdapter.toggleFastScroller();

	// Sticky Headers
	mAdapter.setDisplayHeadersAtStartUp(true)
			.setStickyHeaders(true);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:25,代码来源:FragmentViewPager.java


示例2: onCreateView

import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager; //导入依赖的package包/类
@Override
public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View root = inflater.inflate(R.layout.fragment_news, container, false);

    newsArticleAdapter = new FlexibleAdapter<>(null);

    RecyclerView recyclerView = (RecyclerView) root.findViewById(R.id.news_recyclerView);
    recyclerView.setLayoutManager(new SmoothScrollLinearLayoutManager(getContext()));
    recyclerView.setAdapter(newsArticleAdapter);
    // Adds item divider between elements
    recyclerView.addItemDecoration(new DividerItemDecoration(getContext()));

    mRefreshLayout = (SwipeRefreshLayout) root.findViewById(R.id.news_refreshLayout);
    mRefreshLayout.setOnRefreshListener(() -> pattonvilleApplication.hardRefreshNewsData());
    mRefreshLayout.setColorSchemeResources(R.color.colorPrimary, R.color.colorPrimaryDark);

    return root;
}
 
开发者ID:Pattonville-App-Development-Team,项目名称:Android-App,代码行数:19,代码来源:NewsFragment.java


示例3: initializeRecyclerView

import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager; //导入依赖的package包/类
private void initializeRecyclerView() {
    // Initialize Adapter and RecyclerView
    // Use of stableIds, I strongly suggest to implement 'item.hashCode()'
    FlexibleAdapter.useTag("ViewPagerAdapter");
    mAdapter = new FlexibleAdapter<>(createList(50, 5), getActivity(), true);
    mAdapter.setAnimationOnForwardScrolling(DatabaseConfiguration.animateOnForwardScrolling);

    RecyclerView mRecyclerView = getView().findViewById(R.id.recycler_view);
    mRecyclerView.setLayoutManager(new SmoothScrollLinearLayoutManager(getActivity()));
    mRecyclerView.setAdapter(mAdapter);
    mRecyclerView.setHasFixedSize(true); //Size of RV will not change
    // NOTE: Use default item animator 'canReuseUpdatedViewHolder()' will return true if
    // a Payload is provided. FlexibleAdapter is actually sending Payloads onItemChange.
    mRecyclerView.setItemAnimator(new DefaultItemAnimator());

    // Add FastScroll to the RecyclerView, after the Adapter has been attached the RecyclerView!!!
    FastScroller fastScroller = getView().findViewById(R.id.fast_scroller);
    mAdapter.setFastScroller(fastScroller);

    // Sticky Headers
    mAdapter.setDisplayHeadersAtStartUp(true)
            .setStickyHeaders(true);
}
 
开发者ID:davideas,项目名称:FlexibleAdapter,代码行数:24,代码来源:FragmentViewPager.java


示例4: onCreate

import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_school_links_list);

    isPeachjar = getIntent().getBooleanExtra(INTENT_IS_PEACHJAR, false);

    // Set title appropriately
    if (isPeachjar) {
        setTitle(R.string.title_activity_peachjar);
    } else {
        setTitle(R.string.title_activity_nutrislice);
    }

    List<SchoolLinkItem> schools = Stream.of(DataSource.ALL)
            .filter(dataSource -> isPeachjar ? dataSource.peachjarLink.isPresent() : dataSource.nutrisliceLink.isPresent())
            .sorted(DataSource.DEFAULT_ORDERING)
            .map(dataSource -> isPeachjar ? new PeachjarItem(dataSource) : new NutrisliceItem(dataSource))
            .collect(Collectors.toList());

    schoolLinksRecyclerView = (RecyclerView) findViewById(R.id.school_links_recyclerview);
    schoolLinksRecyclerView.setLayoutManager(new SmoothScrollLinearLayoutManager(this));
    DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(this, DividerItemDecoration.VERTICAL);
    schoolLinksRecyclerView.addItemDecoration(dividerItemDecoration);

    schoolLinksAdapter = new FlexibleAdapter<>(schools);
    schoolLinksRecyclerView.setAdapter(schoolLinksAdapter);
}
 
开发者ID:Pattonville-App-Development-Team,项目名称:Android-App,代码行数:29,代码来源:SchoolListActivity.java


示例5: createNewLinearLayoutManager

import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager; //导入依赖的package包/类
protected LinearLayoutManager createNewLinearLayoutManager() {
	return new SmoothScrollLinearLayoutManager(getActivity());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:AbstractFragment.java


示例6: setAdapterOnRecyclerView

import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager; //导入依赖的package包/类
protected void setAdapterOnRecyclerView(@NonNull RecyclerView recyclerView) {
    recyclerView.setLayoutManager(new SmoothScrollLinearLayoutManager(getActivityWeakReference()));
    recyclerView.setAdapter(flexibleAdapter);
}
 
开发者ID:wulkanowy,项目名称:wulkanowy,代码行数:5,代码来源:AbstractFragment.java


示例7: onCreate

import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager; //导入依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_about_detail);

    developerName = getIntent().getStringExtra(KEY_NAME);
    developerText = getIntent().getStringExtra(KEY_TEXT);
    developerImage = getIntent().getIntExtra(KEY_IMAGE, 0);
    developerLinks = Stream.of(getIntent().getParcelableArrayExtra(KEY_LINK_ITEMS)).map(parcelable -> (LinkItem) parcelable).collect(Collectors.toList());

    name = (TextView) findViewById(R.id.developer_name);
    text = (TextView) findViewById(R.id.developer_text);
    image = (ImageView) findViewById(R.id.developer_image);
    links = (RecyclerView) findViewById(R.id.developer_links);
    linksAdapter = new FlexibleAdapter<>(developerLinks);

    name.setText(developerName);
    text.setText(developerText);

    links.setAdapter(linksAdapter);
    links.setLayoutManager(new SmoothScrollLinearLayoutManager(this, SmoothScrollLinearLayoutManager.HORIZONTAL, false));

    supportPostponeEnterTransition();
    Picasso.with(this)
            .load(developerImage)
            .fit()
            .centerCrop()
            .transform(new CircleTransformation())
            .into(image, new Callback() {
                @Override
                public void onSuccess() {
                    supportStartPostponedEnterTransition();
                }

                @Override
                public void onError() {
                    supportStartPostponedEnterTransition();
                }
            });
}
 
开发者ID:Pattonville-App-Development-Team,项目名称:Android-App,代码行数:42,代码来源:AboutDetailActivity.java


示例8: onCreate

import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.i(TAG, "onCreate: Called");
    setContentView(R.layout.activity_directory_detail);

    Intent intent = getIntent();
    //noinspection unchecked
    dataSources = (Set<DataSource>) intent.getSerializableExtra(KEY_DATASOURCES);

    pattonvilleApplication = PattonvilleApplication.get(this);
    listener = new PauseableListener<DirectoryParsingUpdateData>() {
        @Override
        public int getIdentifier() {
            return DirectoryParsingUpdateData.DIRECTORY_LISTENER_ID;
        }

        @Override
        public void onReceiveData(DirectoryParsingUpdateData data) {
            super.onReceiveData(data);
            updateDirectoryData(data);
        }

        @Override
        public void onResume(DirectoryParsingUpdateData data) {
            super.onResume(data);
            updateDirectoryData(data);
        }
    };
    pattonvilleApplication.registerPauseableListener(listener);

    boolean oneDataSourceProvided = dataSources.size() == 1;

    DataSource dataSource;
    if (oneDataSourceProvided)
        dataSource = dataSources.iterator().next();
    else if (dataSources.equals(DataSource.ALL)) {
        dataSource = null;
        setTitle("All Schools Directory");
    } else
        dataSource = DataSource.DISTRICT;

    if (dataSource != null)
        setTitle(dataSource.shortName + " Directory");

    directoryAdapter = new DirectoryAdapter<>(null, oneDataSourceProvided);
    RecyclerView facultyRecyclerView = (RecyclerView) findViewById(R.id.directory_detail_recyclerView);

    facultyRecyclerView.setAdapter(directoryAdapter);
    facultyRecyclerView.setLayoutManager(new SmoothScrollLinearLayoutManager(this, OrientationHelper.VERTICAL, false));
    DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(facultyRecyclerView.getContext(), DividerItemDecoration.VERTICAL);
    facultyRecyclerView.addItemDecoration(dividerItemDecoration);
    facultyRecyclerView.setFocusable(false);

    fastScroller = (FastScroller) findViewById(R.id.fast_scroller);
    directoryAdapter.setFastScroller(fastScroller, Utils.fetchAccentColor(this, Color.RED)); // Default red to show an error

    directoryAdapter.setDisplayHeadersAtStartUp(true);
    if (dataSources.size() > 1)
        facultyRecyclerView.post(() -> directoryAdapter.setStickyHeaders(true)); //Needed because .post() is cleared by the UPDATE handler ID.

    if (dataSource != null) {
        headerItem = new DirectoryDetailHeaderItem(dataSource);
        directoryAdapter.addScrollableHeader(headerItem);
    }
}
 
开发者ID:Pattonville-App-Development-Team,项目名称:Android-App,代码行数:67,代码来源:DirectoryDetailActivity.java


示例9: onCreateView

import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View layout = inflater.inflate(R.layout.fragment_calendar_events, container, false);

    recyclerView = (RecyclerView) layout.findViewById(R.id.event_recycler_view);

    eventAdapter = new EventAdapter(null);
    recyclerView.setAdapter(eventAdapter);
    //TopSnappedSmoothScroller.MILLISECONDS_PER_INCH = 15;
    recyclerView.setLayoutManager(new SmoothScrollLinearLayoutManager(getContext(), OrientationHelper.VERTICAL, false));
    //TopSnappedSmoothScroller.MILLISECONDS_PER_INCH = 100;
    eventAdapter.setDisplayHeadersAtStartUp(true);
    recyclerView.post(new Runnable() {
        @Override
        public void run() {
            eventAdapter.setStickyHeaders(true);
        }
    });

    fastScroller = (FastScroller) layout.findViewById(R.id.fast_scroller);
    eventAdapter.setFastScroller(fastScroller, Utils.fetchAccentColor(getContext(), Color.RED)); // Default red to show an error

    DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(recyclerView.getContext(), DividerItemDecoration.VERTICAL);
    recyclerView.addItemDecoration(dividerItemDecoration);

    //This is used to move to the current day ONCE, and never activate again during the life of the fragment. It must wait until the first update of data before running.
    eventAdapter.addListener(new FlexibleAdapter.OnUpdateListener() {
        boolean firstRun = true;

        @Override
        public void onUpdateEmptyView(int size) {
            if (firstRun && size > 0 && firstInflationAfterCreation) {
                firstRun = false;
                recyclerView.post(new Runnable() {
                    @Override
                    public void run() {
                        goToCurrentDay();
                    }
                });
            }
            Log.i(TAG, "Updated with size: " + size);
        }
    });

    noItemsTextView = (TextView) layout.findViewById(R.id.no_events_textview);

    firstInflationAfterCreation = savedInstanceState == null;

    return layout;
}
 
开发者ID:Pattonville-App-Development-Team,项目名称:Android-App,代码行数:52,代码来源:CalendarEventsFragment.java


示例10: onCreateView

import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    // Inflate the layout for this fragment
    FrameLayout layout = (FrameLayout) inflater.inflate(R.layout.fragment_calendar_pinned, container, false);

    recyclerView = (RecyclerView) layout.findViewById(R.id.event_recycler_view);

    eventAdapter = new EventAdapter(null);

    recyclerView.setAdapter(eventAdapter);
    recyclerView.setLayoutManager(new SmoothScrollLinearLayoutManager(getContext(), OrientationHelper.VERTICAL, false));

    DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(recyclerView.getContext(), DividerItemDecoration.VERTICAL);
    recyclerView.addItemDecoration(dividerItemDecoration);

    noItemsTextView = (TextView) layout.findViewById(R.id.no_pinned_items_textview);

    return layout;
}
 
开发者ID:Pattonville-App-Development-Team,项目名称:Android-App,代码行数:21,代码来源:CalendarPinnedFragment.java


示例11: onCreateView

import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, final Bundle savedInstanceState) {
    Log.d(TAG, "onCreateView called");
    // Inflate the layout for this fragment
    View rootLayout = inflater.inflate(R.layout.fragment_calendar_month, container, false);

    //rootLayout.getLayoutTransition().enableTransitionType(LayoutTransition.CHANGING);
    //rootLayout.getLayoutTransition().setDuration(LayoutTransition.CHANGING, 200);

    fixedMaterialCalendarView = (FixedMaterialCalendarView) rootLayout.findViewById(R.id.calendar_calendar);
    setUpMaterialCalendarView();

    eventRecyclerView = (RecyclerView) rootLayout.findViewById(R.id.event_recycler_view);
    eventRecyclerView.setNestedScrollingEnabled(false);
    eventAdapter = new EventAdapter(null);
    eventRecyclerView.setAdapter(eventAdapter);
    eventRecyclerView.setLayoutManager(new SmoothScrollLinearLayoutManager(getContext(), OrientationHelper.VERTICAL, false));
    eventRecyclerView.getLayoutManager().setAutoMeasureEnabled(true);

    DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(eventRecyclerView.getContext(), DividerItemDecoration.VERTICAL);
    eventRecyclerView.addItemDecoration(dividerItemDecoration);

    if (savedInstanceState != null)
        currentDateSelected = savedInstanceState.getParcelable(KEY_DATE_SELECTED);
    else
        currentDateSelected = CalendarDay.today();

    int spotlightPadding;
    switch (getResources().getConfiguration().orientation) {
        case Configuration.ORIENTATION_PORTRAIT:
            spotlightPadding = 20;
            nestedScrollView = (NestedScrollView) rootLayout;
            nestedScrollView.setSmoothScrollingEnabled(true);
            break;
        case Configuration.ORIENTATION_LANDSCAPE:
            spotlightPadding = -250;
            nestedScrollView = null;
            break;
        case Configuration.ORIENTATION_UNDEFINED:
        default:
            throw new Error("Why would this ever happen?");
    }
    SpotlightHelper.showSpotlight(getActivity(), rootLayout, spotlightPadding, "CalendarMonthFragment_SelectedDayEventList", "Events occurring on the selected day are shown here.", "Events");

    return rootLayout;
}
 
开发者ID:Pattonville-App-Development-Team,项目名称:Android-App,代码行数:47,代码来源:CalendarMonthFragment.java


示例12: createNewLinearLayoutManager

import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager; //导入依赖的package包/类
protected LinearLayoutManager createNewLinearLayoutManager() {
    return new SmoothScrollLinearLayoutManager(getActivity());
}
 
开发者ID:davideas,项目名称:FlexibleAdapter,代码行数:4,代码来源:AbstractFragment.java


示例13: onCreateView

import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    TopSnappedSmoothScroller.MILLISECONDS_PER_INCH = 15f;

    View root = inflater.inflate(R.layout.fragment_timetable, container, false);

    recyclerView = (RecyclerView) root.findViewById(R.id.fragment_timetable_recycler);
    refreshLayout = (SwipeRefreshLayout) root.findViewById(R.id.fragment_timetable_refresh_layout);

    recyclerView.setLayoutManager(new SmoothScrollLinearLayoutManager(getContext()));

    refreshLayout.setColorSchemeResources(R.color.md_blue_grey_400, R.color.md_blue_grey_500, R.color.md_blue_grey_600);

    adapter = new TimetableAdapter(null);

    adapter.setDisplayHeadersAtStartUp(true);
    adapter.setEndlessProgressItem(progressItem);

    adapter.onLoadMoreListener = () -> {
        progressItem.setStatus(ProgressItem.LOADING);
        adapter.notifyItemChanged(adapter.getGlobalPositionOf(progressItem));
        presenter.loadMore();
    };

    adapter.mItemClickListener = this::onItemClick;
    recyclerView.setAdapter(adapter);

    return root;
}
 
开发者ID:shymmq,项目名称:librus-client,代码行数:31,代码来源:TimetableFragment.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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