aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2014-05-17 17:51:22 +0200
committerBananeweizen <bananeweizen@gmx.de>2014-05-17 17:51:22 +0200
commitb21285e477f71e8417df8ac564e1e86c5a82f30c (patch)
tree1bb0a24737ec653a51bbaf4dfe71e5a80b601e1a /main
parente2d03264f63d644d72c369120d542969723398a1 (diff)
downloadcgeo-b21285e477f71e8417df8ac564e1e86c5a82f30c.zip
cgeo-b21285e477f71e8417df8ac564e1e86c5a82f30c.tar.gz
cgeo-b21285e477f71e8417df8ac564e1e86c5a82f30c.tar.bz2
some formatting fixes
Diffstat (limited to 'main')
-rw-r--r--main/src/cgeo/geocaching/CgeoApplication.java11
-rw-r--r--main/src/cgeo/geocaching/export/GpxExport.java3
-rw-r--r--main/src/cgeo/geocaching/utils/DebugUtils.java42
-rw-r--r--main/src/cgeo/geocaching/utils/ShareUtils.java29
4 files changed, 34 insertions, 51 deletions
diff --git a/main/src/cgeo/geocaching/CgeoApplication.java b/main/src/cgeo/geocaching/CgeoApplication.java
index f390913..b8a2171 100644
--- a/main/src/cgeo/geocaching/CgeoApplication.java
+++ b/main/src/cgeo/geocaching/CgeoApplication.java
@@ -26,10 +26,8 @@ public class CgeoApplication extends Application {
private volatile IGeoData currentGeo = null;
private volatile float currentDirection = 0.0f;
- private static final UncaughtExceptionHandler defaultHandler;
-
static {
- defaultHandler = Thread.getDefaultUncaughtExceptionHandler();
+ final UncaughtExceptionHandler defaultHandler = Thread.getDefaultUncaughtExceptionHandler();
Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler() {
@@ -40,13 +38,10 @@ public class CgeoApplication extends Application {
while (exx.getCause() != null) {
exx = exx.getCause();
}
- if (exx.getClass().equals(OutOfMemoryError.class))
- {
+ if (exx.getClass().equals(OutOfMemoryError.class)) {
try {
Log.e("OutOfMemory");
- android.os.Debug.dumpHprofData(Environment
- .getExternalStorageDirectory().getPath()
- + "/dump.hprof");
+ android.os.Debug.dumpHprofData(Environment.getExternalStorageDirectory().getPath() + "/dump.hprof");
} catch (IOException e) {
Log.e("Error writing dump", e);
}
diff --git a/main/src/cgeo/geocaching/export/GpxExport.java b/main/src/cgeo/geocaching/export/GpxExport.java
index bb0127a..39f4bcf 100644
--- a/main/src/cgeo/geocaching/export/GpxExport.java
+++ b/main/src/cgeo/geocaching/export/GpxExport.java
@@ -167,8 +167,7 @@ class GpxExport extends AbstractExport {
if (exportFile != null) {
ActivityMixin.showToast(activity, getName() + ' ' + getString(R.string.export_exportedto) + ": " + exportFile.toString());
if (Settings.getShareAfterExport()) {
- ShareUtils.share(activity, exportFile,
- "application/xml", R.string.export_gpx_to);
+ ShareUtils.share(activity, exportFile, "application/xml", R.string.export_gpx_to);
}
} else {
ActivityMixin.showToast(activity, getString(R.string.export_failed));
diff --git a/main/src/cgeo/geocaching/utils/DebugUtils.java b/main/src/cgeo/geocaching/utils/DebugUtils.java
index 4bbc74f..07aac64 100644
--- a/main/src/cgeo/geocaching/utils/DebugUtils.java
+++ b/main/src/cgeo/geocaching/utils/DebugUtils.java
@@ -1,6 +1,5 @@
package cgeo.geocaching.utils;
-import cgeo.geocaching.CgeoApplication;
import cgeo.geocaching.R;
import org.eclipse.jdt.annotation.NonNull;
@@ -17,29 +16,22 @@ import java.util.Locale;
public class DebugUtils {
- private DebugUtils() {
- // utility class
- }
+ private DebugUtils() {
+ // utility class
+ }
- public static void createMemoryDump(final @NonNull Context context) {
- try {
- final Date now = new Date();
- final SimpleDateFormat fileNameDateFormat = new SimpleDateFormat(
- "yyyy-MM-dd_hh-mm", Locale.US);
- File file = FileUtils.getUniqueNamedFile(Environment
- .getExternalStorageDirectory().getPath()
- + File.separatorChar
- + "cgeo_dump_"
- + fileNameDateFormat.format(now) + ".hprof");
- android.os.Debug.dumpHprofData(file.getPath());
- Toast.makeText(CgeoApplication.getInstance()
- .getApplicationContext(),
- context.getString(R.string.init_memory_dumped,
- file.getAbsolutePath()),
- Toast.LENGTH_LONG).show();
- ShareUtils.share(context, file, R.string.init_memory_dump);
- } catch (IOException e) {
- Log.e("createMemoryDump", e);
- }
- }
+ public static void createMemoryDump(final @NonNull Context context) {
+ try {
+ final Date now = new Date();
+ final SimpleDateFormat fileNameDateFormat = new SimpleDateFormat("yyyy-MM-dd_hh-mm", Locale.US);
+ File file = FileUtils.getUniqueNamedFile(Environment.getExternalStorageDirectory().getPath()
+ + File.separatorChar + "cgeo_dump_" + fileNameDateFormat.format(now) + ".hprof");
+ android.os.Debug.dumpHprofData(file.getPath());
+ Toast.makeText(context, context.getString(R.string.init_memory_dumped, file.getAbsolutePath()),
+ Toast.LENGTH_LONG).show();
+ ShareUtils.share(context, file, R.string.init_memory_dump);
+ } catch (IOException e) {
+ Log.e("createMemoryDump", e);
+ }
+ }
}
diff --git a/main/src/cgeo/geocaching/utils/ShareUtils.java b/main/src/cgeo/geocaching/utils/ShareUtils.java
index b587547..bfd6838 100644
--- a/main/src/cgeo/geocaching/utils/ShareUtils.java
+++ b/main/src/cgeo/geocaching/utils/ShareUtils.java
@@ -9,22 +9,19 @@ import android.net.Uri;
import java.io.File;
public class ShareUtils {
- private ShareUtils() {
- // utility class
- }
+ private ShareUtils() {
+ // utility class
+ }
- public static void share(final Context context, final @NonNull File file,
- final @NonNull String mimeType, final int titleResourceId) {
- final Intent shareIntent = new Intent();
- shareIntent.setAction(Intent.ACTION_SEND);
- shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
- shareIntent.setType(mimeType);
- context.startActivity(Intent.createChooser(shareIntent,
- context.getString(titleResourceId)));
- }
+ public static void share(final Context context, final @NonNull File file, final @NonNull String mimeType, final int titleResourceId) {
+ final Intent shareIntent = new Intent();
+ shareIntent.setAction(Intent.ACTION_SEND);
+ shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
+ shareIntent.setType(mimeType);
+ context.startActivity(Intent.createChooser(shareIntent, context.getString(titleResourceId)));
+ }
- public static void share(final Context context, final @NonNull File file,
- final int titleResourceId) {
- share(context, file, "*/*", titleResourceId);
- }
+ public static void share(final Context context, final @NonNull File file, final int titleResourceId) {
+ share(context, file, "*/*", titleResourceId);
+ }
}