Merge pull request #2404 from sigmabeta/master

Android: Scale number of columns in game grid according to screen width.
This commit is contained in:
Lioncash 2015-05-11 17:22:43 -04:00
commit 16726628a6
5 changed files with 18 additions and 1 deletions

View File

@ -54,7 +54,8 @@ public final class GameGridActivity extends Activity
//mRecyclerView.setHasFixedSize(true);
// Specifying the LayoutManager determines how the RecyclerView arranges views.
RecyclerView.LayoutManager layoutManager = new GridLayoutManager(this, 4);
RecyclerView.LayoutManager layoutManager = new GridLayoutManager(this,
getResources().getInteger(R.integer.game_grid_columns));
recyclerView.setLayoutManager(layoutManager);
recyclerView.addItemDecoration(new GameAdapter.SpacesItemDecoration(8));

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="game_grid_columns">4</integer>
</resources>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="game_grid_columns">2</integer>
</resources>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="game_grid_columns">3</integer>
</resources>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="game_grid_columns">1</integer>
</resources>