Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
774b0185d3
10 changed files with 263 additions and 146 deletions
|
@ -2,5 +2,8 @@
|
|||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="4dp" />
|
||||
<solid android:color="@color/gpx_chart_blue"/>
|
||||
<solid android:color="?attr/bg_color"/>
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="#808080" />
|
||||
</shape>
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="4dp" />
|
||||
<solid android:color="@color/gpx_chart_orange"/>
|
||||
</shape>
|
|
@ -7,19 +7,18 @@
|
|||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
android:orientation="horizontal"
|
||||
android:background="@drawable/chart_marker_background">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/text_alt_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="2dp"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:paddingLeft="6dp"
|
||||
android:paddingRight="6dp"
|
||||
android:background="@drawable/chart_marker_blue_background">
|
||||
android:paddingRight="6dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_alt_value"
|
||||
|
@ -27,7 +26,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:text="100 "
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
android:textColor="@android:color/white"
|
||||
android:textColor="@color/gpx_chart_blue"
|
||||
android:textStyle="bold"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"/>
|
||||
|
@ -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"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="1dp"
|
||||
android:layout_marginBottom="1dp"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/text_spd_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="2dp"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:paddingLeft="6dp"
|
||||
android:paddingRight="6dp"
|
||||
android:background="@drawable/chart_marker_orange_background">
|
||||
android:paddingRight="6dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_spd_value"
|
||||
|
@ -62,7 +67,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:text="100 "
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
android:textColor="@android:color/white"
|
||||
android:textColor="@color/gpx_chart_orange"
|
||||
android:textStyle="bold"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"/>
|
||||
|
@ -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"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/text_slp_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:paddingLeft="6dp"
|
||||
android:paddingRight="6dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_slp_value"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="100 "
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
android:textColor="@color/gpx_chart_green"
|
||||
android:textStyle="bold"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_slp_units"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="%"
|
||||
android:textSize="@dimen/default_sub_text_size"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"/>
|
||||
|
||||
|
@ -81,5 +119,4 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</RelativeLayout>
|
|
@ -18,117 +18,130 @@
|
|||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:background="?attr/bg_color"
|
||||
android:gravity="center_vertical">
|
||||
android:orientation="vertical"
|
||||
android:background="?attr/bg_color">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1.8"
|
||||
android:minHeight="48dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
android:text="@string/shared_string_show_on_map"/>
|
||||
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:id="@+id/showOnMapToggle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1.8"
|
||||
android:minHeight="48dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="8dp"/>
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
android:text="@string/shared_string_show_on_map"/>
|
||||
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:id="@+id/showOnMapToggle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="8dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:background="?attr/bg_color"
|
||||
android:gravity="center_vertical">
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/split_interval_view"
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1.6"
|
||||
android:minHeight="48dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/split_interval_title"
|
||||
<LinearLayout
|
||||
android:id="@+id/split_interval_view"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
android:text="@string/gpx_split_interval"/>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/split_interval_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:text="10 km"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/split_interval_arrow"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_action_arrow_drop_down"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/color_view"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:minHeight="48dp"
|
||||
android:paddingRight="16dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/colorText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="right"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
android:text="@string/shared_string_color"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/colorImage"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1.6"
|
||||
android:minHeight="48dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:src="@drawable/ic_action_circle"/>
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/split_interval_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
android:text="@string/gpx_split_interval"/>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/split_interval_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:text="10 km"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/split_interval_arrow"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_action_arrow_drop_down"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/color_view"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:minHeight="48dp"
|
||||
android:paddingRight="16dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/colorText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="right"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
android:text="@string/shared_string_color"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/colorImage"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:src="@drawable/ic_action_circle"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -230,5 +230,8 @@
|
|||
<color name="gpx_chart_blue">#2f7af5</color>
|
||||
<color name="gpx_chart_orange">#ff8800</color>
|
||||
<color name="gpx_chart_green">#23b03b</color>
|
||||
<color name="gpx_chart_blue_grid">#c32561c2</color>
|
||||
<color name="gpx_chart_orange_grid">#c3b35f00</color>
|
||||
<color name="gpx_chart_green_grid">#c3197d2a</color>
|
||||
|
||||
</resources>
|
|
@ -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
|
||||
-->
|
||||
<string name="gpx_track">Track</string>
|
||||
<string name="max_speed">Max speed</string>
|
||||
<string name="average_speed">Average speed</string>
|
||||
<string name="shared_string_time_moving">Time moving</string>
|
||||
|
|
|
@ -45,6 +45,7 @@ public class TrackActivity extends TabActivity {
|
|||
ViewPager mViewPager;
|
||||
private long modifiedTime = -1;
|
||||
private List<GpxDisplayGroup> displayGroups;
|
||||
private List<GpxDisplayGroup> 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<GpxDisplayGroup> getGpxFile() {
|
||||
public List<GpxDisplayGroup> 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
|
||||
|
|
|
@ -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<Elevation> 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ public class TrackPointFragment extends OsmAndListFragment {
|
|||
}
|
||||
|
||||
private List<GpxDisplayGroup> filterGroups(GpxDisplayItemType[] types) {
|
||||
List<GpxDisplayGroup> result = getMyActivity().getGpxFile();
|
||||
List<GpxDisplayGroup> result = getMyActivity().getGpxFile(false);
|
||||
List<GpxDisplayGroup> groups = new ArrayList<>();
|
||||
for (GpxDisplayGroup group : result) {
|
||||
boolean add = types == null || hasFilterType(types, group.getType());
|
||||
|
|
|
@ -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<GpxDisplayGroup> groups = getGroups();
|
||||
final List<GpxDisplayGroup> 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<GpxDisplayGroup> groups = getGroups();
|
||||
final List<GpxDisplayGroup> groups = getDisplayGroups();
|
||||
if (groups.size() > 0) {
|
||||
updateSplit(groups, vis.isChecked() ? sf : null);
|
||||
}
|
||||
|
@ -323,8 +323,12 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
|||
}
|
||||
}
|
||||
|
||||
private List<GpxDisplayGroup> getGroups() {
|
||||
return filterGroups();
|
||||
private List<GpxDisplayGroup> getOriginalGroups() {
|
||||
return filterGroups(false);
|
||||
}
|
||||
|
||||
private List<GpxDisplayGroup> 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<GpxDisplayGroup> groups = getGroups();
|
||||
final List<GpxDisplayGroup> 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<GpxDisplayGroup> filterGroups() {
|
||||
List<GpxDisplayGroup> result = getMyActivity().getGpxFile();
|
||||
private List<GpxDisplayGroup> filterGroups(boolean useDisplayGroups) {
|
||||
List<GpxDisplayGroup> result = getMyActivity().getGpxFile(useDisplayGroups);
|
||||
List<GpxDisplayGroup> 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<GpxDisplayGroup> groups = filterGroups();
|
||||
List<GpxDisplayGroup> 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<GpxDisplayGroup> groups = getGroups();
|
||||
final List<GpxDisplayGroup> 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);
|
||||
|
|
Loading…
Reference in a new issue