This commit is contained in:
Alexey Kulish 2017-03-27 18:15:54 +03:00
parent c0d362d424
commit 7f9bc4d5ce
8 changed files with 43 additions and 29 deletions

View file

@ -121,7 +121,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginRight="8dp"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/default_desc_text_size"
tools:text="@string/altitude"/>
@ -130,7 +130,7 @@
android:id="@+id/y_axis_arrow"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginRight="8dp"
android:src="@drawable/ic_action_arrow_drop_down"/>
</LinearLayout>
@ -165,7 +165,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginRight="8dp"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/default_desc_text_size"
tools:text="@string/map_widget_speed"/>
@ -174,7 +174,7 @@
android:id="@+id/x_axis_arrow"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginRight="8dp"
android:src="@drawable/ic_action_arrow_drop_down"/>
</LinearLayout>

View file

@ -50,7 +50,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginRight="8dp"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/default_desc_text_size"
tools:text="@string/altitude"/>
@ -59,7 +59,7 @@
android:id="@+id/y_axis_arrow"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginRight="8dp"
android:src="@drawable/ic_action_arrow_drop_down"/>
</LinearLayout>
@ -94,7 +94,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginRight="8dp"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/default_desc_text_size"
tools:text="@string/distance"/>
@ -103,7 +103,7 @@
android:id="@+id/x_axis_arrow"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginRight="8dp"
android:src="@drawable/ic_action_arrow_drop_down"/>
</LinearLayout>

View file

@ -236,5 +236,8 @@
<color name="gpx_chart_blue_grid">#c32561c2</color>
<color name="gpx_chart_orange_grid">#c3b35f00</color>
<color name="gpx_chart_green_grid">#c3197d2a</color>
<color name="gpx_chart_blue_label">#2561c2</color>
<color name="gpx_chart_orange_label">#b27700</color>
<color name="gpx_chart_green_label">#197d2a</color>
</resources>

View file

