diff options
Diffstat (limited to 'cgeo-calendar')
-rw-r--r-- | cgeo-calendar/.classpath | 1 | ||||
-rw-r--r-- | cgeo-calendar/.settings/org.eclipse.jdt.core.prefs | 2 | ||||
-rw-r--r-- | cgeo-calendar/.settings/org.eclipse.jdt.ui.prefs | 29 | ||||
-rw-r--r-- | cgeo-calendar/proguard-project.txt | 5 | ||||
-rw-r--r-- | cgeo-calendar/src/cgeo/calendar/AbstractAddEntry.java | 6 | ||||
-rw-r--r-- | cgeo-calendar/src/cgeo/calendar/AddEntry.java | 4 | ||||
-rw-r--r-- | cgeo-calendar/src/cgeo/calendar/AddEntryLevel14.java | 4 | ||||
-rw-r--r-- | cgeo-calendar/src/cgeo/calendar/CalendarActivity.java | 5 | ||||
-rw-r--r-- | cgeo-calendar/src/cgeo/calendar/CalendarEntry.java | 23 | ||||
-rw-r--r-- | cgeo-calendar/src/cgeo/calendar/Compatibility.java | 4 |
10 files changed, 62 insertions, 21 deletions
diff --git a/cgeo-calendar/.classpath b/cgeo-calendar/.classpath index 2f1c26a..004d749 100644 --- a/cgeo-calendar/.classpath +++ b/cgeo-calendar/.classpath @@ -10,5 +10,6 @@ <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> <classpathentry combineaccessrules="false" kind="src" path="/cgeo"/> <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/> + <classpathentry kind="lib" path="/cgeo/compile-libs/org.eclipse.jdt.annotation_1.1.0.v20130513-1648.jar"/> <classpathentry kind="output" path="bin/classes"/> </classpath> diff --git a/cgeo-calendar/.settings/org.eclipse.jdt.core.prefs b/cgeo-calendar/.settings/org.eclipse.jdt.core.prefs index 10b38b3..4ef7c1f 100644 --- a/cgeo-calendar/.settings/org.eclipse.jdt.core.prefs +++ b/cgeo-calendar/.settings/org.eclipse.jdt.core.prefs @@ -51,7 +51,7 @@ org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public -org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=no_tag +org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled diff --git a/cgeo-calendar/.settings/org.eclipse.jdt.ui.prefs b/cgeo-calendar/.settings/org.eclipse.jdt.ui.prefs index 7616a5b..06e562c 100644 --- a/cgeo-calendar/.settings/org.eclipse.jdt.ui.prefs +++ b/cgeo-calendar/.settings/org.eclipse.jdt.ui.prefs @@ -1,4 +1,3 @@ -#Wed Sep 14 20:41:07 CEST 2011 eclipse.preferences.version=1 editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true formatter_profile=_cgeo @@ -9,7 +8,7 @@ org.eclipse.jdt.ui.ondemandthreshold=99 org.eclipse.jdt.ui.staticondemandthreshold=99 sp_cleanup.add_default_serial_version_id=true sp_cleanup.add_generated_serial_version_id=false -sp_cleanup.add_missing_annotations=false +sp_cleanup.add_missing_annotations=true sp_cleanup.add_missing_deprecated_annotations=true sp_cleanup.add_missing_methods=false sp_cleanup.add_missing_nls_tags=false @@ -20,15 +19,17 @@ sp_cleanup.always_use_blocks=true sp_cleanup.always_use_parentheses_in_expressions=false sp_cleanup.always_use_this_for_non_static_field_access=false sp_cleanup.always_use_this_for_non_static_method_access=false -sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.convert_functional_interfaces=false +sp_cleanup.convert_to_enhanced_for_loop=true sp_cleanup.correct_indentation=false sp_cleanup.format_source_code=true sp_cleanup.format_source_code_changes_only=true -sp_cleanup.make_local_variable_final=false -sp_cleanup.make_parameters_final=false -sp_cleanup.make_private_fields_final=false +sp_cleanup.insert_inferred_type_arguments=false +sp_cleanup.make_local_variable_final=true +sp_cleanup.make_parameters_final=true +sp_cleanup.make_private_fields_final=true sp_cleanup.make_type_abstract_if_missing_method=false -sp_cleanup.make_variable_declarations_final=false +sp_cleanup.make_variable_declarations_final=true sp_cleanup.never_use_blocks=false sp_cleanup.never_use_parentheses_in_expressions=true sp_cleanup.on_save_use_additional_actions=true @@ -36,15 +37,16 @@ sp_cleanup.organize_imports=true sp_cleanup.qualify_static_field_accesses_with_declaring_class=false sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_with_declaring_class=true sp_cleanup.qualify_static_method_accesses_with_declaring_class=false sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_redundant_type_arguments=false sp_cleanup.remove_trailing_whitespaces=true sp_cleanup.remove_trailing_whitespaces_all=true sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -sp_cleanup.remove_unnecessary_casts=false -sp_cleanup.remove_unnecessary_nls_tags=false -sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true sp_cleanup.remove_unused_local_variables=false sp_cleanup.remove_unused_private_fields=true sp_cleanup.remove_unused_private_members=false @@ -52,10 +54,13 @@ sp_cleanup.remove_unused_private_methods=true sp_cleanup.remove_unused_private_types=true sp_cleanup.sort_members=false sp_cleanup.sort_members_all=false -sp_cleanup.use_blocks=false +sp_cleanup.use_anonymous_class_creation=false +sp_cleanup.use_blocks=true sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_lambda=false sp_cleanup.use_parentheses_in_expressions=false sp_cleanup.use_this_for_non_static_field_access=false sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true sp_cleanup.use_this_for_non_static_method_access=false sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true +sp_cleanup.use_type_arguments=false diff --git a/cgeo-calendar/proguard-project.txt b/cgeo-calendar/proguard-project.txt index 453d1a6..c4cb930 100644 --- a/cgeo-calendar/proguard-project.txt +++ b/cgeo-calendar/proguard-project.txt @@ -29,4 +29,7 @@ public <init>(android.content.Context, android.util.AttributeSet); public <init>(android.content.Context, android.util.AttributeSet, int); public void set*(...); -}
\ No newline at end of file +} + +# Null analysis annotations of Eclipse JDT are just used by the Eclipse compiler, so ignore them here +-dontwarn org.eclipse.jdt.annotation.** diff --git a/cgeo-calendar/src/cgeo/calendar/AbstractAddEntry.java b/cgeo-calendar/src/cgeo/calendar/AbstractAddEntry.java index 893161c..e35ed19 100644 --- a/cgeo-calendar/src/cgeo/calendar/AbstractAddEntry.java +++ b/cgeo-calendar/src/cgeo/calendar/AbstractAddEntry.java @@ -1,13 +1,17 @@ package cgeo.calendar; +import org.eclipse.jdt.annotation.NonNull; + import android.util.Log; abstract class AbstractAddEntry { + @NonNull protected final CalendarEntry entry; + @NonNull protected final CalendarActivity activity; - public AbstractAddEntry(final CalendarEntry entry, final CalendarActivity activity) { + public AbstractAddEntry(@NonNull final CalendarEntry entry, @NonNull final CalendarActivity activity) { this.entry = entry; this.activity = activity; } diff --git a/cgeo-calendar/src/cgeo/calendar/AddEntry.java b/cgeo-calendar/src/cgeo/calendar/AddEntry.java index 30af346..a267e47 100644 --- a/cgeo-calendar/src/cgeo/calendar/AddEntry.java +++ b/cgeo-calendar/src/cgeo/calendar/AddEntry.java @@ -1,5 +1,7 @@ package cgeo.calendar; +import org.eclipse.jdt.annotation.NonNull; + import android.content.ContentValues; import android.net.Uri; import android.text.Html; @@ -16,7 +18,7 @@ class AddEntry extends AbstractAddEntry { * @param calendarId * The selected calendar */ - public AddEntry(final CalendarEntry entry, final CalendarActivity activity, final int calendarId) { + public AddEntry(@NonNull final CalendarEntry entry, @NonNull final CalendarActivity activity, final int calendarId) { super(entry, activity); this.calendarId = calendarId; } diff --git a/cgeo-calendar/src/cgeo/calendar/AddEntryLevel14.java b/cgeo-calendar/src/cgeo/calendar/AddEntryLevel14.java index 11820b4..731a0f8 100644 --- a/cgeo-calendar/src/cgeo/calendar/AddEntryLevel14.java +++ b/cgeo-calendar/src/cgeo/calendar/AddEntryLevel14.java @@ -1,5 +1,7 @@ package cgeo.calendar; +import org.eclipse.jdt.annotation.NonNull; + import android.content.Intent; import android.text.Html; @@ -12,7 +14,7 @@ import java.util.Date; */ class AddEntryLevel14 extends AbstractAddEntry { - public AddEntryLevel14(final CalendarEntry entry, final CalendarActivity activity) { + public AddEntryLevel14(@NonNull final CalendarEntry entry, @NonNull final CalendarActivity activity) { super(entry, activity); } diff --git a/cgeo-calendar/src/cgeo/calendar/CalendarActivity.java b/cgeo-calendar/src/cgeo/calendar/CalendarActivity.java index 2f0c08d..e21de2b 100644 --- a/cgeo-calendar/src/cgeo/calendar/CalendarActivity.java +++ b/cgeo-calendar/src/cgeo/calendar/CalendarActivity.java @@ -1,5 +1,7 @@ package cgeo.calendar; +import org.eclipse.jdt.annotation.NonNull; + import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; @@ -47,7 +49,7 @@ public final class CalendarActivity extends Activity { * @param entry * new entry to be stored */ - private void selectCalendarForAdding(final CalendarEntry entry) { + private void selectCalendarForAdding(@NonNull final CalendarEntry entry) { final SparseArray<String> calendars = queryCalendars(); if (calendars.size() == 0) { @@ -80,6 +82,7 @@ public final class CalendarActivity extends Activity { builder.create().show(); } + @NonNull private SparseArray<String> queryCalendars() { final SparseArray<String> calendars = new SparseArray<>(); diff --git a/cgeo-calendar/src/cgeo/calendar/CalendarEntry.java b/cgeo-calendar/src/cgeo/calendar/CalendarEntry.java index 1e37d6b..8308b7b 100644 --- a/cgeo-calendar/src/cgeo/calendar/CalendarEntry.java +++ b/cgeo-calendar/src/cgeo/calendar/CalendarEntry.java @@ -3,6 +3,7 @@ package cgeo.calendar; import cgeo.geocaching.utils.Log; import org.apache.commons.lang3.CharEncoding; +import org.eclipse.jdt.annotation.NonNull; import android.net.Uri; import android.text.Html; @@ -16,16 +17,23 @@ import java.util.Date; class CalendarEntry { + @NonNull private final String shortDesc; + @NonNull private final String hiddenDate; + @NonNull private final String url; + @NonNull private final String personalNote; + @NonNull private final String name; + @NonNull private final String coords; private int startTimeMinutes = -1; + @NonNull private final Uri uri; - public CalendarEntry(final Uri uri) { + public CalendarEntry(@NonNull final Uri uri) { this.uri = uri; this.shortDesc = getParameter(ICalendar.PARAM_SHORT_DESC); this.hiddenDate = getParameter(ICalendar.PARAM_HIDDEN_DATE); @@ -43,7 +51,8 @@ class CalendarEntry { } } - private String getParameter(final String paramKey) { + @NonNull + private String getParameter(@NonNull final String paramKey) { try { final String param = uri.getQueryParameter(paramKey); if (param == null) { @@ -60,18 +69,22 @@ class CalendarEntry { return getName().length() > 0 && getHiddenDate().length() > 0; } + @NonNull public String getHiddenDate() { return hiddenDate; } + @NonNull public String getUrl() { return url; } + @NonNull public String getPersonalNote() { return personalNote; } + @NonNull public String getShortDesc() { return shortDesc; } @@ -79,6 +92,7 @@ class CalendarEntry { /** * @return <code>Date</code> based on hidden date. Time is set to 00:00:00. */ + @NonNull protected Date parseDate() { try { final Calendar cal = Calendar.getInstance(); @@ -90,13 +104,14 @@ class CalendarEntry { return cal.getTime(); } catch (final NumberFormatException e) { // cannot happen normally, but static code analysis does not know + throw new IllegalStateException("hidden date must be a valid date for cache calendar entries"); } - return null; } /** * @return description string with images removed and personal note included */ + @NonNull protected String parseDescription() { final StringBuilder description = new StringBuilder(); description.append(getUrl()); @@ -121,6 +136,7 @@ class CalendarEntry { return description.toString(); } + @NonNull public String getName() { return name; } @@ -129,6 +145,7 @@ class CalendarEntry { return startTimeMinutes; } + @NonNull public String getCoords() { return coords; } diff --git a/cgeo-calendar/src/cgeo/calendar/Compatibility.java b/cgeo-calendar/src/cgeo/calendar/Compatibility.java index ff14a0f..61ea636 100644 --- a/cgeo-calendar/src/cgeo/calendar/Compatibility.java +++ b/cgeo-calendar/src/cgeo/calendar/Compatibility.java @@ -1,5 +1,7 @@ package cgeo.calendar; +import org.eclipse.jdt.annotation.NonNull; + import android.net.Uri; import android.os.Build; @@ -9,10 +11,12 @@ public final class Compatibility { private final static boolean IS_LEVEL_8 = SDK_VERSION >= 8; private final static boolean IS_LEVEL_14 = SDK_VERSION >= 14; + @NonNull public static Uri getCalendarProviderURI() { return Uri.parse(IS_LEVEL_8 ? "content://com.android.calendar/calendars" : "content://calendar/calendars"); } + @NonNull public static Uri getCalendarEventsProviderURI() { return Uri.parse(IS_LEVEL_8 ? "content://com.android.calendar/events" : "content://calendar/events"); } |