Search in sources :

Example 36 with RecyclerView

use of android.support.v7.widget.RecyclerView in project Android-MaterialRefreshLayout by android-cjj.

the class WaveActivity method setupRecyclerView.

private void setupRecyclerView(RecyclerView recyclerView) {
    recyclerView.setLayoutManager(new LinearLayoutManager(recyclerView.getContext()));
    recyclerView.setAdapter(new SimpleStringRecyclerViewAdapter(WaveActivity.this));
    recyclerView.setItemAnimator(new DefaultItemAnimator());
}
Also used : LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Example 37 with RecyclerView

use of android.support.v7.widget.RecyclerView in project Android-MaterialRefreshLayout by android-cjj.

the class WaveActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_simple);
    initsToolbar();
    materialRefreshLayout = (MaterialRefreshLayout) findViewById(R.id.refresh);
    materialRefreshLayout.setWaveShow(true);
    materialRefreshLayout.setWaveColor(Color.parseColor("#60ff2020"));
    materialRefreshLayout.setMaterialRefreshListener(new MaterialRefreshListener() {

        @Override
        public void onRefresh(final MaterialRefreshLayout materialRefreshLayout) {
            materialRefreshLayout.postDelayed(new Runnable() {

                @Override
                public void run() {
                    materialRefreshLayout.finishRefresh();
                }
            }, 3000);
            materialRefreshLayout.finishRefreshLoadMore();
        }

        @Override
        public void onfinish() {
            Toast.makeText(WaveActivity.this, "finish", Toast.LENGTH_LONG).show();
        }
    });
    RecyclerView rv = (RecyclerView) findViewById(R.id.recyclerview);
    setupRecyclerView(rv);
}
Also used : MaterialRefreshListener(com.cjj.MaterialRefreshListener) MaterialRefreshLayout(com.cjj.MaterialRefreshLayout) RecyclerView(android.support.v7.widget.RecyclerView)

Example 38 with RecyclerView

use of android.support.v7.widget.RecyclerView in project Android-MaterialRefreshLayout by android-cjj.

the class LoadMoreActivity method setupRecyclerView.

private void setupRecyclerView(RecyclerView recyclerView) {
    recyclerView.setLayoutManager(new LinearLayoutManager(recyclerView.getContext()));
    recyclerView.setAdapter(new SimpleStringRecyclerViewAdapter(LoadMoreActivity.this));
    recyclerView.setItemAnimator(new DefaultItemAnimator());
}
Also used : LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Example 39 with RecyclerView

use of android.support.v7.widget.RecyclerView in project platform_frameworks_base by android.

the class RecentsTvView method launchTaskFomRecents.

/**
     * Launch the given task from recents with animation. If the task is not focused, this will
     * attempt to scroll to focus the task before launching.
     * @param task
     */
private void launchTaskFomRecents(final Task task, boolean animate) {
    if (!animate) {
        SystemServicesProxy ssp = Recents.getSystemServices();
        ssp.startActivityFromRecents(getContext(), task.key, task.title, null);
        return;
    }
    mTaskStackHorizontalView.requestFocus();
    Task focusedTask = mTaskStackHorizontalView.getFocusedTask();
    if (focusedTask != null && task != focusedTask) {
        if (mScrollListener != null) {
            mTaskStackHorizontalView.removeOnScrollListener(mScrollListener);
        }
        mScrollListener = new OnScrollListener() {

            @Override
            public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
                super.onScrollStateChanged(recyclerView, newState);
                if (newState == RecyclerView.SCROLL_STATE_IDLE) {
                    TaskCardView cardView = mTaskStackHorizontalView.getChildViewForTask(task);
                    if (cardView != null) {
                        mTransitionHelper.launchTaskFromRecents(mStack, task, mTaskStackHorizontalView, cardView, null, INVALID_STACK_ID);
                    } else {
                        // This should not happen normally. If this happens then the data in
                        // the grid view was altered during the scroll. Log error and launch
                        // task with no animation.
                        Log.e(TAG, "Card view for task : " + task + ", returned null.");
                        SystemServicesProxy ssp = Recents.getSystemServices();
                        ssp.startActivityFromRecents(getContext(), task.key, task.title, null);
                    }
                    mTaskStackHorizontalView.removeOnScrollListener(mScrollListener);
                }
            }
        };
        mTaskStackHorizontalView.addOnScrollListener(mScrollListener);
        mTaskStackHorizontalView.setSelectedPositionSmooth(((TaskStackHorizontalViewAdapter) mTaskStackHorizontalView.getAdapter()).getPositionOfTask(task));
    } else {
        mTransitionHelper.launchTaskFromRecents(mStack, task, mTaskStackHorizontalView, mTaskStackHorizontalView.getChildViewForTask(task), null, INVALID_STACK_ID);
    }
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) Task(com.android.systemui.recents.model.Task) OnScrollListener(android.support.v7.widget.RecyclerView.OnScrollListener) RecyclerView(android.support.v7.widget.RecyclerView)

Example 40 with RecyclerView

use of android.support.v7.widget.RecyclerView in project material-sheet-fab by gowong.

the class NotesListFragment method onCreateView.

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(getLayoutResId(), container, false);
    // Setup list
    RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.notes_list);
    recyclerView.setLayoutManager(new StaggeredGridLayoutManager(getNumColumns(), StaggeredGridLayoutManager.VERTICAL));
    recyclerView.setAdapter(new NotesAdapter(getActivity(), getNumItems()));
    return view;
}
Also used : NotesAdapter(com.gordonwong.materialsheetfab.sample.adapters.NotesAdapter) RecyclerView(android.support.v7.widget.RecyclerView) StaggeredGridLayoutManager(android.support.v7.widget.StaggeredGridLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) Nullable(android.support.annotation.Nullable)

Aggregations

RecyclerView (android.support.v7.widget.RecyclerView)978 View (android.view.View)671 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)574 TextView (android.widget.TextView)213 GridLayoutManager (android.support.v7.widget.GridLayoutManager)143 ImageView (android.widget.ImageView)128 ArrayList (java.util.ArrayList)100 DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)73 Toolbar (android.support.v7.widget.Toolbar)68 ViewGroup (android.view.ViewGroup)66 StaggeredGridLayoutManager (android.support.v7.widget.StaggeredGridLayoutManager)61 Intent (android.content.Intent)54 Bundle (android.os.Bundle)50 SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)49 ItemTouchHelper (android.support.v7.widget.helper.ItemTouchHelper)49 Context (android.content.Context)46 Nullable (android.support.annotation.Nullable)45 Rect (android.graphics.Rect)41 Handler (android.os.Handler)39 LayoutInflater (android.view.LayoutInflater)38