Removed use of Google Drive's shared owner.

This commit is contained in:
Dennis Guse
2019-07-11 22:00:11 +02:00
parent 41be6916bb
commit 44eeb9142c
6 changed files with 10 additions and 62 deletions
@@ -180,9 +180,7 @@ public class MarkerListActivity extends AbstractActivity implements DeleteMarker
String description = statistics ? null : cursor.getString(descriptionIndex); String description = statistics ? null : cursor.getString(descriptionIndex);
String photoUrl = cursor.getString(photoUrlIndex); String photoUrl = cursor.getString(photoUrlIndex);
ListItemUtils.setListItem(MarkerListActivity.this, view, false, true, iconId, ListItemUtils.setListItem(MarkerListActivity.this, view, false, true, iconId, R.string.image_marker, name, null, null, 0, time, false, category, description, photoUrl);
R.string.image_marker, name, null, null, null, 0, time, false, category, description,
photoUrl);
} }
}; };
listView.setAdapter(resourceCursorAdapter); listView.setAdapter(resourceCursorAdapter);
@@ -82,7 +82,6 @@ public class SearchListActivity extends AbstractTrackActivity implements DeleteM
private static final String ICON_ID_FIELD = "icon"; private static final String ICON_ID_FIELD = "icon";
private static final String ICON_CONTENT_DESCRIPTION_ID_FIELD = "iconContentDescription"; private static final String ICON_CONTENT_DESCRIPTION_ID_FIELD = "iconContentDescription";
private static final String NAME_FIELD = "name"; private static final String NAME_FIELD = "name";
private static final String SHARED_OWNER_FIELD = "sharedOwner";
private static final String TOTAL_TIME_FIELD = "totalTime"; private static final String TOTAL_TIME_FIELD = "totalTime";
private static final String TOTAL_DISTANCE_FIELD = "totalDistance"; private static final String TOTAL_DISTANCE_FIELD = "totalDistance";
private static final String MARKER_COUNT_FIELD = "markerCount"; private static final String MARKER_COUNT_FIELD = "markerCount";
@@ -220,7 +219,6 @@ public class SearchListActivity extends AbstractTrackActivity implements DeleteM
int iconId = (Integer) resultMap.get(ICON_ID_FIELD); int iconId = (Integer) resultMap.get(ICON_ID_FIELD);
int iconContentDescriptionId = (Integer) resultMap.get(ICON_CONTENT_DESCRIPTION_ID_FIELD); int iconContentDescriptionId = (Integer) resultMap.get(ICON_CONTENT_DESCRIPTION_ID_FIELD);
String name = (String) resultMap.get(NAME_FIELD); String name = (String) resultMap.get(NAME_FIELD);
String sharedOwner = (String) resultMap.get(SHARED_OWNER_FIELD);
String totalTime = (String) resultMap.get(TOTAL_TIME_FIELD); String totalTime = (String) resultMap.get(TOTAL_TIME_FIELD);
String totalDistance = (String) resultMap.get(TOTAL_DISTANCE_FIELD); String totalDistance = (String) resultMap.get(TOTAL_DISTANCE_FIELD);
int markerCount = (Integer) resultMap.get(MARKER_COUNT_FIELD); int markerCount = (Integer) resultMap.get(MARKER_COUNT_FIELD);
@@ -230,7 +228,7 @@ public class SearchListActivity extends AbstractTrackActivity implements DeleteM
String photoUrl = (String) resultMap.get(PHOTO_URL_FIELD); String photoUrl = (String) resultMap.get(PHOTO_URL_FIELD);
ListItemUtils.setListItem(SearchListActivity.this, view, isRecording, isPaused, iconId, ListItemUtils.setListItem(SearchListActivity.this, view, isRecording, isPaused, iconId,
iconContentDescriptionId, name, sharedOwner, totalTime, totalDistance, markerCount, iconContentDescriptionId, name, totalTime, totalDistance, markerCount,
startTime, false, category, description, photoUrl); startTime, false, category, description, photoUrl);
return view; return view;
} }
@@ -472,7 +470,6 @@ public class SearchListActivity extends AbstractTrackActivity implements DeleteM
statistics ? R.drawable.ic_marker_yellow_pushpin : R.drawable.ic_marker_blue_pushpin); statistics ? R.drawable.ic_marker_yellow_pushpin : R.drawable.ic_marker_blue_pushpin);
resultMap.put(ICON_CONTENT_DESCRIPTION_ID_FIELD, R.string.image_marker); resultMap.put(ICON_CONTENT_DESCRIPTION_ID_FIELD, R.string.image_marker);
resultMap.put(NAME_FIELD, waypoint.getName()); resultMap.put(NAME_FIELD, waypoint.getName());
resultMap.put(SHARED_OWNER_FIELD, null);
// Display the marker's track name in the total time field // Display the marker's track name in the total time field
resultMap.put(TOTAL_TIME_FIELD, trackName == null ? null resultMap.put(TOTAL_TIME_FIELD, trackName == null ? null
: getString(R.string.search_list_marker_track_location, trackName)); : getString(R.string.search_list_marker_track_location, trackName));
@@ -502,7 +499,6 @@ public class SearchListActivity extends AbstractTrackActivity implements DeleteM
resultMap.put(ICON_ID_FIELD, TrackIconUtils.getIconDrawable(icon)); resultMap.put(ICON_ID_FIELD, TrackIconUtils.getIconDrawable(icon));
resultMap.put(ICON_CONTENT_DESCRIPTION_ID_FIELD, R.string.image_track); resultMap.put(ICON_CONTENT_DESCRIPTION_ID_FIELD, R.string.image_track);
resultMap.put(NAME_FIELD, track.getName()); resultMap.put(NAME_FIELD, track.getName());
resultMap.put(SHARED_OWNER_FIELD, track.getSharedOwner());
resultMap.put(TOTAL_TIME_FIELD, StringUtils.formatElapsedTime(tripStatitics.getTotalTime())); resultMap.put(TOTAL_TIME_FIELD, StringUtils.formatElapsedTime(tripStatitics.getTotalTime()));
resultMap.put(TOTAL_DISTANCE_FIELD, resultMap.put(TOTAL_DISTANCE_FIELD,
StringUtils.formatDistance(this, tripStatitics.getTotalDistance(), metricUnits)); StringUtils.formatDistance(this, tripStatitics.getTotalDistance(), metricUnits));
@@ -334,7 +334,6 @@ public class TrackListActivity extends AbstractTrackActivity implements FileType
int idIndex = cursor.getColumnIndex(TracksColumns._ID); int idIndex = cursor.getColumnIndex(TracksColumns._ID);
int iconIndex = cursor.getColumnIndex(TracksColumns.ICON); int iconIndex = cursor.getColumnIndex(TracksColumns.ICON);
int nameIndex = cursor.getColumnIndex(TracksColumns.NAME); int nameIndex = cursor.getColumnIndex(TracksColumns.NAME);
int sharedOwnerIndex = cursor.getColumnIndex(TracksColumns.SHAREDOWNER);
int totalTimeIndex = cursor.getColumnIndexOrThrow(TracksColumns.TOTALTIME); int totalTimeIndex = cursor.getColumnIndexOrThrow(TracksColumns.TOTALTIME);
int totalDistanceIndex = cursor.getColumnIndexOrThrow(TracksColumns.TOTALDISTANCE); int totalDistanceIndex = cursor.getColumnIndexOrThrow(TracksColumns.TOTALDISTANCE);
int startTimeIndex = cursor.getColumnIndexOrThrow(TracksColumns.STARTTIME); int startTimeIndex = cursor.getColumnIndexOrThrow(TracksColumns.STARTTIME);
@@ -346,7 +345,6 @@ public class TrackListActivity extends AbstractTrackActivity implements FileType
String icon = cursor.getString(iconIndex); String icon = cursor.getString(iconIndex);
int iconId = TrackIconUtils.getIconDrawable(icon); int iconId = TrackIconUtils.getIconDrawable(icon);
String name = cursor.getString(nameIndex); String name = cursor.getString(nameIndex);
String sharedOwner = cursor.getString(sharedOwnerIndex);
String totalTime = StringUtils.formatElapsedTime(cursor.getLong(totalTimeIndex)); String totalTime = StringUtils.formatElapsedTime(cursor.getLong(totalTimeIndex));
String totalDistance = StringUtils.formatDistance( String totalDistance = StringUtils.formatDistance(
TrackListActivity.this, cursor.getDouble(totalDistanceIndex), metricUnits); TrackListActivity.this, cursor.getDouble(totalDistanceIndex), metricUnits);
@@ -356,7 +354,7 @@ public class TrackListActivity extends AbstractTrackActivity implements FileType
String description = cursor.getString(descriptionIndex); String description = cursor.getString(descriptionIndex);
ListItemUtils.setListItem(TrackListActivity.this, view, isRecording, recordingTrackPaused, ListItemUtils.setListItem(TrackListActivity.this, view, isRecording, recordingTrackPaused,
iconId, R.string.image_track, name, sharedOwner, totalTime, totalDistance, markerCount, iconId, R.string.image_track, name, totalTime, totalDistance, markerCount,
startTime, true, category, description, null); startTime, true, category, description, null);
} }
}; };
@@ -52,7 +52,6 @@ public class ListItemUtils {
* @param iconId the icon id * @param iconId the icon id
* @param iconContentDescriptionId the icon content description id * @param iconContentDescriptionId the icon content description id
* @param name the name value * @param name the name value
* @param sharedOwner if shared with me track, the owner, else null
* @param totalTime the total time value * @param totalTime the total time value
* @param totalDistance the total distance value * @param totalDistance the total distance value
* @param markerCount the marker count * @param markerCount the marker count
@@ -63,7 +62,7 @@ public class ListItemUtils {
* @param photoUrl the photo url * @param photoUrl the photo url
*/ */
public static void setListItem(Activity activity, View view, boolean isRecording, public static void setListItem(Activity activity, View view, boolean isRecording,
boolean isPaused, int iconId, int iconContentDescriptionId, String name, String sharedOwner, boolean isPaused, int iconId, int iconContentDescriptionId, String name,
String totalTime, String totalDistance, int markerCount, long startTime, String totalTime, String totalDistance, int markerCount, long startTime,
boolean useRelativeTime, String category, String description, String photoUrl) { boolean useRelativeTime, String category, String description, String photoUrl) {
@@ -98,19 +97,16 @@ public class ListItemUtils {
TextView nameTextView = view.findViewById(R.id.list_item_name); TextView nameTextView = view.findViewById(R.id.list_item_name);
setTextView(activity, nameTextView, name, hasPhoto); setTextView(activity, nameTextView, name, hasPhoto);
// Set sharedOwner/totalTime/totalDistance // Set totalTime/totalDistance
TextView ownerTimeDistanceTextView = view.findViewById( TextView ownerTimeDistanceTextView = view.findViewById(R.id.list_item_owner_time_distance);
R.id.list_item_owner_time_distance);
String ownerTimeDistance; String ownerTimeDistance;
if (isRecording) { if (isRecording) {
ownerTimeDistanceTextView.setTextColor(activity.getResources() ownerTimeDistanceTextView.setTextColor(activity.getResources().getColor(isPaused ? android.R.color.white : R.color.recording_text));
.getColor(isPaused ? android.R.color.white : R.color.recording_text)); ownerTimeDistance = activity.getString(isPaused ? R.string.generic_paused : R.string.generic_recording);
ownerTimeDistance = activity.getString(
isPaused ? R.string.generic_paused : R.string.generic_recording);
} else { } else {
// Match list_item_owner_time_distance in list_item.xml // Match list_item_owner_time_distance in list_item.xml
ownerTimeDistanceTextView.setTextAppearance(activity, R.style.TextSmall); ownerTimeDistanceTextView.setTextAppearance(activity, R.style.TextSmall);
ownerTimeDistance = getOwnerTimeDistance(sharedOwner, totalTime, totalDistance); ownerTimeDistance = getTimeDistance(totalTime, totalDistance);
if (markerCount > 0) { if (markerCount > 0) {
ownerTimeDistance += " \u2027"; ownerTimeDistance += " \u2027";
} }
@@ -172,16 +168,11 @@ public class ListItemUtils {
/** /**
* Gets a string for share owner, total time, and total distance. * Gets a string for share owner, total time, and total distance.
* *
* @param sharedOwner the share owner. Can be null
* @param totalTime the total time. Can be null * @param totalTime the total time. Can be null
* @param totalDistance the total distance. Can be null * @param totalDistance the total distance. Can be null
*/ */
private static String getOwnerTimeDistance( private static String getTimeDistance(String totalTime, String totalDistance) {
String sharedOwner, String totalTime, String totalDistance) {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
if (sharedOwner != null && sharedOwner.length() != 0) {
builder.append(sharedOwner);
}
if (totalTime != null && totalTime.length() != 0) { if (totalTime != null && totalTime.length() != 0) {
if (builder.length() != 0) { if (builder.length() != 0) {
builder.append(" \u2027 "); builder.append(" \u2027 ");
@@ -86,11 +86,7 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils {
int minGradeIndex = cursor.getColumnIndexOrThrow(TracksColumns.MINGRADE); int minGradeIndex = cursor.getColumnIndexOrThrow(TracksColumns.MINGRADE);
int maxGradeIndex = cursor.getColumnIndexOrThrow(TracksColumns.MAXGRADE); int maxGradeIndex = cursor.getColumnIndexOrThrow(TracksColumns.MAXGRADE);
int iconIndex = cursor.getColumnIndexOrThrow(TracksColumns.ICON); int iconIndex = cursor.getColumnIndexOrThrow(TracksColumns.ICON);
int driveIdIndex = cursor.getColumnIndexOrThrow(TracksColumns.DRIVEID);
int modifiedTimeIndex = cursor.getColumnIndexOrThrow(TracksColumns.MODIFIEDTIME); int modifiedTimeIndex = cursor.getColumnIndexOrThrow(TracksColumns.MODIFIEDTIME);
int sharedWithMeIndex = cursor.getColumnIndexOrThrow(TracksColumns.SHAREDWITHME);
int sharedOwnerIndex = cursor.getColumnIndexOrThrow(TracksColumns.SHAREDOWNER);
int caloriesIndex = cursor.getColumnIndexOrThrow(TracksColumns.CALORIE);
Track track = new Track(); Track track = new Track();
TripStatistics tripStatistics = track.getTripStatistics(); TripStatistics tripStatistics = track.getTripStatistics();
@@ -162,12 +158,6 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils {
if (!cursor.isNull(modifiedTimeIndex)) { if (!cursor.isNull(modifiedTimeIndex)) {
track.setModifiedTime(cursor.getLong(modifiedTimeIndex)); track.setModifiedTime(cursor.getLong(modifiedTimeIndex));
} }
if (!cursor.isNull(sharedWithMeIndex)) {
track.setSharedWithMe(cursor.getInt(sharedWithMeIndex) == 1);
}
if (!cursor.isNull(sharedOwnerIndex)) {
track.setSharedOwner(cursor.getString(sharedOwnerIndex));
}
return track; return track;
} }
@@ -317,8 +307,6 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils {
values.put(TracksColumns.MAXGRADE, tripStatistics.getMaxGrade()); values.put(TracksColumns.MAXGRADE, tripStatistics.getMaxGrade());
values.put(TracksColumns.ICON, track.getIcon()); values.put(TracksColumns.ICON, track.getIcon());
values.put(TracksColumns.MODIFIEDTIME, track.getModifiedTime()); values.put(TracksColumns.MODIFIEDTIME, track.getModifiedTime());
values.put(TracksColumns.SHAREDWITHME, track.isSharedWithMe());
values.put(TracksColumns.SHAREDOWNER, track.getSharedOwner());
return values; return values;
} }
@@ -367,7 +355,6 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils {
int elevationGainIndex = cursor.getColumnIndexOrThrow(WaypointsColumns.ELEVATIONGAIN); int elevationGainIndex = cursor.getColumnIndexOrThrow(WaypointsColumns.ELEVATIONGAIN);
int minGradeIndex = cursor.getColumnIndexOrThrow(WaypointsColumns.MINGRADE); int minGradeIndex = cursor.getColumnIndexOrThrow(WaypointsColumns.MINGRADE);
int maxGradeIndex = cursor.getColumnIndexOrThrow(WaypointsColumns.MAXGRADE); int maxGradeIndex = cursor.getColumnIndexOrThrow(WaypointsColumns.MAXGRADE);
int calorieIndex = cursor.getColumnIndexOrThrow(WaypointsColumns.CALORIE);
int photoUrlIndex = cursor.getColumnIndexOrThrow(WaypointsColumns.PHOTOURL); int photoUrlIndex = cursor.getColumnIndexOrThrow(WaypointsColumns.PHOTOURL);
Waypoint waypoint = new Waypoint(); Waypoint waypoint = new Waypoint();
@@ -46,8 +46,6 @@ public class Track implements Parcelable {
private int numberOfPoints = 0; private int numberOfPoints = 0;
private String icon = ""; private String icon = "";
private long modifiedTime = -1L; private long modifiedTime = -1L;
private boolean sharedWithMe = false;
private String sharedOwner = "";
private TripStatistics tripStatistics = new TripStatistics(); private TripStatistics tripStatistics = new TripStatistics();
@@ -66,8 +64,6 @@ public class Track implements Parcelable {
numberOfPoints = in.readInt(); numberOfPoints = in.readInt();
icon = in.readString(); icon = in.readString();
modifiedTime = in.readLong(); modifiedTime = in.readLong();
sharedWithMe = in.readByte() == 1;
sharedOwner = in.readString();
ClassLoader classLoader = getClass().getClassLoader(); ClassLoader classLoader = getClass().getClassLoader();
tripStatistics = in.readParcelable(classLoader); tripStatistics = in.readParcelable(classLoader);
@@ -94,8 +90,6 @@ public class Track implements Parcelable {
dest.writeInt(numberOfPoints); dest.writeInt(numberOfPoints);
dest.writeString(icon); dest.writeString(icon);
dest.writeLong(modifiedTime); dest.writeLong(modifiedTime);
dest.writeByte((byte) (sharedWithMe ? 1 : 0));
dest.writeString(sharedOwner);
dest.writeParcelable(tripStatistics, 0); dest.writeParcelable(tripStatistics, 0);
for (int i = 0; i < numberOfPoints; ++i) { for (int i = 0; i < numberOfPoints; ++i) {
@@ -187,22 +181,6 @@ public class Track implements Parcelable {
this.modifiedTime = modifiedTime; this.modifiedTime = modifiedTime;
} }
public boolean isSharedWithMe() {
return sharedWithMe;
}
public void setSharedWithMe(boolean sharedWithMe) {
this.sharedWithMe = sharedWithMe;
}
public String getSharedOwner() {
return sharedOwner;
}
public void setSharedOwner(String sharedOwner) {
this.sharedOwner = sharedOwner;
}
public TripStatistics getTripStatistics() { public TripStatistics getTripStatistics() {
return tripStatistics; return tripStatistics;
} }