Updated our landscape layout to be close to where we want it.

This commit is contained in:
Dan Galpin
2015-05-25 02:30:36 -07:00
parent 20231d8aff
commit 26159a5f42
10 changed files with 164 additions and 73 deletions

View File

@@ -108,7 +108,7 @@ public class DetailFragment extends Fragment implements LoaderManager.LoaderCall
mUri = arguments.getParcelable(DetailFragment.DETAIL_URI);
}
View rootView = inflater.inflate(R.layout.fragment_detail, container, false);
View rootView = inflater.inflate(R.layout.fragment_detail_start, container, false);
mIconView = (ImageView) rootView.findViewById(R.id.detail_icon);
mDateView = (TextView) rootView.findViewById(R.id.detail_date_textview);
mDescriptionView = (TextView) rootView.findViewById(R.id.detail_forecast_textview);

View File

@@ -0,0 +1,75 @@
<!-- Detail Layout for Grid -->
<android.support.v7.widget.GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/detail_additional_pane"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:background="@color/detail_accent_pane_background"
android:paddingBottom="@dimen/abc_list_item_padding_horizontal_material"
android:paddingEnd="@dimen/forecast_detail_horizontal_padding"
android:paddingLeft="@dimen/forecast_detail_horizontal_padding"
android:paddingRight="@dimen/forecast_detail_horizontal_padding"
android:paddingStart="@dimen/forecast_detail_horizontal_padding"
android:paddingTop="@dimen/abc_list_item_padding_horizontal_material"
app:columnCount="2">
<TextView
android:id="@+id/detail_humidity_label_textview"
android:layout_height="wrap_content"
android:fontFamily="sans-serif"
android:gravity="center_vertical"
android:text="@string/humidity"
android:textAppearance="@style/TextAppearance.AppCompat.Title"
android:textColor="@color/detail_accent_label"
app:layout_columnWeight="1"
app:layout_gravity="fill"
app:layout_rowWeight="1" />
<TextView
android:id="@+id/detail_humidity_textview"
android:gravity="center_vertical"
android:textAppearance="@style/TextAppearance.AppCompat.Headline"
android:textColor="@android:color/white"
app:layout_gravity="fill"
tools:text="38%" />
<TextView
android:id="@+id/detail_pressure_label_textview"
android:fontFamily="sans-serif"
android:gravity="center_vertical"
android:text="@string/pressure"
android:textAppearance="@style/TextAppearance.AppCompat.Title"
android:textColor="@color/detail_accent_label"
app:layout_gravity="fill"
app:layout_rowWeight="1" />
<TextView
android:id="@+id/detail_pressure_textview"
android:gravity="center_vertical"
android:textAppearance="@style/TextAppearance.AppCompat.Headline"
android:textColor="@android:color/white"
app:layout_gravity="fill"
tools:text="995 hPa" />
<TextView
android:id="@+id/detail_wind_label_textview"
android:fontFamily="sans-serif"
android:gravity="center_vertical"
android:text="@string/wind"
android:textColor="@color/detail_accent_label"
android:textSize="20sp"
app:layout_gravity="fill"
app:layout_rowWeight="1" />
<TextView
android:id="@+id/detail_wind_textview"
android:gravity="center_vertical"
android:textAppearance="@style/TextAppearance.AppCompat.Headline"
android:textColor="@android:color/white"
app:layout_gravity="fill"
tools:text="4km/h NW" />
</android.support.v7.widget.GridLayout>

View File

