Simple Horizontal Divider Item Decoration for RecyclerView
mRecyclerView.addItemDecoration(new SimpleDividerItemDecoration(
getApplicationContext()
));
NOTE: Add item decoration prior to setting the adapter
| package your.package | |
| import android.net.Uri; | |
| import android.os.Looper; | |
| import android.os.SystemClock; | |
| import com.facebook.common.logging.FLog; | |
| import com.facebook.imagepipeline.image.EncodedImage; | |
| import com.facebook.imagepipeline.producers.BaseNetworkFetcher; | |
| import com.facebook.imagepipeline.producers.BaseProducerContextCallbacks; |
| <templateSet group="android"> | |
| <template name="focvb" value="@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_$END$, container, false); ButterKnife.inject(this, view); return view; } " description="Fragment onCreateView with ButterKnife" toReformat="true" toShortenFQNames="true"> | |
| <context> | |
| <option name="JAVA_CODE" value="false" /> | |
| <option name="JAVA_STATEMENT" value="false" /> | |
| <option name="JAVA_EXPRESSION" value="true" /> | |
| <option name="JAVA_DECLARATION" value="true" /> | |
| <option name="JAVA_COMMENT" value="false" /> | |
| <option name="JAVA_STRING" value="false" /> | |
| <option name="COMPLETION" value="false" /> |
| package com.segmentfault.app.view; | |
| import android.content.Context; | |
| import android.support.v4.view.MotionEventCompat; | |
| import android.support.v4.view.NestedScrollingChild; | |
| import android.support.v4.view.NestedScrollingChildHelper; | |
| import android.support.v4.view.ViewCompat; | |
| import android.support.v4.widget.SwipeRefreshLayout; | |
| import android.util.AttributeSet; | |
| import android.view.MotionEvent; |
| public class PagerActivity extends AppCompatActivity { | |
| @Override | |
| protected void onCreate(Bundle savedInstanceState) { | |
| super.onCreate(savedInstanceState); | |
| setContentView(R.layout.activity_paper); | |
| ViewPager pager = (ViewPager) findViewById(R.id.pager); | |
| pager.setAdapter(new PageAdapter(getSupportFragmentManager())); | |
| } |
| package blog; | |
| import java.util.List; | |
| import rx.Observable; | |
| public class WidgetAndArticles { | |
| static final class Widget { | |
| String articleName; | |
| String articleUrl; |
| package com.scrolltoolbar; | |
| import android.support.v7.app.ActionBarActivity; | |
| import android.os.Bundle; | |
| import android.support.v7.widget.LinearLayoutManager; | |
| import android.support.v7.widget.RecyclerView; | |
| import android.support.v7.widget.Toolbar; | |
| import android.util.Log; | |
| import android.view.Menu; | |
| import android.view.MenuItem; |
| <?xml version="1.0" encoding="utf-8"?> | |
| <!-- | |
| Copyright (C) 2015 The Android Open Source Project | |
| Licensed under the Apache License, Version 2.0 (the "License"); | |
| you may not use this file except in compliance with the License. | |
| You may obtain a copy of the License at | |
| http://www.apache.org/licenses/LICENSE-2.0 |
| import android.support.v7.widget.LinearLayoutManager; | |
| import android.support.v7.widget.RecyclerView; | |
| public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener { | |
| public static String TAG = EndlessRecyclerOnScrollListener.class.getSimpleName(); | |
| private int previousTotal = 0; // The total number of items in the dataset after the last load | |
| private boolean loading = true; // True if we are still waiting for the last set of data to load. | |
| private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more. | |
| int firstVisibleItem, visibleItemCount, totalItemCount; |
| import android.content.Context; | |
| import android.support.v7.widget.RecyclerView; | |
| import android.util.AttributeSet; | |
| import android.view.View; | |
| import org.jetbrains.annotations.NotNull; | |
| import org.jetbrains.annotations.Nullable; | |
| public class EmptyRecyclerView extends RecyclerView { | |
| @Nullable View emptyView; |