Search in sources :

Example 91 with LayoutManager

use of android.support.v7.widget.RecyclerView.LayoutManager in project CustomViews by AndroidStudy233.

the class FollowScollToolbarAct method initRecyclerView.

private void initRecyclerView() {
    layoutManager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
    recyclerView.setLayoutManager(layoutManager);
    NormalRecyclerAdapter adapter = new NormalRecyclerAdapter(this);
    recyclerView.setAdapter(adapter);
    // 控制FAB点击滑动(这里是滑动到0所以无所谓  但是要是滑动到后面的位置就要这样做)
    recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {

        @Override
        public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
            super.onScrollStateChanged(recyclerView, newState);
            if (mShouldScroll) {
                mShouldScroll = false;
                smoothMoveToPosition(recyclerView, mToPosition);
            }
        }
    });
}
Also used : NormalRecyclerAdapter(com.shiqkuangsan.mycustomviews.adapter.NormalRecyclerAdapter) RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Example 92 with LayoutManager

use of android.support.v7.widget.RecyclerView.LayoutManager in project android by nextcloud.

the class NotificationsActivity method setupContent.

/**
 * sets up the UI elements and loads all activity items.
 */
private void setupContent() {
    emptyContentIcon.setImageResource(R.drawable.ic_notification_light_grey);
    emptyContentProgressBar.getIndeterminateDrawable().setColorFilter(ThemeUtils.primaryAccentColor(), PorterDuff.Mode.SRC_IN);
    setLoadingMessage();
    adapter = new NotificationListAdapter(this);
    recyclerView.setAdapter(adapter);
    LinearLayoutManager layoutManager = new LinearLayoutManager(this);
    DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(recyclerView.getContext(), layoutManager.getOrientation());
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.addItemDecoration(dividerItemDecoration);
    BottomNavigationView bottomNavigationView = findViewById(R.id.bottom_navigation_view);
    if (getResources().getBoolean(R.bool.bottom_toolbar_enabled)) {
        bottomNavigationView.setVisibility(View.VISIBLE);
        DisplayUtils.setupBottomBar(bottomNavigationView, getResources(), this, -1);
    }
    fetchAndSetData();
}
Also used : NotificationListAdapter(com.owncloud.android.ui.adapter.NotificationListAdapter) BottomNavigationView(android.support.design.widget.BottomNavigationView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DividerItemDecoration(android.support.v7.widget.DividerItemDecoration)

Example 93 with LayoutManager

use of android.support.v7.widget.RecyclerView.LayoutManager in project collect by opendatakit.

the class AboutActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.about_layout);
    initToolbar();
    int[][] items = { { R.drawable.ic_website, R.string.odk_website, R.string.odk_website_summary }, { R.drawable.ic_forum, R.string.odk_forum, R.string.odk_forum_summary }, { R.drawable.ic_share, R.string.tell_your_friends, R.string.tell_your_friends_msg }, { R.drawable.ic_review_rate, R.string.leave_a_review, R.string.leave_a_review_msg }, { R.drawable.ic_stars, R.string.all_open_source_licenses, R.string.all_open_source_licenses_msg } };
    RecyclerView recyclerView = findViewById(R.id.recyclerView);
    RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this);
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setAdapter(new AboutListAdapter(items, this, this));
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    websiteTabHelper = new CustomTabHelper();
    forumTabHelper = new CustomTabHelper();
    websiteUri = Uri.parse(ODK_WEBSITE);
    forumUri = Uri.parse(ODK_FORUM);
}
Also used : AboutListAdapter(org.odk.collect.android.adapters.AboutListAdapter) CustomTabHelper(org.odk.collect.android.utilities.CustomTabHelper) RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Example 94 with LayoutManager

use of android.support.v7.widget.RecyclerView.LayoutManager in project collect by opendatakit.

the class AppListActivity method setupBottomSheet.

private void setupBottomSheet() {
    bottomSheetDialog = new BottomSheetDialog(this, R.style.MaterialDialogSheet);
    View sheetView = getLayoutInflater().inflate(R.layout.bottom_sheet, null);
    final RecyclerView recyclerView = sheetView.findViewById(R.id.recyclerView);
    final SortDialogAdapter adapter = new SortDialogAdapter(this, recyclerView, sortingOptions, getSelectedSortingOrder(), new RecyclerViewClickListener() {

        @Override
        public void onItemClicked(SortDialogAdapter.ViewHolder holder, int position) {
            holder.updateItemColor(selectedSortingOrder);
            performSelectedSearch(position);
            bottomSheetDialog.dismiss();
            isBottomDialogShown = false;
        }
    });
    RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getApplicationContext());
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setAdapter(adapter);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    bottomSheetDialog.setContentView(sheetView);
    if (isBottomDialogShown) {
        bottomSheetDialog.show();
    }
}
Also used : BottomSheetDialog(android.support.design.widget.BottomSheetDialog) SortDialogAdapter(org.odk.collect.android.adapters.SortDialogAdapter) RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) SearchView(android.support.v7.widget.SearchView) View(android.view.View) AdapterView(android.widget.AdapterView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) ListView(android.widget.ListView) RecyclerViewClickListener(org.odk.collect.android.listeners.RecyclerViewClickListener) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Example 95 with LayoutManager

use of android.support.v7.widget.RecyclerView.LayoutManager in project collect by opendatakit.

the class AppListFragment method setupBottomSheet.

private void setupBottomSheet() {
    bottomSheetDialog = new BottomSheetDialog(getActivity(), R.style.MaterialDialogSheet);
    View sheetView = getActivity().getLayoutInflater().inflate(R.layout.bottom_sheet, null);
    final RecyclerView recyclerView = sheetView.findViewById(R.id.recyclerView);
    final SortDialogAdapter adapter = new SortDialogAdapter(getActivity(), recyclerView, sortingOptions, getSelectedSortingOrder(), new RecyclerViewClickListener() {

        @Override
        public void onItemClicked(SortDialogAdapter.ViewHolder holder, int position) {
            holder.updateItemColor(selectedSortingOrder);
            performSelectedSearch(position);
            bottomSheetDialog.dismiss();
        }
    });
    RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity());
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setAdapter(adapter);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    bottomSheetDialog.setContentView(sheetView);
}
Also used : BottomSheetDialog(android.support.design.widget.BottomSheetDialog) SortDialogAdapter(org.odk.collect.android.adapters.SortDialogAdapter) RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) SearchView(android.support.v7.widget.SearchView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) ListView(android.widget.ListView) RecyclerViewClickListener(org.odk.collect.android.listeners.RecyclerViewClickListener) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Aggregations

LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)430 RecyclerView (android.support.v7.widget.RecyclerView)371 View (android.view.View)261 GridLayoutManager (android.support.v7.widget.GridLayoutManager)128 TextView (android.widget.TextView)113 DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)79 StaggeredGridLayoutManager (android.support.v7.widget.StaggeredGridLayoutManager)73 ImageView (android.widget.ImageView)71 SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)47 Intent (android.content.Intent)46 ArrayList (java.util.ArrayList)43 Bundle (android.os.Bundle)37 Nullable (android.support.annotation.Nullable)33 Context (android.content.Context)29 DividerItemDecoration (android.support.v7.widget.DividerItemDecoration)28 BindView (butterknife.BindView)28 Toolbar (android.support.v7.widget.Toolbar)25 ViewGroup (android.view.ViewGroup)25 Handler (android.os.Handler)22 FloatingActionButton (android.support.design.widget.FloatingActionButton)21