Added dimensions and layouts to get us ready for SMRE part 2.
This commit is contained in:
@@ -23,7 +23,6 @@ import android.support.v4.app.Fragment;
|
|||||||
import android.support.v4.app.LoaderManager;
|
import android.support.v4.app.LoaderManager;
|
||||||
import android.support.v4.content.CursorLoader;
|
import android.support.v4.content.CursorLoader;
|
||||||
import android.support.v4.content.Loader;
|
import android.support.v4.content.Loader;
|
||||||
import android.support.v4.view.MenuItemCompat;
|
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.support.v7.widget.ShareActionProvider;
|
import android.support.v7.widget.ShareActionProvider;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
@@ -50,7 +49,6 @@ public class DetailFragment extends Fragment implements LoaderManager.LoaderCall
|
|||||||
|
|
||||||
private static final String FORECAST_SHARE_HASHTAG = " #SunshineApp";
|
private static final String FORECAST_SHARE_HASHTAG = " #SunshineApp";
|
||||||
|
|
||||||
private ShareActionProvider mShareActionProvider;
|
|
||||||
private String mForecast;
|
private String mForecast;
|
||||||
private Uri mUri;
|
private Uri mUri;
|
||||||
|
|
||||||
@@ -179,12 +177,15 @@ public class DetailFragment extends Fragment implements LoaderManager.LoaderCall
|
|||||||
null
|
null
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
getView().setVisibility(View.INVISIBLE);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
|
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
|
||||||
if (data != null && data.moveToFirst()) {
|
if (data != null && data.moveToFirst()) {
|
||||||
|
getView().setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
// Read weather condition ID from cursor
|
// Read weather condition ID from cursor
|
||||||
int weatherId = data.getInt(COL_WEATHER_CONDITION_ID);
|
int weatherId = data.getInt(COL_WEATHER_CONDITION_ID);
|
||||||
|
|
||||||
@@ -251,10 +252,6 @@ public class DetailFragment extends Fragment implements LoaderManager.LoaderCall
|
|||||||
// We still need this for the share intent
|
// We still need this for the share intent
|
||||||
mForecast = String.format("%s - %s - %s/%s", dateText, description, high, low);
|
mForecast = String.format("%s - %s - %s/%s", dateText, description, high, low);
|
||||||
|
|
||||||
// If onCreateOptionsMenu has already happened, we need to update the share intent now.
|
|
||||||
if (mShareActionProvider != null) {
|
|
||||||
mShareActionProvider.setShareIntent(createShareForecastIntent());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
AppCompatActivity activity = (AppCompatActivity)getActivity();
|
AppCompatActivity activity = (AppCompatActivity)getActivity();
|
||||||
Toolbar toolbarView = (Toolbar) getView().findViewById(R.id.toolbar);
|
Toolbar toolbarView = (Toolbar) getView().findViewById(R.id.toolbar);
|
||||||
|
|||||||
@@ -92,9 +92,11 @@
|
|||||||
android:layout_marginTop="?attr/actionBarSize"
|
android:layout_marginTop="?attr/actionBarSize"
|
||||||
android:layout_alignStart="@id/layout_center"
|
android:layout_alignStart="@id/layout_center"
|
||||||
android:elevation="@dimen/appbar_elevation"
|
android:elevation="@dimen/appbar_elevation"
|
||||||
|
android:layout_marginRight="@dimen/list_item_extra_padding"
|
||||||
|
android:layout_marginEnd="@dimen/list_item_extra_padding"
|
||||||
android:paddingRight="@dimen/abc_list_item_padding_horizontal_material"
|
android:paddingRight="@dimen/abc_list_item_padding_horizontal_material"
|
||||||
android:paddingEnd="@dimen/abc_list_item_padding_horizontal_material"
|
android:paddingEnd="@dimen/abc_list_item_padding_horizontal_material"
|
||||||
android:paddingBottom="@dimen/abc_list_item_padding_horizontal_material"
|
android:paddingBottom="@dimen/detail_container_bottom_margin"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
@@ -23,6 +23,7 @@
|
|||||||
app:columnCount="2">
|
app:columnCount="2">
|
||||||
|
|
||||||
<android.support.v7.widget.Space
|
<android.support.v7.widget.Space
|
||||||
|
android:layout_height="@dimen/detail_view_padding_vertical"
|
||||||
app:layout_columnSpan="2"
|
app:layout_columnSpan="2"
|
||||||
app:layout_columnWeight="1"
|
app:layout_columnWeight="1"
|
||||||
app:layout_rowWeight="1" />
|
app:layout_rowWeight="1" />
|
||||||
@@ -83,6 +84,7 @@
|
|||||||
tools:text="10" />
|
tools:text="10" />
|
||||||
|
|
||||||
<android.support.v7.widget.Space
|
<android.support.v7.widget.Space
|
||||||
|
android:layout_height="@dimen/detail_view_padding_vertical"
|
||||||
app:layout_columnSpan="2"
|
app:layout_columnSpan="2"
|
||||||
app:layout_columnWeight="1"
|
app:layout_columnWeight="1"
|
||||||
app:layout_rowWeight="1" />
|
app:layout_rowWeight="1" />
|
||||||
|
|||||||
19
app/src/main/res/values-sw600dp/dimens.xml
Normal file
19
app/src/main/res/values-sw600dp/dimens.xml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<!--
|
||||||
|
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 Padding - This one actually smaller on tablets -->
|
||||||
|
<dimen name="detail_view_extra_padding">0dp</dimen>
|
||||||
|
</resources>
|
||||||
26
app/src/main/res/values-sw720dp/dimens.xml
Normal file
26
app/src/main/res/values-sw720dp/dimens.xml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?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>
|
||||||
|
<!-- Extra List Item Margin (tablet-only) -->
|
||||||
|
<dimen name="list_item_extra_padding">64dp</dimen>
|
||||||
|
<dimen name="detail_view_padding_vertical">@dimen/abc_list_item_padding_horizontal_material</dimen>
|
||||||
|
<dimen name="detail_view_padding">@dimen/abc_action_bar_default_height_material</dimen>
|
||||||
|
|
||||||
|
<dimen name="forecast_temperature_space">@dimen/abc_list_item_padding_horizontal_material</dimen>
|
||||||
|
<dimen name="detail_container_bottom_margin">@dimen/abc_action_bar_default_height_material</dimen>
|
||||||
|
|
||||||
|
</resources>
|
||||||
@@ -43,4 +43,10 @@
|
|||||||
|
|
||||||
<!-- The amount we want the details view to overlap the app bar -->
|
<!-- The amount we want the details view to overlap the app bar -->
|
||||||
<dimen name="details_app_bar_overlap">24dp</dimen>
|
<dimen name="details_app_bar_overlap">24dp</dimen>
|
||||||
|
|
||||||
|
<!-- Help to make us tablet beautiful -->
|
||||||
|
<dimen name="list_item_extra_padding">0dp</dimen>
|
||||||
|
<dimen name="detail_view_padding">@dimen/abc_list_item_padding_horizontal_material</dimen>
|
||||||
|
<dimen name="forecast_detail_padding_wide">16dp</dimen>
|
||||||
|
<dimen name="detail_container_bottom_margin">@dimen/detail_view_padding</dimen>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
Reference in New Issue
Block a user