Add the owner of the shared with me tracks.

This commit is contained in:
Jimmy Shih
2013-02-14 14:16:39 -08:00
parent 10b714210b
commit c9fa895ba4
12 changed files with 94 additions and 49 deletions
@@ -88,7 +88,8 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils {
int driveIdIndex = cursor.getColumnIndexOrThrow(TracksColumns.DRIVEID);
int modifiedTimeIndex = cursor.getColumnIndexOrThrow(TracksColumns.MODIFIEDTIME);
int sharedWithMeIndex = cursor.getColumnIndexOrThrow(TracksColumns.SHAREDWITHME);
int sharedOwnerIndex = cursor.getColumnIndexOrThrow(TracksColumns.SHAREDOWNER);
Track track = new Track();
TripStatistics tripStatistics = track.getTripStatistics();
if (!cursor.isNull(idIndex)) {
@@ -171,6 +172,9 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils {
if (!cursor.isNull(sharedWithMeIndex)) {
track.setSharedWithMe(cursor.getInt(sharedWithMeIndex) == 1);
}
if (!cursor.isNull(sharedOwnerIndex)) {
track.setSharedOwner(cursor.getString(sharedOwnerIndex));
}
return track;
}
@@ -321,6 +325,7 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils {
values.put(TracksColumns.DRIVEID, track.getDriveId());
values.put(TracksColumns.MODIFIEDTIME, track.getModifiedTime());
values.put(TracksColumns.SHAREDWITHME, track.isSharedWithMe());
values.put(TracksColumns.SHAREDOWNER, track.getSharedOwner());
return values;
}
@@ -50,6 +50,7 @@ public class Track implements Parcelable {
private String driveId = "";
private long modifiedTime = -1L;
private boolean sharedWithMe = false;
private String sharedOwner = "";
private TripStatistics tripStatistics = new TripStatistics();
@@ -72,6 +73,7 @@ public class Track implements Parcelable {
driveId = in.readString();
modifiedTime = in.readLong();
sharedWithMe = in.readByte() == 1;
sharedOwner = in.readString();
ClassLoader classLoader = getClass().getClassLoader();
tripStatistics = in.readParcelable(classLoader);
@@ -102,6 +104,7 @@ public class Track implements Parcelable {
dest.writeString(driveId);
dest.writeLong(modifiedTime);
dest.writeByte((byte) (sharedWithMe ? 1 : 0));
dest.writeString(sharedOwner);
dest.writeParcelable(tripStatistics, 0);
for (int i = 0; i < numberOfPoints; ++i) {
@@ -225,6 +228,14 @@ public class Track implements Parcelable {
this.sharedWithMe = sharedWithMe;
}
public String getSharedOwner() {
return sharedOwner;
}
public void setSharedOwner(String sharedOwner) {
this.sharedOwner = sharedOwner;
}
public TripStatistics getTripStatistics() {
return tripStatistics;
}
@@ -86,6 +86,9 @@ public interface TracksColumns extends BaseColumns {
// 1 if the Google Drive file is from the "Shared with me" directory
public static final String SHAREDWITHME = "sharedwithme";
// The owner of the shared with me track
public static final String SHAREDOWNER = "sharedOwner";
public static final String CREATE_TABLE = "CREATE TABLE " + TABLE_NAME + " (" // table
+ _ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " // id
+ NAME + " STRING, " // name
@@ -116,7 +119,8 @@ public interface TracksColumns extends BaseColumns {
+ ICON + " STRING, " // icon
+ DRIVEID + " STRING, " // drive id
+ MODIFIEDTIME + " INTEGER, " // modified time
+ SHAREDWITHME + " INTEGER" + ");"; // shared with me
+ SHAREDWITHME + " INTEGER, " // shared with me
+ SHAREDOWNER + " STRING" + ");"; // shared owner
public static final String[] COLUMNS = { _ID, // id
NAME, // name
@@ -147,7 +151,8 @@ public interface TracksColumns extends BaseColumns {
ICON, // icon
DRIVEID, // drive id
MODIFIEDTIME, // modified time
SHAREDWITHME }; // shared with me
SHAREDWITHME, // shared with me
SHAREDOWNER }; // shared owner
public static final byte[] COLUMN_TYPES = { ContentTypeIds.LONG_TYPE_ID, // id
ContentTypeIds.STRING_TYPE_ID, // name
@@ -178,6 +183,7 @@ public interface TracksColumns extends BaseColumns {
ContentTypeIds.STRING_TYPE_ID, // icon
ContentTypeIds.STRING_TYPE_ID, // drive id
ContentTypeIds.LONG_TYPE_ID, // modified time
ContentTypeIds.BOOLEAN_TYPE_ID // shared with me
ContentTypeIds.BOOLEAN_TYPE_ID, // shared with me
ContentTypeIds.STRING_TYPE_ID // shared owner
};
}