From 285fcf0e599bb3c33699eaa923a400651b684dad Mon Sep 17 00:00:00 2001 From: Denis Date: Wed, 4 Mar 2015 14:17:19 +0200 Subject: [PATCH 1/2] Updated plugins incons and updated back performance on map --- OsmAnd/res/values/sizes.xml | 2 +- .../src/net/osmand/plus/activities/AvailableGPXFragment.java | 2 +- OsmAnd/src/net/osmand/plus/activities/MapActivity.java | 3 +-- OsmAnd/src/net/osmand/plus/activities/PluginActivity.java | 3 ++- .../src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java | 3 ++- .../net/osmand/plus/development/OsmandDevelopmentPlugin.java | 2 +- .../net/osmand/plus/openseamapsplugin/NauticalMapsPlugin.java | 2 +- 7 files changed, 9 insertions(+), 8 deletions(-) diff --git a/OsmAnd/res/values/sizes.xml b/OsmAnd/res/values/sizes.xml index 52fd9d6ad8..2a75a1805b 100644 --- a/OsmAnd/res/values/sizes.xml +++ b/OsmAnd/res/values/sizes.xml @@ -45,7 +45,7 @@ 6dp 360dp 200dp - 80dp + 90dp 14sp diff --git a/OsmAnd/src/net/osmand/plus/activities/AvailableGPXFragment.java b/OsmAnd/src/net/osmand/plus/activities/AvailableGPXFragment.java index 0bf10c11f2..b50a0c9541 100644 --- a/OsmAnd/src/net/osmand/plus/activities/AvailableGPXFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/AvailableGPXFragment.java @@ -140,7 +140,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment { asyncLoader.execute(getActivity()); } else { allGpxAdapter.refreshSelected(); - allGpxAdapter.notifyDataSetChanged();; + allGpxAdapter.notifyDataSetChanged(); } updateCurrentTrack(getView(), getActivity(), app); diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index e272b9095f..6f5b8e7131 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -317,8 +317,7 @@ public class MapActivity extends AccessibleActivity { public void onBackPressed() { if (dashboardOnMap.isVisible()){ dashboardOnMap.setDashboardVisibility(false); - } - if (!mapActions.onBackPressed()) { + } else if (!mapActions.onBackPressed()) { super.onBackPressed(); } } diff --git a/OsmAnd/src/net/osmand/plus/activities/PluginActivity.java b/OsmAnd/src/net/osmand/plus/activities/PluginActivity.java index e8786813ce..2c3dd85c6e 100644 --- a/OsmAnd/src/net/osmand/plus/activities/PluginActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/PluginActivity.java @@ -17,7 +17,8 @@ import android.widget.ImageView; import android.widget.TextView; /** - * Created by Alexey Pelykh on 02.02.2015. + * Created by Alexey Pelykh + * on 02.02.2015. */ public class PluginActivity extends OsmandActionBarActivity { private static final String TAG = "PluginActivity"; diff --git a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java index 0353ed2794..3e17d92ba6 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java @@ -1245,7 +1245,8 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { @Override public int getLogoResourceId() { - return R.drawable.ic_type_video; + // TODO + return super.getLogoResourceId(); } @Override diff --git a/OsmAnd/src/net/osmand/plus/development/OsmandDevelopmentPlugin.java b/OsmAnd/src/net/osmand/plus/development/OsmandDevelopmentPlugin.java index ef0a0bf67f..211783c83a 100644 --- a/OsmAnd/src/net/osmand/plus/development/OsmandDevelopmentPlugin.java +++ b/OsmAnd/src/net/osmand/plus/development/OsmandDevelopmentPlugin.java @@ -79,7 +79,7 @@ public class OsmandDevelopmentPlugin extends OsmandPlugin { @Override public int getLogoResourceId() { // TODO - return super.getLogoResourceId(); + return R.drawable.ic_plugin_developer; } @Override diff --git a/OsmAnd/src/net/osmand/plus/openseamapsplugin/NauticalMapsPlugin.java b/OsmAnd/src/net/osmand/plus/openseamapsplugin/NauticalMapsPlugin.java index 88cc559223..5ef10698b4 100644 --- a/OsmAnd/src/net/osmand/plus/openseamapsplugin/NauticalMapsPlugin.java +++ b/OsmAnd/src/net/osmand/plus/openseamapsplugin/NauticalMapsPlugin.java @@ -28,7 +28,7 @@ public class NauticalMapsPlugin extends OsmandPlugin { @Override public int getLogoResourceId() { // TODO - return super.getLogoResourceId(); + return R.drawable.ic_plugin_nautical_map; } @Override From 293713de58808af06931074a552f0e7a294d8f8b Mon Sep 17 00:00:00 2001 From: Denis Date: Wed, 4 Mar 2015 18:03:20 +0200 Subject: [PATCH 2/2] Updated selected tracks view. --- OsmAnd/AndroidManifest.xml | 2 +- OsmAnd/res/values/strings.xml | 3 +- .../osmand/plus/OsmAndAppCustomization.java | 2 +- OsmAnd/src/net/osmand/plus/OsmandPlugin.java | 4 +- .../activities/FavoritesTreeFragment.java | 1 + .../osmand/plus/activities/TrackActivity.java | 7 +- .../search/SearchHistoryFragment.java | 8 +- .../audionotes/AudioVideoNotesPlugin.java | 2 +- .../DashAudioVideoNotesFragment.java | 4 +- .../osmand/plus/audionotes/NotesFragment.java | 4 +- .../plus/dashboard/DashFavoritesFragment.java | 2 +- .../plus/monitoring/DashTrackFragment.java | 9 +- .../AvailableGPXFragment.java | 10 +- .../FavoritesActivity.java | 8 +- .../SelectedGPXFragment.java | 264 +++--------------- .../plus/myplaces/TrackPointFragment.java | 31 ++ .../plus/myplaces/TrackSegmentFragment.java | 32 +++ .../osmand/plus/osmedit/OsmEditingPlugin.java | 4 +- .../plus/osmedit/UploadGPXFilesTask.java | 2 +- .../plus/sherpafy/SherpafyCustomization.java | 2 +- 20 files changed, 140 insertions(+), 261 deletions(-) rename OsmAnd/src/net/osmand/plus/{activities => myplaces}/AvailableGPXFragment.java (99%) rename OsmAnd/src/net/osmand/plus/{activities => myplaces}/FavoritesActivity.java (96%) rename OsmAnd/src/net/osmand/plus/{activities => myplaces}/SelectedGPXFragment.java (67%) create mode 100644 OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java create mode 100644 OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java diff --git a/OsmAnd/AndroidManifest.xml b/OsmAnd/AndroidManifest.xml index 982b04fd3b..9aaade9e4b 100644 --- a/OsmAnd/AndroidManifest.xml +++ b/OsmAnd/AndroidManifest.xml @@ -140,7 +140,7 @@ - + diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 52ee6d456a..3a987add45 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -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 --> - + Track segments + Track points Online maps With this plugin you can access many types of online (so called tile or raster) maps, from predefined Openstreetmap tiles (like Mapnik) to satellite images and special purpose layers like weather maps, climate maps, geological maps, hillshade layers, etc. \n\nAny of these maps can either be used as the main (base) map to be displayed on the OsmAnd map screen, or as an overlay or underlay to another base map (like OsmAnd\'s regular offline maps). In order to make any underlay map more visible, certain elements of the OsmAnd vector maps can easily be hidden via the \'Configue map\' menu as desired. diff --git a/OsmAnd/src/net/osmand/plus/OsmAndAppCustomization.java b/OsmAnd/src/net/osmand/plus/OsmAndAppCustomization.java index 5be454bb2f..b96c5e4845 100644 --- a/OsmAnd/src/net/osmand/plus/OsmAndAppCustomization.java +++ b/OsmAnd/src/net/osmand/plus/OsmAndAppCustomization.java @@ -9,7 +9,7 @@ import net.osmand.IProgress; import net.osmand.IndexConstants; import net.osmand.Location; import net.osmand.data.LocationPoint; -import net.osmand.plus.activities.FavoritesActivity; +import net.osmand.plus.myplaces.FavoritesActivity; import net.osmand.plus.activities.MainMenuActivity; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.PluginsActivity; diff --git a/OsmAnd/src/net/osmand/plus/OsmandPlugin.java b/OsmAnd/src/net/osmand/plus/OsmandPlugin.java index 23ee5ce677..ceb31bd69e 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandPlugin.java +++ b/OsmAnd/src/net/osmand/plus/OsmandPlugin.java @@ -9,7 +9,7 @@ import net.osmand.IProgress; import net.osmand.Location; import net.osmand.PlatformUtil; import net.osmand.access.AccessibilityPlugin; -import net.osmand.plus.activities.FavoritesActivity; +import net.osmand.plus.myplaces.FavoritesActivity; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.SettingsActivity; import net.osmand.plus.activities.TabActivity.TabItem; @@ -22,10 +22,8 @@ import net.osmand.plus.osmedit.OsmEditingPlugin; import net.osmand.plus.osmo.OsMoPlugin; import net.osmand.plus.parkingpoint.ParkingPositionPlugin; import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin; -import net.osmand.plus.routepointsnavigation.RoutePointsPlugin; import net.osmand.plus.skimapsplugin.SkiMapsPlugin; import net.osmand.plus.srtmplugin.SRTMPlugin; -import net.osmand.plus.touringview.TouringViewPlugin; import net.osmand.plus.views.OsmandMapTileView; import org.apache.commons.logging.Log; diff --git a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java index 8ae30aa718..8543d8d20d 100644 --- a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java @@ -38,6 +38,7 @@ import net.osmand.plus.base.FavoriteImageDrawable; import net.osmand.plus.dialogs.DirectionsDialogs; import net.osmand.plus.helpers.ColorDialogs; import net.osmand.plus.helpers.ScreenOrientationHelper; +import net.osmand.plus.myplaces.FavoritesActivity; import net.osmand.util.MapUtils; import android.app.Activity; import android.app.AlertDialog; diff --git a/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java b/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java index 271d7526b0..7b6b6e9db4 100644 --- a/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java @@ -12,6 +12,9 @@ import net.osmand.plus.GPXUtilities; import net.osmand.plus.GPXUtilities.GPXFile; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; +import net.osmand.plus.myplaces.SelectedGPXFragment; +import net.osmand.plus.myplaces.TrackPointFragment; +import net.osmand.plus.myplaces.TrackSegmentFragment; import net.osmand.plus.views.controls.PagerSlidingTabStrip; import android.content.Intent; import android.os.AsyncTask; @@ -74,7 +77,9 @@ public class TrackActivity extends TabActivity { // items.add(getTabIndicator(R.string.selected_track, SelectedGPXFragment.class)); setResult(result); ((OsmandFragmentPagerAdapter) mViewPager.getAdapter()).addTab( - getTabIndicator(R.string.selected_track, SelectedGPXFragment.class)); + getTabIndicator(R.string.track_segments, TrackSegmentFragment.class)); + ((OsmandFragmentPagerAdapter) mViewPager.getAdapter()).addTab( + getTabIndicator(R.string.track_points, TrackPointFragment.class)); // setViewPagerAdapter(mViewPager, items ); }; }.execute((Void)null); diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchHistoryFragment.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchHistoryFragment.java index 90aff58d49..367c339b46 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchHistoryFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchHistoryFragment.java @@ -68,10 +68,10 @@ public class SearchHistoryFragment extends ListFragment implements SearchActivit } private void loadIcons() { - addressIcon = getResources().getDrawable(R.drawable.ic_type_coordinates); - favoriteIcon = getResources().getDrawable(R.drawable.ic_action_fav_dark); - locationIcon = getResources().getDrawable(R.drawable.ic_action_marker_dark); - poiIcon = getResources().getDrawable(R.drawable.ic_action_gabout_dark); + addressIcon = getResources().getDrawable(R.drawable.ic_type_address); + 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); if (getMyApplication().getSettings().isLightContent()) { diff --git a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java index 3e17d92ba6..c5100fb029 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java @@ -30,7 +30,7 @@ import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings.CommonPreference; import net.osmand.plus.OsmandSettings.OsmandPreference; import net.osmand.plus.R; -import net.osmand.plus.activities.FavoritesActivity; +import net.osmand.plus.myplaces.FavoritesActivity; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.SavingTrackHelper; import net.osmand.plus.activities.TabActivity.TabItem; diff --git a/OsmAnd/src/net/osmand/plus/audionotes/DashAudioVideoNotesFragment.java b/OsmAnd/src/net/osmand/plus/audionotes/DashAudioVideoNotesFragment.java index f23902f4e2..9574ba16f2 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/DashAudioVideoNotesFragment.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/DashAudioVideoNotesFragment.java @@ -6,11 +6,11 @@ import java.util.List; import net.osmand.data.PointDescription; import net.osmand.plus.OsmandPlugin; import net.osmand.plus.R; -import net.osmand.plus.activities.FavoritesActivity; +import net.osmand.plus.myplaces.FavoritesActivity; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.dashboard.DashBaseFragment; import net.osmand.plus.helpers.FontCache; -import net.osmand.util.Algorithms; + import android.app.Activity; import android.content.Context; import android.content.Intent; diff --git a/OsmAnd/src/net/osmand/plus/audionotes/NotesFragment.java b/OsmAnd/src/net/osmand/plus/audionotes/NotesFragment.java index 27a4cf7d0d..c43b4eb127 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/NotesFragment.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/NotesFragment.java @@ -19,15 +19,13 @@ import android.view.ViewGroup; import android.view.inputmethod.InputMethodManager; import android.widget.ArrayAdapter; import android.widget.EditText; -import android.widget.ExpandableListView; import android.widget.ImageButton; -import android.widget.ImageView; import android.widget.TextView; import net.osmand.data.PointDescription; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandPlugin; import net.osmand.plus.R; -import net.osmand.plus.activities.FavoritesActivity; +import net.osmand.plus.myplaces.FavoritesActivity; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording; import net.osmand.plus.dialogs.DirectionsDialogs; diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashFavoritesFragment.java b/OsmAnd/src/net/osmand/plus/dashboard/DashFavoritesFragment.java index 557821611b..4b3e06a876 100644 --- a/OsmAnd/src/net/osmand/plus/dashboard/DashFavoritesFragment.java +++ b/OsmAnd/src/net/osmand/plus/dashboard/DashFavoritesFragment.java @@ -13,7 +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.myplaces.FavoritesActivity; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.base.FavoriteImageDrawable; import net.osmand.plus.dialogs.DirectionsDialogs; diff --git a/OsmAnd/src/net/osmand/plus/monitoring/DashTrackFragment.java b/OsmAnd/src/net/osmand/plus/monitoring/DashTrackFragment.java index 618f9c5f7f..cda84e13a2 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/DashTrackFragment.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/DashTrackFragment.java @@ -2,24 +2,20 @@ package net.osmand.plus.monitoring; import java.io.File; import java.util.ArrayList; -import java.util.Date; import java.util.List; import net.osmand.IndexConstants; import net.osmand.access.AccessibleToast; import net.osmand.plus.GPXUtilities; import net.osmand.plus.GPXUtilities.GPXFile; -import net.osmand.plus.GpxSelectionHelper; import net.osmand.plus.OsmAndAppCustomization; -import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandSettings; import net.osmand.plus.R; import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile; -import net.osmand.plus.activities.AvailableGPXFragment; -import net.osmand.plus.activities.FavoritesActivity; +import net.osmand.plus.myplaces.AvailableGPXFragment; +import net.osmand.plus.myplaces.FavoritesActivity; import net.osmand.plus.activities.MapActivity; -import net.osmand.plus.activities.SavingTrackHelper; import net.osmand.plus.dashboard.DashBaseFragment; import net.osmand.plus.helpers.FontCache; import net.osmand.plus.helpers.GpxUiHelper; @@ -35,7 +31,6 @@ 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; import android.widget.Toast; diff --git a/OsmAnd/src/net/osmand/plus/activities/AvailableGPXFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java similarity index 99% rename from OsmAnd/src/net/osmand/plus/activities/AvailableGPXFragment.java rename to OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java index b50a0c9541..58af0c89a7 100644 --- a/OsmAnd/src/net/osmand/plus/activities/AvailableGPXFragment.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java @@ -1,4 +1,4 @@ -package net.osmand.plus.activities; +package net.osmand.plus.myplaces; import java.io.File; import java.text.Collator; @@ -16,7 +16,6 @@ import java.util.Set; import net.osmand.IndexConstants; import net.osmand.access.AccessibleToast; -import net.osmand.data.LatLon; import net.osmand.plus.ContextMenuAdapter; import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick; import net.osmand.plus.GPXUtilities; @@ -30,14 +29,17 @@ 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.search.SearchActivity; +import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.activities.OsmandBaseExpandableListAdapter; +import net.osmand.plus.activities.OsmandExpandableListFragment; +import net.osmand.plus.activities.SavingTrackHelper; +import net.osmand.plus.activities.TrackActivity; import net.osmand.plus.dialogs.DirectionsDialogs; import net.osmand.plus.download.LocalIndexesFragment; 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.plus.views.MonitoringInfoControl; import net.osmand.util.Algorithms; import android.app.Activity; import android.app.AlertDialog; diff --git a/OsmAnd/src/net/osmand/plus/activities/FavoritesActivity.java b/OsmAnd/src/net/osmand/plus/myplaces/FavoritesActivity.java similarity index 96% rename from OsmAnd/src/net/osmand/plus/activities/FavoritesActivity.java rename to OsmAnd/src/net/osmand/plus/myplaces/FavoritesActivity.java index 5decccbb3f..b1ebfa972c 100644 --- a/OsmAnd/src/net/osmand/plus/activities/FavoritesActivity.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/FavoritesActivity.java @@ -1,20 +1,21 @@ /** * */ -package net.osmand.plus.activities; +package net.osmand.plus.myplaces; import java.io.File; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.List; -import net.osmand.plus.GpxSelectionHelper; import net.osmand.plus.OsmAndLocationProvider; 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.TabActivity.TabItem; +import net.osmand.plus.activities.FavoritesTreeFragment; +import net.osmand.plus.activities.TabActivity; +import net.osmand.plus.myplaces.AvailableGPXFragment; import net.osmand.plus.views.controls.PagerSlidingTabStrip; import android.app.Activity; import android.graphics.drawable.Drawable; @@ -29,7 +30,6 @@ import android.text.style.ImageSpan; import android.view.MenuItem; import android.view.View; import android.widget.ImageView; -import android.widget.TextView; /** * diff --git a/OsmAnd/src/net/osmand/plus/activities/SelectedGPXFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/SelectedGPXFragment.java similarity index 67% rename from OsmAnd/src/net/osmand/plus/activities/SelectedGPXFragment.java rename to OsmAnd/src/net/osmand/plus/myplaces/SelectedGPXFragment.java index 2e748adc9f..187153eed3 100644 --- a/OsmAnd/src/net/osmand/plus/activities/SelectedGPXFragment.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/SelectedGPXFragment.java @@ -1,4 +1,4 @@ -package net.osmand.plus.activities; +package net.osmand.plus.myplaces; import gnu.trove.list.array.TIntArrayList; @@ -24,6 +24,8 @@ 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; +import net.osmand.plus.activities.TrackActivity; import net.osmand.plus.base.FavoriteImageDrawable; import net.osmand.plus.dialogs.DirectionsDialogs; import net.osmand.util.Algorithms; @@ -33,7 +35,7 @@ import android.app.AlertDialog.Builder; import android.content.DialogInterface; import android.os.AsyncTask; import android.os.Bundle; -import android.support.v7.app.ActionBarActivity; +import android.support.v4.app.ListFragment; import android.support.v7.widget.PopupMenu; import android.text.Html; import android.view.ContextMenu; @@ -44,31 +46,25 @@ import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; -import android.widget.AbsListView; import android.widget.ArrayAdapter; import android.widget.CheckBox; import android.widget.EditText; import android.widget.ExpandableListView; import android.widget.ExpandableListView.ExpandableListContextMenuInfo; -import android.widget.Filter; import android.widget.ImageView; -import android.widget.SectionIndexer; +import android.widget.ListView; import android.widget.Spinner; import android.widget.TextView; -public class SelectedGPXFragment extends OsmandExpandableListFragment { - - public static final int SEARCH_ID = -1; - +public class SelectedGPXFragment extends ListFragment { public static final String ARG_TO_EXPAND_TRACK_INFO = "ARG_TO_EXPAND_TRACK_INFO"; public static final String ARG_TO_FILTER_SHORT_TRACKS = "ARG_TO_FILTER_SHORT_TRACKS"; public static final String ARG_TO_HIDE_CONFIG_BTN = "ARG_TO_HIDE_CONFIG_BTN"; -// private SearchView searchView; - private OsmandApplication app; - private SelectedGPXAdapter adapter; - private boolean lightContent; - private Activity activity; + protected OsmandApplication app; + protected SelectedGPXAdapter adapter; + protected boolean lightContent; + protected Activity activity; @Override @@ -96,8 +92,6 @@ public class SelectedGPXFragment extends OsmandExpandableListFragment { public void onResume() { super.onResume(); setContent(); - List displayGrous = getContent(); - adapter.setDisplayGroups(displayGrous); } private List getContent() { @@ -114,14 +108,7 @@ public class SelectedGPXFragment extends OsmandExpandableListFragment { } - - public void setContent() { - getExpandableListView().setFastScrollEnabled(true); - lightContent = app.getSettings().isLightContent(); - if (adapter == null) { - adapter = new SelectedGPXAdapter(getExpandableListView()); - setAdapter(adapter); - } + protected List filterGroups() { List groups = getContent(); if (isArgumentTrue(ARG_TO_FILTER_SHORT_TRACKS)) { groups = new ArrayList(groups); @@ -140,36 +127,47 @@ public class SelectedGPXFragment extends OsmandExpandableListFragment { } } } - adapter.setDisplayGroups(groups); - if(isArgumentTrue(ARG_TO_EXPAND_TRACK_INFO)){ - for(int i = 0; i < groups.size(); i++) { - getExpandableListView().expandGroup(i); + return groups; + } + + public void setContent(){ + List groups = filterGroups(); + lightContent = app.getSettings().isLightContent(); + + List items = new ArrayList<>(); + for (GpxSelectionHelper.GpxDisplayGroup group : groups) { + for (GpxSelectionHelper.GpxDisplayItem item : group.getModifiableList()) { + items.add(item); } } + adapter = new SelectedGPXAdapter(items); + setListAdapter(adapter); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - View vs = super.onCreateView(inflater, container, savedInstanceState); - getExpandableListView().setOnCreateContextMenuListener(new View.OnCreateContextMenuListener() { + setHasOptionsMenu(true); + View view = getActivity().getLayoutInflater().inflate(R.layout.update_index, container, false); + view.findViewById(R.id.header_layout).setVisibility(View.GONE); + ListView listView = (ListView) view.findViewById(android.R.id.list); + listView.setOnCreateContextMenuListener(new View.OnCreateContextMenuListener() { @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { long packedPos = ((ExpandableListContextMenuInfo) menuInfo).packedPosition; int group = ExpandableListView.getPackedPositionGroup(packedPos); int child = ExpandableListView.getPackedPositionChild(packedPos); if (child >= 0 && group >= 0) { - showContextMenu(adapter.getChild(group, child)); + showContextMenu(adapter.getItem(child)); } } }); TextView tv = new TextView(getActivity()); tv.setText(R.string.none_selected_gpx); tv.setTextSize(24); - //((ViewGroup)getExpandableListView().getParent()).addView(tv); - getExpandableListView().setEmptyView(tv); + listView.setEmptyView(tv); setContent(); - return vs; + return view; } private void showContextMenu(final GpxDisplayItem gpxDisplayItem) { @@ -256,13 +254,6 @@ public class SelectedGPXFragment extends OsmandExpandableListFragment { ((TrackActivity) getActivity()).getClearToolbar(false); } - public void showProgressBar() { - ((ActionBarActivity) getActivity()).setSupportProgressBarIndeterminateVisibility(true); - } - - public void hideProgressBar() { - ((ActionBarActivity) getActivity()).setSupportProgressBarIndeterminateVisibility(false); - } private void selectSplitDistance(final GpxDisplayGroup model) { Builder bld = new AlertDialog.Builder(getMyActivity()); @@ -371,191 +362,20 @@ public class SelectedGPXFragment extends OsmandExpandableListFragment { } - class SelectedGPXAdapter extends OsmandBaseExpandableListAdapter implements SectionIndexer, AbsListView.OnScrollListener { - - Filter myFilter; - private List displayGroups = new ArrayList(); - private ExpandableListView expandableListView; - private boolean groupScroll = true; - private int maxNumberOfSections = 1; - private double itemsInSection; - - public SelectedGPXAdapter(ExpandableListView lv) { - this.expandableListView = lv; - this.expandableListView.setOnScrollListener(this); + class SelectedGPXAdapter extends ArrayAdapter { + public SelectedGPXAdapter(List items) { + super(getActivity(), R.layout.gpx_item_list_item, items); } @Override - public void onScrollStateChanged(AbsListView view, int scrollState) { -// this.manualScroll = scrollState == SCROLL_STATE_TOUCH_SCROLL; - } - - @Override - public void onScroll(AbsListView view, - int firstVisibleItem, - int visibleItemCount, - int totalItemCount) {} - - @Override - public int getPositionForSection(int section) { - if(groupScroll) { - return expandableListView.getFlatListPosition( - ExpandableListView.getPackedPositionForGroup(section)); - } else { - return (int) (section * itemsInSection); - } - } - - // Gets called when scrolling the list manually - @Override - public int getSectionForPosition(int position) { - // Get the packed position of the provided flat one and find the corresponding group - if (groupScroll) { - return ExpandableListView - .getPackedPositionGroup(expandableListView.getExpandableListPosition(position)); - } else { - int m = Math.min(maxNumberOfSections - 1, (int) (position / itemsInSection)); - return m; - } - } - - @Override - public Object[] getSections() { - String[] ar ; - if (groupScroll) { - ar = new String[getGroupCount()]; - for (int i = 0; i < getGroupCount(); i++) { - ar[i] = (i + 1) +"."; - } - } else { - int total = getGroupCount(); - for (int i = 0; i < getGroupCount(); i++) { - if (expandableListView.isGroupExpanded(i)) { - total += getChildrenCount(i); - } - } - maxNumberOfSections = Math.max(1, Math.min(25, total)); - itemsInSection = ((double) total) / maxNumberOfSections; - ar = new String[maxNumberOfSections]; - for (int i = 0; i < ar.length; i++) { - ar[i] = ((i + 1) * 100 / maxNumberOfSections) + "%"; - } - } - return ar; - } - - public void setDisplayGroups(List displayGroups) { - this.displayGroups = displayGroups; - notifyDataSetChanged(); - } - - - - - - @Override - public GpxDisplayItem getChild(int groupPosition, int childPosition) { - GpxDisplayGroup group = getGroup(groupPosition); - return group.getModifiableList().get(childPosition); - } - - @Override - public long getChildId(int groupPosition, int childPosition) { - return groupPosition * 10000 + childPosition; - } - - @Override - public int getChildrenCount(int groupPosition) { - return getGroup(groupPosition).getModifiableList().size(); - } - - @Override - public GpxDisplayGroup getGroup(int groupPosition) { - return displayGroups.get(groupPosition); - } - - @Override - public int getGroupCount() { - return displayGroups.size(); - } - - @Override - public long getGroupId(int groupPosition) { - return groupPosition; - } - - @Override - public boolean hasStableIds() { - return false; - } - - @Override - public boolean isChildSelectable(int groupPosition, int childPosition) { - return true; - } - - @Override - public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { - View row = convertView; - if (row == null) { - LayoutInflater inflater = getMyActivity().getLayoutInflater(); - row = inflater.inflate(R.layout.expandable_list_item_category_btn, parent, false); - fixBackgroundRepeat(row); - } - if(isArgumentTrue(ARG_TO_EXPAND_TRACK_INFO)) { - row.findViewById(R.id.explist_indicator).setVisibility(View.GONE); - } else { - adjustIndicator(groupPosition, isExpanded, row, app.getSettings().isLightContent()); - } - TextView label = (TextView) row.findViewById(R.id.category_name); - final GpxDisplayGroup model = getGroup(groupPosition); - label.setText(model.getGroupName()); - final ImageView ch = (ImageView) row.findViewById(R.id.check_item); - if(isArgumentTrue(ARG_TO_HIDE_CONFIG_BTN)) { - ch.setVisibility(View.GONE); - } else if(model.getType() == GpxDisplayItemType.TRACK_SEGMENT) { - ch.setVisibility(View.VISIBLE); - ch.setImageDrawable(getMyActivity().getResources().getDrawable( - app.getSettings().isLightContent() ? R.drawable.ic_overflow_menu_light - : R.drawable.ic_overflow_menu_dark)); - ch.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - selectSplitDistance(model); - } - - }); - } else if(model.getType() == GpxDisplayItemType.TRACK_POINTS || - model.getType() == GpxDisplayItemType.TRACK_ROUTE_POINTS) { - ch.setVisibility(View.VISIBLE); - ch.setImageDrawable(getMyActivity().getResources().getDrawable( - app.getSettings().isLightContent() ? R.drawable.ic_overflow_menu_light - : R.drawable.ic_overflow_menu_dark)); - ch.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - saveAsFavorites(model); - } - - }); - } else { - ch.setVisibility(View.INVISIBLE); - } - return row; - } - - - - @Override - public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, - ViewGroup parent) { + public View getView(int position, View convertView, ViewGroup parent) { View row = convertView; if (row == null) { LayoutInflater inflater = getMyActivity().getLayoutInflater(); row = inflater.inflate(R.layout.gpx_item_list_item, parent, false); } - GpxDisplayItem child = getChild(groupPosition, childPosition); + GpxDisplayItem child = getItem(position); TextView label = (TextView) row.findViewById(R.id.name); TextView description = (TextView) row.findViewById(R.id.description); TextView additional = (TextView) row.findViewById(R.id.additional); @@ -585,7 +405,7 @@ public class SelectedGPXFragment extends OsmandExpandableListFragment { } } row.setTag(child); - + label.setText(Html.fromHtml(child.name.replace("\n", "
"))); if ((child.expanded || isArgumentTrue(ARG_TO_EXPAND_TRACK_INFO)) && !Algorithms.isEmpty(child.description)) { String d = child.description; @@ -603,10 +423,9 @@ public class SelectedGPXFragment extends OsmandExpandableListFragment { } - @Override - public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { - GpxDisplayItem child = adapter.getChild(groupPosition, childPosition); + public void onListItemClick(ListView l, View v, int position, long id) { + GpxDisplayItem child = adapter.getItem(position); if(child.group.getType() == GpxDisplayItemType.TRACK_POINTS || child.group.getType() == GpxDisplayItemType.TRACK_ROUTE_POINTS) { ContextMenuAdapter qa = new ContextMenuAdapter(v.getContext()); @@ -622,8 +441,5 @@ public class SelectedGPXFragment extends OsmandExpandableListFragment { child.expanded = !child.expanded; adapter.notifyDataSetInvalidated(); } - return true; } - - } diff --git a/OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java new file mode 100644 index 0000000000..44d0c281a0 --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java @@ -0,0 +1,31 @@ +package net.osmand.plus.myplaces; + +import net.osmand.plus.GpxSelectionHelper; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by Denis + * on 04.03.2015. + */ +public class TrackPointFragment extends SelectedGPXFragment { + @Override + public void setContent() { + List groups = filterGroups(); + lightContent = app.getSettings().isLightContent(); + + + List items = new ArrayList<>(); + for (GpxSelectionHelper.GpxDisplayGroup group : groups) { + if (group.getType() != GpxSelectionHelper.GpxDisplayItemType.TRACK_POINTS){ + continue; + } + for (GpxSelectionHelper.GpxDisplayItem item : group.getModifiableList()) { + items.add(item); + } + } + adapter = new SelectedGPXAdapter(items); + setListAdapter(adapter); + } +} diff --git a/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java new file mode 100644 index 0000000000..1d69ee54b7 --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java @@ -0,0 +1,32 @@ +package net.osmand.plus.myplaces; + +import net.osmand.plus.GpxSelectionHelper; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by Denis + * on 04.03.2015. + */ +public class TrackSegmentFragment extends SelectedGPXFragment { + + @Override + public void setContent() { + List groups = filterGroups(); + lightContent = app.getSettings().isLightContent(); + + + List items = new ArrayList<>(); + for (GpxSelectionHelper.GpxDisplayGroup group : groups) { + if (group.getType() != GpxSelectionHelper.GpxDisplayItemType.TRACK_SEGMENT){ + continue; + } + for (GpxSelectionHelper.GpxDisplayItem item : group.getModifiableList()) { + items.add(item); + } + } + adapter = new SelectedGPXAdapter(items); + setListAdapter(adapter); + } +} diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java index 6f93efbadc..7f49a74e34 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java @@ -10,8 +10,8 @@ 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.AvailableGPXFragment; -import net.osmand.plus.activities.AvailableGPXFragment.GpxInfo; +import net.osmand.plus.myplaces.AvailableGPXFragment; +import net.osmand.plus.myplaces.AvailableGPXFragment.GpxInfo; import net.osmand.plus.activities.EnumAdapter; import net.osmand.plus.activities.EnumAdapter.IEnumWithResource; import net.osmand.plus.activities.MapActivity; diff --git a/OsmAnd/src/net/osmand/plus/osmedit/UploadGPXFilesTask.java b/OsmAnd/src/net/osmand/plus/osmedit/UploadGPXFilesTask.java index dde40bc5b5..efbf65e3e1 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/UploadGPXFilesTask.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/UploadGPXFilesTask.java @@ -4,7 +4,7 @@ import java.io.File; import net.osmand.access.AccessibleToast; import net.osmand.plus.R; -import net.osmand.plus.activities.AvailableGPXFragment.GpxInfo; +import net.osmand.plus.myplaces.AvailableGPXFragment.GpxInfo; import net.osmand.plus.osmedit.OsmEditingPlugin.UploadVisibility; import android.app.Activity; import android.os.AsyncTask; diff --git a/OsmAnd/src/net/osmand/plus/sherpafy/SherpafyCustomization.java b/OsmAnd/src/net/osmand/plus/sherpafy/SherpafyCustomization.java index 73304f4097..1f0f06fbc9 100644 --- a/OsmAnd/src/net/osmand/plus/sherpafy/SherpafyCustomization.java +++ b/OsmAnd/src/net/osmand/plus/sherpafy/SherpafyCustomization.java @@ -33,7 +33,7 @@ import net.osmand.plus.TargetPointsHelper; import net.osmand.plus.Version; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivityLayers; -import net.osmand.plus.activities.SelectedGPXFragment; +import net.osmand.plus.myplaces.SelectedGPXFragment; import net.osmand.plus.activities.actions.ShareLocation; import net.osmand.plus.api.FileSettingsAPIImpl; import net.osmand.plus.api.SettingsAPI;