aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2012-09-04 00:44:31 +0200
committerSamuel Tardieu <sam@rfc1149.net>2012-09-04 00:44:31 +0200
commit9b0b7f4f8a2a57e70af74ba477187a92df9a022a (patch)
treee87770ae3e421520f7c2321da81ec1b7de6ac781
parent3b670d190c0dacfffb49559e2af2da08fd3360b1 (diff)
downloadcgeo-9b0b7f4f8a2a57e70af74ba477187a92df9a022a.zip
cgeo-9b0b7f4f8a2a57e70af74ba477187a92df9a022a.tar.gz
cgeo-9b0b7f4f8a2a57e70af74ba477187a92df9a022a.tar.bz2
Refactoring: remove redundant type casts
Those type casts were unnecessary, as the returned value was already of the target type, or the called method (after the cast) was defined by the originally returned type.
-rw-r--r--main/src/cgeo/geocaching/CacheDetailActivity.java12
-rw-r--r--main/src/cgeo/geocaching/CachePopup.java2
-rw-r--r--main/src/cgeo/geocaching/SearchActivity.java4
-rw-r--r--main/src/cgeo/geocaching/UsefulAppsActivity.java2
-rw-r--r--main/src/cgeo/geocaching/VisitCacheActivity.java6
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java2
-rw-r--r--main/src/cgeo/geocaching/cgeocaches.java4
-rw-r--r--main/src/cgeo/geocaching/cgeotrackable.java16
-rw-r--r--main/src/cgeo/geocaching/export/FieldnoteExport.java2
-rw-r--r--main/src/cgeo/geocaching/export/GpxExport.java2
-rw-r--r--main/src/cgeo/geocaching/files/FileList.java2
11 files changed, 27 insertions, 27 deletions
diff --git a/main/src/cgeo/geocaching/CacheDetailActivity.java b/main/src/cgeo/geocaching/CacheDetailActivity.java
index f9f9059..e8c6aec 100644
--- a/main/src/cgeo/geocaching/CacheDetailActivity.java
+++ b/main/src/cgeo/geocaching/CacheDetailActivity.java
@@ -1448,13 +1448,13 @@ public class CacheDetailActivity extends AbstractActivity {
if (connector != null) {
String license = connector.getLicenseText(cache);
if (StringUtils.isNotBlank(license)) {
- ((LinearLayout) view.findViewById(R.id.license_box)).setVisibility(View.VISIBLE);
+ view.findViewById(R.id.license_box).setVisibility(View.VISIBLE);
TextView licenseView = ((TextView) view.findViewById(R.id.license));
licenseView.setText(Html.fromHtml(license), BufferType.SPANNABLE);
licenseView.setClickable(true);
licenseView.setMovementMethod(LinkMovementMethod.getInstance());
} else {
- ((LinearLayout) view.findViewById(R.id.license_box)).setVisibility(View.GONE);
+ view.findViewById(R.id.license_box).setVisibility(View.GONE);
}
}
@@ -1893,7 +1893,7 @@ public class CacheDetailActivity extends AbstractActivity {
// cache personal note
if (StringUtils.isNotBlank(cache.getPersonalNote())) {
- ((LinearLayout) view.findViewById(R.id.personalnote_box)).setVisibility(View.VISIBLE);
+ view.findViewById(R.id.personalnote_box).setVisibility(View.VISIBLE);
TextView personalNoteText = (TextView) view.findViewById(R.id.personalnote);
personalNoteText.setVisibility(View.VISIBLE);
@@ -1902,14 +1902,14 @@ public class CacheDetailActivity extends AbstractActivity {
registerForContextMenu(personalNoteText);
}
else {
- ((LinearLayout) view.findViewById(R.id.personalnote_box)).setVisibility(View.GONE);
+ view.findViewById(R.id.personalnote_box).setVisibility(View.GONE);
}
// cache hint and spoiler images
if (StringUtils.isNotBlank(cache.getHint()) || CollectionUtils.isNotEmpty(cache.getSpoilers())) {
- ((LinearLayout) view.findViewById(R.id.hint_box)).setVisibility(View.VISIBLE);
+ view.findViewById(R.id.hint_box).setVisibility(View.VISIBLE);
} else {
- ((LinearLayout) view.findViewById(R.id.hint_box)).setVisibility(View.GONE);
+ view.findViewById(R.id.hint_box).setVisibility(View.GONE);
}
if (StringUtils.isNotBlank(cache.getHint())) {
diff --git a/main/src/cgeo/geocaching/CachePopup.java b/main/src/cgeo/geocaching/CachePopup.java
index 05b1aab..e01e4a0 100644
--- a/main/src/cgeo/geocaching/CachePopup.java
+++ b/main/src/cgeo/geocaching/CachePopup.java
@@ -89,7 +89,7 @@ public class CachePopup extends AbstractPopupActivity {
addCacheDetails();
- ((LinearLayout) findViewById(R.id.offline_box)).setVisibility(View.VISIBLE);
+ findViewById(R.id.offline_box).setVisibility(View.VISIBLE);
// offline use
final TextView offlineText = (TextView) findViewById(R.id.offline_text);
diff --git a/main/src/cgeo/geocaching/SearchActivity.java b/main/src/cgeo/geocaching/SearchActivity.java
index 3221479..562d5c3 100644
--- a/main/src/cgeo/geocaching/SearchActivity.java
+++ b/main/src/cgeo/geocaching/SearchActivity.java
@@ -129,8 +129,8 @@ public class SearchActivity extends AbstractActivity {
private void init() {
Settings.getLogin();
- ((Button) findViewById(R.id.buttonLatitude)).setOnClickListener(new findByCoordsAction());
- ((Button) findViewById(R.id.buttonLongitude)).setOnClickListener(new findByCoordsAction());
+ findViewById(R.id.buttonLatitude).setOnClickListener(new findByCoordsAction());
+ findViewById(R.id.buttonLongitude).setOnClickListener(new findByCoordsAction());
final Button findByCoords = (Button) findViewById(R.id.search_coordinates);
findByCoords.setOnClickListener(new findByCoordsListener());
diff --git a/main/src/cgeo/geocaching/UsefulAppsActivity.java b/main/src/cgeo/geocaching/UsefulAppsActivity.java
index cb07934..af643b3 100644
--- a/main/src/cgeo/geocaching/UsefulAppsActivity.java
+++ b/main/src/cgeo/geocaching/UsefulAppsActivity.java
@@ -66,7 +66,7 @@ public class UsefulAppsActivity extends AbstractActivity {
((TextView) layout.findViewById(R.id.title)).setText(res.getString(titleId));
((ImageView) layout.findViewById(R.id.image)).setImageDrawable(res.getDrawable(imageId));
((TextView) layout.findViewById(R.id.description)).setText(res.getString(descriptionId));
- ((LinearLayout) layout.findViewById(R.id.app_layout)).setOnClickListener(new OnClickListener() {
+ layout.findViewById(R.id.app_layout).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
diff --git a/main/src/cgeo/geocaching/VisitCacheActivity.java b/main/src/cgeo/geocaching/VisitCacheActivity.java
index c6823c8..0fdbf86 100644
--- a/main/src/cgeo/geocaching/VisitCacheActivity.java
+++ b/main/src/cgeo/geocaching/VisitCacheActivity.java
@@ -151,7 +151,7 @@ public class VisitCacheActivity extends AbstractActivity implements DateDialog.D
}
if (inventoryView.getChildCount() > 0) {
- ((LinearLayout) findViewById(R.id.inventory_box)).setVisibility(View.VISIBLE);
+ findViewById(R.id.inventory_box).setVisibility(View.VISIBLE);
}
if (inventoryView.getChildCount() > 1) {
final LinearLayout inventoryChangeAllView = (LinearLayout) findViewById(R.id.inventory_changeall);
@@ -374,14 +374,14 @@ public class VisitCacheActivity extends AbstractActivity implements DateDialog.D
Log.w("Adding " + typeOne + " " + typeOne.getL10n());
}
} else if (viewId == R.id.changebutton) {
- final int textId = ((TextView) findViewById(viewId)).getId();
+ final int textId = findViewById(viewId).getId();
menu.setHeaderTitle(res.getString(R.string.log_tb_changeall));
for (LogTypeTrackable logType : LogTypeTrackable.values()) {
menu.add(textId, logType.id, 0, res.getString(logType.resourceId));
}
} else {
- final int realViewId = ((LinearLayout) findViewById(viewId)).getId();
+ final int realViewId = findViewById(viewId).getId();
for (final TrackableLog tb : trackables) {
if (tb.id == realViewId) {
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java b/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java
index bf0517f..26e5648 100644
--- a/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java
+++ b/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java
@@ -120,7 +120,7 @@ public final class NavigationAppFactory extends AbstractAppFactory {
if ((showInternalMap || !(navApp.app instanceof InternalMap)) &&
(showDefaultNavigation || defaultNavigationTool != navApp.id)) {
boolean add = false;
- if (cache != null && navApp.app instanceof CacheNavigationApp && ((CacheNavigationApp) navApp.app).isEnabled(cache)) {
+ if (cache != null && navApp.app instanceof CacheNavigationApp && navApp.app.isEnabled(cache)) {
add = true;
}
if (waypoint != null && navApp.app instanceof WaypointNavigationApp && ((WaypointNavigationApp) navApp.app).isEnabled(waypoint)) {
diff --git a/main/src/cgeo/geocaching/cgeocaches.java b/main/src/cgeo/geocaching/cgeocaches.java
index 4b0821d..0251bff 100644
--- a/main/src/cgeo/geocaching/cgeocaches.java
+++ b/main/src/cgeo/geocaching/cgeocaches.java
@@ -350,9 +350,9 @@ public class cgeocaches extends AbstractListActivity {
if (msg.what == 0) { //no caches
progress.setMessage(res.getString(R.string.web_import_waiting));
} else if (msg.what == 1) { //cache downloading
- progress.setMessage(res.getString(R.string.web_downloading) + " " + (String) msg.obj + '…');
+ progress.setMessage(res.getString(R.string.web_downloading) + " " + msg.obj + '…');
} else if (msg.what == 2) { //Cache downloaded
- progress.setMessage(res.getString(R.string.web_downloaded) + " " + (String) msg.obj + '…');
+ progress.setMessage(res.getString(R.string.web_downloaded) + " " + msg.obj + '…');
refreshCurrentList();
} else if (msg.what == -2) {
progress.dismiss();
diff --git a/main/src/cgeo/geocaching/cgeotrackable.java b/main/src/cgeo/geocaching/cgeotrackable.java
index 3cdc58d..fcba7fa 100644
--- a/main/src/cgeo/geocaching/cgeotrackable.java
+++ b/main/src/cgeo/geocaching/cgeotrackable.java
@@ -75,7 +75,7 @@ public class cgeotrackable extends AbstractActivity {
setTitle(trackable.getName().toUpperCase());
}
- ((ScrollView) findViewById(R.id.details_list_box)).setVisibility(View.VISIBLE);
+ findViewById(R.id.details_list_box).setVisibility(View.VISIBLE);
final CacheDetailsCreator details = new CacheDetailsCreator(cgeotrackable.this, (LinearLayout) findViewById(R.id.details_list));
// actiobar icon
@@ -171,7 +171,7 @@ public class cgeotrackable extends AbstractActivity {
// trackable goal
if (StringUtils.isNotBlank(trackable.getGoal())) {
- ((LinearLayout) findViewById(R.id.goal_box)).setVisibility(View.VISIBLE);
+ findViewById(R.id.goal_box).setVisibility(View.VISIBLE);
TextView descView = (TextView) findViewById(R.id.goal);
descView.setVisibility(View.VISIBLE);
descView.setText(Html.fromHtml(trackable.getGoal(), new HtmlImage(geocode, true, 0, false), null), TextView.BufferType.SPANNABLE);
@@ -180,7 +180,7 @@ public class cgeotrackable extends AbstractActivity {
// trackable details
if (StringUtils.isNotBlank(trackable.getDetails())) {
- ((LinearLayout) findViewById(R.id.details_box)).setVisibility(View.VISIBLE);
+ findViewById(R.id.details_box).setVisibility(View.VISIBLE);
TextView descView = (TextView) findViewById(R.id.details);
descView.setVisibility(View.VISIBLE);
descView.setText(Html.fromHtml(trackable.getDetails(), new HtmlImage(geocode, true, 0, false), null), TextView.BufferType.SPANNABLE);
@@ -189,7 +189,7 @@ public class cgeotrackable extends AbstractActivity {
// trackable image
if (StringUtils.isNotBlank(trackable.getImage())) {
- ((LinearLayout) findViewById(R.id.image_box)).setVisibility(View.VISIBLE);
+ findViewById(R.id.image_box).setVisibility(View.VISIBLE);
LinearLayout imgView = (LinearLayout) findViewById(R.id.image);
final ImageView trackableImage = (ImageView) inflater.inflate(R.layout.trackable_image, null);
@@ -451,12 +451,12 @@ public class cgeotrackable extends AbstractActivity {
((TextView) rowView.findViewById(R.id.author)).setText(Html.fromHtml(log.author), TextView.BufferType.SPANNABLE);
if (StringUtils.isBlank(log.cacheName)) {
- ((TextView) rowView.findViewById(R.id.location)).setVisibility(View.GONE);
+ rowView.findViewById(R.id.location).setVisibility(View.GONE);
} else {
((TextView) rowView.findViewById(R.id.location)).setText(Html.fromHtml(log.cacheName));
final String cacheGuid = log.cacheGuid;
final String cacheName = log.cacheName;
- ((TextView) rowView.findViewById(R.id.location)).setOnClickListener(new View.OnClickListener() {
+ rowView.findViewById(R.id.location).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
CacheDetailActivity.startActivityGuid(cgeotrackable.this, cacheGuid, Html.fromHtml(cacheName).toString());
@@ -489,12 +489,12 @@ public class cgeotrackable extends AbstractActivity {
logLayout.addView(log_imgView);
}
- ((TextView) rowView.findViewById(R.id.author)).setOnClickListener(new UserActionsListener());
+ rowView.findViewById(R.id.author).setOnClickListener(new UserActionsListener());
listView.addView(rowView);
}
if (trackable.getLogs().size() > 0) {
- ((LinearLayout) findViewById(R.id.log_box)).setVisibility(View.VISIBLE);
+ findViewById(R.id.log_box).setVisibility(View.VISIBLE);
}
}
}
diff --git a/main/src/cgeo/geocaching/export/FieldnoteExport.java b/main/src/cgeo/geocaching/export/FieldnoteExport.java
index e87555f..9e1b7ef 100644
--- a/main/src/cgeo/geocaching/export/FieldnoteExport.java
+++ b/main/src/cgeo/geocaching/export/FieldnoteExport.java
@@ -69,7 +69,7 @@ class FieldnoteExport extends AbstractExport {
}
});
- ((Button) layout.findViewById(R.id.export)).setOnClickListener(new View.OnClickListener() {
+ layout.findViewById(R.id.export).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
diff --git a/main/src/cgeo/geocaching/export/GpxExport.java b/main/src/cgeo/geocaching/export/GpxExport.java
index 6aa46e6..593a342 100644
--- a/main/src/cgeo/geocaching/export/GpxExport.java
+++ b/main/src/cgeo/geocaching/export/GpxExport.java
@@ -85,7 +85,7 @@ class GpxExport extends AbstractExport {
}
});
- ((Button) layout.findViewById(R.id.export)).setOnClickListener(new View.OnClickListener() {
+ layout.findViewById(R.id.export).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
diff --git a/main/src/cgeo/geocaching/files/FileList.java b/main/src/cgeo/geocaching/files/FileList.java
index 08c1940..994c8b0 100644
--- a/main/src/cgeo/geocaching/files/FileList.java
+++ b/main/src/cgeo/geocaching/files/FileList.java
@@ -44,7 +44,7 @@ public abstract class FileList<T extends ArrayAdapter<File>> extends AbstractLis
if (msg.what == MSG_SEARCH_WHOLE_SD_CARD) {
searchInfo = String.format(res.getString(R.string.file_searching_sdcard_in), getDefaultFolders());
}
- waitDialog.setMessage(searchInfo + (String) msg.obj);
+ waitDialog.setMessage(searchInfo + msg.obj);
}
}