diff --git a/OsmAnd/res/drawable/chart_marker_blue_background.xml b/OsmAnd/res/drawable/chart_marker_background.xml
similarity index 60%
rename from OsmAnd/res/drawable/chart_marker_blue_background.xml
rename to OsmAnd/res/drawable/chart_marker_background.xml
index 8ad8381eec..48543a6da4 100644
--- a/OsmAnd/res/drawable/chart_marker_blue_background.xml
+++ b/OsmAnd/res/drawable/chart_marker_background.xml
@@ -2,5 +2,8 @@
-
+
+
\ No newline at end of file
diff --git a/OsmAnd/res/drawable/chart_marker_orange_background.xml b/OsmAnd/res/drawable/chart_marker_orange_background.xml
deleted file mode 100644
index 13f9bbf6a7..0000000000
--- a/OsmAnd/res/drawable/chart_marker_orange_background.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/OsmAnd/res/layout/chart_marker_view.xml b/OsmAnd/res/layout/chart_marker_view.xml
index 5e21a37561..fa9a0f1e15 100644
--- a/OsmAnd/res/layout/chart_marker_view.xml
+++ b/OsmAnd/res/layout/chart_marker_view.xml
@@ -7,19 +7,18 @@
+ android:orientation="horizontal"
+ android:background="@drawable/chart_marker_background">
+ android:paddingRight="6dp">
@@ -38,23 +37,29 @@
android:layout_height="wrap_content"
android:text="m"
android:textSize="@dimen/default_sub_text_size"
- android:textColor="@android:color/white"
+ android:textColor="?android:attr/textColorSecondary"
android:ellipsize="end"
android:singleLine="true"/>
+
+
+ android:paddingRight="6dp">
@@ -73,7 +78,40 @@
android:layout_height="wrap_content"
android:text="km/h"
android:textSize="@dimen/default_sub_text_size"
- android:textColor="@android:color/white"
+ android:textColor="?android:attr/textColorSecondary"
+ android:ellipsize="end"
+ android:singleLine="true"/>
+
+
+
+
+
+
+
+
@@ -81,5 +119,4 @@
-
\ No newline at end of file
diff --git a/OsmAnd/res/layout/gpx_item_list_header.xml b/OsmAnd/res/layout/gpx_item_list_header.xml
index aa112865c3..b254b96f41 100644
--- a/OsmAnd/res/layout/gpx_item_list_header.xml
+++ b/OsmAnd/res/layout/gpx_item_list_header.xml
@@ -18,117 +18,130 @@
+ android:orientation="vertical"
+ android:background="?attr/bg_color">
-
-
-
+ android:paddingTop="8dp"
+ android:paddingBottom="8dp"
+ android:orientation="horizontal"
+ android:gravity="center_vertical">
+
+
+
+
+
+
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+ android:paddingTop="8dp"
+ android:paddingBottom="8dp"
+ android:background="?attr/selectableItemBackground"
+ android:orientation="horizontal"
+ android:gravity="center_vertical">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/OsmAnd/res/values/colors.xml b/OsmAnd/res/values/colors.xml
index ec7f82473a..0af29e6102 100644
--- a/OsmAnd/res/values/colors.xml
+++ b/OsmAnd/res/values/colors.xml
@@ -230,5 +230,8 @@
#2f7af5
#ff8800
#23b03b
+ #c32561c2
+ #c3b35f00
+ #c3197d2a
\ No newline at end of file
diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml
index 270e26bf3f..6c8d04e364 100644
--- a/OsmAnd/res/values/strings.xml
+++ b/OsmAnd/res/values/strings.xml
@@ -9,6 +9,7 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
-->
+ Track
Max speed
Average speed
Time moving
diff --git a/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java b/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java
index fb7e1f2a9e..3c881b5883 100644
--- a/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java
+++ b/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java
@@ -45,6 +45,7 @@ public class TrackActivity extends TabActivity {
ViewPager mViewPager;
private long modifiedTime = -1;
private List displayGroups;
+ private List originalGroups = new ArrayList<>();
@Override
public void onCreate(Bundle icicle) {
@@ -108,7 +109,7 @@ public class TrackActivity extends TabActivity {
}
}
((OsmandFragmentPagerAdapter) mViewPager.getAdapter()).addTab(
- getTabIndicator(R.string.info_button, TrackSegmentFragment.class));
+ getTabIndicator(R.string.gpx_track, TrackSegmentFragment.class));
if (isHavingWayPoints() || isHavingRoutePoints()) {
((OsmandFragmentPagerAdapter) mViewPager.getAdapter()).addTab(
getTabIndicator(R.string.points, TrackPointFragment.class));
@@ -132,7 +133,7 @@ public class TrackActivity extends TabActivity {
}
}
- public List getGpxFile() {
+ public List getGpxFile(boolean useDisplayGroups) {
if (gpxFile == null) {
return new ArrayList<>();
}
@@ -140,6 +141,10 @@ public class TrackActivity extends TabActivity {
modifiedTime = gpxFile.modifiedTime;
GpxSelectionHelper selectedGpxHelper = ((OsmandApplication) getApplication()).getSelectedGpxHelper();
displayGroups = selectedGpxHelper.collectDisplayGroups(gpxFile);
+ originalGroups.clear();
+ for (GpxDisplayGroup g : displayGroups) {
+ originalGroups.add(g.cloneInstance());
+ }
if (file != null) {
SelectedGpxFile sf = selectedGpxHelper.getSelectedFileByPath(gpxFile.path);
if (sf != null && file != null && sf.getDisplayGroups() != null) {
@@ -147,7 +152,11 @@ public class TrackActivity extends TabActivity {
}
}
}
- return displayGroups;
+ if (useDisplayGroups) {
+ return displayGroups;
+ } else {
+ return originalGroups;
+ }
}
@Override
diff --git a/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java b/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java
index b62798e60a..a18fd9feac 100644
--- a/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java
+++ b/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java
@@ -1004,6 +1004,8 @@ public class GpxUiHelper {
} else {
yAxis = mChart.getAxisLeft();
}
+ yAxis.setTextColor(ActivityCompat.getColor(mChart.getContext(), R.color.gpx_chart_blue));
+ yAxis.setGridColor(ActivityCompat.getColor(mChart.getContext(), R.color.gpx_chart_blue_grid));
yAxis.setGranularity(1f);
yAxis.setValueFormatter(new IAxisValueFormatter() {
@@ -1017,17 +1019,17 @@ public class GpxUiHelper {
List elevationData = analysis.elevationData;
float nextX = 0;
float nextY;
- float prevElev = -80000;
- float gist = 1.5f;
+ //float prevElev = -80000;
+ //float gist = 1.5f;
for (Elevation e : elevationData) {
if (e.distance > 0) {
nextX += (float) e.distance / divX;
nextY = (float) (e.elevation * convEle);
- if (Math.abs(prevElev - e.elevation) < gist) {
- continue;
- } else {
- prevElev = (float) e.elevation;
- }
+ //if (Math.abs(prevElev - e.elevation) < gist) {
+ // continue;
+ //} else {
+ // prevElev = (float) e.elevation;
+ //}
values.add(new Entry(nextX, nextY));
}
}
@@ -1134,6 +1136,8 @@ public class GpxUiHelper {
} else {
yAxis = mChart.getAxisLeft();
}
+ yAxis.setTextColor(ActivityCompat.getColor(mChart.getContext(), R.color.gpx_chart_orange));
+ yAxis.setGridColor(ActivityCompat.getColor(mChart.getContext(), R.color.gpx_chart_orange_grid));
yAxis.setAxisMinimum(0f);
yAxis.setValueFormatter(new IAxisValueFormatter() {
@@ -1246,6 +1250,8 @@ public class GpxUiHelper {
} else {
yAxis = mChart.getAxisLeft();
}
+ yAxis.setTextColor(ActivityCompat.getColor(mChart.getContext(), R.color.gpx_chart_green));
+ yAxis.setGridColor(ActivityCompat.getColor(mChart.getContext(), R.color.gpx_chart_green_grid));
yAxis.setGranularity(1f);
yAxis.setValueFormatter(new IAxisValueFormatter() {
@@ -1264,13 +1270,20 @@ public class GpxUiHelper {
float nextYM;
float prevXM;
float prevYM;
- float prevElevM = -80000;
float prevDistM = -1;
- float gist = 1.5f;
+ //float prevElevM = -80000;
+ //float gist = 1.5f; // 1.5 meters
+ float delta = 30f; // 30 meters
float d;
if (elevationData.size() > 1) {
Elevation e0 = elevationData.get(0);
- nextXM = e0.distance > 0 ? (float) e0.distance : 0f;
+ d = (float) e0.distance;
+ if (d > delta) {
+ nextXM = d / 2f;
+ prevDistM = d;
+ } else {
+ nextXM = 0f;
+ }
nextYM = 0;
prevXM = nextXM;
prevYM = nextYM;
@@ -1279,21 +1292,25 @@ public class GpxUiHelper {
for (int i = 1; i < elevationData.size(); i++) {
Elevation e = elevationData.get(i);
if (e.distance > 0) {
- d = (float) e.distance;
+ d += (float) e.distance;
+ if (d < delta && i < elevationData.size() - 1) {
+ continue;
+ }
if (prevDistM < 0) {
nextDistM = d / 2f;
} else {
nextDistM = prevDistM / 2f + d / 2f;
}
prevDistM = d;
+ d = 0;
nextXM += nextDistM;
nextYM = (float) e.elevation;
- if (Math.abs(prevElevM - nextYM) < gist) {
- nextX += nextDistM / divX;
- continue;
- } else {
- prevElevM = nextYM;
- }
+ //if (Math.abs(prevElevM - nextYM) < gist) {
+ // nextX += nextDistM / divX;
+ // continue;
+ //} else {
+ // prevElevM = nextYM;
+ //}
if (nextX == 0) {
prevXM = nextXM;
prevYM = nextYM;
@@ -1301,7 +1318,7 @@ public class GpxUiHelper {
}
nextX += nextDistM / divX;
nextY = (nextYM - prevYM) / (nextXM - prevXM) * 100f;
- if (nextXM - prevXM > 30 && Math.abs(nextY) < 120) {
+ if (Math.abs(nextY) < 120) {
values.add(new Entry(nextX, nextY));
prevXM = nextXM;
prevYM = nextYM;
@@ -1388,11 +1405,13 @@ public class GpxUiHelper {
private View textAltView;
private View textSpdView;
+ private View textSlpView;
public GPXMarkerView(Context context) {
super(context, R.layout.chart_marker_view);
textAltView = findViewById(R.id.text_alt_container);
textSpdView = findViewById(R.id.text_spd_container);
+ textSlpView = findViewById(R.id.text_slp_container);
}
// callbacks everytime the MarkerView is redrawn, can be used to update the
@@ -1410,19 +1429,29 @@ public class GpxUiHelper {
((TextView) textAltView.findViewById(R.id.text_alt_units)).setText(units);
textAltView.setVisibility(VISIBLE);
textSpdView.setVisibility(GONE);
+ textSlpView.setVisibility(GONE);
break;
case SPEED:
((TextView) textSpdView.findViewById(R.id.text_spd_value)).setText(value);
((TextView) textSpdView.findViewById(R.id.text_spd_units)).setText(units);
textAltView.setVisibility(GONE);
textSpdView.setVisibility(VISIBLE);
+ textSlpView.setVisibility(GONE);
+ break;
+ case SLOPE:
+ ((TextView) textSlpView.findViewById(R.id.text_slp_value)).setText(value);
+ textAltView.setVisibility(GONE);
+ textSpdView.setVisibility(GONE);
+ textSlpView.setVisibility(VISIBLE);
break;
}
+ findViewById(R.id.divider).setVisibility(GONE);
} else if (chartData.getDataSetCount() == 2) {
OrderedLineDataSet dataSet1 = (OrderedLineDataSet) chartData.getDataSetByIndex(0);
OrderedLineDataSet dataSet2 = (OrderedLineDataSet) chartData.getDataSetByIndex(1);
int altSetIndex = -1;
int spdSetIndex = -1;
+ int slpSetIndex = -1;
switch (dataSet1.getDataSetType()) {
case ALTITUDE:
altSetIndex = 0;
@@ -1430,6 +1459,9 @@ public class GpxUiHelper {
case SPEED:
spdSetIndex = 0;
break;
+ case SLOPE:
+ slpSetIndex = 0;
+ break;
}
switch (dataSet2.getDataSetType()) {
case ALTITUDE:
@@ -1438,6 +1470,9 @@ public class GpxUiHelper {
case SPEED:
spdSetIndex = 1;
break;
+ case SLOPE:
+ slpSetIndex = 1;
+ break;
}
if (altSetIndex != -1) {
Entry eAlt = chartData.getEntryForHighlight(new Highlight(e.getX(), Float.NaN, altSetIndex));
@@ -1455,26 +1490,44 @@ public class GpxUiHelper {
} else {
textSpdView.setVisibility(GONE);
}
+ if (slpSetIndex != -1) {
+ Entry eSlp = chartData.getEntryForHighlight(new Highlight(e.getX(), Float.NaN, slpSetIndex));
+ ((TextView) textSlpView.findViewById(R.id.text_slp_value)).setText(Integer.toString((int) eSlp.getY()) + " ");
+ textSlpView.setVisibility(VISIBLE);
+ } else {
+ textSlpView.setVisibility(GONE);
+ }
+ findViewById(R.id.divider).setVisibility(VISIBLE);
} else {
textAltView.setVisibility(GONE);
textSpdView.setVisibility(GONE);
+ textSlpView.setVisibility(GONE);
+ findViewById(R.id.divider).setVisibility(GONE);
}
super.refreshContent(e, highlight);
}
@Override
public MPPointF getOffset() {
- if (getChartView().getData().getDataSetCount() > 1) {
- return new MPPointF(-(textAltView.getWidth() / 2), 0);
+ if (getChartView().getData().getDataSetCount() == 2) {
+ int x = findViewById(R.id.divider).getLeft();
+ return new MPPointF(-x - AndroidUtils.dpToPx(getContext(), .5f), 0);
} else {
- return new MPPointF(-(getWidth() / 2), 0);
+ return new MPPointF(-getWidth() / 2f, 0);
}
}
@Override
public MPPointF getOffsetForDrawingAtPoint(float posX, float posY) {
+ int margin = AndroidUtils.dpToPx(getContext(), 3f);
MPPointF offset = getOffset();
offset.y = -posY;
+ if (posX + offset.x - margin < 0) {
+ offset.x -= (offset.x + posX - margin);
+ }
+ if (posX + offset.x + getWidth() + margin > getChartView().getWidth()) {
+ offset.x -= (getWidth() - (getChartView().getWidth() - posX) + offset.x) + margin;
+ }
return offset;
}
}
diff --git a/OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java
index dcf3b17911..4dacedb592 100644
--- a/OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java
+++ b/OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java
@@ -147,7 +147,7 @@ public class TrackPointFragment extends OsmAndListFragment {
}
private List filterGroups(GpxDisplayItemType[] types) {
- List result = getMyActivity().getGpxFile();
+ List result = getMyActivity().getGpxFile(false);
List groups = new ArrayList<>();
for (GpxDisplayGroup group : result) {
boolean add = types == null || hasFilterType(types, group.getType());
diff --git a/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java
index d5aa24287a..1d22338079 100644
--- a/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java
+++ b/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java
@@ -225,7 +225,7 @@ public class TrackSegmentFragment extends OsmAndListFragment {
public void onClick(View v) {
SelectedGpxFile sf = app.getSelectedGpxHelper().selectGpxFile(getGpx(), vis.isChecked(), false);
if (vis.isChecked() && sf.getGpxFile() != null) {
- final List groups = getGroups();
+ final List groups = getOriginalGroups();
if (groups.size() > 0 && groups.get(0).getModifiableList().size() > 0) {
GpxDisplayItem item = groups.get(0).getModifiableList().get(0);
app.getSettings().setMapLocationToShow(item.locationStart.lat, item.locationStart.lon,
@@ -309,7 +309,7 @@ public class TrackSegmentFragment extends OsmAndListFragment {
public void onItemClick(AdapterView> parent, View view, int position, long id) {
selectedSplitInterval = position;
SelectedGpxFile sf = app.getSelectedGpxHelper().selectGpxFile(getGpx(), vis.isChecked(), false);
- final List groups = getGroups();
+ final List groups = getDisplayGroups();
if (groups.size() > 0) {
updateSplit(groups, vis.isChecked() ? sf : null);
}
@@ -323,8 +323,12 @@ public class TrackSegmentFragment extends OsmAndListFragment {
}
}
- private List getGroups() {
- return filterGroups();
+ private List getOriginalGroups() {
+ return filterGroups(false);
+ }
+
+ private List getDisplayGroups() {
+ return filterGroups(true);
}
private void setupSplitIntervalView(View view) {
@@ -332,7 +336,7 @@ public class TrackSegmentFragment extends OsmAndListFragment {
final TextView text = (TextView) view.findViewById(R.id.split_interval_text);
final ImageView img = (ImageView) view.findViewById(R.id.split_interval_arrow);
int colorId;
- final List groups = getGroups();
+ final List groups = getDisplayGroups();
if (groups.size() > 0) {
colorId = app.getSettings().isLightContent() ?
R.color.primary_text_light : R.color.primary_text_dark;
@@ -387,8 +391,8 @@ public class TrackSegmentFragment extends OsmAndListFragment {
return false;
}
- private List filterGroups() {
- List result = getMyActivity().getGpxFile();
+ private List filterGroups(boolean useDisplayGroups) {
+ List result = getMyActivity().getGpxFile(useDisplayGroups);
List groups = new ArrayList<>();
for (GpxDisplayGroup group : result) {
boolean add = hasFilterType(group.getType());
@@ -425,7 +429,7 @@ public class TrackSegmentFragment extends OsmAndListFragment {
protected void updateContent() {
adapter.clear();
- List groups = filterGroups();
+ List groups = getOriginalGroups();
adapter.setNotifyOnChange(false);
for (GpxDisplayItem i : flatten(groups)) {
adapter.add(i);
@@ -443,7 +447,7 @@ public class TrackSegmentFragment extends OsmAndListFragment {
}
private void prepareSplitIntervalAdapterData() {
- final List groups = getGroups();
+ final List groups = getDisplayGroups();
options.add(app.getString(R.string.shared_string_none));
distanceSplit.add(-1d);
@@ -873,7 +877,7 @@ public class TrackSegmentFragment extends OsmAndListFragment {
((TextView) view.findViewById(R.id.time_moving_text))
.setText(Algorithms.formatDuration((int) (analysis.timeMoving / 1000), app.accessibilityEnabled()));
((TextView) view.findViewById(R.id.distance_text))
- .setText(OsmAndFormatter.getFormattedDistance(analysis.totalDistance, app));
+ .setText(OsmAndFormatter.getFormattedDistance(analysis.totalDistanceMoving, app));
} else {
chart.setVisibility(View.GONE);
@@ -999,10 +1003,10 @@ public class TrackSegmentFragment extends OsmAndListFragment {
protected void onPostExecute(Void result) {
if (mSelectedGpxFile != null) {
- mSelectedGpxFile.setDisplayGroups(filterGroups());
+ mSelectedGpxFile.setDisplayGroups(getDisplayGroups());
}
if (mFragment.isVisible()) {
- mFragment.updateContent();
+ //mFragment.updateContent();
}
if (!mActivity.isFinishing()) {
mActivity.setProgressBarIndeterminateVisibility(false);