Disable current track without plugin

This commit is contained in:
Victor Shcherb 2015-03-10 01:21:04 +01:00
parent 1b7c3720bd
commit 9d95656133
2 changed files with 22 additions and 14 deletions

View file

@ -11,6 +11,7 @@ import net.osmand.plus.GPXUtilities.GPXFile;
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile; import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
import net.osmand.plus.OsmAndAppCustomization; import net.osmand.plus.OsmAndAppCustomization;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
@ -124,6 +125,7 @@ public class DashTrackFragment extends DashBaseFragment {
tracks.removeAllViews(); tracks.removeAllViews();
LayoutInflater inflater = getActivity().getLayoutInflater(); LayoutInflater inflater = getActivity().getLayoutInflater();
if (OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null) {
View view = inflater.inflate(R.layout.dash_gpx_track_item, null, false); View view = inflater.inflate(R.layout.dash_gpx_track_item, null, false);
AvailableGPXFragment.createCurrentTrackView(view, app); AvailableGPXFragment.createCurrentTrackView(view, app);
@ -138,6 +140,7 @@ public class DashTrackFragment extends DashBaseFragment {
view.findViewById(R.id.divider).setVisibility(View.VISIBLE); view.findViewById(R.id.divider).setVisibility(View.VISIBLE);
tracks.addView(view); tracks.addView(view);
startHandler(view); startHandler(view);
}
for (String filename : list) { for (String filename : list) {
final File f = new File(filename); final File f = new File(filename);

View file

@ -156,6 +156,9 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
} }
public void updateCurrentTrack() { public void updateCurrentTrack() {
if (OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) == null) {
return;
}
updateCurrentTrack(getView(), getActivity(), app); updateCurrentTrack(getView(), getActivity(), app);
final CheckBox checkbox = (CheckBox) getView().findViewById(R.id.check_local_index); final CheckBox checkbox = (CheckBox) getView().findViewById(R.id.check_local_index);
checkbox.setVisibility(selectionMode && showOnMapMode? View.VISIBLE : View.GONE); checkbox.setVisibility(selectionMode && showOnMapMode? View.VISIBLE : View.GONE);
@ -178,6 +181,9 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
} }
public static void updateCurrentTrack(View v, final Activity ctx, OsmandApplication app) { public static void updateCurrentTrack(View v, final Activity ctx, OsmandApplication app) {
if (OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null) {
return;
}
if (v == null) { if (v == null) {
return; return;
} }
@ -236,7 +242,6 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
listView.setAdapter(this.adapter); listView.setAdapter(this.adapter);
} }
setHasOptionsMenu(true); setHasOptionsMenu(true);
View currentTrackView = v.findViewById(R.id.current_track); View currentTrackView = v.findViewById(R.id.current_track);
createCurrentTrackView(v, getMyApplication()); createCurrentTrackView(v, getMyApplication());
if (OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) == null) { if (OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) == null) {