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.OsmAndAppCustomization;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
@ -124,20 +125,22 @@ public class DashTrackFragment extends DashBaseFragment {
tracks.removeAllViews();
LayoutInflater inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.dash_gpx_track_item, null, false);
if (OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null) {
View view = inflater.inflate(R.layout.dash_gpx_track_item, null, false);
AvailableGPXFragment.createCurrentTrackView(view, app);
((TextView) view.findViewById(R.id.name)).setText(R.string.shared_string_currently_recording_track);
AvailableGPXFragment.updateCurrentTrack(view, getActivity(), app);
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AvailableGPXFragment.openTrack(getActivity(), null);
}
});
view.findViewById(R.id.divider).setVisibility(View.VISIBLE);
tracks.addView(view);
startHandler(view);
AvailableGPXFragment.createCurrentTrackView(view, app);
((TextView) view.findViewById(R.id.name)).setText(R.string.shared_string_currently_recording_track);
AvailableGPXFragment.updateCurrentTrack(view, getActivity(), app);
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AvailableGPXFragment.openTrack(getActivity(), null);
}
});
view.findViewById(R.id.divider).setVisibility(View.VISIBLE);
tracks.addView(view);
startHandler(view);
}
for (String filename : list) {
final File f = new File(filename);

View file

@ -156,6 +156,9 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
}
public void updateCurrentTrack() {
if (OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) == null) {
return;
}
updateCurrentTrack(getView(), getActivity(), app);
final CheckBox checkbox = (CheckBox) getView().findViewById(R.id.check_local_index);
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) {
if (OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null) {
return;
}
if (v == null) {
return;
}
@ -236,7 +242,6 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
listView.setAdapter(this.adapter);
}
setHasOptionsMenu(true);
View currentTrackView = v.findViewById(R.id.current_track);
createCurrentTrackView(v, getMyApplication());
if (OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) == null) {