Removed 'mytracks' from documentation, code, and filenames.
@@ -36,16 +36,16 @@ import org.junit.runner.RunWith;
|
|||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
public class CustomContentProviderTest {
|
public class CustomContentProviderTest {
|
||||||
|
|
||||||
private static final String DATABASE_NAME = "mytrackstest.db";
|
private static final String DATABASE_NAME = "test.db";
|
||||||
|
|
||||||
private SQLiteDatabase db;
|
private SQLiteDatabase db;
|
||||||
private CustomContentProvider myTracksProvider;
|
private CustomContentProvider customContentProvider;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
protected void setUp() {
|
protected void setUp() {
|
||||||
InstrumentationRegistry.getInstrumentation().getContext().deleteDatabase(DATABASE_NAME);
|
InstrumentationRegistry.getInstrumentation().getContext().deleteDatabase(DATABASE_NAME);
|
||||||
db = (new DatabaseHelper(InstrumentationRegistry.getInstrumentation().getContext(), DATABASE_NAME)).getWritableDatabase();
|
db = (new DatabaseHelper(InstrumentationRegistry.getInstrumentation().getContext(), DATABASE_NAME)).getWritableDatabase();
|
||||||
myTracksProvider = new CustomContentProvider();
|
customContentProvider = new CustomContentProvider();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -61,18 +61,18 @@ public class CustomContentProviderTest {
|
|||||||
* Tests {@link CustomContentProvider#onCreate(android.content.Context)}.
|
* Tests {@link CustomContentProvider#onCreate(android.content.Context)}.
|
||||||
*/
|
*/
|
||||||
public void testOnCreate() {
|
public void testOnCreate() {
|
||||||
Assert.assertTrue(myTracksProvider.onCreate(InstrumentationRegistry.getInstrumentation().getContext()));
|
Assert.assertTrue(customContentProvider.onCreate(InstrumentationRegistry.getInstrumentation().getContext()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests {@link CustomContentProvider#getType(Uri)}.
|
* Tests {@link CustomContentProvider#getType(Uri)}.
|
||||||
*/
|
*/
|
||||||
public void testGetType() {
|
public void testGetType() {
|
||||||
Assert.assertEquals(TracksColumns.CONTENT_TYPE, myTracksProvider.getType(TracksColumns.CONTENT_URI));
|
Assert.assertEquals(TracksColumns.CONTENT_TYPE, customContentProvider.getType(TracksColumns.CONTENT_URI));
|
||||||
Assert.assertEquals(
|
Assert.assertEquals(
|
||||||
TrackPointsColumns.CONTENT_TYPE, myTracksProvider.getType(TrackPointsColumns.CONTENT_URI));
|
TrackPointsColumns.CONTENT_TYPE, customContentProvider.getType(TrackPointsColumns.CONTENT_URI));
|
||||||
Assert.assertEquals(
|
Assert.assertEquals(
|
||||||
WaypointsColumns.CONTENT_TYPE, myTracksProvider.getType(WaypointsColumns.CONTENT_URI));
|
WaypointsColumns.CONTENT_TYPE, customContentProvider.getType(WaypointsColumns.CONTENT_URI));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -381,12 +381,12 @@ public class CustomContentProviderUtilsImplTest {
|
|||||||
waypoint.setLocation(loc);
|
waypoint.setLocation(loc);
|
||||||
providerUtils.insertWaypoint(waypoint);
|
providerUtils.insertWaypoint(waypoint);
|
||||||
|
|
||||||
ContentProviderUtilsImpl myTracksProviderUtilsImpl = new ContentProviderUtilsImpl(
|
ContentProviderUtilsImpl contentProviderUtils = new ContentProviderUtilsImpl(
|
||||||
new MockContentResolver());
|
new MockContentResolver());
|
||||||
|
|
||||||
long waypointId = System.currentTimeMillis();
|
long waypointId = System.currentTimeMillis();
|
||||||
waypoint.setId(waypointId);
|
waypoint.setId(waypointId);
|
||||||
ContentValues contentValues = myTracksProviderUtilsImpl.createContentValues(waypoint);
|
ContentValues contentValues = contentProviderUtils.createContentValues(waypoint);
|
||||||
Assert.assertEquals(waypointId, contentValues.get(WaypointsColumns._ID));
|
Assert.assertEquals(waypointId, contentValues.get(WaypointsColumns._ID));
|
||||||
Assert.assertEquals(22 * 1000000, contentValues.get(WaypointsColumns.LONGITUDE));
|
Assert.assertEquals(22 * 1000000, contentValues.get(WaypointsColumns.LONGITUDE));
|
||||||
Assert.assertEquals(TEST_DESC, contentValues.get(WaypointsColumns.DESCRIPTION));
|
Assert.assertEquals(TEST_DESC, contentValues.get(WaypointsColumns.DESCRIPTION));
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for the MyTracks track recording service.
|
* Tests for the track recording service.
|
||||||
* <p>
|
* <p>
|
||||||
* TODO: The original class, ServiceTestCase, has a few limitations, e.g. it's
|
* TODO: The original class, ServiceTestCase, has a few limitations, e.g. it's
|
||||||
* not possible to properly shutdown the service, unless tearDown() is called,
|
* not possible to properly shutdown the service, unless tearDown() is called,
|
||||||
@@ -135,9 +135,9 @@ public class TrackRecordingServiceTest extends ServiceTestCase<TestRecordingServ
|
|||||||
context = new MockContext(mockContentResolver, renamingDelegatingContext);
|
context = new MockContext(mockContentResolver, renamingDelegatingContext);
|
||||||
|
|
||||||
// Set up the mock content resolver
|
// Set up the mock content resolver
|
||||||
CustomContentProvider myTracksProvider = new CustomContentProvider();
|
CustomContentProvider customContentProvider = new CustomContentProvider();
|
||||||
myTracksProvider.attachInfo(context, null);
|
customContentProvider.attachInfo(context, null);
|
||||||
mockContentResolver.addProvider(ContentProviderUtils.AUTHORITY, myTracksProvider);
|
mockContentResolver.addProvider(ContentProviderUtils.AUTHORITY, customContentProvider);
|
||||||
|
|
||||||
MockContentProvider settingsProvider = new MockContentProvider(context) {
|
MockContentProvider settingsProvider = new MockContentProvider(context) {
|
||||||
@Override
|
@Override
|
||||||
@@ -341,7 +341,7 @@ public class TrackRecordingServiceTest extends ServiceTestCase<TestRecordingServ
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context ctx, Intent intent) {
|
public void onReceive(Context ctx, Intent intent) {
|
||||||
Log.d("MyTracksTest", "Got broadcast: " + intent);
|
Log.d("Test", "Got broadcast: " + intent);
|
||||||
synchronized (receivedIntents) {
|
synchronized (receivedIntents) {
|
||||||
receivedIntents.add(intent);
|
receivedIntents.add(intent);
|
||||||
receivedIntents.notifyAll();
|
receivedIntents.notifyAll();
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import android.content.Intent;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class handles MyTracks related broadcast messages.
|
* This class react to the BOOT_COMPLETED broadcast.
|
||||||
*
|
*
|
||||||
* One example of a broadcast message that this class is interested in,
|
* One example of a broadcast message that this class is interested in,
|
||||||
* is notification about the phone boot. We may want to resume a previously
|
* is notification about the phone boot. We may want to resume a previously
|
||||||
|
|||||||
@@ -400,7 +400,7 @@ public class TrackDetailActivity extends AbstractTrackActivity implements Choose
|
|||||||
File file = new File(dir, FileUtils.buildUniqueFileName(dir, fileName, JPEG_EXTENSION));
|
File file = new File(dir, FileUtils.buildUniqueFileName(dir, fileName, JPEG_EXTENSION));
|
||||||
|
|
||||||
if (file != null) {
|
if (file != null) {
|
||||||
photoUri = FileProvider.getUriForFile(this, "com.google.android.apps.mytracks.fileprovider", file);
|
photoUri = FileProvider.getUriForFile(this, FileUtils.FILEPROVIDER, file);
|
||||||
Log.d(TAG, "Taking photo to URI: " + photoUri);
|
Log.d(TAG, "Taking photo to URI: " + photoUri);
|
||||||
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE)
|
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE)
|
||||||
.putExtra(MediaStore.EXTRA_OUTPUT, photoUri);
|
.putExtra(MediaStore.EXTRA_OUTPUT, photoUri);
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public class CustomContentProvider extends ContentProvider {
|
|||||||
static final int DATABASE_VERSION = 23;
|
static final int DATABASE_VERSION = 23;
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
static final String DATABASE_NAME = "mytracks.db";
|
static final String DATABASE_NAME = "database.db";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Database helper for creating and upgrading the database.
|
* Database helper for creating and upgrading the database.
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import com.google.android.maps.mytracks.R;
|
|||||||
/**
|
/**
|
||||||
* A service to control starting and stopping of a recording. This service,
|
* A service to control starting and stopping of a recording. This service,
|
||||||
* through the AndroidManifest.xml, is configured to only allow components of
|
* through the AndroidManifest.xml, is configured to only allow components of
|
||||||
* the same application to invoke it. Thus this service can be used my MyTracks
|
* the same application to invoke it. Thus this service can be used my the
|
||||||
* app widget, {@link TrackWidgetProvider}, but not by other applications. This
|
* app widget, {@link TrackWidgetProvider}, but not by other applications. This
|
||||||
* application delegates starting and stopping a recording to
|
* application delegates starting and stopping a recording to
|
||||||
* {@link TrackRecordingService} using RPC calls.
|
* {@link TrackRecordingService} using RPC calls.
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import com.google.android.apps.mytracks.content.sensor.SensorDataSet;
|
|||||||
import com.google.android.apps.mytracks.content.sensor.SensorState;
|
import com.google.android.apps.mytracks.content.sensor.SensorState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MyTracks service.
|
* App's service.
|
||||||
* This service is the process that actually records and manages tracks.
|
* This service is the process that actually records and manages tracks.
|
||||||
*/
|
*/
|
||||||
public interface ITrackRecordingService {
|
public interface ITrackRecordingService {
|
||||||
|
|||||||
@@ -238,13 +238,6 @@ public class TrackRecordingService extends Service {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
* Note that this service, through the AndroidManifest.xml, is configured to
|
|
||||||
* allow both MyTracks and third party apps to invoke it. For the onCreate
|
|
||||||
* callback, we cannot tell whether the caller is MyTracks or a third party
|
|
||||||
* app, thus it cannot start/stop a recording or write/update MyTracks
|
|
||||||
* database.
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
@@ -282,13 +275,6 @@ public class TrackRecordingService extends Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Note that this service, through the AndroidManifest.xml, is configured to
|
|
||||||
* allow both MyTracks and third party apps to invoke it. For the
|
|
||||||
* onStartCommand callback, we cannot tell whether the caller is MyTracks or a
|
|
||||||
* third party app, thus it cannot start/stop a recording or write/update
|
|
||||||
* MyTracks database.
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||||
handleStartCommand(intent, startId);
|
handleStartCommand(intent, startId);
|
||||||
|
|||||||
@@ -36,6 +36,13 @@ public class FileUtils {
|
|||||||
*/
|
*/
|
||||||
static final String SDCARD_TOP_DIR = "MyTracks";
|
static final String SDCARD_TOP_DIR = "MyTracks";
|
||||||
|
|
||||||
|
static final String TRACK_PREFIX = "MyTracks";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to transfer picture from the camera.
|
||||||
|
*/
|
||||||
|
public static final String FILEPROVIDER = "com.google.android.apps.mytracks.fileprovider";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The maximum FAT32 path length. See the FAT32 spec at
|
* The maximum FAT32 path length. See the FAT32 spec at
|
||||||
* http://msdn.microsoft.com/en-us/windows/hardware/gg463080
|
* http://msdn.microsoft.com/en-us/windows/hardware/gg463080
|
||||||
@@ -96,7 +103,7 @@ public class FileUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static File getPhotoDir(long trackId) {
|
public static File getPhotoDir(long trackId) {
|
||||||
return new File(getPath(PICTURES_DIR, "MyTracks" + trackId));
|
return new File(getPath(PICTURES_DIR, TRACK_PREFIX + trackId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 199 B After Width: | Height: | Size: 199 B |
|
Before Width: | Height: | Size: 100 B After Width: | Height: | Size: 100 B |
|
Before Width: | Height: | Size: 105 B After Width: | Height: | Size: 105 B |
|
Before Width: | Height: | Size: 105 B After Width: | Height: | Size: 105 B |
|
Before Width: | Height: | Size: 102 B After Width: | Height: | Size: 102 B |
|
Before Width: | Height: | Size: 111 B After Width: | Height: | Size: 111 B |
|
Before Width: | Height: | Size: 111 B After Width: | Height: | Size: 111 B |
|
Before Width: | Height: | Size: 154 B After Width: | Height: | Size: 154 B |
|
Before Width: | Height: | Size: 96 B After Width: | Height: | Size: 96 B |
|
Before Width: | Height: | Size: 102 B After Width: | Height: | Size: 102 B |
|
Before Width: | Height: | Size: 102 B After Width: | Height: | Size: 102 B |
|
Before Width: | Height: | Size: 103 B After Width: | Height: | Size: 103 B |
|
Before Width: | Height: | Size: 107 B After Width: | Height: | Size: 107 B |
|
Before Width: | Height: | Size: 110 B After Width: | Height: | Size: 110 B |
|
Before Width: | Height: | Size: 260 B After Width: | Height: | Size: 260 B |
|
Before Width: | Height: | Size: 104 B After Width: | Height: | Size: 104 B |
|
Before Width: | Height: | Size: 110 B After Width: | Height: | Size: 110 B |
|
Before Width: | Height: | Size: 110 B After Width: | Height: | Size: 110 B |
|
Before Width: | Height: | Size: 114 B After Width: | Height: | Size: 114 B |
|
Before Width: | Height: | Size: 122 B After Width: | Height: | Size: 122 B |
|
Before Width: | Height: | Size: 121 B After Width: | Height: | Size: 121 B |
@@ -16,16 +16,16 @@ limitations under the License.
|
|||||||
-->
|
-->
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<!-- Non focused states -->
|
<!-- Non focused states -->
|
||||||
<item android:drawable="@drawable/tab_unselected_mytracks" android:state_focused="false" android:state_pressed="false" android:state_selected="false"/>
|
<item android:drawable="@drawable/tab_unselected" android:state_focused="false" android:state_pressed="false" android:state_selected="false"/>
|
||||||
<item android:drawable="@drawable/tab_selected_mytracks" android:state_focused="false" android:state_pressed="false" android:state_selected="true"/>
|
<item android:drawable="@drawable/tab_selected" android:state_focused="false" android:state_pressed="false" android:state_selected="true"/>
|
||||||
<!-- Focused states -->
|
<!-- Focused states -->
|
||||||
<item android:drawable="@drawable/tab_unselected_focused_mytracks" android:state_focused="true" android:state_pressed="false" android:state_selected="false"/>
|
<item android:drawable="@drawable/tab_unselected_focused" android:state_focused="true" android:state_pressed="false" android:state_selected="false"/>
|
||||||
<item android:drawable="@drawable/tab_selected_focused_mytracks" android:state_focused="true" android:state_pressed="false" android:state_selected="true"/>
|
<item android:drawable="@drawable/tab_selected_focused" android:state_focused="true" android:state_pressed="false" android:state_selected="true"/>
|
||||||
<!-- Pressed -->
|
<!-- Pressed -->
|
||||||
<!-- Non focused states -->
|
<!-- Non focused states -->
|
||||||
<item android:drawable="@drawable/tab_unselected_pressed_mytracks" android:state_focused="false" android:state_pressed="true" android:state_selected="false"/>
|
<item android:drawable="@drawable/tab_unselected_pressed" android:state_focused="false" android:state_pressed="true" android:state_selected="false"/>
|
||||||
<item android:drawable="@drawable/tab_selected_pressed_mytracks" android:state_focused="false" android:state_pressed="true" android:state_selected="true"/>
|
<item android:drawable="@drawable/tab_selected_pressed" android:state_focused="false" android:state_pressed="true" android:state_selected="true"/>
|
||||||
<!-- Focused states -->
|
<!-- Focused states -->
|
||||||
<item android:drawable="@drawable/tab_unselected_pressed_mytracks" android:state_focused="true" android:state_pressed="true" android:state_selected="false"/>
|
<item android:drawable="@drawable/tab_unselected_pressed" android:state_focused="true" android:state_pressed="true" android:state_selected="false"/>
|
||||||
<item android:drawable="@drawable/tab_selected_pressed_mytracks" android:state_focused="true" android:state_pressed="true" android:state_selected="true"/>
|
<item android:drawable="@drawable/tab_selected_pressed" android:state_focused="true" android:state_pressed="true" android:state_selected="true"/>
|
||||||
</selector>
|
</selector>
|
||||||
@@ -27,7 +27,7 @@ limitations under the License.
|
|||||||
<item name="android:progressBarStyleHorizontal">@style/ProgressBarCustom</item>
|
<item name="android:progressBarStyleHorizontal">@style/ProgressBarCustom</item>
|
||||||
<!-- Manually added -->
|
<!-- Manually added -->
|
||||||
<item name="android:actionBarStyle">@style/ActionBarStyleCustom</item>
|
<item name="android:actionBarStyle">@style/ActionBarStyleCustom</item>
|
||||||
<item name="android:actionModeBackground">@drawable/action_mode_background_mytracks</item>
|
<item name="android:actionModeBackground">@drawable/custom_action_mode_background</item>
|
||||||
<item name="android:alertDialogTheme">@style/CustomAlertDialogTheme</item>
|
<item name="android:alertDialogTheme">@style/CustomAlertDialogTheme</item>
|
||||||
</style>
|
</style>
|
||||||
<style name="CustomAlertDialogTheme" parent="@android:style/Theme.Holo.Dialog">
|
<style name="CustomAlertDialogTheme" parent="@android:style/Theme.Holo.Dialog">
|
||||||
|
|||||||