aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBananeweizen <Bananeweizen@gmx.de>2013-07-31 13:47:10 +0200
committerBananeweizen <Bananeweizen@gmx.de>2013-07-31 13:47:10 +0200
commit4cef30e041e27634f56be70d5694d83663bc1d68 (patch)
treef239c2c762ccd58cead5207e99b609565640a51d
parent13551c5996c5be31bc50cdb691c17d1ac3fa0392 (diff)
downloadcgeo-4cef30e041e27634f56be70d5694d83663bc1d68.zip
cgeo-4cef30e041e27634f56be70d5694d83663bc1d68.tar.gz
cgeo-4cef30e041e27634f56be70d5694d83663bc1d68.tar.bz2
refactoring: make formatter work without context
-rw-r--r--main/src/cgeo/geocaching/NavigateAnyPointActivity.java4
-rw-r--r--main/src/cgeo/geocaching/export/FieldnoteExport.java2
-rw-r--r--main/src/cgeo/geocaching/settings/SettingsActivity.java7
-rw-r--r--main/src/cgeo/geocaching/ui/Formatter.java4
4 files changed, 7 insertions, 10 deletions
diff --git a/main/src/cgeo/geocaching/NavigateAnyPointActivity.java b/main/src/cgeo/geocaching/NavigateAnyPointActivity.java
index be4ef05..b73a154 100644
--- a/main/src/cgeo/geocaching/NavigateAnyPointActivity.java
+++ b/main/src/cgeo/geocaching/NavigateAnyPointActivity.java
@@ -100,13 +100,13 @@ public class NavigateAnyPointActivity extends AbstractActivity {
return rowView;
}
- private void fillViewHolder(ViewHolder viewHolder, Destination loc) {
+ private static void fillViewHolder(ViewHolder viewHolder, Destination loc) {
String lonString = loc.getCoords().format(GeopointFormatter.Format.LON_DECMINUTE);
String latString = loc.getCoords().format(GeopointFormatter.Format.LAT_DECMINUTE);
viewHolder.longitude.setText(lonString);
viewHolder.latitude.setText(latString);
- viewHolder.date.setText(Formatter.formatShortDateTime(getContext(), loc.getDate()));
+ viewHolder.date.setText(Formatter.formatShortDateTime(loc.getDate()));
}
private LayoutInflater getInflater() {
diff --git a/main/src/cgeo/geocaching/export/FieldnoteExport.java b/main/src/cgeo/geocaching/export/FieldnoteExport.java
index 38cd43e..d5e6ff6 100644
--- a/main/src/cgeo/geocaching/export/FieldnoteExport.java
+++ b/main/src/cgeo/geocaching/export/FieldnoteExport.java
@@ -82,7 +82,7 @@ class FieldnoteExport extends AbstractExport {
final CheckBox onlyNewOption = (CheckBox) layout.findViewById(R.id.onlynew);
if (Settings.getFieldnoteExportDate() > 0) {
- onlyNewOption.setText(getString(R.string.export_fieldnotes_onlynew) + "\n(" + Formatter.formatShortDateTime(activity, Settings.getFieldnoteExportDate()) + ')');
+ onlyNewOption.setText(getString(R.string.export_fieldnotes_onlynew) + "\n(" + Formatter.formatShortDateTime(Settings.getFieldnoteExportDate()) + ')');
}
builder.setPositiveButton(R.string.export, new DialogInterface.OnClickListener() {
diff --git a/main/src/cgeo/geocaching/settings/SettingsActivity.java b/main/src/cgeo/geocaching/settings/SettingsActivity.java
index fa84157..4e1d4eb 100644
--- a/main/src/cgeo/geocaching/settings/SettingsActivity.java
+++ b/main/src/cgeo/geocaching/settings/SettingsActivity.java
@@ -480,9 +480,9 @@ public class SettingsActivity extends PreferenceActivity {
if (preference instanceof EditPasswordPreference) {
if (StringUtils.isBlank((String) value)) {
- preference.setSummary("");
+ preference.setSummary(StringUtils.EMPTY);
} else {
- preference.setSummary("\u2022 \u2022 \u2022 \u2022 \u2022 \u2022 \u2022 \u2022 \u2022 \u2022");
+ preference.setSummary(StringUtils.repeat("\u2022 ", 10));
}
} else if (preference instanceof ListPreference) {
// For list preferences, look up the correct display value in
@@ -500,8 +500,7 @@ public class SettingsActivity extends PreferenceActivity {
String text;
if (lastBackupFile != null) {
text = preference.getContext().getString(R.string.init_backup_last) + " "
- + Formatter.formatTime(lastBackupFile.lastModified())
- + ", " + Formatter.formatDate(lastBackupFile.lastModified());
+ + Formatter.formatShortDateTime(lastBackupFile.lastModified());
} else {
text = preference.getContext().getString(R.string.init_backup_last_no);
}
diff --git a/main/src/cgeo/geocaching/ui/Formatter.java b/main/src/cgeo/geocaching/ui/Formatter.java
index 92a0defc..ecae9ea 100644
--- a/main/src/cgeo/geocaching/ui/Formatter.java
+++ b/main/src/cgeo/geocaching/ui/Formatter.java
@@ -99,13 +99,11 @@ public abstract class Formatter {
* Generate a numeric date and time string according to system-wide settings (locale,
* date format) such as "7 sept. at 12:35".
*
- * @param context
- * a Context
* @param date
* milliseconds since the epoch
* @return the formatted string
*/
- public static String formatShortDateTime(Context context, long date) {
+ public static String formatShortDateTime(long date) {
return DateUtils.formatDateTime(context, date, DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_ABBREV_ALL);
}