diff options
author | Marco Jacob <mjacob@union06.de> | 2012-05-02 22:22:19 +0200 |
---|---|---|
committer | Marco Jacob <mjacob@union06.de> | 2012-05-02 22:22:19 +0200 |
commit | f77498069f2b37f5e3839f2d11c68509394235f4 (patch) | |
tree | 6936ea0b0afffe35e5621cb5cadedbac6b4f0a15 | |
parent | 2b566f2e55a9bc9332a12e4bc14e221ee00518e1 (diff) | |
download | cgeo-f77498069f2b37f5e3839f2d11c68509394235f4.zip cgeo-f77498069f2b37f5e3839f2d11c68509394235f4.tar.gz cgeo-f77498069f2b37f5e3839f2d11c68509394235f4.tar.bz2 |
show static maps for cache after download dialog
-rw-r--r-- | main/src/cgeo/geocaching/StaticMapsActivity.java | 69 |
1 files changed, 39 insertions, 30 deletions
diff --git a/main/src/cgeo/geocaching/StaticMapsActivity.java b/main/src/cgeo/geocaching/StaticMapsActivity.java index 0cbf01e..4f51d34 100644 --- a/main/src/cgeo/geocaching/StaticMapsActivity.java +++ b/main/src/cgeo/geocaching/StaticMapsActivity.java @@ -51,44 +51,53 @@ public class StaticMapsActivity extends AbstractActivity { finish(); } } else { - if (inflater == null) { - inflater = getLayoutInflater(); - } - - if (smapsView == null) { - smapsView = (LinearLayout) findViewById(R.id.maps_list); - } - smapsView.removeAllViews(); - - for (final Bitmap image : maps) { - if (image != null) { - final ImageView map = (ImageView) inflater.inflate(R.layout.map_static_item, null); - map.setImageBitmap(image); - smapsView.addView(map); - } - } + showStaticMaps(); } } catch (Exception e) { Log.e("StaticMapsActivity.loadMapsHandler: " + e.toString()); } } - }; - DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dialog.dismiss(); - switch (which) { - case DialogInterface.BUTTON_POSITIVE: - downloadStaticMaps(); - break; - - case DialogInterface.BUTTON_NEGATIVE: - showToast(res.getString(R.string.err_detail_not_load_map_static)); - break; + /** + * Shows the static maps. + */ + private void showStaticMaps() { + if (inflater == null) { + inflater = getLayoutInflater(); + } + + if (smapsView == null) { + smapsView = (LinearLayout) findViewById(R.id.maps_list); + } + smapsView.removeAllViews(); + + for (final Bitmap image : maps) { + if (image != null) { + final ImageView map = (ImageView) inflater.inflate(R.layout.map_static_item, null); + map.setImageBitmap(image); + smapsView.addView(map); + } } - finish(); } + + DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + dialog.dismiss(); + switch (which) { + case DialogInterface.BUTTON_POSITIVE: + downloadStaticMaps(); + showStaticMaps(); + return; + + case DialogInterface.BUTTON_NEGATIVE: + showToast(res.getString(R.string.err_detail_not_load_map_static)); + break; + } + finish(); + } + }; + }; @Override |