Updated the project with GridLayout and other changes.
This commit is contained in:
@@ -9,6 +9,7 @@ Android SDK 21 or Higher
|
||||
Build Tools version 21.1.2
|
||||
Android Support AppCompat 22.2.0
|
||||
Android Support Annotations 22.2.0
|
||||
Android Support GridLayout 22.2.0
|
||||
Google Play Services GCM 7.0.0
|
||||
BumpTech Glide 3.5.2
|
||||
|
||||
|
||||
@@ -24,5 +24,6 @@ dependencies {
|
||||
compile 'com.github.bumptech.glide:glide:3.5.2'
|
||||
compile 'com.android.support:appcompat-v7:22.1.0'
|
||||
compile 'com.android.support:support-annotations:22.1.0'
|
||||
compile 'com.android.support:gridlayout-v7:22.1.0'
|
||||
compile 'com.google.android.gms:play-services-gcm:7.0.0'
|
||||
}
|
||||
|
||||
@@ -31,10 +31,6 @@ public class DetailActivity extends AppCompatActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_detail);
|
||||
|
||||
Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
// Create the detail fragment and add it to the activity
|
||||
// using a fragment transaction.
|
||||
@@ -50,24 +46,4 @@ public class DetailActivity extends AppCompatActivity {
|
||||
.commit();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
getMenuInflater().inflate(R.menu.detail, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle action bar item clicks here. The action bar will
|
||||
// automatically handle clicks on the Home/Up button, so long
|
||||
// as you specify a parent activity in AndroidManifest.xml.
|
||||
int id = item.getItemId();
|
||||
if (id == R.id.action_settings) {
|
||||
startActivity(new Intent(this, SettingsActivity.class));
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,9 @@ import android.support.v4.app.LoaderManager;
|
||||
import android.support.v4.content.CursorLoader;
|
||||
import android.support.v4.content.Loader;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.ShareActionProvider;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
@@ -84,14 +86,16 @@ public class DetailFragment extends Fragment implements LoaderManager.LoaderCall
|
||||
public static final int COL_WEATHER_CONDITION_ID = 9;
|
||||
|
||||
private ImageView mIconView;
|
||||
private TextView mFriendlyDateView;
|
||||
private TextView mDateView;
|
||||
private TextView mDescriptionView;
|
||||
private TextView mHighTempView;
|
||||
private TextView mLowTempView;
|
||||
private TextView mHumidityView;
|
||||
private TextView mHumidityLabelView;
|
||||
private TextView mWindView;
|
||||
private TextView mWindLabelView;
|
||||
private TextView mPressureView;
|
||||
private TextView mPressureLabelView;
|
||||
|
||||
public DetailFragment() {
|
||||
setHasOptionsMenu(true);
|
||||
@@ -109,30 +113,30 @@ public class DetailFragment extends Fragment implements LoaderManager.LoaderCall
|
||||
View rootView = inflater.inflate(R.layout.fragment_detail, container, false);
|
||||
mIconView = (ImageView) rootView.findViewById(R.id.detail_icon);
|
||||
mDateView = (TextView) rootView.findViewById(R.id.detail_date_textview);
|
||||
mFriendlyDateView = (TextView) rootView.findViewById(R.id.detail_day_textview);
|
||||
mDescriptionView = (TextView) rootView.findViewById(R.id.detail_forecast_textview);
|
||||
mHighTempView = (TextView) rootView.findViewById(R.id.detail_high_textview);
|
||||
mLowTempView = (TextView) rootView.findViewById(R.id.detail_low_textview);
|
||||
mHumidityView = (TextView) rootView.findViewById(R.id.detail_humidity_textview);
|
||||
mHumidityLabelView = (TextView) rootView.findViewById(R.id.detail_humidity_label_textview);
|
||||
mWindView = (TextView) rootView.findViewById(R.id.detail_wind_textview);
|
||||
mWindLabelView = (TextView) rootView.findViewById(R.id.detail_wind_label_textview);
|
||||
mPressureView = (TextView) rootView.findViewById(R.id.detail_pressure_textview);
|
||||
mPressureLabelView = (TextView) rootView.findViewById(R.id.detail_pressure_label_textview);
|
||||
return rootView;
|
||||
}
|
||||
|
||||
private void finishCreatingMenu(Menu menu) {
|
||||
// Retrieve the share menu item
|
||||
MenuItem menuItem = menu.findItem(R.id.action_share);
|
||||
menuItem.setIntent(createShareForecastIntent());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
inflater.inflate(R.menu.detailfragment, menu);
|
||||
|
||||
// Retrieve the share menu item
|
||||
MenuItem menuItem = menu.findItem(R.id.action_share);
|
||||
|
||||
// Get the provider and hold onto it to set/change the share intent.
|
||||
mShareActionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(menuItem);
|
||||
|
||||
// If onLoadFinished happens before this, we can go ahead and set the share intent now.
|
||||
if (mForecast != null) {
|
||||
mShareActionProvider.setShareIntent(createShareForecastIntent());
|
||||
if ( getActivity() instanceof DetailActivity ){
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
inflater.inflate(R.menu.detailfragment, menu);
|
||||
finishCreatingMenu(menu);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,18 +188,20 @@ public class DetailFragment extends Fragment implements LoaderManager.LoaderCall
|
||||
// Read weather condition ID from cursor
|
||||
int weatherId = data.getInt(COL_WEATHER_CONDITION_ID);
|
||||
|
||||
// Use weather art image
|
||||
Glide.with(this)
|
||||
.load(Utility.getArtUrlForWeatherCondition(getActivity(), weatherId))
|
||||
.error(Utility.getArtResourceForWeatherCondition(weatherId))
|
||||
.crossFade()
|
||||
.into(mIconView);
|
||||
if ( Utility.usingLocalGraphics(getActivity()) ) {
|
||||
mIconView.setImageResource(Utility.getArtResourceForWeatherCondition(weatherId));
|
||||
} else {
|
||||
// Use weather art image
|
||||
Glide.with(this)
|
||||
.load(Utility.getArtUrlForWeatherCondition(getActivity(), weatherId))
|
||||
.error(Utility.getArtResourceForWeatherCondition(weatherId))
|
||||
.crossFade()
|
||||
.into(mIconView);
|
||||
}
|
||||
|
||||
// Read date from cursor and update views for day of week and date
|
||||
long date = data.getLong(COL_WEATHER_DATE);
|
||||
String friendlyDateText = Utility.getDayName(getActivity(), date);
|
||||
String dateText = Utility.getFormattedMonthDay(getActivity(), date);
|
||||
mFriendlyDateView.setText(friendlyDateText);
|
||||
String dateText = Utility.getFullFriendlyDayString(getActivity(),date);
|
||||
mDateView.setText(dateText);
|
||||
|
||||
// Get description from weather condition ID
|
||||
@@ -226,18 +232,21 @@ public class DetailFragment extends Fragment implements LoaderManager.LoaderCall
|
||||
// Read humidity from cursor and update view
|
||||
float humidity = data.getFloat(COL_WEATHER_HUMIDITY);
|
||||
mHumidityView.setText(getActivity().getString(R.string.format_humidity, humidity));
|
||||
mHumidityView.setContentDescription(mHumidityView.getText());
|
||||
mHumidityView.setContentDescription(getString(R.string.a11y_humidity, mHumidityView.getText()));
|
||||
mHumidityLabelView.setContentDescription(mHumidityView.getContentDescription());
|
||||
|
||||
// Read wind speed and direction from cursor and update view
|
||||
float windSpeedStr = data.getFloat(COL_WEATHER_WIND_SPEED);
|
||||
float windDirStr = data.getFloat(COL_WEATHER_DEGREES);
|
||||
mWindView.setText(Utility.getFormattedWind(getActivity(), windSpeedStr, windDirStr));
|
||||
mWindView.setContentDescription(mWindView.getText());
|
||||
mWindView.setContentDescription(getString(R.string.a11y_wind, mWindView.getText()));
|
||||
mWindLabelView.setContentDescription(mWindView.getContentDescription());
|
||||
|
||||
// Read pressure from cursor and update view
|
||||
float pressure = data.getFloat(COL_WEATHER_PRESSURE);
|
||||
mPressureView.setText(getActivity().getString(R.string.format_pressure, pressure));
|
||||
mPressureView.setContentDescription(mPressureView.getText());
|
||||
mPressureView.setText(getString(R.string.format_pressure, pressure));
|
||||
mPressureView.setContentDescription(getString(R.string.a11y_pressure, mPressureView.getText()));
|
||||
mPressureLabelView.setContentDescription(mPressureView.getContentDescription());
|
||||
|
||||
// We still need this for the share intent
|
||||
mForecast = String.format("%s - %s - %s/%s", dateText, description, high, low);
|
||||
@@ -247,6 +256,27 @@ public class DetailFragment extends Fragment implements LoaderManager.LoaderCall
|
||||
mShareActionProvider.setShareIntent(createShareForecastIntent());
|
||||
}
|
||||
}
|
||||
AppCompatActivity activity = (AppCompatActivity)getActivity();
|
||||
Toolbar toolbarView = (Toolbar) getView().findViewById(R.id.toolbar);
|
||||
|
||||
// We need to start the enter transition after the data has loaded
|
||||
if (activity instanceof DetailActivity) {
|
||||
activity.supportStartPostponedEnterTransition();
|
||||
|
||||
if ( null != toolbarView ) {
|
||||
activity.setSupportActionBar(toolbarView);
|
||||
|
||||
activity.getSupportActionBar().setDisplayShowTitleEnabled(false);
|
||||
activity.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
} else {
|
||||
if ( null != toolbarView ) {
|
||||
Menu menu = toolbarView.getMenu();
|
||||
if ( null != menu ) menu.clear();
|
||||
toolbarView.inflateMenu(R.menu.detailfragment);
|
||||
finishCreatingMenu(toolbarView.getMenu());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -104,6 +104,24 @@ public class Utility {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to convert the database representation of the date into something to display
|
||||
* to users. As classy and polished a user experience as "20140102" is, we can do better.
|
||||
*
|
||||
* @param context Context to use for resource localization
|
||||
* @param dateInMillis The date in milliseconds
|
||||
* @return a user-friendly representation of the date.
|
||||
*/
|
||||
public static String getFullFriendlyDayString(Context context, long dateInMillis) {
|
||||
|
||||
String day = getDayName(context, dateInMillis);
|
||||
int formatId = R.string.format_full_friendly_date;
|
||||
return String.format(context.getString(
|
||||
formatId,
|
||||
day,
|
||||
getFormattedMonthDay(context, dateInMillis)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a day, returns just the name to use for that day.
|
||||
* E.g "today", "tomorrow", "wednesday".
|
||||
@@ -217,6 +235,19 @@ public class Utility {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to return whether or not Sunshine is using local graphics.
|
||||
*
|
||||
* @param context Context to use for retrieving the preference
|
||||
* @return true if Sunshine is using local graphics, false otherwise.
|
||||
*/
|
||||
public static boolean usingLocalGraphics(Context context) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
String sunshineArtPack = context.getString(R.string.pref_art_pack_sunshine);
|
||||
return prefs.getString(context.getString(R.string.pref_art_pack_key),
|
||||
sunshineArtPack).equals(sunshineArtPack);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to provide the art urls according to the weather condition id returned
|
||||
* by the OpenWeatherMap call.
|
||||
|
||||
@@ -13,23 +13,10 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/weather_detail_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/>
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/weather_detail_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="com.example.android.sunshine.app.DetailActivity"
|
||||
tools:ignore="MergeRootFrame" />
|
||||
</LinearLayout>
|
||||
android:layout_height="match_parent"
|
||||
tools:context="com.example.android.sunshine.app.DetailActivity"
|
||||
tools:ignore="MergeRootFrame" />
|
||||
|
||||
91
app/src/main/res/layout/detail_today_grid.xml
Normal file
91
app/src/main/res/layout/detail_today_grid.xml
Normal file
@@ -0,0 +1,91 @@
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<!-- 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:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/white"
|
||||
app:columnCount="2">
|
||||
|
||||
<android.support.v7.widget.Space
|
||||
app:layout_columnSpan="2"
|
||||
app:layout_columnWeight="1"
|
||||
app:layout_rowWeight="1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/detail_date_textview"
|
||||
android:layout_marginBottom="@dimen/abc_list_item_padding_horizontal_material"
|
||||
android:layout_marginTop="@dimen/abc_list_item_padding_horizontal_material"
|
||||
android:fontFamily="sans-serif"
|
||||
android:gravity="center_horizontal"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Title"
|
||||
android:textColor="@color/secondary_text"
|
||||
app:layout_columnSpan="2"
|
||||
app:layout_columnWeight="1"
|
||||
app:layout_gravity="fill_horizontal"
|
||||
tools:text="Today, April 03" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/detail_icon"
|
||||
android:layout_width="0dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:maxHeight="@dimen/today_icon"
|
||||
android:maxWidth="@dimen/today_icon"
|
||||
app:layout_columnWeight="1"
|
||||
app:layout_gravity="fill_horizontal"
|
||||
tools:src="@drawable/art_clouds" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/detail_high_textview"
|
||||
android:layout_width="0dp"
|
||||
android:fontFamily="sans-serif-light"
|
||||
android:gravity="center_horizontal"
|
||||
android:textColor="@color/primary_text"
|
||||
android:textSize="72sp"
|
||||
app:layout_columnWeight="1"
|
||||
app:layout_gravity="fill_horizontal"
|
||||
tools:text="19" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/detail_forecast_textview"
|
||||
android:layout_width="0dp"
|
||||
android:fontFamily="sans-serif"
|
||||
android:gravity="center_horizontal"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Title"
|
||||
android:textColor="@color/secondary_text"
|
||||
app:layout_columnWeight="1"
|
||||
tools:text="Rainy" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/detail_low_textview"
|
||||
android:layout_width="0dp"
|
||||
android:layout_marginBottom="@dimen/abc_list_item_padding_horizontal_material"
|
||||
android:fontFamily="sans-serif-light"
|
||||
android:gravity="center_horizontal"
|
||||
android:textColor="@color/secondary_text"
|
||||
android:textSize="36sp"
|
||||
app:layout_columnWeight="1"
|
||||
tools:text="10" />
|
||||
|
||||
<android.support.v7.widget.Space
|
||||
app:layout_columnSpan="2"
|
||||
app:layout_columnWeight="1"
|
||||
app:layout_rowWeight="1" />
|
||||
|
||||
</android.support.v7.widget.GridLayout>
|
||||
|
||||
@@ -14,115 +14,127 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
<!-- Master layout. -->
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<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:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="@android:color/white" />
|
||||
|
||||
<include layout="@layout/detail_today_grid"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="3"/>
|
||||
|
||||
<LinearLayout
|
||||
android:gravity="center_vertical"
|
||||
android:layout_gravity="start"
|
||||
android:layout_height="wrap_content"
|
||||
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:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
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">
|
||||
|
||||
<!-- Header: Day, Date -->
|
||||
<TextView
|
||||
android:fontFamily="sans-serif-condensed"
|
||||
android:id="@+id/detail_day_textview"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="24sp" />
|
||||
|
||||
<TextView
|
||||
android:fontFamily="sans-serif-condensed"
|
||||
android:id="@+id/detail_date_textview"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:textColor="@color/grey_700"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<!-- Main content: high, low, art, weather state -->
|
||||
<LinearLayout
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:gravity="start"
|
||||
<TextView
|
||||
android:id="@+id/detail_humidity_label_textview"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="sans-serif"
|
||||
android:paddingEnd="@dimen/forecast_detail_horizontal_padding"
|
||||
android:paddingRight="@dimen/forecast_detail_horizontal_padding"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/humidity"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Title"
|
||||
android:textColor="@color/detail_accent_label" />
|
||||
|
||||
<TextView
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:fontFamily="sans-serif-light"
|
||||
android:id="@+id/detail_high_textview"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:textSize="96sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/detail_low_textview"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:textColor="@color/grey_700"
|
||||
android:textSize="48sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_gravity="center"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/detail_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/detail_forecast_textview"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:textAppearanceLarge"
|
||||
android:textColor="@color/grey_700" />
|
||||
</LinearLayout>
|
||||
android:paddingEnd="@dimen/forecast_detail_horizontal_padding"
|
||||
android:paddingRight="@dimen/forecast_detail_horizontal_padding"
|
||||
android:id="@+id/detail_humidity_textview"
|
||||
android:gravity="center_vertical"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Headline"
|
||||
android:textColor="@android:color/white"
|
||||
tools:text="38%" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Humidity, wind, pressure -->
|
||||
<LinearLayout
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginRight="0dp"
|
||||
android:layout_marginEnd="0dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="vertical">
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/detail_humidity_textview"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:textAppearance="?android:textAppearanceLarge" />
|
||||
android:paddingEnd="@dimen/forecast_detail_horizontal_padding"
|
||||
android:paddingRight="@dimen/forecast_detail_horizontal_padding"
|
||||
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" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/detail_pressure_textview"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_width="match_parent"
|
||||
android:textAppearance="?android:textAppearanceLarge" />
|
||||
android:gravity="center_vertical"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Headline"
|
||||
android:textColor="@android:color/white"
|
||||
tools:text="995 hPa" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/detail_wind_textview"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_width="match_parent"
|
||||
android:textAppearance="?android:textAppearanceLarge" />
|
||||
android:paddingEnd="@dimen/forecast_detail_horizontal_padding"
|
||||
android:paddingRight="@dimen/forecast_detail_horizontal_padding"
|
||||
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:textAppearance="@style/TextAppearance.AppCompat.Title" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/detail_wind_textview"
|
||||
android:gravity="center_vertical"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Headline"
|
||||
android:textColor="@android:color/white"
|
||||
tools:text="4km/h NW" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
<ImageSwitcher
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/imageSwitcher"
|
||||
android:layout_gravity="right" />
|
||||
</LinearLayout>
|
||||
|
||||
@@ -14,113 +14,119 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
<!-- Master layout. -->
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<FrameLayout 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:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:padding="16dp" >
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_height="wrap_content"
|
||||
<FrameLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
>
|
||||
|
||||
<include layout="@layout/detail_today_grid"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:elevation="0dp"
|
||||
android:background="@android:color/transparent"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<android.support.v7.widget.GridLayout
|
||||
android:id="@+id/detail_additional_pane"
|
||||
android:layout_width="wrap_content"
|
||||
android:minWidth="56dp"
|
||||
android:orientation="vertical" >
|
||||
android:layout_height="match_parent"
|
||||
app:columnCount="2"
|
||||
android:background="@color/detail_accent_pane_background"
|
||||
android:paddingEnd="@dimen/abc_list_item_padding_horizontal_material"
|
||||
android:paddingRight="@dimen/abc_list_item_padding_horizontal_material"
|
||||
>
|
||||
|
||||
<!-- Header: Day, Date -->
|
||||
<TextView
|
||||
android:fontFamily="sans-serif-condensed"
|
||||
android:id="@+id/detail_day_textview"
|
||||
android:layout_height="wrap_content"
|
||||
android:minWidth="120dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:textSize="24sp" />
|
||||
<android.support.v7.widget.Space
|
||||
app:layout_columnSpan="2"
|
||||
app:layout_rowWeight="1" />
|
||||
|
||||
<TextView
|
||||
android:fontFamily="sans-serif-condensed"
|
||||
android:id="@+id/detail_date_textview"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:textColor="@color/grey_700"
|
||||
android:textSize="20sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Main content: high, low, art, weather state -->
|
||||
<LinearLayout
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:orientation="vertical">
|
||||
android:id="@+id/detail_humidity_label_textview"
|
||||
android:fontFamily="sans-serif"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/humidity"
|
||||
android:textColor="@color/detail_accent_label"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Title"
|
||||
android:paddingLeft="@dimen/abc_list_item_padding_horizontal_material"
|
||||
android:paddingRight="@dimen/abc_list_item_padding_horizontal_material"
|
||||
android:paddingBottom="@dimen/abc_list_item_padding_horizontal_material"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:fontFamily="sans-serif-light"
|
||||
android:id="@+id/detail_high_textview"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:textSize="96sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/detail_low_textview"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:textColor="@color/grey_700"
|
||||
android:textSize="48sp" />
|
||||
|
||||
<!-- Humidity, wind, pressure -->
|
||||
<TextView
|
||||
android:fontFamily="sans-serif-condensed"
|
||||
android:id="@+id/detail_humidity_textview"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:textAppearance="?android:textAppearanceLarge" />
|
||||
android:fontFamily="sans-serif"
|
||||
android:gravity="center_vertical"
|
||||
tools:text="38%"
|
||||
android:textColor="@android:color/white"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Title"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/detail_pressure_label_textview"
|
||||
android:fontFamily="sans-serif"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/pressure"
|
||||
android:textColor="@color/detail_accent_label"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Title"
|
||||
android:paddingTop="@dimen/detail_view_extra_padding"
|
||||
android:paddingLeft="@dimen/abc_list_item_padding_horizontal_material"
|
||||
android:paddingRight="@dimen/abc_list_item_padding_horizontal_material"
|
||||
android:paddingBottom="@dimen/abc_list_item_padding_horizontal_material"
|
||||
/>
|
||||
|
||||
|
||||
<TextView
|
||||
android:fontFamily="sans-serif-condensed"
|
||||
android:id="@+id/detail_pressure_textview"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:textAppearance="?android:textAppearanceLarge" />
|
||||
android:fontFamily="sans-serif"
|
||||
android:gravity="center_vertical"
|
||||
tools:text="995 hPa"
|
||||
android:textColor="@android:color/white"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Title"
|
||||
/>
|
||||
|
||||
<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:textAppearance="@style/TextAppearance.AppCompat.Title"
|
||||
android:paddingTop="@dimen/detail_view_extra_padding"
|
||||
android:paddingLeft="@dimen/abc_list_item_padding_horizontal_material"
|
||||
android:paddingRight="@dimen/abc_list_item_padding_horizontal_material"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:fontFamily="sans-serif-condensed"
|
||||
android:id="@+id/detail_wind_textview"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:textAppearance="?android:textAppearanceLarge" />
|
||||
</LinearLayout>
|
||||
android:fontFamily="sans-serif"
|
||||
android:gravity="center_vertical"
|
||||
tools:text="4km/h NW"
|
||||
android:textColor="@android:color/white"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Title"
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<android.support.v7.widget.Space
|
||||
app:layout_columnSpan="2"
|
||||
app:layout_rowWeight="1" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/detail_icon"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:adjustViewBounds="true" />
|
||||
|
||||
<TextView
|
||||
android:fontFamily="sans-serif-condensed"
|
||||
android:id="@+id/detail_forecast_textview"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:textColor="@color/grey_700"
|
||||
android:textAppearance="?android:textAppearanceLarge"/>
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.GridLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</FrameLayout>
|
||||
@@ -18,6 +18,6 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item android:id="@+id/action_share"
|
||||
android:title="@string/action_share"
|
||||
app:showAsAction="always"
|
||||
app:actionProviderClass="android.support.v7.widget.ShareActionProvider" />
|
||||
android:icon="@drawable/abc_ic_menu_share_mtrl_alpha"
|
||||
app:showAsAction="always"/>
|
||||
</menu>
|
||||
|
||||
@@ -26,5 +26,11 @@
|
||||
<color name="primary_dark">#0288D1</color> <!-- 700 -->
|
||||
<color name="primary_light">#B3E5FC</color> <!-- 100 -->
|
||||
<color name="accent">#FFD740</color>
|
||||
<color name="primary_text">#212121</color>
|
||||
<color name="secondary_text">#727272</color>
|
||||
|
||||
<!-- our detail accent colors -->
|
||||
<color name="detail_accent_pane_background">#455A64</color>
|
||||
<color name="detail_accent_label">#90A4AE</color>
|
||||
|
||||
</resources>
|
||||
@@ -19,4 +19,11 @@
|
||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||
|
||||
<dimen name="notification_large_icon_default">48dp</dimen>
|
||||
<dimen name="forecast_detail_horizontal_padding">32dp</dimen>
|
||||
|
||||
<!-- Icon Sizes -->
|
||||
<dimen name="today_icon">96dp</dimen>
|
||||
|
||||
<!-- Extra Padding -->
|
||||
<dimen name="detail_view_extra_padding">@dimen/abc_list_item_padding_horizontal_material</dimen>
|
||||
</resources>
|
||||
|
||||
@@ -111,17 +111,20 @@
|
||||
<!-- Temperature format [CHAR LIMIT=5 -->
|
||||
<string name="format_temperature"><xliff:g id="temp">%1.0f</xliff:g>\u00B0</string>
|
||||
|
||||
<string name="wind">Wind</string>
|
||||
<!-- Windspeed formats -->
|
||||
<!-- Wind in mph [CHAR LIMIT=25] -->
|
||||
<string name="format_wind_mph">Wind: <xliff:g id="speed">%1$1.0f</xliff:g> mph <xliff:g id="direction">%2$s</xliff:g></string>
|
||||
<string name="format_wind_mph"><xliff:g id="speed">%1$1.0f</xliff:g> mph <xliff:g id="direction">%2$s</xliff:g></string>
|
||||
<!-- Wind in kph [CHAR LIMIT=25] -->
|
||||
<string name="format_wind_kmh">Wind: <xliff:g id="speed">%1$1.0f</xliff:g> km/h <xliff:g id="direction">%2$s</xliff:g></string>
|
||||
<string name="format_wind_kmh"><xliff:g id="speed">%1$1.0f</xliff:g> km/h <xliff:g id="direction">%2$s</xliff:g></string>
|
||||
|
||||
<string name="pressure">Pressure</string>
|
||||
<!-- Pressure format CHAR LIMIT=25] -->
|
||||
<string name="format_pressure">Pressure: <xliff:g id="pressure">%1.0f</xliff:g> hPa</string>
|
||||
<string name="format_pressure"><xliff:g id="pressure">%1.0f</xliff:g> hPa</string>
|
||||
|
||||
<string name="humidity">Humidity</string>
|
||||
<!-- Humidity format CHAR LIMIT=25]-->
|
||||
<string name="format_humidity">Humidity: <xliff:g id="humidity">%1.0f</xliff:g> %%</string>
|
||||
<string name="format_humidity"><xliff:g id="humidity">%1.0f</xliff:g> %%</string>
|
||||
|
||||
<!-- SyncAdapter related -->
|
||||
<string name="sync_account_type">sunshine.example.com</string>
|
||||
@@ -145,6 +148,9 @@
|
||||
<string name="a11y_forecast_icon">Forecast icon: <xliff:g id="condition">%1$s</xliff:g></string>
|
||||
<string name="a11y_high_temp">High: <xliff:g id="high">%1$s</xliff:g></string>
|
||||
<string name="a11y_low_temp">Low: <xliff:g id="low">%1$s</xliff:g></string>
|
||||
<string name="a11y_humidity">Humidity: <xliff:g id="humidity">%1$s</xliff:g></string>
|
||||
<string name="a11y_pressure">Barometric Pressure: <xliff:g id="pressure">%1$s</xliff:g></string>
|
||||
<string name="a11y_wind">Wind speed and direction: <xliff:g id="wind">%1$s</xliff:g></string>
|
||||
|
||||
<!-- Weather Conditions -->
|
||||
<string name="condition_2xx">Storm</string>
|
||||
|
||||
Reference in New Issue
Block a user