Methods Summary |
---|
static void | buildCreationString(java.lang.StringBuilder builder)
if (ATTRIBUTES.length != ATTRIBUTES_DATA_TYPE.length) {
throw new IllegalArgumentException(
"Attribute length does not match data type length");
}
for (int i = 0; i < ATTRIBUTES_DATA_TYPE.length; i++) {
if (i != 0) {
builder.append(", ");
}
builder.append(String.format("%s %s", ATTRIBUTES[i],
ATTRIBUTES_DATA_TYPE[i]));
}
|
static com.android.locationtracker.data.TrackerEntry | createEntry(android.database.Cursor cursor)
String timestamp = cursor.getString(cursor.getColumnIndex(TIMESTAMP));
String tag = cursor.getString(cursor.getColumnIndex(TAG));
String sType = cursor.getString(cursor.getColumnIndex(ENTRY_TYPE));
TrackerEntry entry = new TrackerEntry(tag, EntryType.valueOf(sType));
entry.setTimestamp(timestamp);
if (entry.getType() == EntryType.LOCATION_TYPE) {
Location location = new Location(tag);
location.setLatitude(cursor.getFloat(cursor
.getColumnIndexOrThrow(LATITUDE)));
location.setLongitude(cursor.getFloat(cursor
.getColumnIndexOrThrow(LONGITUDE)));
Float accuracy = getNullableFloat(cursor, ACCURACY);
if (accuracy != null) {
location.setAccuracy(accuracy);
}
Float altitude = getNullableFloat(cursor, ALTITUDE);
if (altitude != null) {
location.setAltitude(altitude);
}
Float bearing = getNullableFloat(cursor, BEARING);
if (bearing != null) {
location.setBearing(bearing);
}
Float speed = getNullableFloat(cursor, SPEED);
if (speed != null) {
location.setSpeed(speed);
}
location.setTime(cursor.getLong(cursor.getColumnIndex(LOC_TIME)));
entry.setLocation(location);
}
entry.setLogMsg(cursor.getString(cursor.getColumnIndex(DEBUG_INFO)));
return entry;
|
static com.android.locationtracker.data.TrackerEntry | createEntry(android.location.Location loc, float distFromNetLocation)Creates a TrackerEntry from a Location
TrackerEntry entry = new TrackerEntry(loc);
String timestampVal = DateUtils.getCurrentKMLTimestamp();
entry.setTimestamp(timestampVal);
entry.setDistFromNetLocation(distFromNetLocation);
return entry;
|
static com.android.locationtracker.data.TrackerEntry | createEntry(java.lang.String tag, java.lang.String msg)Creates a TrackerEntry from a log msg
TrackerEntry entry = new TrackerEntry(tag, EntryType.LOG_TYPE);
String timestampVal = DateUtils.getCurrentKMLTimestamp();
entry.setTimestamp(timestampVal);
entry.setLogMsg(msg);
return entry;
|
android.content.ContentValues | getAsContentValues()
ContentValues cValues = new ContentValues(ATTRIBUTES.length);
cValues.put(TIMESTAMP, mTimestamp);
cValues.put(TAG, mTag);
cValues.put(ENTRY_TYPE, mType.toString());
if (mType == EntryType.LOCATION_TYPE) {
cValues.put(LATITUDE, mLocation.getLatitude());
cValues.put(LONGITUDE, mLocation.getLongitude());
if (mLocation.hasAccuracy()) {
cValues.put(ACCURACY, mLocation.getAccuracy());
}
if (mLocation.hasAltitude()) {
cValues.put(ALTITUDE, mLocation.getAltitude());
}
if (mLocation.hasSpeed()) {
cValues.put(SPEED, mLocation.getSpeed());
}
if (mLocation.hasBearing()) {
cValues.put(BEARING, mLocation.getBearing());
}
cValues.put(DIST_NET_LOCATION, mDistFromNetLocation);
cValues.put(LOC_TIME, mLocation.getTime());
StringBuilder debugBuilder = new StringBuilder("");
if (mLocation.getExtras() != null) {
for (String key : LOCATION_DEBUG_KEYS) {
Object val = mLocation.getExtras().get(key);
if (val != null) {
debugBuilder.append(String.format("%s=%s; ", key, val
.toString()));
}
}
}
cValues.put(DEBUG_INFO, debugBuilder.toString());
} else {
cValues.put(DEBUG_INFO, mLogMsg);
}
return cValues;
|
float | getDistFromNetLocation()
return mDistFromNetLocation;
|
android.location.Location | getLocation()
return mLocation;
|
java.lang.String | getLogMsg()
return mLogMsg;
|
private static java.lang.Float | getNullableFloat(android.database.Cursor cursor, java.lang.String colName)
Float retValue = null;
int colIndex = cursor.getColumnIndexOrThrow(colName);
if (!cursor.isNull(colIndex)) {
retValue = cursor.getFloat(colIndex);
}
return retValue;
|
java.lang.String | getTag()
return mTag;
|
java.lang.String | getTimestamp()
return mTimestamp;
|
com.android.locationtracker.data.TrackerEntry$EntryType | getType()
return mType;
|
private void | setDistFromNetLocation(float distFromNetLocation)
mDistFromNetLocation = distFromNetLocation;
|
private void | setLocation(android.location.Location location)
mLocation = location;
|
private void | setLogMsg(java.lang.String msg)
mLogMsg = msg;
|
private void | setTimestamp(java.lang.String timestamp)
mTimestamp = timestamp;
|