Gpx tracks card and My tracks updated
This commit is contained in:
parent
36b0cc7890
commit
ca6ebeac3b
7 changed files with 90 additions and 13 deletions
37
OsmAnd/res/layout/available_gpx.xml
Normal file
37
OsmAnd/res/layout/available_gpx.xml
Normal file
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout android:id="@+id/current_track"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<include android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
layout="@layout/dash_gpx_track_item"/>
|
||||
|
||||
<Button android:id="@+id/map_btn"
|
||||
android:text="@string/back_to_map"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<ExpandableListView
|
||||
android:id="@android:id/list"
|
||||
style="@style/OsmandListView"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0dp"
|
||||
android:background="?attr/expandable_list_background"
|
||||
android:layout_marginLeft="0dp"
|
||||
android:layout_marginRight="0dp"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_weight="1"
|
||||
android:groupIndicator="@android:color/transparent"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
|
@ -17,7 +17,7 @@
|
|||
android:layout_marginRight="@dimen/showAllButtonMarginRight"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView android:id="@+id/name"
|
||||
android:textColor="@color/dashboard_black"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
<LinearLayout android:orientation="horizontal"
|
||||
|
@ -56,14 +56,16 @@
|
|||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView android:id="@+id/stop"
|
||||
<ImageButton android:id="@+id/stop"
|
||||
android:visibility="gone"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="?attr/dashboard_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<ImageView android:id="@+id/show_on_map"
|
||||
<ImageButton android:id="@+id/show_on_map"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="?attr/dashboard_button"
|
||||
android:layout_width="@dimen/dashListItemHeight"
|
||||
android:layout_height="@dimen/dashListItemHeight"/>
|
||||
</LinearLayout>
|
||||
|
|
|
@ -60,13 +60,13 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<!--<fragment-->
|
||||
<!--xmlns:android="http://schemas.android.com/apk/res/android"-->
|
||||
<!--android:id="@+id/TracksFragment"-->
|
||||
<!--android:name="net.osmand.plus.dashboard.DashTrackFragment"-->
|
||||
<!--android:layout_marginTop="@dimen/dashCardMargin"-->
|
||||
<!--android:layout_width="match_parent"-->
|
||||
<!--android:layout_height="wrap_content"/>-->
|
||||
<fragment
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/TracksFragment"
|
||||
android:name="net.osmand.plus.monitoring.DashTrackFragment"
|
||||
android:layout_marginTop="@dimen/dashCardMargin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<!--<fragment-->
|
||||
<!--xmlns:android="http://schemas.android.com/apk/res/android"-->
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
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="currently_recording_track">Currently recording track</string>
|
||||
<string name="back_to_map">Back to map</string>
|
||||
<string name="plugin_nautical_descr1">Activating this view changes the map style to Nautical, thus showing all nautical navigation marks and chart symbols.</string>
|
||||
<string name="plugin_nautical_descr2">A map file containing all nautical symbols globally is availabe as one single download called \'World seamarks\'.</string>
|
||||
<string name="plugin_nautical_descr3">This view can be reverted by either de-activating it again here, or by changing the \'Map style\' under \'Configure map\' as desired.</string>
|
||||
|
|
|
@ -27,6 +27,7 @@ import net.osmand.plus.R;
|
|||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||
import net.osmand.plus.helpers.GpxUiHelper;
|
||||
import net.osmand.plus.helpers.ScreenOrientationHelper;
|
||||
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
||||
import net.osmand.plus.osmedit.OsmEditingPlugin;
|
||||
import net.osmand.util.Algorithms;
|
||||
import android.app.Activity;
|
||||
|
@ -39,6 +40,7 @@ import android.content.res.TypedArray;
|
|||
import android.graphics.Typeface;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
|
@ -109,6 +111,27 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
asyncLoader = new LoadGpxTask();
|
||||
asyncLoader.execute(getActivity());
|
||||
}
|
||||
OsmandMonitoringPlugin plugin = OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class);
|
||||
GpxSelectionHelper.SelectedGpxFile currentTrack = savingTrackHelper.getCurrentTrack();
|
||||
View v = getView();
|
||||
if (v == null){
|
||||
return;
|
||||
}
|
||||
if (plugin != null && savingTrackHelper.getCurrentGpx() != null) {
|
||||
|
||||
|
||||
v.findViewById(R.id.current_track).setVisibility(View.VISIBLE);
|
||||
((TextView)v.findViewById(R.id.name)).setText(R.string.currently_recording_track);
|
||||
String description = GpxUiHelper.getDescription(getMyApplication(), currentTrack.getGpxFile(), null, true);
|
||||
int startindex = description.indexOf(">");
|
||||
int endindex = description.indexOf("</font>");
|
||||
String distnace = description.substring(startindex + 1, endindex);
|
||||
((TextView)v.findViewById(R.id.distance)).setText(distnace);
|
||||
v.findViewById(R.id.time_icon).setVisibility(View.GONE);
|
||||
} else {
|
||||
v.findViewById(R.id.current_track).setVisibility(View.GONE);
|
||||
}
|
||||
//TODO implement updating view of current track
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -120,6 +143,16 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View v = inflater.inflate(R.layout.available_gpx, container, false);
|
||||
listView =(ExpandableListView) v.findViewById(android.R.id.list);
|
||||
if(this.adapter != null) {
|
||||
listView.setAdapter(this.adapter);
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
menu.clear();
|
||||
|
|
|
@ -21,8 +21,8 @@ public abstract class OsmandExpandableListFragment extends Fragment
|
|||
implements OnChildClickListener {
|
||||
|
||||
|
||||
private ExpandableListView listView;
|
||||
private ExpandableListAdapter adapter;
|
||||
protected ExpandableListView listView;
|
||||
protected ExpandableListAdapter adapter;
|
||||
|
||||
|
||||
public OsmandApplication getMyApplication() {
|
||||
|
|
|
@ -18,6 +18,7 @@ import android.view.LayoutInflater;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
@ -92,6 +93,9 @@ public class DashTrackFragment extends DashBaseFragment {
|
|||
setText(distnace);
|
||||
view.findViewById(R.id.time_icon).setVisibility(View.GONE);
|
||||
//view.findViewById(R.id.distance_icon).setVisibility(View.GONE);
|
||||
view.findViewById(R.id.stop).setVisibility(View.GONE);
|
||||
((ImageButton)view.findViewById(R.id.show_on_map)).
|
||||
setImageDrawable(getResources().getDrawable(R.drawable.ic_action_map));
|
||||
tracks.addView(view);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue