This commit is contained in:
Bars107 2015-02-24 11:37:48 +02:00
commit c684b01f2b
15 changed files with 185 additions and 53 deletions

View 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>

View file

@ -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>

View file

@ -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"-->

View file

@ -15,8 +15,7 @@
android:focusable="false"
android:visibility="gone"
android:layout_marginRight="@dimen/local_index_check_right_margin"
android:layout_marginTop="@dimen/favorites_icon_top_margin"
/>
android:layout_marginTop="@dimen/favorites_icon_top_margin"/>
<ImageView
android:id="@+id/icon"

View file

@ -7,31 +7,67 @@
android:orientation="horizontal"
android:paddingBottom="5dp"
android:paddingLeft="@dimen/list_content_padding"
android:paddingRight="@dimen/list_content_padding"
android:paddingTop="5dp">
<TextView
android:id="@+id/label"
style="@style/ListText"
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/favorites_icon_right_margin"
android:layout_marginTop="@dimen/favorites_icon_top_margin"
android:focusable="false"
android:src="@drawable/ic_sdcard"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginRight="3dp"
android:layout_weight="1"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:textColorPrimary"
tools:text="@string/lorem_ipsum"/>
android:orientation="vertical">
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/dashFavNameTextSize"
tools:text="@string/lorem_ipsum"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/direction"
android:layout_width="@dimen/dashFavDirectionSize"
android:layout_height="@dimen/dashFavDirectionSize"
android:layout_gravity="center_vertical"/>
<TextView
android:id="@+id/distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/showAllButtonTextSize"
tools:text="100500 km"/>
</LinearLayout>
</LinearLayout>
<ImageButton
android:id="@+id/remove"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/options"
android:layout_width="@dimen/list_item_height"
android:layout_height="@dimen/list_item_height"
android:layout_gravity="center_vertical"
android:background="?attr/reset_image"
android:contentDescription="@string/default_buttons_delete"
android:paddingLeft="2dp"
android:paddingRight="2dp"
android:paddingTop="2dp"/>
android:background="?attr/options_button_background"
android:focusable="false"
android:src="?attr/list_settings_icon"/>
</LinearLayout>

View file

@ -10,6 +10,8 @@
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="days_behind">days behind</string>
<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>

View file

@ -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();

View file

