Search in sources :

Example 51 with LayoutManager

use of android.support.v7.widget.RecyclerView.LayoutManager in project wire-android by wireapp.

the class MentioningFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    visible = true;
    final LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity(), OrientationHelper.HORIZONTAL, false);
    layoutManager.setStackFromEnd(true);
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.addItemDecoration(new SpacingItemDecorator(getResources().getDimensionPixelSize(R.dimen.mentioning__item__padding_outer)));
    mentioningAdapter = new MentioningAdapter();
    mentioningAdapter.setOnItemClickListener(this);
    recyclerView.setAdapter(mentioningAdapter);
    recyclerView.setBackground(ViewUtils.getRoundedRect(getResources().getDimensionPixelSize(R.dimen.mentioning__popover__height) / 2, getResources().getColor(R.color.mentioning__popover__background)));
    recyclerView.post(new Runnable() {

        @Override
        public void run() {
            if (getActivity() == null || getResources() == null || contentView == null) {
                return;
            }
            maxLeft = getResources().getDimensionPixelSize(R.dimen.content__separator__avatar_container__width) - getResources().getDimensionPixelSize(R.dimen.content__separator__chathead__size);
            totalWidth = contentView.getMeasuredWidth();
            maxRight = totalWidth - maxLeft;
        }
    });
    hide();
}
Also used : LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Example 52 with LayoutManager

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

the class SearchFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    // Init toolbar
    toolbar.setNavigationIcon(BuildUtils.getBackArrowDrawable(getActivity()));
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            getActivity().finish();
        }
    });
    toolbar.inflateMenu(R.menu.search_menu);
    toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {

        @Override
        public boolean onMenuItemClick(MenuItem menuItem) {
            if (menuItem.getItemId() == R.id.search) {
                loadData(false);
                return true;
            }
            return false;
        }
    });
    // search
    searchEditView.addTextChangedListener(new TextWatcher() {

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            loadData(false);
        }

        @Override
        public void afterTextChanged(Editable s) {
        }
    });
    // load more
    layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager();
    recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {

        @Override
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            int visibleItemCount = layoutManager.getChildCount();
            int totalItemCount = layoutManager.getItemCount();
            int lastVisibleItemPosition = layoutManager.findLastVisibleItemPosition();
            if (canLoadMore && !isLoadingMore && lastVisibleItemPosition == totalItemCount - 1) {
                loadOlderMails();
            }
        }
    });
}
Also used : TextWatcher(android.text.TextWatcher) Editable(android.text.Editable) MenuItem(android.view.MenuItem) RecyclerView(android.support.v7.widget.RecyclerView) BindView(butterknife.BindView) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) Toolbar(android.support.v7.widget.Toolbar)

Example 53 with LayoutManager

use of android.support.v7.widget.RecyclerView.LayoutManager in project Rutgers-Course-Tracker by tevjef.

the class SubjectFragment method initRecyclerView.

public void initRecyclerView() {
    LinearLayoutManager layoutManager = new LinearLayoutManager(getParentActivity());
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    layoutManager.setSmoothScrollbarEnabled(true);
    mRecyclerView.setLayoutManager(layoutManager);
    mRecyclerView.setHasFixedSize(true);
    if (mListDataset == null) {
        mListDataset = new ArrayList<>(10);
    }
    if (mRecyclerView.getAdapter() == null) {
        mRecyclerView.setAdapter(new SubjectFragmentAdapter(mListDataset, this));
    }
}
Also used : LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Example 54 with LayoutManager

use of android.support.v7.widget.RecyclerView.LayoutManager in project Rutgers-Course-Tracker by tevjef.

the class CourseFragment method initRecyclerView.

public void initRecyclerView() {
    LinearLayoutManager layoutManager = new LinearLayoutManager(getParentActivity());
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    layoutManager.setSmoothScrollbarEnabled(true);
    mRecyclerView.setLayoutManager(layoutManager);
    mRecyclerView.setHasFixedSize(true);
    if (mListDataset == null) {
        mListDataset = new ArrayList<>(10);
    }
    if (mRecyclerView.getAdapter() == null) {
        mRecyclerView.setAdapter(new CourseFragmentAdapter(mListDataset, this));
    }
}
Also used : LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Example 55 with LayoutManager

use of android.support.v7.widget.RecyclerView.LayoutManager in project Rutgers-Course-Tracker by tevjef.

the class CourseInfoFragment method initRecyclerView.

public void initRecyclerView() {
    LinearLayoutManager layoutManager = new LinearLayoutManager(getParentActivity());
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    mRecyclerView.setLayoutManager(layoutManager);
    mRecyclerView.setHasFixedSize(true);
    if (mRecyclerView.getAdapter() == null) {
        mRecyclerView.setAdapter(new CourseInfoFragmentAdapter(mHeaderViews, mSelectedCourse.getSections(), this));
    }
}
Also used : LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

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