Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Serhat Sürgüveç SerhatSurguvec

🎯
Focusing
View GitHub Profile
@SerhatSurguvec
SerhatSurguvec / FragmentStateAdapter.java
Last active Apr 10, 2019
ViewPager2 Individual Options Menu Support for FragmentStateAdapter
View FragmentStateAdapter.java
/**
* Similar in behavior to {@link FragmentStatePagerAdapter}
* <p>
* Lifecycle within {@link RecyclerView}:
* <ul>
* <li>{@link RecyclerView.ViewHolder} initially an empty {@link FrameLayout}, serves as a
* re-usable container for a {@link Fragment} in later stages.
* <li>{@link RecyclerView.Adapter#onBindViewHolder} we ask for a {@link Fragment} for the
* position. If we already have the fragment, or have previously saved its state, we use those.
* <li>{@link RecyclerView.Adapter#onAttachedToWindow} we attach the {@link Fragment} to a
View DividerItemDecoration.java
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.View;
You can’t perform that action at this time.