@@ -16,8 +16,6 @@
<!-- Master layout. -->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
@@ -33,76 +31,10 @@
android:layout_height="0dp"
android:layout_weight="3"/>
<android.support.v7.widget.GridLayout
android:id="@+id/detail_additional_pane"
<include layout="@layout/detail_extras_grid"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
app:columnCount="2"
android:background="@color/detail_accent_pane_background"
android:paddingBottom="@dimen/abc_list_item_padding_horizontal_material"
android:paddingTop="@dimen/abc_list_item_padding_horizontal_material"
android:paddingLeft="@dimen/forecast_detail_horizontal_padding"
android:paddingStart="@dimen/forecast_detail_horizontal_padding"
android:paddingRight="@dimen/forecast_detail_horizontal_padding"
android:paddingEnd="@dimen/forecast_detail_horizontal_padding">
android:layout_weight="2"/>
<TextView
android:id="@+id/detail_humidity_label_textview"
android:layout_height="wrap_content"
android:fontFamily="sans-serif"
android:gravity="center_vertical"
android:text="@string/humidity"
android:textAppearance="@style/TextAppearance.AppCompat.Title"
android:textColor="@color/detail_accent_label"
app:layout_columnWeight="1"
app:layout_gravity="fill"
app:layout_rowWeight="1" />
<TextView
android:id="@+id/detail_humidity_textview"
android:gravity="center_vertical"
tools:text="38%"
android:textAppearance="@style/TextAppearance.AppCompat.Headline"
android:textColor="@android:color/white"
app:layout_gravity="fill"/>
<TextView
android:id="@+id/detail_pressure_label_textview"
android:fontFamily="sans-serif"
android:gravity="center_vertical"
android:text="@string/pressure"
android:textAppearance="@style/TextAppearance.AppCompat.Title"
android:textColor="@color/detail_accent_label"
app:layout_gravity="fill"
app:layout_rowWeight="1"/>
<TextView
android:id="@+id/detail_pressure_textview"
android:gravity="center_vertical"
tools:text="995 hPa"
android:textAppearance="@style/TextAppearance.AppCompat.Headline"
android:textColor="@android:color/white"
app:layout_gravity="fill"/>
<TextView
android:id="@+id/detail_wind_label_textview"
android:fontFamily="sans-serif"
android:gravity="center_vertical"
android:text="@string/wind"
android:textColor="@color/detail_accent_label"
android:textSize="20sp"
app:layout_gravity="fill"
app:layout_rowWeight="1" />
<TextView
android:id="@+id/detail_wind_textview"
android:gravity="center_vertical"
tools:text="4km/h NW"
android:textAppearance="@style/TextAppearance.AppCompat.Headline"
android:textColor="@android:color/white"
app:layout_gravity="fill" />
</android.support.v7.widget.GridLayout>
</LinearLayout>

View File

@@ -20,6 +20,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/touch_selector"
android:paddingLeft="@dimen/list_item_extra_padding"
android:paddingRight="@dimen/list_item_extra_padding"
>
<LinearLayout

View File

@@ -19,5 +19,5 @@
http://developer.android.com/training/multiscreen/screensizes.html#TaskUseAliasFilters
-->
<!-- Replace fragment detail view with layout that takes advantage of more available width.-->
<item type="layout" name="fragment_detail">@layout/fragment_detail_wide</item>
<item type="layout" name="fragment_detail_start">@layout/fragment_detail_wide</item>
</resources>

View File

@@ -0,0 +1,19 @@
<?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
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<resources>
<item type="layout" name="fragment_detail_start">@layout/fragment_detail</item>
</resources>

View File

@@ -0,0 +1,22 @@
<!--
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
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<resources>
<!-- Extra List Item Margin (tablet-only) -->
<dimen name="list_item_extra_padding">80dp</dimen>
<dimen name="forecast_temperature_space">@dimen/abc_list_item_padding_horizontal_material</dimen>
<dimen name="detail_view_padding_vertical">@dimen/abc_list_item_padding_horizontal_material</dimen>
</resources>

View File

@@ -20,5 +20,5 @@
-->
<!-- Replace fragment detail view with layout that takes advantage of more available width.-->
<item type="layout" name="fragment_detail">@layout/fragment_detail_wide</item>
<item type="layout" name="fragment_detail_start">@layout/fragment_detail_wide</item>
</resources>

View File

@@ -0,0 +1,22 @@
<!--
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
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<resources>
<!-- Extra List Item Margin (tablet-only) -->
<dimen name="list_item_extra_padding">80dp</dimen>
<dimen name="detail_view_padding_vertical">@dimen/abc_list_item_padding_horizontal_material</dimen>
<dimen name="forecast_temperature_space">@dimen/abc_list_item_padding_horizontal_material</dimen>
</resources>

View File

@@ -0,0 +1,19 @@
<?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
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<resources>
<item type="layout" name="fragment_detail_start">@layout/fragment_detail</item>
</resources>