This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PartThreeFragment extends Fragment { | |
public final static String ITEMS_COUNT_KEY = "PartThreeFragment$ItemsCount"; | |
public static PartThreeFragment createInstance(int itemsCount) { | |
PartThreeFragment partThreeFragment = new PartThreeFragment(); | |
Bundle bundle = new Bundle(); | |
bundle.putInt(ITEMS_COUNT_KEY, itemsCount); | |
partThreeFragment.setArguments(bundle); | |
return partThreeFragment; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<android.support.v7.widget.RecyclerView | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
android:id="@+id/recyclerView" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
android { | |
compileSdkVersion 22 | |
buildToolsVersion "22.0.1" | |
defaultConfig { | |
minSdkVersion 14 | |
targetSdkVersion 22 | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void initRecyclerView() { | |
final RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerView); | |
int paddingTop = Utils.getToolbarHeight(PartTwoActivity.this) + Utils.getTabsHeight(PartTwoActivity.this); | |
recyclerView.setPadding(recyclerView.getPaddingLeft(), paddingTop, recyclerView.getPaddingRight(), recyclerView.getPaddingBottom()); | |
recyclerView.setLayoutManager(new GridLayoutManager(this, 3)); | |
RecyclerAdapter recyclerAdapter = new RecyclerAdapter(createItemList()); | |
//... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class HidingScrollListener extends RecyclerView.OnScrollListener { | |
private static final float HIDE_THRESHOLD = 10; | |
private static final float SHOW_THRESHOLD = 70; | |
private int mToolbarOffset = 0; | |
private boolean mControlsVisible = true; | |
private int mToolbarHeight; | |
private int mTotalScrolledDistance; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<android.support.v7.widget.RecyclerView | |
android:id="@+id/recyclerView" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:clipToPadding="false"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PartTwoActivity extends ActionBarActivity { | |
private LinearLayout mToolbarContainer; | |
private int mToolbarHeight; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
setTheme(R.style.AppThemeGreen); | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_part_two); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void initRecyclerView() { | |
final RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerView); | |
int paddingTop = Utils.getToolbarHeight(PartTwoActivity.this) + Utils.getTabsHeight(PartTwoActivity.this); | |
recyclerView.setPadding(recyclerView.getPaddingLeft(), paddingTop, recyclerView.getPaddingRight(), recyclerView.getPaddingBottom()); | |
recyclerView.setLayoutManager(new LinearLayoutManager(this)); | |
// ... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="@dimen/tabsHeight" | |
android:background="?attr/colorPrimary"> | |
<FrameLayout | |
android:layout_width="0dp" | |
android:layout_height="match_parent" | |
android:layout_weight="1" > | |
<TextView | |
android:layout_width="match_parent" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<android.support.v7.widget.RecyclerView | |
android:id="@+id/recyclerView" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:clipToPadding="false"/> |