diff options
author | Chih-Chung Chang <chihchung@google.com> | 2009-05-14 19:19:17 +0800 |
---|---|---|
committer | Chih-Chung Chang <chihchung@google.com> | 2009-05-15 11:24:08 +0800 |
commit | f6e6d2b5815106c406cdca52eaa75de7c5998be1 (patch) | |
tree | 31f48e583344a2a7461334a1b608393b1b2c1b6c /src/com/android/camera/MenuHelper.java | |
parent | 5de4e421e17f1c2ed35fa1ccf8777838e884f66b (diff) | |
download | LegacyCamera-f6e6d2b5815106c406cdca52eaa75de7c5998be1.zip LegacyCamera-f6e6d2b5815106c406cdca52eaa75de7c5998be1.tar.gz LegacyCamera-f6e6d2b5815106c406cdca52eaa75de7c5998be1.tar.bz2 |
Fix problems identified by findbugs fixit.
Diffstat (limited to 'src/com/android/camera/MenuHelper.java')
-rw-r--r-- | src/com/android/camera/MenuHelper.java | 53 |
1 files changed, 24 insertions, 29 deletions
diff --git a/src/com/android/camera/MenuHelper.java b/src/com/android/camera/MenuHelper.java index 8aad194..363b429 100644 --- a/src/com/android/camera/MenuHelper.java +++ b/src/com/android/camera/MenuHelper.java @@ -212,16 +212,13 @@ public class MenuHelper { try { Geocoder geocoder = new Geocoder(context); - List<Address> address = geocoder.getFromLocation( - lat, lng, 1); - Iterator<Address> iterator = address.iterator(); - - while (iterator.hasNext()) { - Address addr = iterator.next(); - value += addr.getAddressLine( - addr.getMaxAddressLineIndex()); - Log.v(TAG, addr.toString()); + List<Address> address = geocoder.getFromLocation(lat, lng, 1); + StringBuilder sb = new StringBuilder(); + for (Address addr : address) { + int index = addr.getMaxAddressLineIndex(); + sb.append(addr.getAddressLine(index)); } + value = sb.toString(); } catch (IOException ex) { // Ignore this exception. value = EMPTY_STRING; @@ -665,26 +662,24 @@ public class MenuHelper { // is really a framework bug in that it shouldn't show the submenu // if the submenu has no visible items. requiresWriteAccessItems.add(rotateSubmenu.getItem()); - if (rotateSubmenu != null) { - requiresWriteAccessItems.add( - rotateSubmenu.add(0, MENU_IMAGE_ROTATE_LEFT, 50, - R.string.rotate_left) - .setOnMenuItemClickListener( - new MenuItem.OnMenuItemClickListener() { - public boolean onMenuItemClick(MenuItem item) { - return onRotateClicked(onInvoke, -90); - } - }).setAlphabeticShortcut('l')); - requiresWriteAccessItems.add( - rotateSubmenu.add(0, MENU_IMAGE_ROTATE_RIGHT, 60, - R.string.rotate_right) - .setOnMenuItemClickListener( - new MenuItem.OnMenuItemClickListener() { - public boolean onMenuItemClick(MenuItem item) { - return onRotateClicked(onInvoke, 90); - } - }).setAlphabeticShortcut('r')); - } + requiresWriteAccessItems.add( + rotateSubmenu.add(0, MENU_IMAGE_ROTATE_LEFT, 50, + R.string.rotate_left) + .setOnMenuItemClickListener( + new MenuItem.OnMenuItemClickListener() { + public boolean onMenuItemClick(MenuItem item) { + return onRotateClicked(onInvoke, -90); + } + }).setAlphabeticShortcut('l')); + requiresWriteAccessItems.add( + rotateSubmenu.add(0, MENU_IMAGE_ROTATE_RIGHT, 60, + R.string.rotate_right) + .setOnMenuItemClickListener( + new MenuItem.OnMenuItemClickListener() { + public boolean onMenuItemClick(MenuItem item) { + return onRotateClicked(onInvoke, 90); + } + }).setAlphabeticShortcut('r')); } if (isImage && ((inclusions & INCLUDE_CROP_MENU) != 0)) { |