+
+ @Override
+ public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
+ Log.v(LOG_TAG, "In onLoadFinished");
+ if (!data.moveToFirst()) { return; }
+
+ String dateString = Utility.formatDate(
+ data.getString(data.getColumnIndex(WeatherEntry.COLUMN_DATETEXT)));
+ ((TextView) getView().findViewById(R.id.detail_date_textview))
+ .setText(dateString);
+
+ String weatherDescription =
+ data.getString(data.getColumnIndex(WeatherEntry.COLUMN_SHORT_DESC));
+ ((TextView) getView().findViewById(R.id.detail_forecast_textview))
+ .setText(weatherDescription);
+
+ boolean isMetric = Utility.isMetric(getActivity());
+
+ String high = Utility.formatTemperature(
+ data.getDouble(data.getColumnIndex(WeatherEntry.COLUMN_MAX_TEMP)), isMetric);
+ ((TextView) getView().findViewById(R.id.detail_high_textview)).setText(high);
+
+ String low = Utility.formatTemperature(
+ data.getDouble(data.getColumnIndex(WeatherEntry.COLUMN_MIN_TEMP)), isMetric);
+ ((TextView) getView().findViewById(R.id.detail_low_textview)).setText(low);
+
+ // We still need this for the share intent
+ mForecast = String.format("%s - %s - %s/%s", dateString, weatherDescription, high, low);
+
+ Log.v(LOG_TAG, "Forecast String: " + mForecast);
+
+ // If onCreateOptionsMenu has already happened, we need to update the share intent now.
+ if (mShareActionProvider != null) {
+ mShareActionProvider.setShareIntent(createShareForecastIntent());
+ }
+ }
+
+ @Override
+ public void onLoaderReset(Loader<Cursor> loader) { }
+
+
+
+// @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_show_location) {
+// SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getActivity());
+// String location = preferences.getString(getString(R.string.pref_location_key),
+// getString(R.string.pref_location_default));
+// Intent intent = new Intent(Intent.ACTION_VIEW);
+// Uri geoLocation;
+// try {
+// geoLocation = Uri.parse("geo:0,0?q=" + URLEncoder.encode(location, "UTF-8"));
+// intent.setData(geoLocation);
+// } catch (UnsupportedEncodingException e) {
+// Log.e(LOG_TAG, "Error ", e);
+// }
+// if (intent.resolveActivity(getActivity().getPackageManager()) != null) {
+// startActivity(intent);
+// }
+//
+// }
+// return super.onOptionsItemSelected(item);
+// }