From f1ecdea03fe7c9e3f748eafc078457439da96044 Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 5 Mar 2015 15:15:23 +0200 Subject: [PATCH] Updated icons for recents --- .../src/net/osmand/data/PointDescription.java | 17 +++++++++-- .../search/SearchHistoryFragment.java | 28 +++++++++++++------ .../plus/audionotes/AudioNotesLayer.java | 7 +++-- .../audionotes/AudioVideoNotesPlugin.java | 11 ++++++++ .../DashAudioVideoNotesFragment.java | 2 +- .../osmand/plus/audionotes/NotesFragment.java | 2 +- 6 files changed, 51 insertions(+), 16 deletions(-) diff --git a/OsmAnd/src/net/osmand/data/PointDescription.java b/OsmAnd/src/net/osmand/data/PointDescription.java index f018796679..bf01a5e2fa 100644 --- a/OsmAnd/src/net/osmand/data/PointDescription.java +++ b/OsmAnd/src/net/osmand/data/PointDescription.java @@ -26,7 +26,9 @@ public class PointDescription { public static final String POINT_TYPE_ADDRESS = "address"; public static final String POINT_TYPE_OSM_NOTE= "osm_note"; public static final String POINT_TYPE_MARKER = "marker"; - public static final String POINT_TYPE_NOTE = "avnote"; + public static final String POINT_TYPE_AUDIO_NOTE = "audionote"; + public static final String POINT_TYPE_VIDEO_NOTE = "videonote"; + public static final String POINT_TYPE_PHOTO_NOTE = "photonote"; public static final String POINT_TYPE_LOCATION = "location"; public static final String POINT_TYPE_ALARM = "alarm"; public static final String POINT_TYPE_TARGET = "destination"; @@ -111,10 +113,19 @@ public class PointDescription { return POINT_TYPE_FAVORITE.equals(type); } - public boolean isAvNote() { - return POINT_TYPE_NOTE.equals(type); + public boolean isAudioNote() { + return POINT_TYPE_AUDIO_NOTE.equals(type); } + public boolean isVideoNote() { + return POINT_TYPE_VIDEO_NOTE.equals(type); + } + + public boolean isPhotoNote() { + return POINT_TYPE_PHOTO_NOTE.equals(type); + } + + @Override public int hashCode() { final int prime = 31; diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchHistoryFragment.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchHistoryFragment.java index 367c339b46..b9e26374da 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchHistoryFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchHistoryFragment.java @@ -48,7 +48,9 @@ public class SearchHistoryFragment extends ListFragment implements SearchActivit private Drawable locationIcon; private Drawable poiIcon; private Drawable wptIcon; - private Drawable noteIcon; + private Drawable audioNoteIcon; + private Drawable videoNoteIcon; + private Drawable photoNoteIcon; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { @@ -72,8 +74,10 @@ public class SearchHistoryFragment extends ListFragment implements SearchActivit favoriteIcon = getResources().getDrawable(R.drawable.ic_type_favorites); locationIcon = getResources().getDrawable(R.drawable.ic_type_coordinates); poiIcon = getResources().getDrawable(R.drawable.ic_type_info); - wptIcon = getResources().getDrawable(R.drawable.ic_action_flage_dark); - noteIcon = getResources().getDrawable(R.drawable.ic_action_note_dark); + wptIcon = getResources().getDrawable(R.drawable.ic_type_waypoint); + audioNoteIcon = getResources().getDrawable(R.drawable.ic_type_audio); + videoNoteIcon = getResources().getDrawable(R.drawable.ic_type_video); + photoNoteIcon = getResources().getDrawable(R.drawable.ic_type_img); if (getMyApplication().getSettings().isLightContent()) { addressIcon = addressIcon.mutate(); addressIcon.setColorFilter(getResources().getColor(R.color.icon_color_light), PorterDuff.Mode.MULTIPLY); @@ -85,8 +89,12 @@ public class SearchHistoryFragment extends ListFragment implements SearchActivit poiIcon.setColorFilter(getResources().getColor(R.color.icon_color_light), PorterDuff.Mode.MULTIPLY); wptIcon = wptIcon.mutate(); wptIcon.setColorFilter(getResources().getColor(R.color.icon_color_light), PorterDuff.Mode.MULTIPLY); - noteIcon = noteIcon.mutate(); - noteIcon.setColorFilter(getResources().getColor(R.color.icon_color_light), PorterDuff.Mode.MULTIPLY); + audioNoteIcon = audioNoteIcon.mutate(); + audioNoteIcon.setColorFilter(getResources().getColor(R.color.icon_color_light), PorterDuff.Mode.MULTIPLY); + videoNoteIcon = videoNoteIcon.mutate(); + videoNoteIcon.setColorFilter(getResources().getColor(R.color.icon_color_light), PorterDuff.Mode.MULTIPLY); + photoNoteIcon = photoNoteIcon.mutate(); + photoNoteIcon.setColorFilter(getResources().getColor(R.color.icon_color_light), PorterDuff.Mode.MULTIPLY); } } @@ -224,9 +232,13 @@ public class SearchHistoryFragment extends ListFragment implements SearchActivit icon.setImageDrawable(poiIcon); } else if (historyEntry.getName().isWpt()) { icon.setImageDrawable(wptIcon); - } else if (historyEntry.getName().isAvNote()) { - icon.setImageDrawable(noteIcon); - } else { + } else if (historyEntry.getName().isAudioNote()) { + icon.setImageDrawable(audioNoteIcon); + } else if (historyEntry.getName().isVideoNote()) { + icon.setImageDrawable(videoNoteIcon); + }else if (historyEntry.getName().isPhotoNote()) { + icon.setImageDrawable(photoNoteIcon); + } else { icon.setImageDrawable(addressIcon); } diff --git a/OsmAnd/src/net/osmand/plus/audionotes/AudioNotesLayer.java b/OsmAnd/src/net/osmand/plus/audionotes/AudioNotesLayer.java index d7363e2873..4e5ca7d5d0 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/AudioNotesLayer.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/AudioNotesLayer.java @@ -170,10 +170,11 @@ public class AudioNotesLayer extends OsmandMapLayer implements IContextMenuProvi @Override public PointDescription getObjectName(Object o) { if(o instanceof Recording){ - if(((Recording)o).getName(activity).isEmpty()) { - return new PointDescription(PointDescription.POINT_TYPE_NOTE, view.getResources().getString(R.string.recording_default_name)); + Recording rec = (Recording) o; + if(rec.getName(activity).isEmpty()) { + return new PointDescription(rec.getSearchHistoryType(), view.getResources().getString(R.string.recording_default_name)); } - return new PointDescription(PointDescription.POINT_TYPE_NOTE, ((Recording)o).getName(activity)); + return new PointDescription(rec.getSearchHistoryType(), ((Recording)o).getName(activity)); } return null; } diff --git a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java index c5100fb029..cda70c6078 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java @@ -21,6 +21,7 @@ import net.osmand.PlatformUtil; import net.osmand.access.AccessibleAlertBuilder; import net.osmand.access.AccessibleToast; import net.osmand.data.DataTileManager; +import net.osmand.data.PointDescription; import net.osmand.plus.ApplicationMode; import net.osmand.plus.ContextMenuAdapter; import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick; @@ -213,6 +214,16 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { return ""; } + public String getSearchHistoryType(){ + if (isPhoto()){ + return PointDescription.POINT_TYPE_PHOTO_NOTE; + } else if (isVideo()) { + return PointDescription.POINT_TYPE_VIDEO_NOTE; + } else { + return PointDescription.POINT_TYPE_PHOTO_NOTE; + } + } + public boolean isPhoto() { return file.getName().endsWith(IMG_EXTENSION); } diff --git a/OsmAnd/src/net/osmand/plus/audionotes/DashAudioVideoNotesFragment.java b/OsmAnd/src/net/osmand/plus/audionotes/DashAudioVideoNotesFragment.java index 9574ba16f2..80860f42aa 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/DashAudioVideoNotesFragment.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/DashAudioVideoNotesFragment.java @@ -115,7 +115,7 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment { @Override public void onClick(View v) { getMyApplication().getSettings().setMapLocationToShow(recording.getLatitude(), recording.getLongitude(), 15, - new PointDescription(PointDescription.POINT_TYPE_NOTE, + new PointDescription(recording.getSearchHistoryType(), recording.getName(getActivity())), true, recording); //$NON-NLS-1$ MapActivity.launchMapActivityMoveToTop(getActivity()); diff --git a/OsmAnd/src/net/osmand/plus/audionotes/NotesFragment.java b/OsmAnd/src/net/osmand/plus/audionotes/NotesFragment.java index c43b4eb127..a4e6401c92 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/NotesFragment.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/NotesFragment.java @@ -113,7 +113,7 @@ public class NotesFragment extends ListFragment { private void showOnMap(Recording recording) { getMyApplication().getSettings().setMapLocationToShow(recording.getLatitude(), recording.getLongitude(), 15, - new PointDescription(PointDescription.POINT_TYPE_NOTE, recording.getName(getActivity())), true, + new PointDescription(recording.getSearchHistoryType(), recording.getName(getActivity())), true, recording); //$NON-NLS-1$ MapActivity.launchMapActivityMoveToTop(getActivity()); }