forked from upstream-mirrors/OpenTracks
Merge with c31ef4ac66823a80d02265da7810432b51ce01ed
This commit is contained in:
@@ -158,10 +158,12 @@ limitations under the License.
|
||||
<uses-permission android:name="com.google.android.apps.mytracks.TRACK_NOTIFICATIONS" />
|
||||
|
||||
<!-- Features required -->
|
||||
<!--
|
||||
<uses-feature android:name="android.hardware.location" android:required="true"/>
|
||||
<uses-feature android:name="android.hardware.location.gps" android:required="true"/>
|
||||
<uses-feature android:name="android.hardware.touchscreen" android:required="true"/>
|
||||
|
||||
-->
|
||||
|
||||
<!-- Features optional -->
|
||||
<uses-feature android:name="android.hardware.bluetooth" android:required="false"/>
|
||||
<uses-feature android:name="android.hardware.location.network" android:required="false"/>
|
||||
|
||||
@@ -58,6 +58,11 @@ limitations under the License.
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/about_bart"
|
||||
android:textSize="20sp" />
|
||||
<TextView
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -361,6 +361,8 @@ limitations under the License.
|
||||
<string name="about_version">Wersja:</string>
|
||||
<string name="about_email">Wsparcie</string>
|
||||
<string name="about_support">Wsparcie:</string>
|
||||
|
||||
<string name="about_bart">Bartłomiej Niechwiej</string>
|
||||
|
||||
<!-- Send to Google -->
|
||||
<string name="sendtogoogle_title">Wyślij do...</string>
|
||||
|
||||
@@ -388,6 +388,7 @@ limitations under the License.
|
||||
<string name="about_googlegroups">mytracks@googlegroups.com</string>
|
||||
<string name="about_weburl">mytracks.appspot.com</string>
|
||||
<string name="about_copyright_message">Copyright 2009 Google Inc.</string>
|
||||
<string name="about_bart">Bartlomiej Niechwiej</string>
|
||||
<string name="about_dylan">Dylan Casey</string>
|
||||
<string name="about_leif">Leif Hendrik Wilden</string>
|
||||
<string name="about_rdamazio">Rodrigo Damazio Bovendorp</string>
|
||||
|
||||
@@ -21,6 +21,7 @@ import android.database.Cursor;
|
||||
import android.location.Location;
|
||||
import android.net.Uri;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -309,6 +310,71 @@ public interface MyTracksProviderUtils {
|
||||
* @return a new waypoint object
|
||||
*/
|
||||
Waypoint createWaypoint(Cursor cursor);
|
||||
|
||||
/**
|
||||
* A lightweight wrapper around the original {@link Cursor} with a method to clean up.
|
||||
*/
|
||||
interface LocationIterator extends Iterator<Location> {
|
||||
/**
|
||||
* Should be called in case the underlying iterator hasn't reached the last record.
|
||||
*/
|
||||
void close();
|
||||
}
|
||||
|
||||
/**
|
||||
* A factory for creating new {@class Location}s.
|
||||
*/
|
||||
interface LocationFactory {
|
||||
/**
|
||||
* Creates a new {@link Location} object to be populated from the underlying database record.
|
||||
* It's up to the implementing class to decide whether to create a new instance or reuse
|
||||
* existing to optimize for speed.
|
||||
*
|
||||
* @return a {@link Location} to be populated from the database.
|
||||
*/
|
||||
Location createLocation();
|
||||
}
|
||||
|
||||
/**
|
||||
* The default {@class Location}s factory, which creates a new location of 'gps' type each
|
||||
* time the user advances to the next element using {@link LocationIterator#next()} method.
|
||||
*/
|
||||
LocationFactory DEFAULT_LOCATION_FACTORY = new LocationFactory() {
|
||||
@Override
|
||||
public Location createLocation() {
|
||||
return new Location("gps");
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a new read-only iterator over all track points for the given track. It provides
|
||||
* a lightweight way of iterating over large tracks without failing due to the underlying cursor
|
||||
* limitations. Since it's a read-only iterator, {@link Iterator#remove()} always throws
|
||||
* {@class UnsupportedOperationException}.
|
||||
*
|
||||
* Once constructed, the user should either iterate over all elements, or call
|
||||
* {@link LocationIterator#close()} to make sure that all resources are properly deallocated.
|
||||
*
|
||||
* Example use:
|
||||
* <code>
|
||||
* ...
|
||||
* LocationIterator it = providerUtils.getLocationIterator(
|
||||
* 1, MyTracksProviderUtils.DEFAULT_LOCATION_FACTORY);
|
||||
* try {
|
||||
* for (Location loc : it) {
|
||||
* ... // Do something useful with the location.
|
||||
* }
|
||||
* } finally {
|
||||
* it.close();
|
||||
* }
|
||||
* ...
|
||||
* </code>
|
||||
*
|
||||
* @param trackId the ID of a track to retrieve locations for.
|
||||
* @param locationFactory the factory for creating new locations.
|
||||
* @return the read-only iterator over the given track's points.
|
||||
*/
|
||||
LocationIterator getLocationIterator(long trackId, LocationFactory locationFactory);
|
||||
|
||||
/**
|
||||
* A factory which can produce instances of {@link MyTracksProviderUtils},
|
||||
|
||||
+6
@@ -934,4 +934,10 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils {
|
||||
contentResolver.update(TracksColumns.CONTENT_URI,
|
||||
createContentValues(track), "_id=" + track.getId(), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LocationIterator getLocationIterator(long trackId, LocationFactory locationFactory) {
|
||||
// TODO: Implement it.
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user