@ -21,7 +21,6 @@ import net.osmand.plus.activities.search.SearchActivity;
import net.osmand.plus.activities.search.SearchActivity.SearchActivityChild;
import net.osmand.plus.base.FavoriteImageDrawable;
import net.osmand.plus.dialogs.DirectionsDialogs;
import net.osmand.util.Algorithms;
import net.osmand.util.MapUtils;
import android.app.Activity;
import android.content.Intent;
@ -156,7 +155,7 @@ public class FavoritesListFragment extends ListFragment implements SearchActivit
}
public FavouritesAdapter(Activity activity, List<FavouritePoint> list) {
super(activity, R.layout.favourites_list_item, list);
super(activity, R.layout.favorites_list_item, list);
this.activity = activity;
this.app = ((OsmandApplication) activity.getApplication());
boolean light = app.getSettings().isLightContent();
@ -178,7 +177,7 @@ public class FavoritesListFragment extends ListFragment implements SearchActivit
View row = convertView;
if (row == null) {
LayoutInflater inflater = activity.getLayoutInflater();
row = inflater.inflate(R.layout.favourites_list_item, parent, false);
row = inflater.inflate(R.layout.favorites_list_item, parent, false);
}
TextView name = (TextView) row.findViewById(R.id.favourite_label);

View file

@ -204,7 +204,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
private boolean editPoint(final FavouritePoint point) {
Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle(R.string.favourites_context_menu_edit);
final View v = getActivity().getLayoutInflater().inflate(R.layout.favourite_edit_dialog,
final View v = getActivity().getLayoutInflater().inflate(R.layout.favorite_edit_dialog,
getExpandableListView(), false);
final AutoCompleteTextView cat = (AutoCompleteTextView) v.findViewById(R.id.Category);
final EditText editText = (EditText) v.findViewById(R.id.Name);
@ -762,7 +762,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
View row = convertView;
if (row == null) {
LayoutInflater inflater = getActivity().getLayoutInflater();
row = inflater.inflate(R.layout.favourites_list_item, parent, false);
row = inflater.inflate(R.layout.favorites_list_item, parent, false);
}
TextView name = (TextView) row.findViewById(R.id.favourite_label);

View file

@ -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() {

View file

@ -10,11 +10,19 @@ import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.search.SearchActivity.SearchActivityChild;
import net.osmand.plus.audionotes.AudioVideoNotesPlugin;
import net.osmand.plus.dialogs.DirectionsDialogs;
import net.osmand.plus.helpers.SearchHistoryHelper;
import net.osmand.plus.helpers.SearchHistoryHelper.HistoryEntry;
import net.osmand.util.MapUtils;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.media.Image;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.ListFragment;
@ -24,11 +32,13 @@ import android.text.style.ForegroundColorSpan;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.TextView.BufferType;
@ -95,7 +105,9 @@ public class SearchHistoryFragment extends ListFragment implements SearchActivit
location = ((OsmandApplication) activity.getApplication()).getSettings().getLastKnownMapLocation();
}
historyAdapter.clear();
historyAdapter.addAll(helper.getHistoryEntries());
for(HistoryEntry entry : helper.getHistoryEntries()){
historyAdapter.add(entry);
}
locationUpdate(location);
clearButton.setVisibility(historyAdapter.isEmpty() ? View.GONE : View.VISIBLE);
@ -127,6 +139,7 @@ public class SearchHistoryFragment extends ListFragment implements SearchActivit
class HistoryAdapter extends ArrayAdapter<HistoryEntry> {
private LatLon location;
Drawable arrowImage;
public void updateLocation(LatLon l) {
location = l;
@ -135,6 +148,14 @@ public class SearchHistoryFragment extends ListFragment implements SearchActivit
public HistoryAdapter(List<HistoryEntry> list) {
super(getActivity(), R.layout.search_history_list_item, list);
arrowImage = getResources().getDrawable(R.drawable.ic_destination_arrow_white);
arrowImage.mutate();
boolean light = getMyApplication().getSettings().isLightContent();
if (light) {
arrowImage.setColorFilter(getResources().getColor(R.color.color_distance), PorterDuff.Mode.MULTIPLY);
} else {
arrowImage.setColorFilter(getResources().getColor(R.color.color_distance), PorterDuff.Mode.MULTIPLY);
}
}
@Override
@ -144,33 +165,28 @@ public class SearchHistoryFragment extends ListFragment implements SearchActivit
LayoutInflater inflater = getActivity().getLayoutInflater();
row = inflater.inflate(R.layout.search_history_list_item, parent, false);
}
TextView label = (TextView) row.findViewById(R.id.label);
TextView nameText = (TextView) row.findViewById(R.id.name);
TextView distanceText = (TextView) row.findViewById(R.id.distance);
String distance = "";
ImageButton icon = (ImageButton) row.findViewById(R.id.remove);
ImageView arrow = (ImageView) row.findViewById(R.id.direction);
arrow.setImageDrawable(arrowImage);
ImageButton options = (ImageButton) row.findViewById(R.id.options);
final HistoryEntry model = getItem(position);
if (location != null) {
int dist = (int) (MapUtils.getDistance(location, model.getLat(), model.getLon()));
distance = OsmAndFormatter.getFormattedDistance(dist, (OsmandApplication) getActivity().getApplication()) + " ";
}
String rnk = MessageFormat.format(" {0,number,#.##E00} ", ((float)model.getRank(System.currentTimeMillis())));
label.setText(distance + rnk + model.getName().getName(), BufferType.SPANNABLE);
((Spannable) label.getText()).setSpan(new ForegroundColorSpan(getResources().getColor(R.color.color_distance)), 0, distance.length(), 0);
icon.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
helper.remove(model);
historyAdapter.remove(model);
}
distanceText.setText(distance);
nameText.setText(model.getName().getName(), BufferType.SPANNABLE);
});
View.OnClickListener clickListener = new View.OnClickListener() {
options.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
selectModel(model, v);
}
};
label.setOnClickListener(clickListener);
});
return row;
}
}
@ -181,4 +197,8 @@ public class SearchHistoryFragment extends ListFragment implements SearchActivit
((SearchActivity) getActivity()).getClearToolbar(false);
}
}
public OsmandApplication getMyApplication() {
return (OsmandApplication) getActivity().getApplication();
}
}

View file

@ -175,7 +175,7 @@ public class FavoriteDialogs {
public static Dialog createAddFavouriteDialog(final Activity activity, final Bundle args) {
Builder builder = new AlertDialog.Builder(activity);
builder.setTitle(R.string.favourites_context_menu_edit);
final View v = activity.getLayoutInflater().inflate(R.layout.favourite_edit_dialog, null, false);
final View v = activity.getLayoutInflater().inflate(R.layout.favorite_edit_dialog, null, false);
final FavouritesDbHelper helper = ((OsmandApplication) activity.getApplication()).getFavorites();
builder.setView(v);
final EditText editText = (EditText) v.findViewById(R.id.Name);

View file

@ -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);
}
}