blob: 03954f5f882e3037a6e1dc5755a7bc8ff6d040ab (
plain)
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
|
package cgeo.geocaching.apps;
import menion.android.locus.addon.publiclib.geoData.PointsData;
import menion.android.locus.addon.publiclib.utils.DataCursor;
import menion.android.locus.addon.publiclib.utils.DataStorage;
import android.content.ContentProvider;
import android.content.ContentValues;
import android.database.Cursor;
import android.net.Uri;
import android.os.Parcel;
/**
* code provided by menion - developer of Locus
*/
public class LocusDataStorageProvider extends ContentProvider {
@Override
public Cursor query(Uri aUri, String[] aProjection, String aSelection,
String[] aSelectionArgs, String aSortOrder) {
final DataCursor cursor = new DataCursor(new String[] { "data" });
for (final PointsData item : DataStorage.getData()) {
final Parcel par = Parcel.obtain();
item.writeToParcel(par, 0);
// add byte array to row
cursor.addRow(new Object[] { par.marshall() });
par.recycle();
}
// data filled to cursor, clear reference to prevent some memory issue
DataStorage.clearData();
// now finally return filled cursor
return cursor;
}
@Override
public int delete(Uri uri, String selection, String[] selectionArgs) {
return 0;
}
@Override
public String getType(Uri uri) {
return null;
}
@Override
public Uri insert(Uri uri, ContentValues values) {
return null;
}
@Override
public boolean onCreate() {
return false;
}
@Override
public int update(Uri uri, ContentValues values, String selection,
String[] selectionArgs) {
return 0;
}
}
|