diff --git a/OsmAnd/res/layout/available_gpx.xml b/OsmAnd/res/layout/available_gpx.xml
index d45911e47b..0bb085b1fc 100644
--- a/OsmAnd/res/layout/available_gpx.xml
+++ b/OsmAnd/res/layout/available_gpx.xml
@@ -1,24 +1,34 @@
+ android:layout_height="match_parent"
+ android:orientation="vertical">
-
+ android:layout_height="wrap_content"
+ android:background="?attr/card_bg"
+ android:orientation="vertical">
-
+
-
+
-
+
+
+
diff --git a/OsmAnd/res/layout/dash_favorites_item.xml b/OsmAnd/res/layout/dash_favorites_item.xml
index 20eacc6ec6..62c9076754 100644
--- a/OsmAnd/res/layout/dash_favorites_item.xml
+++ b/OsmAnd/res/layout/dash_favorites_item.xml
@@ -77,7 +77,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="4dp"
- android:textColor="@color/dashboard_descr_colol"
+ android:textColor="@color/icon_color_light"
android:textSize="@dimen/showAllButtonTextSize"/>
diff --git a/OsmAnd/res/layout/dash_gpx_track_item.xml b/OsmAnd/res/layout/dash_gpx_track_item.xml
index 1adc373af9..9ac98dd620 100644
--- a/OsmAnd/res/layout/dash_gpx_track_item.xml
+++ b/OsmAnd/res/layout/dash_gpx_track_item.xml
@@ -1,73 +1,103 @@
-
-
-
-
-
-
-
+ android:layout_height="wrap_content"
+ android:minHeight="@dimen/dashListItemHeight"
+ android:orientation="vertical">
-
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
diff --git a/OsmAnd/res/layout/dash_map_fragment.xml b/OsmAnd/res/layout/dash_map_fragment.xml
index a8d0e524de..4f10bd82da 100644
--- a/OsmAnd/res/layout/dash_map_fragment.xml
+++ b/OsmAnd/res/layout/dash_map_fragment.xml
@@ -22,7 +22,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="3"
- android:textColor="@color/dashboard_descr_colol"
+ android:textColor="@color/icon_color_light"
android:text="@string/loading_data"
android:textSize="@dimen/dashProgressTextSize"/>
diff --git a/OsmAnd/res/layout/favorites_list_item.xml b/OsmAnd/res/layout/favorites_list_item.xml
index 609391c1ae..69537c2b8a 100644
--- a/OsmAnd/res/layout/favorites_list_item.xml
+++ b/OsmAnd/res/layout/favorites_list_item.xml
@@ -84,7 +84,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="4dp"
- android:textColor="@color/dashboard_descr_colol"
+ android:textColor="@color/icon_color_light"
android:textSize="@dimen/showAllButtonTextSize"/>
diff --git a/OsmAnd/res/layout/note.xml b/OsmAnd/res/layout/note.xml
index c98c4fe83c..5898e02b07 100644
--- a/OsmAnd/res/layout/note.xml
+++ b/OsmAnd/res/layout/note.xml
@@ -5,72 +5,85 @@
android:layout_height="wrap_content"
android:background="?attr/expandable_list_item_background"
android:minHeight="@dimen/list_item_height"
- android:orientation="horizontal"
+ android:orientation="vertical"
android:paddingLeft="@dimen/list_content_padding">
-
-
-
+
-
-
+
+ android:layout_gravity="center_vertical"
+ android:layout_marginRight="@dimen/local_index_check_right_margin"
+ android:focusable="false"
+ android:visibility="gone"/>
-
-
+ android:layout_gravity="center_vertical"
+ android:layout_marginRight="@dimen/favorites_icon_right_margin"
+ android:focusable="false"
+ android:src="@drawable/ic_sdcard"/>
+
+
+
+
-
+
+
+
+
+
+
+
+
+
-
-
\ No newline at end of file
diff --git a/OsmAnd/res/values/colors.xml b/OsmAnd/res/values/colors.xml
index 26c1b12534..0136008297 100644
--- a/OsmAnd/res/values/colors.xml
+++ b/OsmAnd/res/values/colors.xml
@@ -20,7 +20,9 @@
#292f33
- #727272
+ #727272
+
+ #448AFF
#eaeaea
#F0F0F0
#3d474c
diff --git a/OsmAnd/src/net/osmand/plus/activities/ActionBarPreferenceActivity.java b/OsmAnd/src/net/osmand/plus/activities/ActionBarPreferenceActivity.java
index 0eb1a2eced..e9f0ca4b8a 100644
--- a/OsmAnd/src/net/osmand/plus/activities/ActionBarPreferenceActivity.java
+++ b/OsmAnd/src/net/osmand/plus/activities/ActionBarPreferenceActivity.java
@@ -48,6 +48,7 @@ public abstract class ActionBarPreferenceActivity extends PreferenceActivity {
}
tb.setClickable(true);
Drawable back = getResources().getDrawable(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
+ back.mutate();
back.setColorFilter(0xffffffff, PorterDuff.Mode.MULTIPLY);
tb.setNavigationIcon(back);
tb.setBackgroundColor(getResources().getColor(getResIdFromAttribute(this, R.attr.pstsTabBackground)));
diff --git a/OsmAnd/src/net/osmand/plus/activities/AvailableGPXFragment.java b/OsmAnd/src/net/osmand/plus/activities/AvailableGPXFragment.java
index 6323fa1279..11092c71b2 100644
--- a/OsmAnd/src/net/osmand/plus/activities/AvailableGPXFragment.java
+++ b/OsmAnd/src/net/osmand/plus/activities/AvailableGPXFragment.java
@@ -37,7 +37,9 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.TypedArray;
+import android.graphics.PorterDuff;
import android.graphics.Typeface;
+import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
@@ -111,27 +113,9 @@ 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) {
+ updateCurrentTrack(getView());
- 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("");
- 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
@@ -142,6 +126,24 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
}
}
+ private void updateCurrentTrack(View v){
+ if (v == null){
+ return;
+ }
+ OsmandMonitoringPlugin plugin = OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class);
+
+ GpxSelectionHelper.SelectedGpxFile currentTrack = savingTrackHelper.getCurrentTrack();
+ if (plugin != null && savingTrackHelper.getCurrentGpx() != null) {
+ v.findViewById(R.id.current_track).setVisibility(View.VISIBLE);
+ String description = GpxUiHelper.getDescription(getMyApplication(), currentTrack.getGpxFile(), null, true);
+ int startindex = description.indexOf(">");
+ int endindex = description.indexOf("");
+ String distance = description.substring(startindex + 1, endindex);
+ ((TextView)v.findViewById(R.id.distance)).setText(distance);
+ } else {
+ v.findViewById(R.id.current_track).setVisibility(View.GONE);
+ }
+ }
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
@@ -150,6 +152,29 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
if(this.adapter != null) {
listView.setAdapter(this.adapter);
}
+
+ ((TextView)v.findViewById(R.id.name)).setText(R.string.currently_recording_track);
+ v.findViewById(R.id.time_icon).setVisibility(View.GONE);
+
+ Drawable icon = getResources().getDrawable(R.drawable.ic_action_rec_stop);
+ icon.mutate();
+ boolean light = getMyApplication().getSettings().isLightContent();
+ if (light){
+ icon.setColorFilter(0xff727272, PorterDuff.Mode.MULTIPLY);
+ }
+ ImageButton stop = ((ImageButton)v.findViewById(R.id.stop));
+ stop.setImageDrawable(icon);
+ stop.setVisibility(View.VISIBLE);
+
+ icon = getResources().getDrawable(R.drawable.ic_action_gsave_dark);
+ icon.mutate();
+ if (light) {
+ icon.setColorFilter(0xff727272, PorterDuff.Mode.MULTIPLY);
+ }
+ ImageButton save = ((ImageButton)v.findViewById(R.id.show_on_map));
+ v.findViewById(R.id.divider).setVisibility(View.GONE);
+ save.setImageDrawable(icon);
+ updateCurrentTrack(v);
return v;
}
@@ -225,7 +250,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
}
};
optionsMenuAdapter.item(R.string.show_gpx_route)
- .icons(R.drawable.ic_action_map_marker_dark, R.drawable.ic_action_map_marker_dark).listen(listener).reg();
+ .icons(R.drawable.ic_show_on_map, R.drawable.ic_show_on_map).listen(listener).reg();
optionsMenuAdapter.item(R.string.local_index_mi_delete)
.icons(R.drawable.ic_action_delete_dark, R.drawable.ic_action_delete_dark).listen(listener).reg();
optionsMenuAdapter.item(R.string.local_index_mi_reload)
@@ -532,26 +557,6 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
}
}
- private void showContextMenu(final GpxInfo info) {
- Builder builder = new AlertDialog.Builder(getActivity());
- final ContextMenuAdapter adapter = new ContextMenuAdapter(getActivity());
- basicFileOperation(info, adapter);
-
- String[] values = adapter.getItemNames();
- builder.setItems(values, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- OnContextMenuClick clk = adapter.getClickAdapter(which);
- if (clk != null) {
- clk.onContextMenuClick(null, adapter.getElementId(which), which, false);
- }
- }
-
- });
- builder.show();
- }
-
-
public class LoadGpxTask extends AsyncTask> {
private List result;
@@ -915,8 +920,13 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
boolean light = getMyApplication().getSettings().isLightContent();
final PopupMenu optionsMenu = new PopupMenu(getActivity(), v);
DirectionsDialogs.setupPopUpMenuIcon(optionsMenu);
+ Drawable showIcon = getResources().getDrawable(R.drawable.ic_show_on_map);
+ if (light) {
+ showIcon.mutate();
+ showIcon.setColorFilter(getResources().getColor(R.color.icon_color_light), PorterDuff.Mode.MULTIPLY);
+ }
MenuItem item = optionsMenu.getMenu().add(R.string.show_gpx_route)
- .setIcon(light ? R.drawable.ic_action_map_marker_light : R.drawable.ic_action_map_marker_dark);
+ .setIcon(showIcon);
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
diff --git a/OsmAnd/src/net/osmand/plus/activities/FavoritesActivity.java b/OsmAnd/src/net/osmand/plus/activities/FavoritesActivity.java
index db2fe17f19..837d5169d4 100644
--- a/OsmAnd/src/net/osmand/plus/activities/FavoritesActivity.java
+++ b/OsmAnd/src/net/osmand/plus/activities/FavoritesActivity.java
@@ -38,10 +38,12 @@ public class FavoritesActivity extends TabActivity {
// private static final String FAVOURITES_INFO = "FAVOURITES_INFO";
private static final String TRACKS = "TRACKS";
// private static final String SELECTED_TRACK = "SELECTED_TRACK";
-// public static int FAVORITES_TAB = 0;
-// public static int GPX_TAB = 1;
-// public static int SELECTED_GPX_TAB = 2;
-// public static String TAB_PARAM = "TAB_PARAM";
+ public static int FAVORITES_TAB = 0;
+ public static int GPX_TAB = 1;
+ public static int SELECTED_GPX_TAB = 2;
+ public static int NOTES_TAB = 3;
+ public static int OSM_EDITS_TAB = 4;
+ public static String TAB_PARAM = "TAB_PARAM";
protected List> fragList = new ArrayList>();
@Override
@@ -78,10 +80,18 @@ public class FavoritesActivity extends TabActivity {
OsmandPlugin.addMyPlacesTabPlugins(this, mTabs, getIntent());
Integer tab = settings.FAVORITES_TAB.get();
+ if (tab == NOTES_TAB) {
+ tab = mTabs.size() -1;
+ } else if (tab == OSM_EDITS_TAB) {
+ //TODO implement method of counting position for other plugins
+ }
setViewPagerAdapter(mViewPager, mTabs);
mSlidingTabLayout.setViewPager(mViewPager);
+ if (tab > mTabs.size() - 1){
+ tab = 0;
+ }
mViewPager.setCurrentItem(tab);
updateSelectedTracks();
// setupHomeButton();
diff --git a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java
index ce6f940b60..d2d1abaf01 100644
--- a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java
+++ b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java
@@ -947,7 +947,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
if (getAllRecordings().size() > 0) {
mTabs.add(favoritesActivity.getTabIndicator(R.string.notes, NotesFragment.class));
if (intent != null && "AUDIO".equals(intent.getStringExtra("TAB"))) {
- app.getSettings().FAVORITES_TAB.set(mTabs.size() - 1);
+ app.getSettings().FAVORITES_TAB.set(FavoritesActivity.NOTES_TAB);
}
}
}
diff --git a/OsmAnd/src/net/osmand/plus/audionotes/DashAudioVideoNotesFragment.java b/OsmAnd/src/net/osmand/plus/audionotes/DashAudioVideoNotesFragment.java
index 109d42cdee..47f1381a27 100644
--- a/OsmAnd/src/net/osmand/plus/audionotes/DashAudioVideoNotesFragment.java
+++ b/OsmAnd/src/net/osmand/plus/audionotes/DashAudioVideoNotesFragment.java
@@ -49,6 +49,7 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
final Intent favorites = new Intent(activity, fa);
favorites.putExtra("TAB", "AUDIO");
favorites.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
+ getMyApplication().getSettings().FAVORITES_TAB.set(FavoritesActivity.NOTES_TAB);
activity.startActivity(favorites);
}
});
@@ -104,6 +105,7 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
}
});
view.findViewById(R.id.options).setVisibility(View.GONE);
+ view.findViewById(R.id.divider).setVisibility(View.VISIBLE);
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashFavoritesFragment.java b/OsmAnd/src/net/osmand/plus/dashboard/DashFavoritesFragment.java
index 63dde7ac8b..557821611b 100644
--- a/OsmAnd/src/net/osmand/plus/dashboard/DashFavoritesFragment.java
+++ b/OsmAnd/src/net/osmand/plus/dashboard/DashFavoritesFragment.java
@@ -13,6 +13,7 @@ import net.osmand.plus.FavouritesDbHelper;
import net.osmand.plus.OsmAndAppCustomization;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.R;
+import net.osmand.plus.activities.FavoritesActivity;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.FavoriteImageDrawable;
import net.osmand.plus.dialogs.DirectionsDialogs;
@@ -56,6 +57,7 @@ public class DashFavoritesFragment extends DashLocationFragment implements Favou
OsmAndAppCustomization appCustomization = getMyApplication().getAppCustomization();
final Intent favorites = new Intent(activity, appCustomization.getFavoritesActivity());
favorites.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
+ getMyApplication().getSettings().FAVORITES_TAB.set(FavoritesActivity.FAVORITES_TAB);
activity.startActivity(favorites);
}
});
diff --git a/OsmAnd/src/net/osmand/plus/monitoring/DashTrackFragment.java b/OsmAnd/src/net/osmand/plus/monitoring/DashTrackFragment.java
index d29388e34b..223e00f192 100644
--- a/OsmAnd/src/net/osmand/plus/monitoring/DashTrackFragment.java
+++ b/OsmAnd/src/net/osmand/plus/monitoring/DashTrackFragment.java
@@ -4,15 +4,23 @@ import java.io.File;
import java.util.List;
import net.osmand.IndexConstants;
+import net.osmand.access.AccessibleToast;
import net.osmand.plus.GPXUtilities;
+import net.osmand.plus.GpxSelectionHelper;
import net.osmand.plus.OsmAndAppCustomization;
+import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
+import net.osmand.plus.activities.FavoritesActivity;
+import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.dashboard.DashBaseFragment;
import net.osmand.plus.helpers.FontCache;
import net.osmand.plus.helpers.GpxUiHelper;
+
import android.app.Activity;
import android.content.Intent;
+import android.graphics.PorterDuff;
import android.graphics.Typeface;
+import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
@@ -21,6 +29,7 @@ import android.widget.Button;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.TextView;
+import android.widget.Toast;
/**
* Created by Denis
@@ -43,6 +52,7 @@ public class DashTrackFragment extends DashBaseFragment {
Activity activity = getActivity();
OsmAndAppCustomization appCustomization = getMyApplication().getAppCustomization();
final Intent favorites = new Intent(activity, appCustomization.getFavoritesActivity());
+ getMyApplication().getSettings().FAVORITES_TAB.set(FavoritesActivity.GPX_TAB);
favorites.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
activity.startActivity(favorites);
}
@@ -62,7 +72,7 @@ public class DashTrackFragment extends DashBaseFragment {
final List list = GpxUiHelper.getSortedGPXFilenames(dir);
- if (list.size() == 0){
+ if (list.size() == 0) {
(mainView.findViewById(R.id.main_fav)).setVisibility(View.GONE);
return;
} else {
@@ -71,32 +81,69 @@ public class DashTrackFragment extends DashBaseFragment {
LinearLayout tracks = (LinearLayout) mainView.findViewById(R.id.items);
tracks.removeAllViews();
- if (list.size() > 3){
- while (list.size() != 3){
+ if (list.size() > 3) {
+ while (list.size() != 3) {
list.remove(3);
}
}
- for (String filename : list){
+ for (String filename : list) {
final File f = new File(dir, filename);
- GPXUtilities.GPXFile res = GPXUtilities.loadGPXFile(getMyApplication(), f);
+ final GPXUtilities.GPXFile res = GPXUtilities.loadGPXFile(getMyApplication(), f);
LayoutInflater inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.dash_gpx_track_item, null, false);
- ((TextView)view.findViewById(R.id.name)).setText(filename);
- ((TextView)view.findViewById(R.id.points_count)).
+ ((TextView) view.findViewById(R.id.name)).setText(filename);
+ ((TextView) view.findViewById(R.id.points_count)).
setText(res.points.size() + " " + getActivity().getString(R.string.points));
String description = GpxUiHelper.getDescription(getMyApplication(), res, f, true);
int startindex = description.indexOf(">");
int endindex = description.indexOf("");
String distnace = description.substring(startindex + 1, endindex);
- ((TextView)view.findViewById(R.id.distance)).
+ ((TextView) view.findViewById(R.id.distance)).
setText(distnace);
view.findViewById(R.id.time_icon).setVisibility(View.GONE);
+
+ boolean light = getMyApplication().getSettings().isLightContent();
+ Drawable icon = getResources().getDrawable(R.drawable.ic_show_on_map);
+ GpxSelectionHelper gpxSelectionHelper = getMyApplication().getSelectedGpxHelper();
+ boolean isShowingOnMap = gpxSelectionHelper.getSelectedFileByName(filename) != null;
+ //setting proper icon color
+ if (isShowingOnMap) {
+ icon.mutate();
+ if (light) {
+ icon.setColorFilter(getResources().getColor(R.color.dashboard_gpx_on_map), PorterDuff.Mode.MULTIPLY);
+ } else {
+ icon.setColorFilter(getResources().getColor(R.color.color_distance), PorterDuff.Mode.MULTIPLY);
+ }
+ } else if (light) {
+ icon.mutate();
+ icon.setColorFilter(getResources().getColor(R.color.icon_color_light), PorterDuff.Mode.MULTIPLY);
+
+ }
+ final ImageButton showOnMap = (ImageButton) view.findViewById(R.id.show_on_map);
+ showOnMap.setImageDrawable(icon);
+ showOnMap.setVisibility(View.VISIBLE);
//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));
+ view.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ showOnMap(res);
+ }
+ });
tracks.addView(view);
}
}
+
+ private void showOnMap(GPXUtilities.GPXFile file){
+ if (file.isEmpty()) {
+ AccessibleToast.makeText(getActivity(), R.string.gpx_file_is_empty, Toast.LENGTH_LONG).show();
+ return;
+ }
+
+ OsmandSettings settings = getMyApplication().getSettings();
+ settings.setMapLocationToShow(file.getLastPoint().lat, file.getLastPoint().lon, settings.getLastKnownMapZoom());
+ getMyApplication().getSelectedGpxHelper().setGpxFileToDisplay(file);
+ MapActivity.launchMapActivityMoveToTop(getActivity());
+ }
}