Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jasman #1730

Closed
wants to merge 6 commits into from
Closed

Jasman #1730

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -221,15 +221,15 @@ void writePace(Speed speed, StringBuilder builder, int resId, String lineBreak)
}

/**
* @param altitude_m altitude_m in meters
* @param altitudeM altitude_m in meters
* @param builder StringBuilder to append
* @param resId resource id of altitude string
* @param lineBreak line break string
*/
@VisibleForTesting
void writeAltitude(double altitude_m, StringBuilder builder, int resId, String lineBreak) {
long altitudeInM = Math.round(altitude_m);
long altitudeInFt = Math.round(Distance.of(altitude_m).toFT());
void writeAltitude(double altitudeM, StringBuilder builder, int resId, String lineBreak) {
long altitudeInM = Math.round(altitudeM);
long altitudeInFt = Math.round(Distance.of(altitudeM).toFT());
builder.append(context.getString(resId, altitudeInM, altitudeInFt));
builder.append(lineBreak);
}
Expand Down
16 changes: 13 additions & 3 deletions src/main/java/de/dennisguse/opentracks/share/ShareUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,16 @@
import de.dennisguse.opentracks.data.models.Track;
import de.dennisguse.opentracks.io.file.TrackFileFormat;
import de.dennisguse.opentracks.settings.PreferencesUtils;

class NoTracksToShareException extends RuntimeException{
public NoTracksToShareException()
{
super("Did not find any tracks to share.");
}
public NoTracksToShareException(String message)
{
super(message);
}
}
public class ShareUtils {

private static final String TAG = ShareUtils.class.getSimpleName();
Expand All @@ -34,7 +43,7 @@ private ShareUtils() {
*/
public static Intent newShareFileIntent(Context context, Track.Id... trackIds) {
if (trackIds.length == 0) {
throw new RuntimeException("Need to share at least one track.");
throw new NoTracksToShareException("Need to share at least one track.");
}

ContentProviderUtils contentProviderUtils = new ContentProviderUtils(context);
Expand Down Expand Up @@ -95,7 +104,8 @@ public static Intent newShareFileIntent(Context context, Marker.Id... markerIds)
}
if (marker.getPhotoURI() == null) {
Log.e(TAG, "MarkerId " + markerId.id() + " has no picture.");
continue;


}

mime = context.getContentResolver().getType(marker.getPhotoURI());
Expand Down
Loading