diff options
author | Bananeweizen <bananeweizen@gmx.de> | 2015-01-15 19:07:22 +0100 |
---|---|---|
committer | Bananeweizen <bananeweizen@gmx.de> | 2015-01-15 19:07:22 +0100 |
commit | d48111ad950a65f44b07cc4f88accb83a2ec2916 (patch) | |
tree | 48440c381f997730852e2b5cb0dcd9241f69a813 /main/thirdparty/menion/android | |
parent | 63faef78abca89237a6ce23f823ab31208e82410 (diff) | |
download | cgeo-d48111ad950a65f44b07cc4f88accb83a2ec2916.zip cgeo-d48111ad950a65f44b07cc4f88accb83a2ec2916.tar.gz cgeo-d48111ad950a65f44b07cc4f88accb83a2ec2916.tar.bz2 |
refactoring: move LocusDataStorageProvider to external source folder
That code is not ours, and should therefore be managed separately.
However, the original package name is not really known.
Diffstat (limited to 'main/thirdparty/menion/android')
-rw-r--r-- | main/thirdparty/menion/android/locus/LocusDataStorageProvider.java | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/main/thirdparty/menion/android/locus/LocusDataStorageProvider.java b/main/thirdparty/menion/android/locus/LocusDataStorageProvider.java new file mode 100644 index 0000000..b575cb5 --- /dev/null +++ b/main/thirdparty/menion/android/locus/LocusDataStorageProvider.java @@ -0,0 +1,63 @@ +package menion.android.locus; + +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; + } + +} |