aboutsummaryrefslogtreecommitdiffstats
path: root/cgeo-calendar
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2015-01-15 18:55:59 +0100
committerBananeweizen <bananeweizen@gmx.de>2015-01-15 18:55:59 +0100
commitfa5afccd5cf1804bd9ae8871af754bd5ca2ca01f (patch)
tree02437dfe64b1909a5d2f084d937ea8e7760b3cd7 /cgeo-calendar
parente285004d95c559be50c0cce495de4ee4198a5996 (diff)
downloadcgeo-fa5afccd5cf1804bd9ae8871af754bd5ca2ca01f.zip
cgeo-fa5afccd5cf1804bd9ae8871af754bd5ca2ca01f.tar.gz
cgeo-fa5afccd5cf1804bd9ae8871af754bd5ca2ca01f.tar.bz2
null annotations in apps, contacts, calendar
Diffstat (limited to 'cgeo-calendar')
-rw-r--r--cgeo-calendar/.classpath1
-rw-r--r--cgeo-calendar/compile-libs/org.eclipse.jdt.annotation_1.1.0.v20130513-1648.jarbin0 -> 14613 bytes
-rw-r--r--cgeo-calendar/src/cgeo/calendar/AbstractAddEntry.java6
-rw-r--r--cgeo-calendar/src/cgeo/calendar/AddEntry.java4
-rw-r--r--cgeo-calendar/src/cgeo/calendar/AddEntryLevel14.java4
-rw-r--r--cgeo-calendar/src/cgeo/calendar/CalendarActivity.java5
-rw-r--r--cgeo-calendar/src/cgeo/calendar/CalendarEntry.java23
-rw-r--r--cgeo-calendar/src/cgeo/calendar/Compatibility.java4
8 files changed, 40 insertions, 7 deletions
diff --git a/cgeo-calendar/.classpath b/cgeo-calendar/.classpath
index 2f1c26a..7d962c2 100644
--- a/cgeo-calendar/.classpath
+++ b/cgeo-calendar/.classpath
@@ -11,4 +11,5 @@
<classpathentry combineaccessrules="false" kind="src" path="/cgeo"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="output" path="bin/classes"/>
+ <classpathentry kind="lib" path="compile-libs/org.eclipse.jdt.annotation_1.1.0.v20130513-1648.jar"/>
</classpath>
diff --git a/cgeo-calendar/compile-libs/org.eclipse.jdt.annotation_1.1.0.v20130513-1648.jar b/cgeo-calendar/compile-libs/org.eclipse.jdt.annotation_1.1.0.v20130513-1648.jar
new file mode 100644
index 0000000..daca164
--- /dev/null
+++ b/cgeo-calendar/compile-libs/org.eclipse.jdt.annotation_1.1.0.v20130513-1648.jar
Binary files differ
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");
}