From: gu.martinm@gmail.com Date: Wed, 9 Apr 2014 07:21:51 +0000 (+0200) Subject: Improvements in GUI for google map in weather information app. X-Git-Tag: weatherinformation-1.0~183 X-Git-Url: https://git.gumartinm.name/?a=commitdiff_plain;h=9f4955dd7224baaec07f7efb9f1997d401c89d32;p=AndroidWeatherInformation Improvements in GUI for google map in weather information app. --- diff --git a/gen/.gitignore b/gen/.gitignore new file mode 100644 index 0000000..d4ffb9e --- /dev/null +++ b/gen/.gitignore @@ -0,0 +1,2 @@ +/com +/de diff --git a/res/drawable-hdpi/ic_action_map.png b/res/drawable-hdpi/ic_action_map.png deleted file mode 100644 index 370cf5c..0000000 Binary files a/res/drawable-hdpi/ic_action_map.png and /dev/null differ diff --git a/res/drawable-hdpi/ic_action_place.png b/res/drawable-hdpi/ic_action_place.png new file mode 100644 index 0000000..dba994d Binary files /dev/null and b/res/drawable-hdpi/ic_action_place.png differ diff --git a/res/drawable-mdpi/ic_action_map.png b/res/drawable-mdpi/ic_action_map.png deleted file mode 100644 index 50a9100..0000000 Binary files a/res/drawable-mdpi/ic_action_map.png and /dev/null differ diff --git a/res/drawable-mdpi/ic_action_place.png b/res/drawable-mdpi/ic_action_place.png new file mode 100644 index 0000000..ce055ca Binary files /dev/null and b/res/drawable-mdpi/ic_action_place.png differ diff --git a/res/drawable-xhdpi/ic_action_map.png b/res/drawable-xhdpi/ic_action_map.png deleted file mode 100644 index 537c5a4..0000000 Binary files a/res/drawable-xhdpi/ic_action_map.png and /dev/null differ diff --git a/res/drawable-xhdpi/ic_action_place.png b/res/drawable-xhdpi/ic_action_place.png new file mode 100644 index 0000000..5e93aeb Binary files /dev/null and b/res/drawable-xhdpi/ic_action_place.png differ diff --git a/res/drawable-xxhdpi/ic_action_map.png b/res/drawable-xxhdpi/ic_action_map.png deleted file mode 100644 index ed72ce9..0000000 Binary files a/res/drawable-xxhdpi/ic_action_map.png and /dev/null differ diff --git a/res/drawable-xxhdpi/ic_action_place.png b/res/drawable-xxhdpi/ic_action_place.png new file mode 100644 index 0000000..25623c7 Binary files /dev/null and b/res/drawable-xxhdpi/ic_action_place.png differ diff --git a/res/menu/weather_main_menu.xml b/res/menu/weather_main_menu.xml index 33a8e65..a589c87 100644 --- a/res/menu/weather_main_menu.xml +++ b/res/menu/weather_main_menu.xml @@ -28,7 +28,7 @@ Language city not found country not found - Downloading remote data + Downloading remote data + Please wait… diff --git a/src/de/example/exampletdd/WeatherInformationMapActivity.java b/src/de/example/exampletdd/WeatherInformationMapActivity.java index ad67b52..779a243 100644 --- a/src/de/example/exampletdd/WeatherInformationMapActivity.java +++ b/src/de/example/exampletdd/WeatherInformationMapActivity.java @@ -20,9 +20,9 @@ import android.os.Bundle; import android.util.Log; import android.widget.TextView; +import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.GoogleMap.OnMapLongClickListener; -import com.google.android.gms.maps.GoogleMap.OnMarkerClickListener; import com.google.android.gms.maps.MapFragment; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.Marker; @@ -50,13 +50,6 @@ public class WeatherInformationMapActivity extends Activity { this.mMap.setMyLocationEnabled(true); this.mMap.getUiSettings().setCompassEnabled(false); this.mMap.setOnMapLongClickListener(new LongClickListener()); - this.mMap.setOnMarkerClickListener(new MarkerClickListener()); - - } - - @Override - public void onResume() { - super.onResume(); GeocodingData geocodingData = null; try { @@ -75,9 +68,11 @@ public class WeatherInformationMapActivity extends Activity { final LatLng point = new LatLng( geocodingData.getLatitude(), geocodingData.getLongitude()); this.mMap.clear(); - this.mMarker = this.mMap.addMarker(new MarkerOptions().position( - point).draggable( - true)); + this.mMarker = this.mMap.addMarker(new MarkerOptions().position(point).draggable(true)); + + this.mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(point,15)); + this.mMap.animateCamera(CameraUpdateFactory.zoomIn()); + this.mMap.animateCamera(CameraUpdateFactory.zoomTo(15), 2000, null); final TextView cityCountry = (TextView) WeatherInformationMapActivity.this .findViewById(R.id.weather_map_citycountry_data); @@ -128,16 +123,7 @@ public class WeatherInformationMapActivity extends Activity { @Override public void onMapLongClick(final LatLng point) { - if (WeatherInformationMapActivity.this.mMarker == null) { - WeatherInformationMapActivity.this.mMarker = WeatherInformationMapActivity.this.mMap - .addMarker(new MarkerOptions().position(point).draggable( - true)); - } else { - WeatherInformationMapActivity.this.mMarker.setPosition(point); - } - final GeocoderAsyncTask geocoderAsyncTask = new GeocoderAsyncTask(); - geocoderAsyncTask.execute(point.latitude, point.longitude); } } @@ -148,7 +134,8 @@ public class WeatherInformationMapActivity extends Activity { public GeocoderAsyncTask() { this.newFragment = ProgressDialogFragment - .newInstance(R.string.weather_progress_getdata); + .newInstance(R.string.progress_dialog_get_remote_data, + WeatherInformationMapActivity.this.getString(R.string.progress_dialog_generic_message)); } @Override @@ -198,6 +185,7 @@ public class WeatherInformationMapActivity extends Activity { private void onPostExecuteThrowable(final GeocodingData geocodingData) throws FileNotFoundException, IOException { + WeatherInformationMapActivity.this.storeGeocodingDataToFile(geocodingData); final String city = (geocodingData.getCity() == null) ? @@ -206,11 +194,18 @@ public class WeatherInformationMapActivity extends Activity { final String country = (geocodingData.getCountry() == null) ? WeatherInformationMapActivity.this.getString(R.string.country_not_found) : geocodingData.getCountry(); - final TextView cityCountry = (TextView) WeatherInformationMapActivity.this - .findViewById(R.id.weather_map_citycountry_data); - + .findViewById(R.id.weather_map_citycountry_data); cityCountry.setText(city + "," + country); + + final LatLng point = new LatLng(geocodingData.getLatitude(), geocodingData.getLongitude()); + if (WeatherInformationMapActivity.this.mMarker == null) { + WeatherInformationMapActivity.this.mMarker = + WeatherInformationMapActivity.this.mMap.addMarker + (new MarkerOptions().position(point).draggable(true)); + } else { + WeatherInformationMapActivity.this.mMarker.setPosition(point); + } } private GeocodingData getGeocodingData(final double latitude, final double longitude) throws IOException { @@ -234,14 +229,4 @@ public class WeatherInformationMapActivity extends Activity { } } - - private class MarkerClickListener implements OnMarkerClickListener { - - @Override - public boolean onMarkerClick(final Marker marker) { - marker.getPosition(); - return false; - } - - } } diff --git a/src/de/example/exampletdd/fragment/WeatherInformationDataFragment.java b/src/de/example/exampletdd/fragment/WeatherInformationDataFragment.java index efc8657..5d60ecf 100644 --- a/src/de/example/exampletdd/fragment/WeatherInformationDataFragment.java +++ b/src/de/example/exampletdd/fragment/WeatherInformationDataFragment.java @@ -210,11 +210,12 @@ public class WeatherInformationDataFragment extends Fragment implements GetWeath entries.set(6, new WeatherDataEntry(this.getString(R.string.text_field_cloudiness), tempFormatter.format(cloudiness))); } - if (weatherData.getIconData() != null) { + if (weatherData.getWeather().getIcon() != null) { final Bitmap icon = BitmapFactory.decodeByteArray( weatherData.getIconData(), 0, weatherData.getIconData().length); - final ImageView imageIcon = (ImageView) this.getActivity().findViewById(R.id.weather_picture); + final ImageView imageIcon = (ImageView) this.getActivity() + .findViewById(R.id.weather_picture); imageIcon.setImageBitmap(icon); } @@ -285,8 +286,10 @@ public class WeatherInformationDataFragment extends Fragment implements GetWeath final WeatherService weatherService) { this.weatherHTTPClient = weatherHTTPClient; this.weatherService = weatherService; - this.newFragment = ProgressDialogFragment - .newInstance(R.string.weather_progress_getdata); + this.newFragment = ProgressDialogFragment.newInstance( + R.string.progress_dialog_get_remote_data, + WeatherInformationDataFragment.this + .getString(R.string.progress_dialog_generic_message)); } @Override