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());
}
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);
}
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());
}
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);
}
}
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;
}
Aggregations