@ -674,6 +674,7 @@ public class GpxSelectionHelper {
public Bitmap image;
public boolean expanded;
public boolean route;
public boolean wasHidden = true;
public WptPt locationOnMap;
public GPXDataSetType[] chartTypes;

View file

@ -208,10 +208,14 @@ public class GpxUiHelper {
if (allGpxList.isEmpty()) {
Toast.makeText(activity, R.string.gpx_files_not_found, Toast.LENGTH_LONG).show();
}
allGpxList.add(0, new GPXInfo(activity.getString(R.string.show_current_gpx_title), 0, 0));
final ContextMenuAdapter adapter = createGpxContextMenuAdapter(allGpxList, selectedGpxList, true);
boolean showCurrentTrack = false;
if (OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null) {
allGpxList.add(0, new GPXInfo(activity.getString(R.string.show_current_gpx_title), 0, 0));
showCurrentTrack = true;
}
final ContextMenuAdapter adapter = createGpxContextMenuAdapter(allGpxList, selectedGpxList, showCurrentTrack);
return createDialog(activity, true, true, true, callbackWithObject, allGpxList, adapter);
return createDialog(activity, showCurrentTrack, true, true, callbackWithObject, allGpxList, adapter);
}
public static AlertDialog selectGPXFile(final Activity activity,
@ -1136,7 +1140,7 @@ public class GpxUiHelper {
} else {
yAxis = mChart.getAxisLeft();
}
yAxis.setTextColor(ActivityCompat.getColor(mChart.getContext(), R.color.gpx_chart_blue));
yAxis.setTextColor(ActivityCompat.getColor(mChart.getContext(), R.color.gpx_chart_blue_label));
yAxis.setGridColor(ActivityCompat.getColor(mChart.getContext(), R.color.gpx_chart_blue_grid));
yAxis.setGranularity(1f);
yAxis.resetAxisMinimum();
@ -1234,7 +1238,7 @@ public class GpxUiHelper {
} else {
yAxis = mChart.getAxisLeft();
}
yAxis.setTextColor(ActivityCompat.getColor(mChart.getContext(), R.color.gpx_chart_orange));
yAxis.setTextColor(ActivityCompat.getColor(mChart.getContext(), R.color.gpx_chart_orange_label));
yAxis.setGridColor(ActivityCompat.getColor(mChart.getContext(), R.color.gpx_chart_orange_grid));
yAxis.setAxisMinimum(0f);
@ -1354,7 +1358,7 @@ public class GpxUiHelper {
} else {
yAxis = mChart.getAxisLeft();
}
yAxis.setTextColor(ActivityCompat.getColor(mChart.getContext(), R.color.gpx_chart_green));
yAxis.setTextColor(ActivityCompat.getColor(mChart.getContext(), R.color.gpx_chart_green_label));
yAxis.setGridColor(ActivityCompat.getColor(mChart.getContext(), R.color.gpx_chart_green_grid));
yAxis.setGranularity(1f);
yAxis.resetAxisMinimum();

View file

@ -78,7 +78,11 @@ public class TrackDetailsMenu {
mapActivity.getMapView().setMapPositionX(1);
} else {
toolbarController = new TrackDetailsBarController();
toolbarController.setTitle(mapActivity.getString(R.string.rendering_category_details));
if (gpxItem != null && gpxItem.group != null) {
toolbarController.setTitle(gpxItem.group.getGpxName());
} else {
toolbarController.setTitle(mapActivity.getString(R.string.rendering_category_details));
}
toolbarController.setOnBackButtonClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -88,21 +92,9 @@ public class TrackDetailsMenu {
toolbarController.setOnCloseButtonClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
MapActivity.clearPrevActivityIntent();
hide();
}
});
/*
if (gpxItem.group.getGpx().showCurrentTrack) {
toolbarController.setRefreshBtnVisible(true);
toolbarController.setOnRefreshButtonClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
update();
}
});
}
*/
mapActivity.showTopToolbar(toolbarController);
}
@ -141,6 +133,9 @@ public class TrackDetailsMenu {
public void onDismiss() {
VISIBLE = false;
if (gpxItem != null && !gpxItem.route && gpxItem.wasHidden && gpxItem.group != null && gpxItem.group.getGpx() != null) {
mapActivity.getMyApplication().getSelectedGpxHelper().selectGpxFile(gpxItem.group.getGpx(), false, false);
}
if (toolbarController != null) {
mapActivity.hideTopToolbar(toolbarController);
}

View file

@ -41,6 +41,15 @@ public class TrackDetailsMenuFragment extends Fragment {
mainView = view.findViewById(R.id.main_view);
TextView topBarTitle = (TextView) mainView.findViewById(R.id.top_bar_title);
if (topBarTitle != null) {
if (menu.getGpxItem().group != null) {
topBarTitle.setText(menu.getGpxItem().group.getGpxName());
} else {
topBarTitle.setText(mapActivity.getString(R.string.rendering_category_details));
}
}
ImageButton backButton = (ImageButton) mainView.findViewById(R.id.top_bar_back_button);
ImageButton closeButton = (ImageButton) mainView.findViewById(R.id.top_bar_close_button);
if (backButton != null) {
@ -55,7 +64,6 @@ public class TrackDetailsMenuFragment extends Fragment {
closeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
MapActivity.clearPrevActivityIntent();
dismiss();
}
});
@ -75,7 +83,9 @@ public class TrackDetailsMenuFragment extends Fragment {
} else {
obs.removeGlobalOnLayoutListener(this);
}
updateInfo();
if (getMapActivity() != null) {
updateInfo();
}
}
});

View file

@ -1357,6 +1357,7 @@ public class TrackSegmentFragment extends OsmAndListFragment {
}
if (gpxItem.group.getGpx() != null) {
gpxItem.wasHidden = app.getSelectedGpxHelper().getSelectedFileByPath(getGpx().path) == null;
app.getSelectedGpxHelper().setGpxFileToDisplay(gpxItem.group.getGpx());
}
final OsmandSettings settings = app.getSettings();