From 9f4955dd7224baaec07f7efb9f1997d401c89d32 Mon Sep 17 00:00:00 2001 From: "gu.martinm@gmail.com" Date: Wed, 9 Apr 2014 09:21:51 +0200 Subject: [PATCH] Improvements in GUI for google map in weather information app. --- gen/.gitignore | 2 + res/drawable-hdpi/ic_action_map.png | Bin 802 -> 0 bytes res/drawable-hdpi/ic_action_place.png | Bin 0 -> 555 bytes res/drawable-mdpi/ic_action_map.png | Bin 604 -> 0 bytes res/drawable-mdpi/ic_action_place.png | Bin 0 -> 393 bytes res/drawable-xhdpi/ic_action_map.png | Bin 1022 -> 0 bytes res/drawable-xhdpi/ic_action_place.png | Bin 0 -> 698 bytes res/drawable-xxhdpi/ic_action_map.png | Bin 1529 -> 0 bytes res/drawable-xxhdpi/ic_action_place.png | Bin 0 -> 958 bytes res/menu/weather_main_menu.xml | 2 +- res/values/strings.xml | 3 +- .../exampletdd/WeatherInformationMapActivity.java | 53 ++++++++------------- .../fragment/WeatherInformationDataFragment.java | 11 +++-- 13 files changed, 31 insertions(+), 40 deletions(-) create mode 100644 gen/.gitignore delete mode 100644 res/drawable-hdpi/ic_action_map.png create mode 100644 res/drawable-hdpi/ic_action_place.png delete mode 100644 res/drawable-mdpi/ic_action_map.png create mode 100644 res/drawable-mdpi/ic_action_place.png delete mode 100644 res/drawable-xhdpi/ic_action_map.png create mode 100644 res/drawable-xhdpi/ic_action_place.png delete mode 100644 res/drawable-xxhdpi/ic_action_map.png create mode 100644 res/drawable-xxhdpi/ic_action_place.png 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 370cf5c38f3efec6d186a1e65ee9b23efbf0c1cb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 802 zcmV+-1Ks?IP)|3eB;0~7!SPyjh)Rx^smmSjcNVBlsnV2tHk-QM2Geu_G7 zPY(bO0Cx^xAii8KmkE80JK}fQ>-Bbj0FVu7q#Xgk#FzffP^bbSyE0$XDu&boAdaoC z$$QGtSrY(lIg!AL7(eZ4p$<4VqK`8jpM6lsx8q#lW)KQtXPlb?6hF78<5HZH?BE0d zE4IJ{>n5v1*M9J8Xz-PN74j!Zbqr9lWf-c>>+WMxA;G(x#wR(ISvsG>k(fa50pt); zg~aM-iZU$#qA)~bBo+Yk2+k+I0q7zSt2`v9Cjeq9c>F(wlCVMRK%^ww79$cR+z`19 z4o{%ZQQ|uToiZP-%fR4xX+am&gwqKe9b&E}pN9a(aD3cq1fb7vO(%qtqbfzA-=knT zz^OnZcdVFW%Sg#OzeL1OzLJHV2&C5|D5W87p*lN~KqwuyAEQSju2Dxq56h>Ej}eyQ{zP-{b{`mPkL z+yH2XYyL!^K3>{t=4PnIZ=#b_Zq8eWy%a?r{*}%4(03&^@pl8oG07^^^g+x-k+uNH z(XiP^GY#FMHUZ2ldUG{l53T^XAn*l1`{5q|!avt3h-I6>G=(g$*#r2YP*tKz$!Ap~ z08*W2C)Ews8h{#(mk!CdQ(6ZBzR(paA2OPFa9$KAu^8`ydYTA(10Y9$SK`9uMsRrP z&>W_^2-(PJEQPv=0va00m5)ly9GbfSI3D9kM&^S;OxmP}a6Gr@pX>qf#tl2H5VmN# z)$Cg);4u(@VH+wG(u$^!Vd?;+Hl1d`q)zLeMGZ9C--)+1H}!_*6kXq28JkBk-L}Vz g?gxN-2k;}n0Dm9>SJ?%Fr~m)}07*qoM6N<$f=nP{CIA2c diff --git a/res/drawable-hdpi/ic_action_place.png b/res/drawable-hdpi/ic_action_place.png new file mode 100644 index 0000000000000000000000000000000000000000..dba994d8a7f0b5a8d113467b2ccabe2c1338e34b GIT binary patch literal 555 zcmV+`0@VG9P)Q2BcO>9fKqQieJO92Dt@E4WI5n3Lx?w3;|Gn3B#jB@h-F% zHbA1BoB%5S;`#dRi$B6{@~l(QF5SUB;Y+4g}@gh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kdh?Cv;MkMmi!{!g+7<+QxMUT0 zff97J*y5f9a#%*oJ1WTowPopiBLMJA6lAN5{2f``I>(6jgfwRDp_r3EqDi9wpmr}D zNpR?J-&`Z4a?!uFCMA}Q=zxL`7?cb1)fW0=T$Ij|r9v+(Ph4XM0K&JJibgob(ZEa0 z+nNq!7&Y5Sh|uyA!fOqFNK96-1_tD%G;?mA4DEpUz9Nlsy7rgQ`rpBck&w|V=05VTMEHp#a zs4~N^+MEvOhS6|uI!CCuBz2g8c@sh=x%X+&mt92#IWB@aF2z|3p&ZN7b#gVUTZ0V% z*b7ytTH^p#gEdlRVcC~c0OUe}sHXYX1Zn0G9|@T`~jJtpET307*qoM6N<$f=bxXTL1t6 diff --git a/res/drawable-xhdpi/ic_action_place.png b/res/drawable-xhdpi/ic_action_place.png new file mode 100644 index 0000000000000000000000000000000000000000..5e93aeb0bb08a45f68ecf24f74a5ac3300aa5dfe GIT binary patch literal 698 zcmV;r0!96aP)E+E{4cG%1?#yHv_$uj88XngQ*_4KsTuHEYy z30(Z<55Vg@8^J4XOGKZe62(c_+ggjHt))@ljxX~3z1HT5PbM=P9lMgA-V z_z8+*7q{Tp9p+jLaj0Oay%qkd0vD;0@R23gwm9ckrSKyc4_pdu{qvJ;E_qeuF z;J9lvuUqa)JKu@|erS$FnjTdE0ur!SZ%JF@=(qJ^SL(oVR~847Wlx(5;-=5#27|$1 gFc=I5Mtle`0Jtu}*?$Y-5C8xG07*qoM6N<$f*gJ=A^-pY literal 0 HcmV?d00001 diff --git a/res/drawable-xxhdpi/ic_action_map.png b/res/drawable-xxhdpi/ic_action_map.png deleted file mode 100644 index ed72ce91c8788fad8b1a8ade10783d10b60f3ae7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1529 zcmVE2apfI zxBtjKWKRxY_JO_49Iab zo&hT*5C{YUfj}S-2m}JbCE?0;=llD6pl?PJ9#$k*S69cP1U&1TiNuT*u_j=Vz4Kb) z(k_GmAwUQaw1}HBRa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sQ;yy_a||*qbcZXBQFju@Z@1$k#g9- zu)$ITNN(ykdQijr#r2Ky{8cBmA`Ih`3~2NRs)6sB$*(55G3|>J7Ier53<(Dzphdt? zdN-Alf_jvK0{jk}pd|uEO8&8rq#z+cAOr{j0zSEGyHoy^p%)~VuvjG!2m}IwKp+qZ f1Oh=m{t7SvM#&ydtJi}g00000NkvXXu0mjfVK&0o diff --git a/res/drawable-xxhdpi/ic_action_place.png b/res/drawable-xxhdpi/ic_action_place.png new file mode 100644 index 0000000000000000000000000000000000000000..25623c77978465aeb0d75674a88bd721f2aa3bbb GIT binary patch literal 958 zcmV;v13~ES_G;v+i=t>LfM4KUz!&!V z*z+xFd+n?c2MW+V@GHsqA#je^A_`G}1%4`lUygJO=ZG&zrKtc4{@ng~l=?mnr8BZyFB731A1k z9I(yw;YK>Id`ggXJYSWw|0Q>}6g}tSfE8Hq9iOsrfYjR`o^MmhqNW#6`(Ez^CmjyOa{8&j>F--|T9;OpdbK*>`pOo&vn4PcZw=1GAI`m<7<# z1U)Z)7g&Jf5T!`6yf&}*f`;f|nv?|?>ah?P=q31P#4ACvm^vC<+R)DqX-vX3umHgy z+?wPt$PWBWUI1(HI&`Oj>`tw9Km{25O5>45Edln-enkP~(4+wh{!vP!$;APV9gqNO zj+`i49%VAFvJ*fiJcP-((s&>X!2u{`NVOqQ6+kji(*+0ZuPse7&p>qtstX_)sF8(g zttXlT9Azf=#1ufm1upyd6hN;RFHr`K_B~;jm9qfZzd#u?+EWo_PT3FVfB-Il%6>!# zI5xRtKcoO7c0@3p54r=!%G45ZppXKL-~!0(M|Qx_8M{FpB&-19f*}@X2jpMOLVr5C z1anee0t|3oP$OqQOa6&S%Gc4o-IH!H+_Kb1+S}r>a}@+8>nw z;)1ec_O}#ZSP}MDF3#MdtBhq_F?~tz+Lm$~(}1E9;EKiB0pXxMWe1#H(58_6Q3@cf z7;2`~@+6JvxBLI@#*5JCtc ggb+gd@LPZZ00z4O$j^F$r~m)}07*qoM6N<$f)f{~B>(^b literal 0 HcmV?d00001 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 -- 2.1.4