diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 5ff2a44..4659c95 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -109,6 +109,17 @@
+
+
+
+
+
+
+
+
diff --git a/app/src/main/java/com/example/android/sunshine/app/widget/TodayWidgetProvider.java b/app/src/main/java/com/example/android/sunshine/app/widget/TodayWidgetProvider.java
new file mode 100644
index 0000000..04ef261
--- /dev/null
+++ b/app/src/main/java/com/example/android/sunshine/app/widget/TodayWidgetProvider.java
@@ -0,0 +1,69 @@
+/*
+ * 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.
+ */
+package com.example.android.sunshine.app.widget;
+
+import android.annotation.TargetApi;
+import android.app.PendingIntent;
+import android.appwidget.AppWidgetManager;
+import android.appwidget.AppWidgetProvider;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Build;
+import android.widget.RemoteViews;
+
+import com.example.android.sunshine.app.MainActivity;
+import com.example.android.sunshine.app.R;
+import com.example.android.sunshine.app.Utility;
+
+/**
+ * Provider for a widget showing today's weather.
+ */
+public class TodayWidgetProvider extends AppWidgetProvider {
+
+ public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
+ int weatherArtResourceId = R.drawable.art_clear;
+ String description = "Clear";
+ double maxTemp = 24;
+ String formattedMaxTemperature = Utility.formatTemperature(context, maxTemp);
+
+ // Perform this loop procedure for each Today widget
+ for (int appWidgetId : appWidgetIds) {
+ int layoutId = R.layout.widget_today_small;
+ RemoteViews views = new RemoteViews(context.getPackageName(), layoutId);
+
+ // Add the data to the RemoteViews
+ views.setImageViewResource(R.id.widget_icon, weatherArtResourceId);
+ // Content Descriptions for RemoteViews were only added in ICS MR1
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
+ setRemoteContentDescription(views, description);
+ }
+ views.setTextViewText(R.id.widget_high_temperature, formattedMaxTemperature);
+
+ // Create an Intent to launch MainActivity
+ Intent launchIntent = new Intent(context, MainActivity.class);
+ PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, launchIntent, 0);
+ views.setOnClickPendingIntent(R.id.widget, pendingIntent);
+
+ // Tell the AppWidgetManager to perform an update on the current app widget
+ appWidgetManager.updateAppWidget(appWidgetId, views);
+ }
+ }
+
+ @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)
+ private void setRemoteContentDescription(RemoteViews views, String description) {
+ views.setContentDescription(R.id.widget_icon, description);
+ }
+}
diff --git a/app/src/main/res/layout/widget_today_small.xml b/app/src/main/res/layout/widget_today_small.xml
new file mode 100644
index 0000000..d9b2d19
--- /dev/null
+++ b/app/src/main/res/layout/widget_today_small.xml
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values-v14/widget_dimens.xml b/app/src/main/res/values-v14/widget_dimens.xml
new file mode 100644
index 0000000..f02fa43
--- /dev/null
+++ b/app/src/main/res/values-v14/widget_dimens.xml
@@ -0,0 +1,18 @@
+
+
+
+ 0dp
+
\ No newline at end of file
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
index 53d3569..12b07d1 100644
--- a/app/src/main/res/values/dimens.xml
+++ b/app/src/main/res/values/dimens.xml
@@ -52,4 +52,8 @@
6dp
360dp
+
+
+ 40dp
+ 40dp
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index ccd978c..27c9e53 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -136,6 +136,9 @@
last_notification
+
+ Sunshine Today
+
No Weather Information Available
No weather information available. The network is not available to fetch weather data.
diff --git a/app/src/main/res/values/widget_dimens.xml b/app/src/main/res/values/widget_dimens.xml
new file mode 100644
index 0000000..848a802
--- /dev/null
+++ b/app/src/main/res/values/widget_dimens.xml
@@ -0,0 +1,18 @@
+
+
+
+ 8dp
+
\ No newline at end of file
diff --git a/app/src/main/res/xml/widget_info_today.xml b/app/src/main/res/xml/widget_info_today.xml
new file mode 100644
index 0000000..9812f0b
--- /dev/null
+++ b/app/src/main/res/xml/widget_info_today.xml
@@ -0,0 +1,20 @@
+
+
+
\ No newline at end of file