aboutsummaryrefslogtreecommitdiffstats
path: root/main/src
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2012-05-15 08:08:24 +0200
committerBananeweizen <bananeweizen@gmx.de>2012-05-15 08:08:24 +0200
commitd29085d093a35ff5f08ef9415ea7d6a846f17c68 (patch)
treeb1563180f491a5135b755cbbdb3ed8d88ea2829d /main/src
parent55f3fb7375c6ad64f40db46d94646685464e331e (diff)
downloadcgeo-d29085d093a35ff5f08ef9415ea7d6a846f17c68.zip
cgeo-d29085d093a35ff5f08ef9415ea7d6a846f17c68.tar.gz
cgeo-d29085d093a35ff5f08ef9415ea7d6a846f17c68.tar.bz2
refactoring: minor cleanups
* use ellipsis * avoid String concatenation
Diffstat (limited to 'main/src')
-rw-r--r--main/src/cgeo/geocaching/cgData.java6
-rw-r--r--main/src/cgeo/geocaching/cgeoapplication.java4
-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/connector/gc/AbstractSearchThread.java2
-rw-r--r--main/src/cgeo/geocaching/connector/gc/GCParser.java10
-rw-r--r--main/src/cgeo/geocaching/files/FileList.java2
-rw-r--r--main/src/cgeo/geocaching/maps/CachesOverlay.java2
-rw-r--r--main/src/cgeo/geocaching/twitter/Twitter.java6
9 files changed, 25 insertions, 27 deletions
diff --git a/main/src/cgeo/geocaching/cgData.java b/main/src/cgeo/geocaching/cgData.java
index 2d671eb..7fdb8cc 100644
--- a/main/src/cgeo/geocaching/cgData.java
+++ b/main/src/cgeo/geocaching/cgData.java
@@ -454,9 +454,9 @@ public class cgData {
@Override
public SQLiteDatabase openOrCreateDatabase(String name, int mode,
CursorFactory factory) {
- File f = new File(name);
- f.getParentFile().mkdirs();
- return SQLiteDatabase.openOrCreateDatabase(f, factory);
+ final File file = new File(name);
+ file.getParentFile().mkdirs();
+ return SQLiteDatabase.openOrCreateDatabase(file, factory);
}
}
diff --git a/main/src/cgeo/geocaching/cgeoapplication.java b/main/src/cgeo/geocaching/cgeoapplication.java
index f72155c..89ac250 100644
--- a/main/src/cgeo/geocaching/cgeoapplication.java
+++ b/main/src/cgeo/geocaching/cgeoapplication.java
@@ -60,7 +60,7 @@ public class cgeoapplication extends Application {
@Override
public void onTerminate() {
- Log.d("Terminating c:geo...");
+ Log.d("Terminating c:geo…");
if (storage != null) {
storage.clean();
@@ -79,7 +79,7 @@ public class cgeoapplication extends Application {
/**
* Move the database to/from external storage in a new thread,
* showing a progress window
- *
+ *
* @param fromActivity
*/
public void moveDatabase(final Activity fromActivity) {
diff --git a/main/src/cgeo/geocaching/cgeocaches.java b/main/src/cgeo/geocaching/cgeocaches.java
index daed99d..ad8c30e 100644
--- a/main/src/cgeo/geocaching/cgeocaches.java
+++ b/main/src/cgeo/geocaching/cgeocaches.java
@@ -388,9 +388,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) + " " + (String) 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) + " " + (String) 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 4d982a2..63ad788 100644
--- a/main/src/cgeo/geocaching/cgeotrackable.java
+++ b/main/src/cgeo/geocaching/cgeotrackable.java
@@ -112,18 +112,18 @@ public class cgeotrackable extends AbstractActivity {
trackable.getSpottedType() == cgTrackable.SPOTTED_UNKNOWN ||
trackable.getSpottedType() == cgTrackable.SPOTTED_OWNER
) {
- String text;
+ StringBuilder text;
if (trackable.getSpottedType() == cgTrackable.SPOTTED_CACHE) {
- text = res.getString(R.string.trackable_spotted_in_cache) + ' ' + Html.fromHtml(trackable.getSpottedName()).toString();
+ text = new StringBuilder(res.getString(R.string.trackable_spotted_in_cache) + ' ' + Html.fromHtml(trackable.getSpottedName()).toString());
} else if (trackable.getSpottedType() == cgTrackable.SPOTTED_USER) {
- text = res.getString(R.string.trackable_spotted_at_user) + ' ' + Html.fromHtml(trackable.getSpottedName()).toString();
+ text = new StringBuilder(res.getString(R.string.trackable_spotted_at_user) + ' ' + Html.fromHtml(trackable.getSpottedName()).toString());
} else if (trackable.getSpottedType() == cgTrackable.SPOTTED_UNKNOWN) {
- text = res.getString(R.string.trackable_spotted_unknown_location);
+ text = new StringBuilder(res.getString(R.string.trackable_spotted_unknown_location));
} else if (trackable.getSpottedType() == cgTrackable.SPOTTED_OWNER) {
- text = res.getString(R.string.trackable_spotted_owner);
+ text = new StringBuilder(res.getString(R.string.trackable_spotted_owner));
} else {
- text = "N/A";
+ text = new StringBuilder("N/A");
}
// days since last spotting
@@ -131,13 +131,13 @@ public class cgeotrackable extends AbstractActivity {
for (LogEntry log : trackable.getLogs()) {
if (log.type == LogType.RETRIEVED_IT || log.type == LogType.GRABBED_IT || log.type == LogType.DISCOVERED_IT || log.type == LogType.PLACED_IT) {
final int days = log.daysSinceLog();
- text += (" (" + res.getQuantityString(R.plurals.days_ago, days, days) + ")");
+ text.append(" (").append(res.getQuantityString(R.plurals.days_ago, days, days)).append(')');
break;
}
}
}
- final TextView spotted = details.add(R.string.trackable_spotted, text);
+ final TextView spotted = details.add(R.string.trackable_spotted, text.toString());
spotted.setClickable(true);
if (cgTrackable.SPOTTED_CACHE == trackable.getSpottedType()) {
spotted.setOnClickListener(new View.OnClickListener() {
diff --git a/main/src/cgeo/geocaching/connector/gc/AbstractSearchThread.java b/main/src/cgeo/geocaching/connector/gc/AbstractSearchThread.java
index 33c8a92..d0e45f6 100644
--- a/main/src/cgeo/geocaching/connector/gc/AbstractSearchThread.java
+++ b/main/src/cgeo/geocaching/connector/gc/AbstractSearchThread.java
@@ -30,7 +30,7 @@ abstract public class AbstractSearchThread extends Thread {
try {
wait();
} catch (InterruptedException e) {
- Log.w("searchThread is not waiting for user...");
+ Log.w("searchThread is not waiting for user…");
}
}
diff --git a/main/src/cgeo/geocaching/connector/gc/GCParser.java b/main/src/cgeo/geocaching/connector/gc/GCParser.java
index edd5422..dc69043 100644
--- a/main/src/cgeo/geocaching/connector/gc/GCParser.java
+++ b/main/src/cgeo/geocaching/connector/gc/GCParser.java
@@ -987,16 +987,14 @@ public abstract class GCParser {
final StringBuilder hdnSelected = new StringBuilder();
for (TrackableLog tb : trackables) {
- String ctl;
final String action = Integer.toString(tb.id) + tb.action.action;
+ final StringBuilder paramText = new StringBuilder("ctl00$ContentBody$LogBookPanel1$uxTrackables$repTravelBugs$ctl");
if (tb.ctl < 10) {
- ctl = "0" + Integer.toString(tb.ctl);
- } else {
- ctl = Integer.toString(tb.ctl);
+ paramText.append('0');
}
-
- params.put("ctl00$ContentBody$LogBookPanel1$uxTrackables$repTravelBugs$ctl" + ctl + "$ddlAction", action);
+ paramText.append(tb.ctl).append("$ddlAction");
+ params.put(paramText.toString(), action);
if (tb.action != LogTypeTrackable.DO_NOTHING) {
hdnSelected.append(action);
hdnSelected.append(',');
diff --git a/main/src/cgeo/geocaching/files/FileList.java b/main/src/cgeo/geocaching/files/FileList.java
index 2fa4e5d..6e3c8e1 100644
--- a/main/src/cgeo/geocaching/files/FileList.java
+++ b/main/src/cgeo/geocaching/files/FileList.java
@@ -211,7 +211,7 @@ public abstract class FileList<T extends ArrayAdapter<File>> extends AbstractLis
continue; // skip hidden directories
}
if (name.length() > 16) {
- name = name.substring(0, 14) + "...";
+ name = name.substring(0, 14) + '…';
}
changeWaitDialogHandler.sendMessage(Message.obtain(changeWaitDialogHandler, 0, name));
diff --git a/main/src/cgeo/geocaching/maps/CachesOverlay.java b/main/src/cgeo/geocaching/maps/CachesOverlay.java
index 9ad040f..8cfeac5 100644
--- a/main/src/cgeo/geocaching/maps/CachesOverlay.java
+++ b/main/src/cgeo/geocaching/maps/CachesOverlay.java
@@ -203,7 +203,7 @@ public class CachesOverlay extends AbstractItemizedOverlay {
if (waitDialog == null) {
waitDialog = new ProgressDialog(context);
- waitDialog.setMessage("loading details...");
+ waitDialog.setMessage("loading details…");
waitDialog.setCancelable(false);
}
waitDialog.show();
diff --git a/main/src/cgeo/geocaching/twitter/Twitter.java b/main/src/cgeo/geocaching/twitter/Twitter.java
index 4a10046..da109b6 100644
--- a/main/src/cgeo/geocaching/twitter/Twitter.java
+++ b/main/src/cgeo/geocaching/twitter/Twitter.java
@@ -66,13 +66,13 @@ public final class Twitter {
String name = cache.getName();
status = "I found " + name + " (" + url + ")";
if (status.length() > MAX_TWEET_SIZE) {
- name = name.substring(0, name.length() - (status.length() - MAX_TWEET_SIZE) - 3) + "...";
+ name = name.substring(0, name.length() - (status.length() - MAX_TWEET_SIZE) - 1) + '…';
}
status = "I found " + name + " (" + url + ")";
status = appendHashTag(status, "cgeo");
status = appendHashTag(status, "geocaching");
}
-
+
postTweet(cgeoapplication.getInstance(), status, null);
}
@@ -80,7 +80,7 @@ public final class Twitter {
final cgTrackable trackable = cgeoapplication.getInstance().getTrackableByGeocode(geocode);
String name = trackable.getName();
if (name.length() > 82) {
- name = name.substring(0, 79) + "...";
+ name = name.substring(0, 81) + '…';
}
StringBuilder builder = new StringBuilder("I touched ");
builder.append(name);