1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
package cgeo.geocaching.connector.oc;
import cgeo.geocaching.Geocache;
import cgeo.geocaching.LogCacheActivity;
import cgeo.geocaching.TrackableLog;
import cgeo.geocaching.connector.ILoggingManager;
import cgeo.geocaching.connector.ImageResult;
import cgeo.geocaching.connector.LogResult;
import cgeo.geocaching.enumerations.LogType;
import cgeo.geocaching.enumerations.StatusCode;
import android.app.Activity;
import android.net.Uri;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections;
import java.util.List;
public class OkapiLoggingManager implements ILoggingManager {
private final OCApiConnector connector;
private final Geocache cache;
private LogCacheActivity activity;
private final static List<LogType> standardLogTypes = Arrays.asList(LogType.FOUND_IT, LogType.DIDNT_FIND_IT, LogType.NOTE, LogType.NEEDS_MAINTENANCE);
private final static List<LogType> eventLogTypes = Arrays.asList(LogType.WILL_ATTEND, LogType.ATTENDED, LogType.NOTE);
public OkapiLoggingManager(Activity activity, OCApiConnector connector, Geocache cache) {
this.connector = connector;
this.cache = cache;
this.activity = (LogCacheActivity) activity;
}
@Override
public void init() {
activity.onLoadFinished();
}
@Override
public LogResult postLog(Geocache cache, LogType logType, Calendar date, String log, String logPassword, List<TrackableLog> trackableLogs) {
return OkapiClient.postLog(cache, logType, date, log, logPassword, connector);
}
@Override
public ImageResult postLogImage(String logId, String imageCaption, String imageDescription, Uri imageUri) {
return new ImageResult(StatusCode.LOG_POST_ERROR, "");
}
@Override
public boolean hasLoaderError() {
return false;
}
@Override
public List<TrackableLog> getTrackables() {
return Collections.emptyList();
}
@Override
public List<LogType> getPossibleLogTypes() {
if (cache.isEventCache()) {
return eventLogTypes;
}
return standardLogTypes;
}
}
|