diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2011-10-08 16:50:50 +0200 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2011-10-08 16:50:50 +0200 |
| commit | 0f93713aeba816ded5e99acef86419da90507aaf (patch) | |
| tree | 7181f65bad0340dba04c974722ec9abac0513f1c /main/src/cgeo/geocaching | |
| parent | 9731ffa193c81c77ad64cb06c7574098113fd316 (diff) | |
| download | cgeo-0f93713aeba816ded5e99acef86419da90507aaf.zip cgeo-0f93713aeba816ded5e99acef86419da90507aaf.tar.gz cgeo-0f93713aeba816ded5e99acef86419da90507aaf.tar.bz2 | |
Various mechanical code cleanups
The cleanups, most of which were found by CodePro Tools, are of the
following categories:
- remove unnecessary type casts (and, subsequently, unnecessary import
statements)
- transform "if (test) return true; else return false" statements into
simpler "return test"
- mark abstract class as such
- remove unnecessary overrides (method only calling its super method)
Diffstat (limited to 'main/src/cgeo/geocaching')
| -rw-r--r-- | main/src/cgeo/geocaching/GCVote.java | 2 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgCacheListAdapter.java | 24 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgData.java | 130 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgGPXListAdapter.java | 7 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgMapfileListAdapter.java | 7 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgSearchThread.java | 2 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgeoaddresses.java | 6 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgeocaches.java | 14 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgeodetail.java | 2 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgeopopup.java | 3 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgeotrackable.java | 11 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgeowaypointadd.java | 4 |
12 files changed, 94 insertions, 118 deletions
diff --git a/main/src/cgeo/geocaching/GCVote.java b/main/src/cgeo/geocaching/GCVote.java index 73e08a6..e6fbbe3 100644 --- a/main/src/cgeo/geocaching/GCVote.java +++ b/main/src/cgeo/geocaching/GCVote.java @@ -91,7 +91,7 @@ public final class GCVote { final Matcher matcherGuid = patternGuid.matcher(voteData); if (matcherGuid.find()) { if (matcherGuid.groupCount() > 0) { - guid = (String) matcherGuid.group(1); + guid = matcherGuid.group(1); } } } catch (Exception e) { diff --git a/main/src/cgeo/geocaching/cgCacheListAdapter.java b/main/src/cgeo/geocaching/cgCacheListAdapter.java index 9d27491..62762be 100644 --- a/main/src/cgeo/geocaching/cgCacheListAdapter.java +++ b/main/src/cgeo/geocaching/cgCacheListAdapter.java @@ -85,7 +85,7 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> { if (gcIconDrawables == null || gcIconDrawables.isEmpty()) { for (String cacheType : cgBase.cacheTypesInv.keySet()) { - gcIconDrawables.put(cacheType, (Drawable) activity.getResources().getDrawable(cgBase.getCacheIcon(cacheType))); + gcIconDrawables.put(cacheType, activity.getResources().getDrawable(cgBase.getCacheIcon(cacheType))); } } @@ -155,11 +155,7 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> { } public boolean isFilter() { - if (currentFilter != null) { - return true; - } else { - return false; - } + return currentFilter != null; } public String getFilterName() { @@ -253,14 +249,14 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> { try { if (statComparator != null) { - Collections.sort((List<cgCache>) list, statComparator); + Collections.sort(list, statComparator); } else { if (coordsIn == null) { return; } final DistanceComparator dstComparator = new DistanceComparator(coordsIn); - Collections.sort((List<cgCache>) list, dstComparator); + Collections.sort(list, dstComparator); } notifyDataSetChanged(); } catch (Exception e) { @@ -278,10 +274,10 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> { if (list != null && list.isEmpty() == false && (System.currentTimeMillis() - lastSort) > 1000 && sort) { try { if (statComparator != null) { - Collections.sort((List<cgCache>) list, statComparator); + Collections.sort(list, statComparator); } else { final DistanceComparator dstComparator = new DistanceComparator(coordsIn); - Collections.sort((List<cgCache>) list, dstComparator); + Collections.sort(list, dstComparator); } notifyDataSetChanged(); } catch (Exception e) { @@ -344,11 +340,7 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> { setSelectMode(false, false); notifyDataSetChanged(); - if (cleared > 0 || status) { - return true; - } else { - return false; - } + return cleared > 0 || status; } @Override @@ -367,7 +359,7 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> { View v = rowView; if (v == null) { - v = (View) inflater.inflate(R.layout.cache, null); + v = inflater.inflate(R.layout.cache, null); holder = new cgCacheView(); holder.oneCache = (RelativeLayout) v.findViewById(R.id.one_cache); diff --git a/main/src/cgeo/geocaching/cgData.java b/main/src/cgeo/geocaching/cgData.java index 86d6b60..f27be4c 100644 --- a/main/src/cgeo/geocaching/cgData.java +++ b/main/src/cgeo/geocaching/cgData.java @@ -950,7 +950,7 @@ public class cgData { index = cursor.getColumnIndex("geocode"); do { - list.add((String) cursor.getString(index)); + list.add(cursor.getString(index)); } while (cursor.moveToNext()); } else { cursor.close(); @@ -1011,11 +1011,11 @@ public class cgData { cursor.moveToFirst(); index = cursor.getColumnIndex("updated"); - dataUpdated = (long) cursor.getLong(index); + dataUpdated = cursor.getLong(index); index = cursor.getColumnIndex("detailedupdate"); - dataDetailedUpdate = (long) cursor.getLong(index); + dataDetailedUpdate = cursor.getLong(index); index = cursor.getColumnIndex("detailed"); - dataDetailed = (int) cursor.getInt(index); + dataDetailed = cursor.getInt(index); } } } catch (Exception e) { @@ -1089,7 +1089,7 @@ public class cgData { cursor.moveToFirst(); index = cursor.getColumnIndex("reason"); - reason = (long) cursor.getLong(index); + reason = cursor.getLong(index); } cursor.close(); @@ -1098,11 +1098,7 @@ public class cgData { Log.e(Settings.tag, "cgData.isOffline: " + e.toString()); } - if (reason >= 1) { - return true; - } else { - return false; - } + return reason >= 1; } public String getGeocodeForGuid(String guid) { @@ -1133,7 +1129,7 @@ public class cgData { cursor.moveToFirst(); index = cursor.getColumnIndex("geocode"); - geocode = (String) cursor.getString(index); + geocode = cursor.getString(index); } } } catch (Exception e) { @@ -1175,7 +1171,7 @@ public class cgData { cursor.moveToFirst(); index = cursor.getColumnIndex("cacheid"); - cacheid = (String) cursor.getString(index); + cacheid = cursor.getString(index); } } } catch (Exception e) { @@ -2036,22 +2032,22 @@ public class cgData { int index; cgCache cache = new cgCache(); - cache.updated = (long) cursor.getLong(cursor.getColumnIndex("updated")); - cache.reason = (int) cursor.getInt(cursor.getColumnIndex("reason")); + cache.updated = cursor.getLong(cursor.getColumnIndex("updated")); + cache.reason = cursor.getInt(cursor.getColumnIndex("reason")); cache.detailed = cursor.getInt(cursor.getColumnIndex("detailed")) == 1; cache.detailedUpdate = (Long) cursor.getLong(cursor.getColumnIndex("detailedupdate")); cache.visitedDate = (Long) cursor.getLong(cursor.getColumnIndex("visiteddate")); - cache.geocode = (String) cursor.getString(cursor.getColumnIndex("geocode")); - cache.cacheId = (String) cursor.getString(cursor.getColumnIndex("cacheid")); - cache.guid = (String) cursor.getString(cursor.getColumnIndex("guid")); - cache.type = (String) cursor.getString(cursor.getColumnIndex("type")); - cache.name = (String) cursor.getString(cursor.getColumnIndex("name")); + cache.geocode = cursor.getString(cursor.getColumnIndex("geocode")); + cache.cacheId = cursor.getString(cursor.getColumnIndex("cacheid")); + cache.guid = cursor.getString(cursor.getColumnIndex("guid")); + cache.type = cursor.getString(cursor.getColumnIndex("type")); + cache.name = cursor.getString(cursor.getColumnIndex("name")); cache.own = cursor.getInt(cursor.getColumnIndex("own")) == 1; - cache.owner = (String) cursor.getString(cursor.getColumnIndex("owner")); - cache.ownerReal = (String) cursor.getString(cursor.getColumnIndex("owner_real")); - cache.hidden = new Date((long) cursor.getLong(cursor.getColumnIndex("hidden"))); - cache.hint = (String) cursor.getString(cursor.getColumnIndex("hint")); - cache.size = CacheSize.FIND_BY_ID.get((String) cursor.getString(cursor.getColumnIndex("size"))); + cache.owner = cursor.getString(cursor.getColumnIndex("owner")); + cache.ownerReal = cursor.getString(cursor.getColumnIndex("owner_real")); + cache.hidden = new Date(cursor.getLong(cursor.getColumnIndex("hidden"))); + cache.hint = cursor.getString(cursor.getColumnIndex("hint")); + cache.size = CacheSize.FIND_BY_ID.get(cursor.getString(cursor.getColumnIndex("size"))); cache.difficulty = (Float) cursor.getFloat(cursor.getColumnIndex("difficulty")); index = cursor.getColumnIndex("direction"); if (cursor.isNull(index)) { @@ -2066,8 +2062,8 @@ public class cgData { cache.distance = cursor.getFloat(index); } cache.terrain = (Float) cursor.getFloat(cursor.getColumnIndex("terrain")); - cache.latlon = (String) cursor.getString(cursor.getColumnIndex("latlon")); - cache.location = (String) cursor.getString(cursor.getColumnIndex("location")); + cache.latlon = cursor.getString(cursor.getColumnIndex("latlon")); + cache.location = cursor.getString(cursor.getColumnIndex("location")); cache.coords = getCoords(cursor); index = cursor.getColumnIndex("elevation"); if (cursor.isNull(index)) { @@ -2075,8 +2071,8 @@ public class cgData { } else { cache.elevation = (Double) cursor.getDouble(index); } - cache.personalNote = (String) cursor.getString(cursor.getColumnIndex("personal_note")); - cache.shortdesc = (String) cursor.getString(cursor.getColumnIndex("shortdesc")); + cache.personalNote = cursor.getString(cursor.getColumnIndex("personal_note")); + cache.shortdesc = cursor.getString(cursor.getColumnIndex("shortdesc")); // do not set cache.description ! cache.favouriteCnt = (Integer) cursor.getInt(cursor.getColumnIndex("favourite_cnt")); cache.rating = (Float) cursor.getFloat(cursor.getColumnIndex("rating")); @@ -2117,7 +2113,7 @@ public class cgData { int index = cursor.getColumnIndex("attribute"); do { - attributes.add((String) cursor.getString(index)); + attributes.add(cursor.getString(index)); } while (cursor.moveToNext()); } @@ -2199,15 +2195,15 @@ public class cgData { private static cgWaypoint createWaypointFromDatabaseContent(Cursor cursor) { cgWaypoint waypoint = new cgWaypoint(); - waypoint.id = (int) cursor.getInt(cursor.getColumnIndex("_id")); - waypoint.geocode = (String) cursor.getString(cursor.getColumnIndex("geocode")); - waypoint.type = (String) cursor.getString(cursor.getColumnIndex("type")); - waypoint.setPrefix((String) cursor.getString(cursor.getColumnIndex("prefix"))); - waypoint.lookup = (String) cursor.getString(cursor.getColumnIndex("lookup")); - waypoint.name = (String) cursor.getString(cursor.getColumnIndex("name")); - waypoint.latlon = (String) cursor.getString(cursor.getColumnIndex("latlon")); + waypoint.id = cursor.getInt(cursor.getColumnIndex("_id")); + waypoint.geocode = cursor.getString(cursor.getColumnIndex("geocode")); + waypoint.type = cursor.getString(cursor.getColumnIndex("type")); + waypoint.setPrefix(cursor.getString(cursor.getColumnIndex("prefix"))); + waypoint.lookup = cursor.getString(cursor.getColumnIndex("lookup")); + waypoint.name = cursor.getString(cursor.getColumnIndex("name")); + waypoint.latlon = cursor.getString(cursor.getColumnIndex("latlon")); waypoint.coords = getCoords(cursor); - waypoint.note = (String) cursor.getString(cursor.getColumnIndex("note")); + waypoint.note = cursor.getString(cursor.getColumnIndex("note")); return waypoint; } @@ -2239,9 +2235,9 @@ public class cgData { do { cgImage spoiler = new cgImage(); - spoiler.url = (String) cursor.getString(indexUrl); - spoiler.title = (String) cursor.getString(indexTitle); - spoiler.description = (String) cursor.getString(indexDescription); + spoiler.url = cursor.getString(indexUrl); + spoiler.title = cursor.getString(indexTitle); + spoiler.description = cursor.getString(indexDescription); spoilers.add(spoiler); } while (cursor.moveToNext()); @@ -2283,8 +2279,8 @@ public class cgData { do { final cgDestination dest = new cgDestination(); - dest.setId((long) cursor.getLong(indexId)); - dest.setDate((long) cursor.getLong(indexDate)); + dest.setId(cursor.getLong(indexId)); + dest.setDate(cursor.getLong(indexDate)); dest.setCoords(getCoords(cursor, indexLatitude, indexLongitude)); // If coordinates are non-existent or invalid, do not consider @@ -2348,21 +2344,21 @@ public class cgData { while (cursor.moveToNext() && logs.size() < 100) { if (log == null || log.id != cursor.getInt(indexLogsId)) { log = new cgLog(); - log.id = (int) cursor.getInt(indexLogsId); - log.type = (int) cursor.getInt(indexType); - log.author = (String) cursor.getString(indexAuthor); - log.log = (String) cursor.getString(indexLog); - log.date = (long) cursor.getLong(indexDate); - log.found = (int) cursor.getInt(indexFound); + log.id = cursor.getInt(indexLogsId); + log.type = cursor.getInt(indexType); + log.author = cursor.getString(indexAuthor); + log.log = cursor.getString(indexLog); + log.date = cursor.getLong(indexDate); + log.found = cursor.getInt(indexFound); logs.add(log); } if (!cursor.isNull(indexLogImagesId)) { final cgImage log_img = new cgImage(); - log_img.title = (String) cursor.getString(indexTitle); + log_img.title = cursor.getString(indexTitle); if (log_img.title == null) { log_img.title = ""; } - log_img.url = (String) cursor.getString(indexUrl); + log_img.url = cursor.getString(indexUrl); if (log_img.url == null) { log_img.url = ""; } @@ -2489,18 +2485,18 @@ public class cgData { private cgTrackable createTrackableFromDatabaseContent(Cursor cursor) { cgTrackable trackable = new cgTrackable(); - trackable.geocode = (String) cursor.getString(cursor.getColumnIndex("tbcode")); - trackable.guid = (String) cursor.getString(cursor.getColumnIndex("guid")); - trackable.name = (String) cursor.getString(cursor.getColumnIndex("title")); - trackable.owner = (String) cursor.getString(cursor.getColumnIndex("owner")); + trackable.geocode = cursor.getString(cursor.getColumnIndex("tbcode")); + trackable.guid = cursor.getString(cursor.getColumnIndex("guid")); + trackable.name = cursor.getString(cursor.getColumnIndex("title")); + trackable.owner = cursor.getString(cursor.getColumnIndex("owner")); String releasedPre = cursor.getString(cursor.getColumnIndex("released")); if (releasedPre != null && Long.getLong(releasedPre) != null) { trackable.released = new Date(Long.getLong(releasedPre)); } else { trackable.released = null; } - trackable.goal = (String) cursor.getString(cursor.getColumnIndex("goal")); - trackable.details = (String) cursor.getString(cursor.getColumnIndex("description")); + trackable.goal = cursor.getString(cursor.getColumnIndex("goal")); + trackable.details = cursor.getString(cursor.getColumnIndex("description")); trackable.logs = loadLogs(trackable.geocode); return trackable; } @@ -2598,7 +2594,7 @@ public class cgData { int index = cursor.getColumnIndex("geocode"); do { - geocodes.add((String) cursor.getString(index)); + geocodes.add(cursor.getString(index)); } while (cursor.moveToNext()); } else { cursor.close(); @@ -2649,7 +2645,7 @@ public class cgData { int index = cursor.getColumnIndex("geocode"); do { - geocodes.add((String) cursor.getString(index)); + geocodes.add(cursor.getString(index)); } while (cursor.moveToNext()); } else { cursor.close(); @@ -2739,7 +2735,7 @@ public class cgData { int index = cursor.getColumnIndex("geocode"); do { - geocodes.add((String) cursor.getString(index)); + geocodes.add(cursor.getString(index)); } while (cursor.moveToNext()); } else { cursor.close(); @@ -2791,7 +2787,7 @@ public class cgData { int index = cursor.getColumnIndex("geocode"); do { - geocodes.add((String) cursor.getString(index)); + geocodes.add(cursor.getString(index)); } while (cursor.moveToNext()); } else { cursor.close(); @@ -3042,10 +3038,10 @@ public class cgData { cursor.moveToFirst(); log = new cgLog(); - log.id = (int) cursor.getInt(cursor.getColumnIndex("_id")); - log.type = (int) cursor.getInt(cursor.getColumnIndex("type")); - log.log = (String) cursor.getString(cursor.getColumnIndex("log")); - log.date = (long) cursor.getLong(cursor.getColumnIndex("date")); + log.id = cursor.getInt(cursor.getColumnIndex("_id")); + log.type = cursor.getInt(cursor.getColumnIndex("type")); + log.log = cursor.getString(cursor.getColumnIndex("log")); + log.date = cursor.getLong(cursor.getColumnIndex("date")); } if (cursor != null) { @@ -3163,8 +3159,8 @@ public class cgData { do { cgList list = new cgList(false); - list.id = ((int) cursor.getInt(indexId)) + 10; - list.title = (String) cursor.getString(indexTitle); + list.id = (cursor.getInt(indexId)) + 10; + list.title = cursor.getString(indexTitle); list.updated = (Long) cursor.getLong(indexUpdated); list.coords = getCoords(cursor, indexLatitude, indexLongitude); @@ -3238,7 +3234,7 @@ public class cgData { values.put("title", name); values.put("updated", System.currentTimeMillis()); - count = (int) databaseRW.update(dbTableLists, values, "_id = " + (listId - 10), null); + count = databaseRW.update(dbTableLists, values, "_id = " + (listId - 10), null); databaseRW.setTransactionSuccessful(); } finally { databaseRW.endTransaction(); diff --git a/main/src/cgeo/geocaching/cgGPXListAdapter.java b/main/src/cgeo/geocaching/cgGPXListAdapter.java index 92d701f..786d1f2 100644 --- a/main/src/cgeo/geocaching/cgGPXListAdapter.java +++ b/main/src/cgeo/geocaching/cgGPXListAdapter.java @@ -37,7 +37,7 @@ public class cgGPXListAdapter extends ArrayAdapter<File> { View v = rowView; if (v == null) { - v = (View) inflater.inflate(R.layout.gpx_item, null); + v = inflater.inflate(R.layout.gpx_item, null); holder = new cgGPXView(); holder.filepath = (TextView) v.findViewById(R.id.filepath); @@ -57,11 +57,6 @@ public class cgGPXListAdapter extends ArrayAdapter<File> { return v; } - @Override - public void notifyDataSetChanged() { - super.notifyDataSetChanged(); - } - private class touchListener implements View.OnClickListener { private File file = null; diff --git a/main/src/cgeo/geocaching/cgMapfileListAdapter.java b/main/src/cgeo/geocaching/cgMapfileListAdapter.java index e52e517..dbac179 100644 --- a/main/src/cgeo/geocaching/cgMapfileListAdapter.java +++ b/main/src/cgeo/geocaching/cgMapfileListAdapter.java @@ -39,7 +39,7 @@ public class cgMapfileListAdapter extends ArrayAdapter<File> { View v = rowView; if (v == null) { - v = (View) inflater.inflate(R.layout.mapfile_item, null); + v = inflater.inflate(R.layout.mapfile_item, null); holder = new MapfileView(); holder.filepath = (TextView) v.findViewById(R.id.mapfilepath); @@ -67,11 +67,6 @@ public class cgMapfileListAdapter extends ArrayAdapter<File> { return v; } - @Override - public void notifyDataSetChanged() { - super.notifyDataSetChanged(); - } - private class touchListener implements View.OnClickListener { private File file = null; diff --git a/main/src/cgeo/geocaching/cgSearchThread.java b/main/src/cgeo/geocaching/cgSearchThread.java index 0d802f3..3daddc5 100644 --- a/main/src/cgeo/geocaching/cgSearchThread.java +++ b/main/src/cgeo/geocaching/cgSearchThread.java @@ -3,7 +3,7 @@ package cgeo.geocaching; import android.os.Handler; import android.util.Log; -public class cgSearchThread extends Thread { +abstract public class cgSearchThread extends Thread { private Handler recaptchaHandler = null; private String recaptchaChallenge = null; private String recaptchaText = null; diff --git a/main/src/cgeo/geocaching/cgeoaddresses.java b/main/src/cgeo/geocaching/cgeoaddresses.java index 8941fe2..688d645 100644 --- a/main/src/cgeo/geocaching/cgeoaddresses.java +++ b/main/src/cgeo/geocaching/cgeoaddresses.java @@ -136,9 +136,9 @@ public class cgeoaddresses extends AbstractActivity { public void onClick(View arg0) { Intent addressIntent = new Intent(cgeoaddresses.this, cgeocaches.class); addressIntent.putExtra("type", "address"); - addressIntent.putExtra("latitude", (Double) latitude); - addressIntent.putExtra("longitude", (Double) longitude); - addressIntent.putExtra("address", (String) address); + addressIntent.putExtra("latitude", latitude); + addressIntent.putExtra("longitude", longitude); + addressIntent.putExtra("address", address); addressIntent.putExtra("cachetype", Settings.getCacheType()); startActivity(addressIntent); diff --git a/main/src/cgeo/geocaching/cgeocaches.java b/main/src/cgeo/geocaching/cgeocaches.java index a823238..8c49afa 100644 --- a/main/src/cgeo/geocaching/cgeocaches.java +++ b/main/src/cgeo/geocaching/cgeocaches.java @@ -188,7 +188,7 @@ public class cgeocaches extends AbstractListActivity { cacheList.addAll(cacheListTmp); cacheListTmp.clear(); - Collections.sort((List<cgCache>) cacheList, gcComparator); + Collections.sort(cacheList, gcComparator); } } else { setTitle(title); @@ -285,7 +285,7 @@ public class cgeocaches extends AbstractListActivity { if (CollectionUtils.isNotEmpty(cacheListTmp)) { cacheList.addAll(cacheListTmp); cacheListTmp.clear(); - Collections.sort((List<cgCache>) cacheList, gcComparator); + Collections.sort(cacheList, gcComparator); } if (adapter != null) { adapter.reFilter(); @@ -357,7 +357,7 @@ public class cgeocaches extends AbstractListActivity { } int secondsElapsed = (int) ((System.currentTimeMillis() - detailProgressTime) / 1000); - int minutesRemaining = (int) ((detailTotal - detailProgress) * secondsElapsed / ((detailProgress > 0) ? detailProgress : 1) / 60); + int minutesRemaining = ((detailTotal - detailProgress) * secondsElapsed / ((detailProgress > 0) ? detailProgress : 1) / 60); waitDialog.setProgress(detailProgress); if (minutesRemaining < 1) { @@ -375,7 +375,7 @@ public class cgeocaches extends AbstractListActivity { cacheList.clear(); cacheList.addAll(cacheListTmp); cacheListTmp.clear(); - Collections.sort((List<cgCache>) cacheList, gcComparator); + Collections.sort(cacheList, gcComparator); } } @@ -445,7 +445,7 @@ public class cgeocaches extends AbstractListActivity { cacheList.addAll(cacheListTmp); cacheListTmp.clear(); - Collections.sort((List<cgCache>) cacheList, gcComparator); + Collections.sort(cacheList, gcComparator); } if (waitDialog != null) { @@ -473,7 +473,7 @@ public class cgeocaches extends AbstractListActivity { cacheList.addAll(cacheListTmp); cacheListTmp.clear(); - Collections.sort((List<cgCache>) cacheList, gcComparator); + Collections.sort(cacheList, gcComparator); } if (waitDialog != null) { @@ -1493,7 +1493,7 @@ public class cgeocaches extends AbstractListActivity { }); waitDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); - int etaTime = (int) ((detailTotal * 25) / 60); + int etaTime = ((detailTotal * 25) / 60); if (etaTime < 1) { waitDialog.setMessage(res.getString(R.string.caches_downloading) + " " + res.getString(R.string.caches_eta_ltm)); } else if (etaTime == 1) { diff --git a/main/src/cgeo/geocaching/cgeodetail.java b/main/src/cgeo/geocaching/cgeodetail.java index d3daad2..c26b885 100644 --- a/main/src/cgeo/geocaching/cgeodetail.java +++ b/main/src/cgeo/geocaching/cgeodetail.java @@ -659,7 +659,7 @@ public class cgeodetail extends AbstractActivity { detailsList.removeAllViews(); // actionbar icon, default myster< - ((TextView) findViewById(R.id.actionbar_title)).setCompoundDrawablesWithIntrinsicBounds((Drawable) getResources().getDrawable(cgBase.getCacheIcon(cache.type)), null, null, null); + ((TextView) findViewById(R.id.actionbar_title)).setCompoundDrawablesWithIntrinsicBounds(getResources().getDrawable(cgBase.getCacheIcon(cache.type)), null, null, null); // cache name (full name) itemLayout = (RelativeLayout) inflater.inflate(R.layout.cache_item, null); diff --git a/main/src/cgeo/geocaching/cgeopopup.java b/main/src/cgeo/geocaching/cgeopopup.java index c214f57..bc0fd46 100644 --- a/main/src/cgeo/geocaching/cgeopopup.java +++ b/main/src/cgeo/geocaching/cgeopopup.java @@ -8,7 +8,6 @@ import org.apache.commons.lang3.StringUtils; import android.app.ProgressDialog; import android.content.Intent; import android.content.res.Configuration; -import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; import android.os.Handler; @@ -229,7 +228,7 @@ public class cgeopopup extends AbstractActivity { detailsList.removeAllViews(); // actionbar icon - ((TextView) findViewById(R.id.actionbar_title)).setCompoundDrawablesWithIntrinsicBounds((Drawable) getResources().getDrawable(cgBase.getCacheIcon(cache.type)), null, null, null); + ((TextView) findViewById(R.id.actionbar_title)).setCompoundDrawablesWithIntrinsicBounds(getResources().getDrawable(cgBase.getCacheIcon(cache.type)), null, null, null); // cache type itemLayout = (RelativeLayout) inflater.inflate(R.layout.cache_item, null); diff --git a/main/src/cgeo/geocaching/cgeotrackable.java b/main/src/cgeo/geocaching/cgeotrackable.java index cfeac98..aea5855 100644 --- a/main/src/cgeo/geocaching/cgeotrackable.java +++ b/main/src/cgeo/geocaching/cgeotrackable.java @@ -7,7 +7,6 @@ import org.apache.commons.lang3.StringUtils; import android.app.ProgressDialog; import android.content.Intent; import android.graphics.drawable.BitmapDrawable; -import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; import android.os.Handler; @@ -176,8 +175,8 @@ public class cgeotrackable extends AbstractActivity { itemLayout.setOnClickListener(new View.OnClickListener() { public void onClick(View arg0) { Intent cacheIntent = new Intent(cgeotrackable.this, cgeodetail.class); - cacheIntent.putExtra("guid", (String) trackable.spottedGuid); - cacheIntent.putExtra("name", (String) trackable.spottedName); + cacheIntent.putExtra("guid", trackable.spottedGuid); + cacheIntent.putExtra("name", trackable.spottedName); startActivity(cacheIntent); } }); @@ -514,8 +513,8 @@ public class cgeotrackable extends AbstractActivity { ((TextView) rowView.findViewById(R.id.location)).setOnClickListener(new View.OnClickListener() { public void onClick(View arg0) { Intent cacheIntent = new Intent(cgeotrackable.this, cgeodetail.class); - cacheIntent.putExtra("guid", (String) cacheGuid); - cacheIntent.putExtra("name", (String) Html.fromHtml(cacheName).toString()); + cacheIntent.putExtra("guid", cacheGuid); + cacheIntent.putExtra("name", Html.fromHtml(cacheName).toString()); startActivity(cacheIntent); } }); @@ -595,7 +594,7 @@ public class cgeotrackable extends AbstractActivity { public void handleMessage(Message message) { BitmapDrawable image = (BitmapDrawable) message.obj; if (image != null && view != null) { - view.setCompoundDrawablesWithIntrinsicBounds((Drawable) image, null, null, null); + view.setCompoundDrawablesWithIntrinsicBounds(image, null, null, null); } } } diff --git a/main/src/cgeo/geocaching/cgeowaypointadd.java b/main/src/cgeo/geocaching/cgeowaypointadd.java index b33e3ff..0f161e6 100644 --- a/main/src/cgeo/geocaching/cgeowaypointadd.java +++ b/main/src/cgeo/geocaching/cgeowaypointadd.java @@ -310,8 +310,8 @@ public class cgeowaypointadd extends AbstractActivity { return; } - coords.add(0, (Double) latParsed); - coords.add(1, (Double) lonParsed); + coords.add(0, latParsed); + coords.add(1, lonParsed); } else if (latitude != null && longitude != null) { coords.add(0, latitude); coords.add(1, longitude); |
