mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-02 17:43:06 +02:00
Allow users to insert only waypoint markers.
This commit is contained in:
@@ -1,46 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2012 Google Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
style="@style/ScrollView" >
|
||||
<RelativeLayout
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent"
|
||||
android:padding="8dp" >
|
||||
<RadioGroup
|
||||
android:id="@+id/marker_add_type"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content" >
|
||||
<RadioButton
|
||||
android:id="@+id/marker_add_statistics"
|
||||
android:text="@string/marker_statistics"
|
||||
style="@style/TextMedium" />
|
||||
<RadioButton
|
||||
android:id="@+id/marker_add_waypoint"
|
||||
android:text="@string/marker_waypoint"
|
||||
style="@style/TextMedium" />
|
||||
</RadioGroup>
|
||||
<Button
|
||||
android:id="@+id/marker_add_more_options"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/generic_more_options" />
|
||||
</RelativeLayout>
|
||||
</ScrollView>
|
||||
@@ -24,28 +24,6 @@ limitations under the License.
|
||||
android:layout_width="fill_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="8dp" >
|
||||
<LinearLayout
|
||||
android:id="@+id/marker_edit_type_section"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent"
|
||||
android:orientation="vertical" >
|
||||
<TextView
|
||||
android:text="@string/marker_type"
|
||||
style="@style/EditLabel" />
|
||||
<RadioGroup
|
||||
android:id="@+id/marker_edit_type"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content" >
|
||||
<RadioButton
|
||||
android:id="@+id/marker_edit_statistics"
|
||||
android:text="@string/marker_statistics"
|
||||
style="@style/TextMedium" />
|
||||
<RadioButton
|
||||
android:id="@+id/marker_edit_waypoint"
|
||||
android:text="@string/marker_waypoint"
|
||||
style="@style/TextMedium" />
|
||||
</RadioGroup>
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:text="@string/generic_name"
|
||||
style="@style/EditLabel" />
|
||||
@@ -73,10 +51,10 @@ limitations under the License.
|
||||
android:imeOptions="actionNext"
|
||||
style="@style/EditName" />
|
||||
<TextView
|
||||
android:text="@string/marker_edit_waypoint_marker_type"
|
||||
android:text="@string/marker_edit_marker_type"
|
||||
style="@style/EditLabel.WithPaddingTop" />
|
||||
<AutoCompleteTextView
|
||||
android:hint="@string/marker_edit_waypoint_marker_type_hint"
|
||||
android:hint="@string/marker_edit_marker_type_hint"
|
||||
android:id="@+id/marker_edit_waypoint_marker_type"
|
||||
android:imeOptions="actionNext"
|
||||
style="@style/EditCategory" />
|
||||
|
||||
@@ -39,7 +39,6 @@ limitations under the License.
|
||||
<string name="min_recording_interval_key">minRecordingInterval</string>
|
||||
<string name="min_required_accuracy_key">minRequiredAccuracy</string>
|
||||
<string name="pick_existing_map_key">pickExistingMap</string>
|
||||
<string name="pick_statistics_marker_key">pickStatisticsMarker</string>
|
||||
<string name="preferred_account_key">preferredAccount</string>
|
||||
<string name="recording_track_id_key">recordingTrackId</string>
|
||||
<string name="report_speed_key">reportSpeed</string>
|
||||
|
||||
@@ -634,10 +634,6 @@ limitations under the License.
|
||||
translation_description="The title on an alert dialog indicating error.">
|
||||
Error
|
||||
</string>
|
||||
<string name="generic_more_options"
|
||||
translation_description="The text on a button to say more options.">
|
||||
More options
|
||||
</string>
|
||||
<string name="generic_name"
|
||||
translation_description="The text label for entering a name.">
|
||||
Name
|
||||
@@ -953,29 +949,29 @@ limitations under the License.
|
||||
<string name="marker_detail_name"
|
||||
translation_description="In the marker detail page, the label for the marker name.
|
||||
|
||||
%1$s marker name. E.g., 'Waypoint 1'.">
|
||||
%1$s marker name. E.g., 'Marker 1'.">
|
||||
Name: %1$s
|
||||
</string>
|
||||
<string name="marker_detail_waypoint_description"
|
||||
translation_description="In the marker detail page, the label for the waypoint description.
|
||||
<string name="marker_detail_description"
|
||||
translation_description="In the marker detail page, the label for the description.
|
||||
|
||||
%1$s marker description. E.g., 'At the top'.">
|
||||
Description: %1$s
|
||||
</string>
|
||||
<string name="marker_detail_waypoint_marker_type"
|
||||
translation_description="In the marker detail page, the label for the waypoint marker type.
|
||||
<string name="marker_detail_marker_type"
|
||||
translation_description="In the marker detail page, the label for the marker type.
|
||||
|
||||
%1$s marker type. E.g., 'building'.">
|
||||
Marker type: %1$s
|
||||
</string>
|
||||
<string name="marker_edit_waypoint_marker_type"
|
||||
translation_description="In the marker edit page, the label for the waypoint marker type,
|
||||
including some exmaples.">
|
||||
<string name="marker_edit_marker_type"
|
||||
translation_description="In the marker edit page, the label for the marker type, including some
|
||||
exmaples.">
|
||||
Marker type (e.g. building, pothole...)
|
||||
</string>
|
||||
<string name="marker_edit_waypoint_marker_type_hint"
|
||||
translation_description="In the marker edit page, the hint in the waypoint marker type text
|
||||
field when it is empty.">
|
||||
<string name="marker_edit_marker_type_hint"
|
||||
translation_description="In the marker edit page, the hint in the marker type text field when it
|
||||
is empty.">
|
||||
Marker type
|
||||
</string>
|
||||
<string name="marker_label_end"
|
||||
@@ -996,10 +992,6 @@ limitations under the License.
|
||||
translation_description="The message when the marker list is empty.">
|
||||
You don\'t have any markers.
|
||||
</string>
|
||||
<string name="marker_statistics"
|
||||
translation_description="The label to add a statistics marker.">
|
||||
Statistics
|
||||
</string>
|
||||
<string name="marker_statistics_name_format"
|
||||
translation_description="When adding a statistics marker, the string format for the default
|
||||
name.
|
||||
@@ -1007,20 +999,11 @@ limitations under the License.
|
||||
%1$d: number. E.g., '1'.">
|
||||
Statistics %1$d
|
||||
</string>
|
||||
<string name="marker_type"
|
||||
translation_description="When adding a marker, the label to select a type, statistics or
|
||||
waypoint.">
|
||||
Type
|
||||
</string>
|
||||
<string name="marker_waypoint"
|
||||
translation_description="The label to add a waypoint marker.">
|
||||
Waypoint
|
||||
</string>
|
||||
<string name="marker_waypoint_name_format"
|
||||
translation_description="When adding a waypoint marker, the string format for the default name.
|
||||
<string name="marker_name_format"
|
||||
translation_description="When adding a marker, the string format for the default name.
|
||||
|
||||
%1$d: number. E.g., '1'.">
|
||||
Waypoint %1$d
|
||||
Marker %1$d
|
||||
</string>
|
||||
|
||||
<!-- Menu Items -->
|
||||
@@ -1090,7 +1073,7 @@ limitations under the License.
|
||||
Save as %1$s
|
||||
</string>
|
||||
<string name="menu_search"
|
||||
translation_description="In the menu, to start a textual search for tracks or waypoints.">
|
||||
translation_description="In the menu, to start a textual search for tracks or markers.">
|
||||
Search
|
||||
</string>
|
||||
<string name="menu_send_google"
|
||||
|
||||
@@ -73,11 +73,9 @@ public class MarkerDetailActivity extends AbstractMyTracksActivity {
|
||||
statisticsSection.setVisibility(View.GONE);
|
||||
|
||||
TextView markerType = (TextView) findViewById(R.id.marker_detail_waypoint_marker_type);
|
||||
markerType.setText(getString(
|
||||
R.string.marker_detail_waypoint_marker_type, waypoint.getCategory()));
|
||||
markerType.setText(getString(R.string.marker_detail_marker_type, waypoint.getCategory()));
|
||||
TextView description = (TextView) findViewById(R.id.marker_detail_waypoint_description);
|
||||
description.setText(getString(
|
||||
R.string.marker_detail_waypoint_description, waypoint.getDescription()));
|
||||
description.setText(getString(R.string.marker_detail_description, waypoint.getDescription()));
|
||||
} else {
|
||||
waypointSection.setVisibility(View.GONE);
|
||||
statisticsSection.setVisibility(View.VISIBLE);
|
||||
|
||||
@@ -21,7 +21,6 @@ import com.google.android.apps.mytracks.content.Waypoint;
|
||||
import com.google.android.apps.mytracks.content.WaypointCreationRequest;
|
||||
import com.google.android.apps.mytracks.content.WaypointCreationRequest.WaypointType;
|
||||
import com.google.android.apps.mytracks.services.TrackRecordingServiceConnection;
|
||||
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
||||
import com.google.android.apps.mytracks.util.TrackRecordingServiceConnectionUtils;
|
||||
import com.google.android.maps.mytracks.R;
|
||||
|
||||
@@ -33,7 +32,6 @@ import android.widget.ArrayAdapter;
|
||||
import android.widget.AutoCompleteTextView;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.RadioGroup;
|
||||
|
||||
/**
|
||||
* An activity to add/edit a marker.
|
||||
@@ -46,17 +44,13 @@ public class MarkerEditActivity extends AbstractMyTracksActivity {
|
||||
|
||||
public static final String EXTRA_TRACK_ID = "track_id";
|
||||
public static final String EXTRA_MARKER_ID = "marker_id";
|
||||
public static final String EXTRA_STATISTICS_MARKER = "statistics_marker";
|
||||
|
||||
private long trackId;
|
||||
private long markerId;
|
||||
private boolean statisticsMarker;
|
||||
private TrackRecordingServiceConnection trackRecordingServiceConnection;
|
||||
private Waypoint waypoint;
|
||||
|
||||
// UI elements
|
||||
private View typeSection;
|
||||
private RadioGroup type;
|
||||
private View statisticsSection;
|
||||
private EditText statisticsName;
|
||||
private View waypointSection;
|
||||
@@ -72,36 +66,9 @@ public class MarkerEditActivity extends AbstractMyTracksActivity {
|
||||
|
||||
trackId = getIntent().getLongExtra(EXTRA_TRACK_ID, -1L);
|
||||
markerId = getIntent().getLongExtra(EXTRA_MARKER_ID, -1L);
|
||||
statisticsMarker = getIntent().getBooleanExtra(EXTRA_STATISTICS_MARKER, true);
|
||||
trackRecordingServiceConnection = new TrackRecordingServiceConnection(this, null);
|
||||
trackRecordingServiceConnection = new TrackRecordingServiceConnection(this, null);
|
||||
|
||||
// Setup UI elements
|
||||
typeSection = findViewById(R.id.marker_edit_type_section);
|
||||
type = (RadioGroup) findViewById(R.id.marker_edit_type);
|
||||
type.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
||||
boolean statistics = checkedId == R.id.marker_edit_statistics;
|
||||
statisticsSection.setVisibility(statistics ? View.VISIBLE : View.GONE);
|
||||
waypointSection.setVisibility(statistics ? View.GONE : View.VISIBLE);
|
||||
int nextMarkerNumber = trackId == -1L ? -1
|
||||
: MyTracksProviderUtils.Factory.get(MarkerEditActivity.this)
|
||||
.getNextMarkerNumber(trackId, statistics);
|
||||
if (statistics) {
|
||||
String name = nextMarkerNumber == -1 ? getString(R.string.marker_type_statistics)
|
||||
: getString(R.string.marker_statistics_name_format, nextMarkerNumber);
|
||||
statisticsName.setText(name);
|
||||
statisticsName.selectAll();
|
||||
} else {
|
||||
String name = nextMarkerNumber == -1 ? getString(R.string.marker_type_waypoint)
|
||||
: getString(R.string.marker_waypoint_name_format, nextMarkerNumber);
|
||||
waypointName.setText(name);
|
||||
waypointName.selectAll();
|
||||
waypointMarkerType.setText("");
|
||||
waypointDescription.setText("");
|
||||
}
|
||||
}
|
||||
});
|
||||
statisticsSection = findViewById(R.id.marker_edit_statistics_section);
|
||||
statisticsName = (EditText) findViewById(R.id.marker_edit_statistics_name);
|
||||
|
||||
@@ -131,7 +98,6 @@ public class MarkerEditActivity extends AbstractMyTracksActivity {
|
||||
final boolean newMarker = markerId == -1L;
|
||||
|
||||
setTitle(newMarker ? R.string.menu_insert_marker : R.string.menu_edit);
|
||||
typeSection.setVisibility(newMarker ? View.VISIBLE : View.GONE);
|
||||
done.setText(newMarker ? R.string.generic_add : R.string.generic_save);
|
||||
done.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@@ -146,7 +112,16 @@ public class MarkerEditActivity extends AbstractMyTracksActivity {
|
||||
});
|
||||
|
||||
if (newMarker) {
|
||||
type.check(statisticsMarker ? R.id.marker_edit_statistics : R.id.marker_edit_waypoint);
|
||||
statisticsSection.setVisibility(View.GONE);
|
||||
waypointSection.setVisibility(View.VISIBLE);
|
||||
int nextMarkerNumber = trackId == -1L ? -1
|
||||
: MyTracksProviderUtils.Factory.get(this).getNextMarkerNumber(trackId, false);
|
||||
String name = nextMarkerNumber == -1 ? getString(R.string.marker_type_waypoint)
|
||||
: getString(R.string.marker_name_format, nextMarkerNumber);
|
||||
waypointName.setText(name);
|
||||
waypointName.selectAll();
|
||||
waypointMarkerType.setText("");
|
||||
waypointDescription.setText("");
|
||||
} else {
|
||||
waypoint = MyTracksProviderUtils.Factory.get(this).getWaypoint(markerId);
|
||||
if (waypoint == null) {
|
||||
@@ -183,18 +158,12 @@ public class MarkerEditActivity extends AbstractMyTracksActivity {
|
||||
* Adds a marker.
|
||||
*/
|
||||
private void addMarker() {
|
||||
boolean statistics = type.getCheckedRadioButtonId() == R.id.marker_edit_statistics;
|
||||
PreferencesUtils.setBoolean(this, R.string.pick_statistics_marker_key, statistics);
|
||||
|
||||
WaypointType waypointType = statistics ? WaypointType.STATISTICS : WaypointType.WAYPOINT;
|
||||
String markerName = statistics ? statisticsName.getText().toString()
|
||||
: waypointName.getText().toString();
|
||||
String markerCategory = statistics ? null : waypointMarkerType.getText().toString();
|
||||
String markerDescription = statistics ? null : waypointDescription.getText().toString();
|
||||
String markerIconUrl = getString(statistics ? R.string.marker_statistics_icon_url
|
||||
: R.string.marker_waypoint_icon_url);
|
||||
WaypointCreationRequest waypointCreationRequest = new WaypointCreationRequest(
|
||||
waypointType, markerName, markerCategory, markerDescription, markerIconUrl);
|
||||
WaypointType.WAYPOINT,
|
||||
waypointName.getText().toString(),
|
||||
waypointMarkerType.getText().toString(),
|
||||
waypointDescription.getText().toString(),
|
||||
getString(R.string.marker_waypoint_icon_url));
|
||||
TrackRecordingServiceConnectionUtils.addMarker(
|
||||
this, trackRecordingServiceConnection, waypointCreationRequest);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import com.google.android.apps.mytracks.content.MyTracksProviderUtils;
|
||||
import com.google.android.apps.mytracks.content.Waypoint;
|
||||
import com.google.android.apps.mytracks.content.WaypointsColumns;
|
||||
import com.google.android.apps.mytracks.fragments.DeleteOneMarkerDialogFragment;
|
||||
import com.google.android.apps.mytracks.fragments.MarkerAddDialogFragment;
|
||||
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
|
||||
import com.google.android.apps.mytracks.util.IntentUtils;
|
||||
import com.google.android.apps.mytracks.util.ListItemUtils;
|
||||
@@ -196,8 +195,9 @@ public class MarkerListActivity extends AbstractMyTracksActivity {
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.marker_list_insert_marker:
|
||||
MarkerAddDialogFragment.newInstance(trackId)
|
||||
.show(getSupportFragmentManager(), MarkerAddDialogFragment.MARKER_ADD_DIALOG_TAG);
|
||||
Intent intent = IntentUtils.newIntent(this, MarkerEditActivity.class)
|
||||
.putExtra(MarkerEditActivity.EXTRA_TRACK_ID, trackId);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
case R.id.marker_list_search:
|
||||
return ApiAdapterFactory.getApiAdapter().handleSearchMenuSelection(this);
|
||||
|
||||
@@ -26,7 +26,6 @@ import com.google.android.apps.mytracks.fragments.DeleteOneTrackDialogFragment;
|
||||
import com.google.android.apps.mytracks.fragments.DeleteOneTrackDialogFragment.DeleteOneTrackCaller;
|
||||
import com.google.android.apps.mytracks.fragments.InstallEarthDialogFragment;
|
||||
import com.google.android.apps.mytracks.fragments.MapFragment;
|
||||
import com.google.android.apps.mytracks.fragments.MarkerAddDialogFragment;
|
||||
import com.google.android.apps.mytracks.fragments.StatsFragment;
|
||||
import com.google.android.apps.mytracks.io.file.SaveActivity;
|
||||
import com.google.android.apps.mytracks.io.file.TrackWriterFactory.TrackFileFormat;
|
||||
@@ -255,8 +254,9 @@ public class TrackDetailActivity extends AbstractMyTracksActivity implements Del
|
||||
TrackRecordingServiceConnectionUtils.stop(this, trackRecordingServiceConnection, true);
|
||||
return true;
|
||||
case R.id.track_detail_insert_marker:
|
||||
MarkerAddDialogFragment.newInstance(trackId)
|
||||
.show(getSupportFragmentManager(), MarkerAddDialogFragment.MARKER_ADD_DIALOG_TAG);
|
||||
intent = IntentUtils.newIntent(this, MarkerEditActivity.class)
|
||||
.putExtra(MarkerEditActivity.EXTRA_TRACK_ID, trackId);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
case R.id.track_detail_play:
|
||||
if (isEarthInstalled()) {
|
||||
|
||||
@@ -1,122 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
package com.google.android.apps.mytracks.fragments;
|
||||
|
||||
import com.google.android.apps.mytracks.MarkerEditActivity;
|
||||
import com.google.android.apps.mytracks.content.WaypointCreationRequest;
|
||||
import com.google.android.apps.mytracks.services.TrackRecordingServiceConnection;
|
||||
import com.google.android.apps.mytracks.util.IntentUtils;
|
||||
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
||||
import com.google.android.apps.mytracks.util.TrackRecordingServiceConnectionUtils;
|
||||
import com.google.android.maps.mytracks.R;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.RadioGroup;
|
||||
|
||||
/**
|
||||
* A DialogFragment to add a marker.
|
||||
*
|
||||
* @author Jimmy Shih
|
||||
*/
|
||||
public class MarkerAddDialogFragment extends DialogFragment {
|
||||
|
||||
public static final String MARKER_ADD_DIALOG_TAG = "markerAddDialog";
|
||||
|
||||
private static final String KEY_TRACK_ID = "trackId";
|
||||
private TrackRecordingServiceConnection trackRecordingServiceConnection;
|
||||
private RadioGroup radioGroup;
|
||||
private Button moreOptions;
|
||||
|
||||
/**
|
||||
* Creates a new instance of {@link MarkerAddDialogFragment}.
|
||||
*
|
||||
* @param trackId the track id
|
||||
*/
|
||||
public static MarkerAddDialogFragment newInstance(long trackId) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putLong(KEY_TRACK_ID, trackId);
|
||||
|
||||
MarkerAddDialogFragment markerAddDialogFragment = new MarkerAddDialogFragment();
|
||||
markerAddDialogFragment.setArguments(bundle);
|
||||
return markerAddDialogFragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle arg0) {
|
||||
super.onCreate(arg0);
|
||||
trackRecordingServiceConnection = new TrackRecordingServiceConnection(getActivity(), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
TrackRecordingServiceConnectionUtils.resume(getActivity(), trackRecordingServiceConnection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
trackRecordingServiceConnection.unbind();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
View view = getActivity().getLayoutInflater().inflate(R.layout.marker_add, null);
|
||||
radioGroup = (RadioGroup) view.findViewById(R.id.marker_add_type);
|
||||
moreOptions = (Button) view.findViewById(R.id.marker_add_more_options);
|
||||
moreOptions.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
boolean statisticsMarker = radioGroup.getCheckedRadioButtonId()
|
||||
== R.id.marker_add_statistics;
|
||||
Intent intent = IntentUtils.newIntent(getActivity(), MarkerEditActivity.class);
|
||||
intent.putExtra(MarkerEditActivity.EXTRA_TRACK_ID, getArguments().getLong(KEY_TRACK_ID));
|
||||
intent.putExtra(MarkerEditActivity.EXTRA_STATISTICS_MARKER, statisticsMarker);
|
||||
startActivity(intent);
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
boolean pickStatisticsMarker = PreferencesUtils.getBoolean(getActivity(),
|
||||
R.string.pick_statistics_marker_key, PreferencesUtils.PICK_STATISTICS_MARKER_DEFAULT);
|
||||
radioGroup.check(pickStatisticsMarker ? R.id.marker_add_statistics : R.id.marker_add_waypoint);
|
||||
return new AlertDialog.Builder(getActivity())
|
||||
.setNegativeButton(R.string.generic_cancel, null)
|
||||
.setPositiveButton(R.string.generic_add, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
boolean statisticsMarker = radioGroup.getCheckedRadioButtonId()
|
||||
== R.id.marker_add_statistics;
|
||||
PreferencesUtils.setBoolean(
|
||||
getActivity(), R.string.pick_statistics_marker_key, statisticsMarker);
|
||||
TrackRecordingServiceConnectionUtils.addMarker(getActivity(),
|
||||
trackRecordingServiceConnection,
|
||||
statisticsMarker ? WaypointCreationRequest.DEFAULT_STATISTICS
|
||||
: WaypointCreationRequest.DEFAULT_WAYPOINT);
|
||||
}
|
||||
})
|
||||
.setTitle(R.string.menu_insert_marker)
|
||||
.setView(view)
|
||||
.create();
|
||||
}
|
||||
}
|
||||
@@ -102,7 +102,7 @@ public class CsvTrackWriter implements TrackFormatWriter {
|
||||
@Override
|
||||
public void writeBeginWaypoints() {
|
||||
writeCommaSeparatedLine(context.getString(R.string.generic_name),
|
||||
context.getString(R.string.marker_edit_waypoint_marker_type_hint),
|
||||
context.getString(R.string.marker_edit_marker_type_hint),
|
||||
context.getString(R.string.generic_description),
|
||||
context.getString(R.string.description_location_latitude),
|
||||
context.getString(R.string.description_location_longitude),
|
||||
|
||||
@@ -963,7 +963,7 @@ public class TrackRecordingService extends Service {
|
||||
} else {
|
||||
int nextMarkerNumber = providerUtils.getNextMarkerNumber(recordingTrackId, false);
|
||||
name = nextMarkerNumber == -1 ? getString(R.string.marker_type_waypoint)
|
||||
: getString(R.string.marker_waypoint_name_format, nextMarkerNumber);
|
||||
: getString(R.string.marker_name_format, nextMarkerNumber);
|
||||
}
|
||||
wpt.setName(name);
|
||||
if (request.getCategory() != null) {
|
||||
|
||||
@@ -66,7 +66,6 @@ public class PreferencesUtils {
|
||||
|
||||
public static final int PERIODIC_TASK_OFF = 0;
|
||||
public static final boolean PICK_EXISTING_MAP_DEFAULT = false;
|
||||
public static final boolean PICK_STATISTICS_MARKER_DEFAULT = true;
|
||||
public static final String PREFERRED_ACCOUNT_DEFAULT = "";
|
||||
public static final long RECORDING_TRACK_ID_DEFAULT = -1L;
|
||||
public static final boolean REPORT_SPEED_DEFAULT = true;
|
||||
|
||||
+1
-1
@@ -535,7 +535,7 @@ public class TrackRecordingServiceTest extends ServiceTestCase<TestRecordingServ
|
||||
Waypoint wpt = providerUtils.getWaypoint(1);
|
||||
assertEquals(getContext().getString(R.string.marker_waypoint_icon_url),
|
||||
wpt.getIcon());
|
||||
assertEquals(getContext().getString(R.string.marker_waypoint_name_format, 1), wpt.getName());
|
||||
assertEquals(getContext().getString(R.string.marker_name_format, 1), wpt.getName());
|
||||
assertEquals(Waypoint.TYPE_WAYPOINT, wpt.getType());
|
||||
assertEquals(123L, wpt.getTrackId());
|
||||
assertEquals(0.0, wpt.getLength());
|
||||
|
||||
Reference in New Issue
Block a user