Skip to content

Commit

Permalink
Issue BaseballCardTracker#278: Create layout for tablets
Browse files Browse the repository at this point in the history
  • Loading branch information
codeguru42 committed Jun 18, 2014
1 parent 7979a60 commit aa4735d
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 2 deletions.
60 changes: 60 additions & 0 deletions gradle/android/src/lite/res/layout-large/main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is part of BBCT for Android.
Copyright 2012-2014 codeguru <[email protected]>
BBCT for Android is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
BBCT for Android is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">

<FrameLayout
android:id="@id/ad_view"
android:layout_width="fill_parent"
android:layout_height="100dp"/>

<TextView
android:id="@+id/premium_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="@string/premium"/>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:baselineAligned="false">

<fragment
android:id="@+id/list_fragment"
class="bbct.android.common.activity.BaseballCardList"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
tools:layout="@layout/card_list"/>

<FrameLayout
android:id="@+id/fragment_holder"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"/>

</LinearLayout>

</LinearLayout>
2 changes: 1 addition & 1 deletion gradle/android/src/lite/res/layout/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<FrameLayout
android:id="@id/ad_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
android:layout_height="100dp" />

<TextView
android:id="@+id/premium_text"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(R.layout.main);

if (savedInstanceState == null) {
if (savedInstanceState == null && !isInTwoPaneMode()) {
Uri uri = BaseballCardContract.getUri(this.getPackageName());
Cursor cursor = this.getContentResolver().query(uri,
BaseballCardContract.PROJECTION, null, null, null);
Expand Down Expand Up @@ -109,4 +109,8 @@ public boolean onOptionsItemSelected(MenuItem item) {
return super.onOptionsItemSelected(item);
}

public boolean isInTwoPaneMode() {
return this.findViewById(R.id.list_fragment) != null;
}

}
41 changes: 41 additions & 0 deletions gradle/android/src/main/res/layout-large/main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is part of BBCT for Android.
Copyright 2012-2014 codeguru <[email protected]>
BBCT for Android is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
BBCT for Android is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:baselineAligned="false">

<fragment
android:id="@+id/list_fragment"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
class="bbct.android.common.activity.BaseballCardList"
tools:layout="@layout/card_list"/>

<FrameLayout
android:id="@+id/fragment_holder"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"/>

</LinearLayout>

0 comments on commit aa4735d

Please sign in to comment.