diff options
Diffstat (limited to 'main')
18 files changed, 93 insertions, 107 deletions
diff --git a/main/.classpath b/main/.classpath index 72adb52..d7bb252 100644 --- a/main/.classpath +++ b/main/.classpath @@ -19,5 +19,6 @@ <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/> + <classpathentry kind="lib" path="compile-libs/org.eclipse.jdt.annotation_1.1.0.v20130513-1648.jar"/> <classpathentry kind="output" path="bin/classes"/> </classpath> diff --git a/main/.settings/org.eclipse.jdt.core.prefs b/main/.settings/org.eclipse.jdt.core.prefs index 41c73f0..9fb16cd 100644 --- a/main/.settings/org.eclipse.jdt.core.prefs +++ b/main/.settings/org.eclipse.jdt.core.prefs @@ -1,4 +1,10 @@ eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled +org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore +org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve @@ -18,6 +24,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod= org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.compiler.problem.emptyStatement=warning org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore @@ -36,7 +43,9 @@ org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled @@ -53,12 +62,18 @@ org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warni org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore -org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error +org.eclipse.jdt.core.compiler.problem.nullReference=error +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning -org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning +org.eclipse.jdt.core.compiler.problem.potentialNullReference=error +org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning @@ -68,10 +83,12 @@ org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning @@ -90,6 +107,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference= org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.processAnnotations=enabled diff --git a/main/compile-libs/org.eclipse.jdt.annotation_1.1.0.v20130513-1648.jar b/main/compile-libs/org.eclipse.jdt.annotation_1.1.0.v20130513-1648.jar Binary files differnew file mode 100644 index 0000000..daca164 --- /dev/null +++ b/main/compile-libs/org.eclipse.jdt.annotation_1.1.0.v20130513-1648.jar diff --git a/main/res/layout/logs_item.xml b/main/res/layout/logs_item.xml index 6bfe30a..6ce20bb 100644 --- a/main/res/layout/logs_item.xml +++ b/main/res/layout/logs_item.xml @@ -58,9 +58,7 @@ android:layout_height="wrap_content" android:layout_gravity="left" android:layout_marginTop="22dip" - android:autoLink="web" android:gravity="left" - android:linksClickable="true" android:textColor="?text_color" android:textSize="14sp" /> diff --git a/main/src/cgeo/geocaching/CacheDetailActivity.java b/main/src/cgeo/geocaching/CacheDetailActivity.java index 4a9cc6e..e4bed64 100644 --- a/main/src/cgeo/geocaching/CacheDetailActivity.java +++ b/main/src/cgeo/geocaching/CacheDetailActivity.java @@ -1279,7 +1279,6 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc private Handler handler; public DropCacheThread(Handler handler) { - super(); this.handler = handler; } @@ -2452,7 +2451,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc } protected void storeCache(final int listId, final StoreCacheHandler storeCacheHandler) { - progress.show(CacheDetailActivity.this, res.getString(R.string.cache_dialog_offline_save_title), res.getString(R.string.cache_dialog_offline_save_message), true, storeCacheHandler.cancelMessage()); + progress.show(this, res.getString(R.string.cache_dialog_offline_save_title), res.getString(R.string.cache_dialog_offline_save_message), true, storeCacheHandler.cancelMessage()); if (storeThread != null) { storeThread.interrupt(); diff --git a/main/src/cgeo/geocaching/Geocache.java b/main/src/cgeo/geocaching/Geocache.java index 96fbc06..2c3f218 100644 --- a/main/src/cgeo/geocaching/Geocache.java +++ b/main/src/cgeo/geocaching/Geocache.java @@ -1,8 +1,8 @@ package cgeo.geocaching; -import cgeo.geocaching.cgData.StorageLocation; import cgeo.geocaching.activity.ActivityMixin; import cgeo.geocaching.activity.IAbstractActivity; +import cgeo.geocaching.cgData.StorageLocation; import cgeo.geocaching.connector.ConnectorFactory; import cgeo.geocaching.connector.IConnector; import cgeo.geocaching.connector.ILoggingManager; @@ -33,6 +33,7 @@ import cgeo.geocaching.utils.MatcherWrapper; import cgeo.geocaching.utils.UncertainProperty; import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; @@ -602,21 +603,21 @@ public class Geocache implements ICache, IWaypoint { @Override public boolean isArchived() { - return (archived != null && archived.booleanValue()); + return BooleanUtils.isTrue(archived); } @Override public boolean isDisabled() { - return (disabled != null && disabled.booleanValue()); + return BooleanUtils.isTrue(disabled); } @Override public boolean isPremiumMembersOnly() { - return (premiumMembersOnly != null && premiumMembersOnly.booleanValue()); + return BooleanUtils.isTrue(premiumMembersOnly); } public void setPremiumMembersOnly(boolean members) { - this.premiumMembersOnly = Boolean.valueOf(members); + this.premiumMembersOnly = members; } @Override @@ -767,16 +768,16 @@ public class Geocache implements ICache, IWaypoint { @Override public boolean isFound() { - return (found != null && found.booleanValue()); + return BooleanUtils.isTrue(found); } @Override public boolean isFavorite() { - return (favorite != null && favorite.booleanValue()); + return BooleanUtils.isTrue(favorite); } public void setFavorite(boolean favorite) { - this.favorite = Boolean.valueOf(favorite); + this.favorite = favorite; } @Override @@ -990,11 +991,11 @@ public class Geocache implements ICache, IWaypoint { @Override public boolean isOnWatchlist() { - return (onWatchlist != null && onWatchlist.booleanValue()); + return BooleanUtils.isTrue(onWatchlist); } public void setOnWatchlist(boolean onWatchlist) { - this.onWatchlist = Boolean.valueOf(onWatchlist); + this.onWatchlist = onWatchlist; } /** @@ -1063,11 +1064,11 @@ public class Geocache implements ICache, IWaypoint { } public boolean isLogOffline() { - return (logOffline != null && logOffline.booleanValue()); + return BooleanUtils.isTrue(logOffline); } public void setLogOffline(boolean logOffline) { - this.logOffline = Boolean.valueOf(logOffline); + this.logOffline = logOffline; } public boolean isStatusChecked() { @@ -1140,15 +1141,15 @@ public class Geocache implements ICache, IWaypoint { } public void setDisabled(boolean disabled) { - this.disabled = Boolean.valueOf(disabled); + this.disabled = disabled; } public void setArchived(boolean archived) { - this.archived = Boolean.valueOf(archived); + this.archived = archived; } public void setFound(boolean found) { - this.found = Boolean.valueOf(found); + this.found = found; } public void setAttributes(List<String> attributes) { diff --git a/main/src/cgeo/geocaching/MainActivity.java b/main/src/cgeo/geocaching/MainActivity.java index 0fd6759..c7c28f3 100644 --- a/main/src/cgeo/geocaching/MainActivity.java +++ b/main/src/cgeo/geocaching/MainActivity.java @@ -542,7 +542,7 @@ public class MainActivity extends AbstractActivity { navAccuracy.setText(null); navLocation.setText(res.getString(R.string.loc_trying)); } - } catch (Exception e) { + } catch (RuntimeException e) { Log.w("Failed to update location."); } } diff --git a/main/src/cgeo/geocaching/StoredList.java b/main/src/cgeo/geocaching/StoredList.java index 4946420..e080af9 100644 --- a/main/src/cgeo/geocaching/StoredList.java +++ b/main/src/cgeo/geocaching/StoredList.java @@ -4,6 +4,7 @@ import cgeo.geocaching.activity.ActivityMixin; import cgeo.geocaching.utils.RunnableWithArgument; import org.apache.commons.lang3.StringUtils; +import org.eclipse.jdt.annotation.NonNull; import android.app.Activity; import android.app.AlertDialog; @@ -78,10 +79,6 @@ public final class StoredList { public void promptForListSelection(final int titleId, final RunnableWithArgument<Integer> runAfterwards, final boolean onlyConcreteLists, final int exceptListId, final String newListName) { final List<StoredList> lists = getSortedLists(); - if (lists == null) { - return; - } - if (exceptListId > StoredList.TEMPORARY_LIST_ID) { StoredList exceptList = cgData.getList(exceptListId); if (exceptList != null) { @@ -122,7 +119,8 @@ public final class StoredList { builder.create().show(); } - private static List<StoredList> getSortedLists() { + private static @NonNull + List<StoredList> getSortedLists() { final Collator collator = Collator.getInstance(); final List<StoredList> lists = cgData.getLists(); Collections.sort(lists, new Comparator<StoredList>() { diff --git a/main/src/cgeo/geocaching/cgData.java b/main/src/cgeo/geocaching/cgData.java index 9d636f9..a925597 100644 --- a/main/src/cgeo/geocaching/cgData.java +++ b/main/src/cgeo/geocaching/cgData.java @@ -20,6 +20,7 @@ import cgeo.geocaching.utils.Log; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; import org.apache.commons.lang3.StringUtils; +import org.eclipse.jdt.annotation.NonNull; import android.content.ContentValues; import android.content.Context; @@ -2479,7 +2480,8 @@ public class cgData { } } - public static List<StoredList> getLists() { + public static @NonNull + List<StoredList> getLists() { init(); final Resources res = cgeoapplication.getInstance().getResources(); diff --git a/main/src/cgeo/geocaching/filter/DistanceFilter.java b/main/src/cgeo/geocaching/filter/DistanceFilter.java index 2f39473..4d00b65 100644 --- a/main/src/cgeo/geocaching/filter/DistanceFilter.java +++ b/main/src/cgeo/geocaching/filter/DistanceFilter.java @@ -27,7 +27,7 @@ class DistanceFilter extends AbstractFilter { final Geopoint coords = cache.getCoords(); if (coords == null) { // If a cache has no coordinates, consider it to be out of range. It will - // happen with archived cache. + // happen with archived caches. return false; } final float distance = currentPos.distanceTo(coords); @@ -50,7 +50,7 @@ class DistanceFilter extends AbstractFilter { else { maxRange = Integer.MAX_VALUE; } - final String range = maxRange == Integer.MAX_VALUE ? "> " + String.valueOf(minRange) : String.valueOf(minRange) + " - " + String.valueOf(maxRange); + final String range = maxRange == Integer.MAX_VALUE ? "> " + minRange : minRange + " - " + maxRange; final String name = cgeoapplication.getInstance().getResources().getQuantityString(R.plurals.tts_kilometers, maxRange, range); filters.add(new DistanceFilter(name, minRange, maxRange)); } diff --git a/main/src/cgeo/geocaching/maps/PositionHistory.java b/main/src/cgeo/geocaching/maps/PositionHistory.java index 9b090fc..bc6779e 100644 --- a/main/src/cgeo/geocaching/maps/PositionHistory.java +++ b/main/src/cgeo/geocaching/maps/PositionHistory.java @@ -28,7 +28,7 @@ public class PositionHistory { if (coordinates.getAccuracy() >= 50f) { return; } - if (coordinates.getLatitude() == 0.0 && coordinates.getLatitude() == 0.0) { + if (coordinates.getLatitude() == 0.0 && coordinates.getLongitude() == 0.0) { return; } if (history.isEmpty()) { diff --git a/main/src/cgeo/geocaching/network/OAuthAuthorizationActivity.java b/main/src/cgeo/geocaching/network/OAuthAuthorizationActivity.java index 14e0b33..221147c 100644 --- a/main/src/cgeo/geocaching/network/OAuthAuthorizationActivity.java +++ b/main/src/cgeo/geocaching/network/OAuthAuthorizationActivity.java @@ -5,6 +5,7 @@ import cgeo.geocaching.activity.AbstractActivity; import cgeo.geocaching.utils.Log; import cgeo.geocaching.utils.MatcherWrapper; +import ch.boye.httpclientandroidlib.ParseException; import ch.boye.httpclientandroidlib.client.entity.UrlEncodedFormEntity; import ch.boye.httpclientandroidlib.util.EntityUtils; @@ -22,6 +23,7 @@ import android.widget.Button; import android.widget.EditText; import android.widget.TextView; +import java.io.IOException; import java.util.regex.Pattern; public abstract class OAuthAuthorizationActivity extends AbstractActivity { @@ -156,38 +158,36 @@ public abstract class OAuthAuthorizationActivity extends AbstractActivity { private void requestToken() { int status = 0; - try { - final Parameters params = new Parameters(); - params.put("oauth_callback", "oob"); - final String method = "GET"; - OAuth.signOAuth(host, pathRequest, method, https, params, null, null, consumerKey, consumerSecret); - final String line = Network.getResponseData(Network.getRequest(getUrlPrefix() + host + pathRequest, params)); - - if (StringUtils.isNotBlank(line)) { - final MatcherWrapper paramsMatcher1 = new MatcherWrapper(paramsPattern1, line); - if (paramsMatcher1.find()) { - OAtoken = paramsMatcher1.group(1); - } - final MatcherWrapper paramsMatcher2 = new MatcherWrapper(paramsPattern2, line); - if (paramsMatcher2.find()) { - OAtokenSecret = paramsMatcher2.group(1); - } + final Parameters params = new Parameters(); + params.put("oauth_callback", "oob"); + final String method = "GET"; + OAuth.signOAuth(host, pathRequest, method, https, params, null, null, consumerKey, consumerSecret); + final String line = Network.getResponseData(Network.getRequest(getUrlPrefix() + host + pathRequest, params)); + + if (StringUtils.isNotBlank(line)) { + final MatcherWrapper paramsMatcher1 = new MatcherWrapper(paramsPattern1, line); + if (paramsMatcher1.find()) { + OAtoken = paramsMatcher1.group(1); + } + final MatcherWrapper paramsMatcher2 = new MatcherWrapper(paramsPattern2, line); + if (paramsMatcher2.find()) { + OAtokenSecret = paramsMatcher2.group(1); + } - if (StringUtils.isNotBlank(OAtoken) && StringUtils.isNotBlank(OAtokenSecret)) { - setTempTokens(OAtoken, OAtokenSecret); - try { - final Parameters paramsBrowser = new Parameters(); - paramsBrowser.put("oauth_token", OAtoken); - final String encodedParams = EntityUtils.toString(new UrlEncodedFormEntity(paramsBrowser)); - startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getUrlPrefix() + host + pathAuthorize + "?" + encodedParams))); - status = 1; - } catch (Exception e) { - Log.e("OAuthAuthorizationActivity.requestToken(2)", e); - } + if (StringUtils.isNotBlank(OAtoken) && StringUtils.isNotBlank(OAtokenSecret)) { + setTempTokens(OAtoken, OAtokenSecret); + try { + final Parameters paramsBrowser = new Parameters(); + paramsBrowser.put("oauth_token", OAtoken); + final String encodedParams = EntityUtils.toString(new UrlEncodedFormEntity(paramsBrowser)); + startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getUrlPrefix() + host + pathAuthorize + "?" + encodedParams))); + status = 1; + } catch (ParseException e) { + Log.e("OAuthAuthorizationActivity.requestToken", e); + } catch (IOException e) { + Log.e("OAuthAuthorizationActivity.requestToken", e); } } - } catch (Exception e) { - Log.e("OAuthAuthorizationActivity.requestToken(1)", e); } requestTokenHandler.sendEmptyMessage(status); diff --git a/main/src/cgeo/geocaching/settings/Settings.java b/main/src/cgeo/geocaching/settings/Settings.java index 0e6158f..3597cd0 100644 --- a/main/src/cgeo/geocaching/settings/Settings.java +++ b/main/src/cgeo/geocaching/settings/Settings.java @@ -471,7 +471,7 @@ public final class Settings { /** * @return User selected date format on GC.com - * @see Login#gcCustomDateFormats + * @see Login#GC_CUSTOM_DATE_FORMATS */ public static String getGcCustomDate() { return getString(R.string.pref_gccustomdate, null); @@ -548,16 +548,9 @@ public final class Settings { static boolean getImperialUnitsDefault() { final String countryCode = Locale.getDefault().getCountry(); - if ("US".equals(countryCode)) { - return true; // USA - } - if ("LR".equals(countryCode)) { - return true; // Liberia - } - if ("MM".equals(countryCode)) { - return true; // Burma - } - return false; + return "US".equals(countryCode) // USA + || "LR".equals(countryCode) // Liberia + || "MM".equals(countryCode); // Burma } public static boolean isLiveMap() { diff --git a/main/src/cgeo/geocaching/utils/DatabaseBackupUtils.java b/main/src/cgeo/geocaching/utils/DatabaseBackupUtils.java index 24f375d..8aa605f 100644 --- a/main/src/cgeo/geocaching/utils/DatabaseBackupUtils.java +++ b/main/src/cgeo/geocaching/utils/DatabaseBackupUtils.java @@ -97,7 +97,7 @@ public class DatabaseBackupUtils { public static File getRestoreFile() { final File fileSourceFile = cgData.getBackupFileInternal(); - return fileSourceFile.exists() ? fileSourceFile : null; + return fileSourceFile.exists() && fileSourceFile.length() > 0 ? fileSourceFile : null; } public static boolean hasBackup() { diff --git a/main/src/cgeo/geocaching/utils/ImageUtils.java b/main/src/cgeo/geocaching/utils/ImageUtils.java index ea7d3ff..dc6333a 100644 --- a/main/src/cgeo/geocaching/utils/ImageUtils.java +++ b/main/src/cgeo/geocaching/utils/ImageUtils.java @@ -10,6 +10,7 @@ import android.graphics.drawable.BitmapDrawable; import java.io.BufferedOutputStream; import java.io.FileOutputStream; +import java.io.IOException; public final class ImageUtils { @@ -75,7 +76,7 @@ public final class ImageUtils { bitmap.compress(format, quality, bos); bos.flush(); bos.close(); - } catch (Exception e) { + } catch (IOException e) { Log.e("ImageHelper.storeBitmap", e); } } diff --git a/main/src/cgeo/geocaching/utils/SimpleCancellableHandler.java b/main/src/cgeo/geocaching/utils/SimpleCancellableHandler.java index 9207c74..22cd4d7 100644 --- a/main/src/cgeo/geocaching/utils/SimpleCancellableHandler.java +++ b/main/src/cgeo/geocaching/utils/SimpleCancellableHandler.java @@ -26,7 +26,6 @@ public class SimpleCancellableHandler extends CancellableHandler { activity.showToast(msg.getData().getString(MESSAGE_TEXT)); } dismissProgress(); - return; } @Override diff --git a/main/src/cgeo/geocaching/utils/SimpleHandler.java b/main/src/cgeo/geocaching/utils/SimpleHandler.java index b01d0e1..8e0a479 100644 --- a/main/src/cgeo/geocaching/utils/SimpleHandler.java +++ b/main/src/cgeo/geocaching/utils/SimpleHandler.java @@ -3,7 +3,6 @@ package cgeo.geocaching.utils; import cgeo.geocaching.activity.AbstractActivity; import cgeo.geocaching.activity.Progress; -import android.content.res.Resources; import android.os.Handler; import android.os.Message; @@ -15,48 +14,20 @@ public abstract class SimpleHandler extends Handler { protected final WeakReference<Progress> progressDialogRef; public SimpleHandler(final AbstractActivity activity, final Progress progress) { - this.activityRef = new WeakReference<AbstractActivity>(activity); - this.progressDialogRef = new WeakReference<Progress>(progress); + activityRef = new WeakReference<AbstractActivity>(activity); + progressDialogRef = new WeakReference<Progress>(progress); } @Override public void handleMessage(final Message msg) { - AbstractActivity activity = activityRef.get(); + final AbstractActivity activity = activityRef.get(); if (activity != null && msg.getData() != null && msg.getData().getString(MESSAGE_TEXT) != null) { activity.showToast(msg.getData().getString(MESSAGE_TEXT)); } - dismissProgress(); - return; - } - - protected final void showToast(final int resId) { - AbstractActivity activity = activityRef.get(); - if (activity != null) { - Resources res = activity.getResources(); - activity.showToast(res.getText(resId).toString()); - } - } - - protected final void dismissProgress() { - Progress progressDialog = progressDialogRef.get(); + final Progress progressDialog = progressDialogRef.get(); if (progressDialog != null) { progressDialog.dismiss(); } } - protected final void setProgressMessage(final String txt) { - Progress progressDialog = progressDialogRef.get(); - if (progressDialog != null) { - progressDialog.setMessage(txt); - } - } - - protected final void finishActivity() { - AbstractActivity activity = activityRef.get(); - if (activity != null) { - activity.finish(); - } - - } - } diff --git a/main/src/cgeo/geocaching/utils/UncertainProperty.java b/main/src/cgeo/geocaching/utils/UncertainProperty.java index 5f86662..e8686e3 100644 --- a/main/src/cgeo/geocaching/utils/UncertainProperty.java +++ b/main/src/cgeo/geocaching/utils/UncertainProperty.java @@ -2,6 +2,11 @@ package cgeo.geocaching.utils; import cgeo.geocaching.connector.gc.Tile; +/** + * Property with certainty. When merging properties, the one with higher certainty wins. + * + * @param <T> + */ public class UncertainProperty<T> { private final T value; |
