Merge pull request #1096 from Bars107/master
Updated icons, dashboard on map and selected tracks.
This commit is contained in:
commit
e1d6d9953d
25 changed files with 149 additions and 269 deletions
|
@ -140,7 +140,7 @@
|
|||
<activity android:name="net.osmand.plus.activities.search.SearchActivity" android:label="@string/search_activity" />
|
||||
<activity android:name="net.osmand.plus.activities.ShowRouteInfoActivity" android:label="@string/show_route" />
|
||||
<activity android:name="net.osmand.plus.activities.FavoritesListActivity" android:label="@string/favourites_list_activity" />
|
||||
<activity android:name="net.osmand.plus.activities.FavoritesActivity" android:windowSoftInputMode="adjustPan" />
|
||||
<activity android:name=".myplaces.FavoritesActivity" android:windowSoftInputMode="adjustPan" />
|
||||
<activity android:name="net.osmand.plus.activities.TrackActivity"/>
|
||||
<activity android:name="net.osmand.plus.activities.PluginsActivity" />
|
||||
<activity android:name="net.osmand.plus.activities.PluginActivity" />
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
<dimen name="gpx_text_top_margin">6dp</dimen>
|
||||
<dimen name="dashboard_map_width">360dp</dimen>
|
||||
<dimen name="dashboard_map_top_padding">200dp</dimen>
|
||||
<dimen name="dashboard_map_bottom_padding">80dp</dimen>
|
||||
<dimen name="dashboard_map_bottom_padding">90dp</dimen>
|
||||
|
||||
<!-- TextSizes -->
|
||||
<dimen name="list_header_text_size">14sp</dimen>
|
||||
|
|
|
@ -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="track_segments">Track segments</string>
|
||||
<string name="track_points">Track points</string>
|
||||
<string name="online_map_settings">Online maps</string>
|
||||
<string name="osmand_rastermaps_plugin_description">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.
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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()) {
|
||||
|
|
|
@ -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;
|
||||
|
@ -1245,7 +1245,8 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
|||
|
||||
@Override
|
||||
public int getLogoResourceId() {
|
||||
return R.drawable.ic_type_video;
|
||||
// TODO
|
||||
return super.getLogoResourceId();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -79,7 +79,7 @@ public class OsmandDevelopmentPlugin extends OsmandPlugin {
|
|||
@Override
|
||||
public int getLogoResourceId() {
|
||||
// TODO
|
||||
return super.getLogoResourceId();
|
||||
return R.drawable.ic_plugin_developer;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
@ -140,7 +142,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
asyncLoader.execute(getActivity());
|
||||
} else {
|
||||
allGpxAdapter.refreshSelected();
|
||||
allGpxAdapter.notifyDataSetChanged();;
|
||||
allGpxAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
updateCurrentTrack(getView(), getActivity(), app);
|
|
@ -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;
|
||||
|
||||
/**
|
||||
*
|
|
@ -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<GpxDisplayGroup> displayGrous = getContent();
|
||||
adapter.setDisplayGroups(displayGrous);
|
||||
}
|
||||
|
||||
private List<GpxDisplayGroup> 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<GpxDisplayGroup> filterGroups() {
|
||||
List<GpxDisplayGroup> groups = getContent();
|
||||
if (isArgumentTrue(ARG_TO_FILTER_SHORT_TRACKS)) {
|
||||
groups = new ArrayList<GpxSelectionHelper.GpxDisplayGroup>(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<GpxSelectionHelper.GpxDisplayGroup> groups = filterGroups();
|
||||
lightContent = app.getSettings().isLightContent();
|
||||
|
||||
List<GpxSelectionHelper.GpxDisplayItem> 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<GpxDisplayGroup> displayGroups = new ArrayList<GpxDisplayGroup>();
|
||||
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<GpxDisplayItem> {
|
||||
|
||||
public SelectedGPXAdapter(List<GpxDisplayItem> 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<GpxDisplayGroup> 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", "<br/>")));
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
31
OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java
Normal file
31
OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java
Normal file
|
@ -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<GpxSelectionHelper.GpxDisplayGroup> groups = filterGroups();
|
||||
lightContent = app.getSettings().isLightContent();
|
||||
|
||||
|
||||
List<GpxSelectionHelper.GpxDisplayItem> 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);
|
||||
}
|
||||
}
|
|
@ -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<GpxSelectionHelper.GpxDisplayGroup> groups = filterGroups();
|
||||
lightContent = app.getSettings().isLightContent();
|
||||
|
||||
|
||||
List<GpxSelectionHelper.GpxDisplayItem> 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);
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue