Update icons
BIN
OsmAnd/res/drawable-hdpi/ic_action_road_works_dark.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 931 B |
Before Width: | Height: | Size: 980 B |
Before Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 5.5 KiB |
Before Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
BIN
OsmAnd/res/drawable-xhdpi/ic_action_road_works_dark.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.6 KiB |
BIN
OsmAnd/res/drawable-xxhdpi/ic_action_road_works_dark.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.2 KiB |
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true" android:drawable="@drawable/map_btn_cancel_p" />
|
||||
<item android:state_enabled="false" android:drawable="@drawable/map_btn_cancel_p" />
|
||||
<item android:drawable="@drawable/map_btn_cancel_o" />
|
||||
</selector>
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true" android:drawable="@drawable/map_btn_hmenu_p" />
|
||||
<item android:state_enabled="false" android:drawable="@drawable/map_btn_hmenu_p" />
|
||||
<item android:drawable="@drawable/map_btn_hmenu_o" />
|
||||
</selector>
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true" android:drawable="@drawable/map_btn_info_p" />
|
||||
<item android:state_enabled="false" android:drawable="@drawable/map_btn_info_p" />
|
||||
<item android:state_checked="true" android:drawable="@drawable/map_btn_info_p" />
|
||||
<item android:drawable="@drawable/map_btn_info_o" />
|
||||
</selector>
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true" android:drawable="@drawable/map_btn_menu_p" />
|
||||
<item android:state_enabled="false" android:drawable="@drawable/map_btn_menu_p" />
|
||||
<item android:drawable="@drawable/map_btn_menu_o" />
|
||||
</selector>
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true" android:drawable="@drawable/map_btn_navigate_p" />
|
||||
<item android:state_enabled="false" android:drawable="@drawable/map_btn_navigate_p" />
|
||||
<item android:drawable="@drawable/map_btn_navigate_o" />
|
||||
</selector>
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true" android:drawable="@drawable/map_btn_signpost_p" />
|
||||
<item android:state_enabled="false" android:drawable="@drawable/map_btn_signpost_p" />
|
||||
<item android:drawable="@drawable/map_btn_signpost_o" />
|
||||
</selector>
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true" android:drawable="@drawable/map_zoom_in_p" />
|
||||
<item android:state_enabled="false" android:drawable="@drawable/map_zoom_in_p" />
|
||||
<item android:drawable="@drawable/map_zoom_in_o" />
|
||||
</selector>
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true" android:drawable="@drawable/map_zoom_out_p" />
|
||||
<item android:state_enabled="false" android:drawable="@drawable/map_zoom_out_p" />
|
||||
<item android:drawable="@drawable/map_zoom_out_o" />
|
||||
</selector>
|
|
@ -1,6 +1,5 @@
|
|||
package net.osmand.plus;
|
||||
|
||||
import android.widget.*;
|
||||
import gnu.trove.list.array.TIntArrayList;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -8,15 +7,21 @@ import java.util.LinkedHashSet;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.osmand.plus.activities.actions.AppModeDialog;
|
||||
import net.osmand.plus.dialogs.ConfigureMapMenu;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||
import net.osmand.plus.activities.actions.AppModeDialog;
|
||||
import net.osmand.plus.dialogs.ConfigureMapMenu;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class ContextMenuAdapter {
|
||||
|
||||
|
@ -124,11 +129,17 @@ public class ContextMenuAdapter {
|
|||
selectedList.set(pos, s);
|
||||
}
|
||||
|
||||
public int getImageId(int pos, boolean light) {
|
||||
if(!light || iconListLight.get(pos) == 0) {
|
||||
return iconList.get(pos);
|
||||
|
||||
public Drawable getImage(OsmandApplication ctx, int pos, boolean light) {
|
||||
int lst = iconList.get(pos);
|
||||
if(lst != 0) {
|
||||
return ctx.getResources().getDrawable(lst);
|
||||
}
|
||||
return iconListLight.get(pos);
|
||||
int lstLight = iconListLight.get(pos);
|
||||
if(lstLight != 0) {
|
||||
return ctx.getIconsCache().getActionBarIcon(lstLight, light);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getBackgroundColor(Context ctx, boolean holoLight) {
|
||||
|
@ -178,10 +189,9 @@ public class ContextMenuAdapter {
|
|||
this.icon = icon;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Item icons(int icon, int lightIcon) {
|
||||
this.icon = icon;
|
||||
this.lightIcon = lightIcon;
|
||||
|
||||
public Item iconColor(int icon) {
|
||||
this.lightIcon = icon;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -236,6 +246,8 @@ public class ContextMenuAdapter {
|
|||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public String[] getItemNames() {
|
||||
|
@ -276,6 +288,7 @@ public class ContextMenuAdapter {
|
|||
|
||||
public ArrayAdapter<?> createListAdapter(final Activity activity, final boolean holoLight) {
|
||||
final int layoutId = defaultLayoutId;
|
||||
final OsmandApplication app = ((OsmandApplication) activity.getApplication());
|
||||
ArrayAdapter<String> listAdapter = new ArrayAdapter<String>(activity, layoutId, R.id.title,
|
||||
getItemNames()) {
|
||||
@Override
|
||||
|
@ -289,7 +302,7 @@ public class ContextMenuAdapter {
|
|||
@Override
|
||||
public void onClick(View view) {
|
||||
if (selected.size() > 0) {
|
||||
((OsmandApplication) activity.getApplication()).getSettings().APPLICATION_MODE.set(selected.iterator().next());
|
||||
app.getSettings().APPLICATION_MODE.set(selected.iterator().next());
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
if (changeAppModeListener != null) {
|
||||
|
@ -305,9 +318,9 @@ public class ContextMenuAdapter {
|
|||
TextView tv = (TextView) v.findViewById(R.id.title);
|
||||
tv.setText(isCategory(position) ? getItemName(position).toUpperCase() : getItemName(position));
|
||||
|
||||
int imageId = getImageId(position, holoLight);
|
||||
if (imageId != 0) {
|
||||
((ImageView) v.findViewById(R.id.icon)).setImageResource(imageId);
|
||||
Drawable imageId = getImage(app, position, holoLight);
|
||||
if (imageId != null) {
|
||||
((ImageView) v.findViewById(R.id.icon)).setImageDrawable(imageId);
|
||||
v.findViewById(R.id.icon).setVisibility(View.VISIBLE);
|
||||
} else if (v.findViewById(R.id.icon) != null){
|
||||
v.findViewById(R.id.icon).setVisibility(View.GONE);
|
||||
|
|
|
@ -28,14 +28,6 @@ public class IconsCache {
|
|||
return d;
|
||||
}
|
||||
|
||||
public Drawable getContentIcon(int id, int lightContentColor, int darkContentColor) {
|
||||
return getDrawable(id, app.getSettings().isLightContent() ? lightContentColor : darkContentColor);
|
||||
}
|
||||
|
||||
public Drawable getContentIcon(int id, int lightContentColor) {
|
||||
return getDrawable(id, app.getSettings().isLightContent() ? lightContentColor : 0);
|
||||
}
|
||||
|
||||
public Drawable getIcon(int id, int colorId) {
|
||||
return getDrawable(id, colorId);
|
||||
}
|
||||
|
@ -45,4 +37,13 @@ public class IconsCache {
|
|||
return getDrawable(id, app.getSettings().isLightContent() ? R.color.icon_color_light : 0);
|
||||
}
|
||||
|
||||
|
||||
public Drawable getActionBarIcon(int id) {
|
||||
return getDrawable(id, app.getSettings().isLightActionBar() ? R.color.icon_color_light : 0);
|
||||
}
|
||||
|
||||
public Drawable getActionBarIcon(int id, boolean light) {
|
||||
return getDrawable(id, light ? R.color.icon_color_light : 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1774,7 +1774,7 @@ public class OsmandSettings {
|
|||
new IntPreference("osmand_theme", OSMAND_DARK_THEME).makeGlobal().cache();
|
||||
|
||||
public boolean isLightActionBar(){
|
||||
return OSMAND_THEME.get() == OSMAND_LIGHT_THEME;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -111,16 +111,16 @@ public class HelpActivity extends OsmandActionBarActivity {
|
|||
getClearToolbar(false);
|
||||
}
|
||||
createMenuItem(menu, HOME, R.string.home,
|
||||
R.drawable.ic_action_home_dark, R.drawable.ic_action_home_dark,
|
||||
R.drawable.ic_action_home_dark,
|
||||
MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||
createMenuItem(menu, BACK, R.string.shared_string_previous,
|
||||
R.drawable.ic_action_undo_dark, R.drawable.ic_action_undo_dark,
|
||||
R.drawable.ic_action_undo_dark,
|
||||
MenuItemCompat.SHOW_AS_ACTION_ALWAYS );
|
||||
createMenuItem(menu, FORWARD, R.string.shared_string_next,
|
||||
R.drawable.ic_action_redo_dark, R.drawable.ic_action_redo_dark,
|
||||
R.drawable.ic_action_redo_dark,
|
||||
MenuItemCompat.SHOW_AS_ACTION_ALWAYS );
|
||||
createMenuItem(menu, CLOSE, R.string.shared_string_close,
|
||||
R.drawable.ic_action_close_dark, R.drawable.ic_action_close_dark,
|
||||
R.drawable.ic_action_close_dark,
|
||||
MenuItemCompat.SHOW_AS_ACTION_ALWAYS );
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
|
@ -152,11 +152,10 @@ public class HelpActivity extends OsmandActionBarActivity {
|
|||
return false;
|
||||
}
|
||||
|
||||
public MenuItem createMenuItem(Menu m, int id, int titleRes, int iconLight, int iconDark, int menuItemType) {
|
||||
int r = isLightActionBar() ? iconLight : iconDark;
|
||||
public MenuItem createMenuItem(Menu m, int id, int titleRes, int iconDark, int menuItemType) {
|
||||
MenuItem menuItem = m.add(0, id, 0, titleRes);
|
||||
if (r != 0) {
|
||||
menuItem.setIcon(r);
|
||||
if (iconDark != 0) {
|
||||
menuItem.setIcon(getMyApplication().getIconsCache().getActionBarIcon(iconDark));
|
||||
}
|
||||
MenuItemCompat.setShowAsAction(menuItem, menuItemType);
|
||||
menuItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
|
@ -168,10 +167,6 @@ public class HelpActivity extends OsmandActionBarActivity {
|
|||
return menuItem;
|
||||
}
|
||||
|
||||
public boolean isLightActionBar() {
|
||||
return ((OsmandApplication) getApplication()).getSettings().isLightActionBar();
|
||||
}
|
||||
|
||||
public Toolbar getClearToolbar(boolean visible) {
|
||||
final Toolbar tb = (Toolbar) findViewById(R.id.bottomControls);
|
||||
tb.setTitle(null);
|
||||
|
|
|
@ -50,6 +50,7 @@ import android.app.AlertDialog.Builder;
|
|||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
@ -739,7 +740,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
}
|
||||
if(routingHelper.isRouteCalculated()) {
|
||||
optionsMenuHelper.item(R.string.impassable_road)
|
||||
.icons(R.drawable.ic_action_road_works_dark, R.drawable.ic_action_road_works_light)
|
||||
.iconColor(R.drawable.ic_action_road_works_dark)
|
||||
.listen(new OnContextMenuClick() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
|
@ -969,9 +970,9 @@ public class MapActivityActions implements DialogProvider {
|
|||
for (int i = 0; i < qa.length(); i++) {
|
||||
|
||||
ActionItem ai = new ActionItem();
|
||||
int id = qa.getImageId(i, true);
|
||||
if (id != 0) {
|
||||
ai.setIcon(activity.getResources().getDrawable(id));
|
||||
Drawable id = qa.getImage(app, i, true);
|
||||
if (id != null) {
|
||||
ai.setIcon(id);
|
||||
}
|
||||
final int ki = i;
|
||||
ai.setTitle(qa.getItemName(i));
|
||||
|
|
|
@ -122,7 +122,7 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi
|
|||
}
|
||||
MenuItem menuItem = menu.add(0, NAVIGATE_TO, 0, R.string.context_menu_item_directions_to);
|
||||
MenuItemCompat.setShowAsAction(menuItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||
menuItem = menuItem.setIcon(light ? R.drawable.ic_action_gdirections_light : R.drawable.ic_action_gdirections_dark);
|
||||
menuItem = menuItem.setIcon(app.getIconsCache().getActionBarIcon(R.drawable.ic_action_gdirections_dark, light));
|
||||
menuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
||||
|
||||
@Override
|
||||
|
@ -135,13 +135,11 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi
|
|||
if (targets.getPointToNavigate() != null) {
|
||||
menuItem = menu.add(0, ADD_WAYPOINT, 0, R.string.context_menu_item_intermediate_point);
|
||||
MenuItemCompat.setShowAsAction(menuItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||
menuItem = menuItem.setIcon(light ? R.drawable.ic_action_flage_light
|
||||
: R.drawable.ic_action_flage_dark);
|
||||
menuItem = menuItem.setIcon(app.getIconsCache().getActionBarIcon(R.drawable.ic_action_flage_dark, light));
|
||||
} else {
|
||||
menuItem = menu.add(0, ADD_WAYPOINT, 0, R.string.context_menu_item_destination_point);
|
||||
MenuItemCompat.setShowAsAction(menuItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||
menuItem = menuItem.setIcon(light ? R.drawable.ic_action_flag_light
|
||||
: R.drawable.ic_action_flag_dark);
|
||||
menuItem = menuItem.setIcon(app.getIconsCache().getActionBarIcon(R.drawable.ic_action_flag_dark, light));
|
||||
}
|
||||
menuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
||||
@Override
|
||||
|
@ -153,7 +151,7 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi
|
|||
//}
|
||||
menuItem = menu.add(0, SHOW_ON_MAP, 0, R.string.shared_string_show_on_map);
|
||||
MenuItemCompat.setShowAsAction(menuItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||
menuItem = menuItem.setIcon(light ? R.drawable.ic_action_marker_light : R.drawable.ic_action_marker_dark);
|
||||
menuItem = menuItem.setIcon(app.getIconsCache().getActionBarIcon(R.drawable.ic_action_marker_dark, light));
|
||||
|
||||
menuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
||||
@Override
|
||||
|
@ -165,7 +163,7 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi
|
|||
|
||||
menuItem = menu.add(0, ADD_TO_FAVORITE, 0, R.string.shared_string_add_to_favorites);
|
||||
MenuItemCompat.setShowAsAction(menuItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||
menuItem = menuItem.setIcon(light ? R.drawable.ic_action_fav_light : R.drawable.ic_action_fav_dark);
|
||||
menuItem = menuItem.setIcon(app.getIconsCache().getActionBarIcon(R.drawable.ic_action_fav_dark, light));
|
||||
|
||||
menuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
||||
@Override
|
||||
|
|
|
@ -507,10 +507,10 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
|||
}
|
||||
};
|
||||
optionsMenuAdapter.item(R.string.local_index_mi_reload)
|
||||
.icon(R.drawable.ic_action_refresh_dark)
|
||||
.iconColor(R.drawable.ic_action_refresh_dark)
|
||||
.listen(listener).position(1).reg();
|
||||
optionsMenuAdapter.item(R.string.shared_string_delete)
|
||||
.icon(R.drawable.ic_action_delete_dark)
|
||||
.iconColor(R.drawable.ic_action_delete_dark)
|
||||
.listen(listener).position(2).reg();
|
||||
optionsMenuAdapter.item(R.string.local_index_mi_backup)
|
||||
.listen(listener).position(3).reg();
|
||||
|
@ -535,8 +535,9 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
|||
item = menu.add(0, optionsMenuAdapter.getElementId(j), j + 1, optionsMenuAdapter.getItemName(j));
|
||||
MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS );
|
||||
}
|
||||
if (optionsMenuAdapter.getImageId(j, isLightActionBar()) != 0) {
|
||||
item.setIcon(optionsMenuAdapter.getImageId(j, isLightActionBar()));
|
||||
OsmandApplication app = getMyApplication();
|
||||
if (optionsMenuAdapter.getImage(app, j, isLightActionBar()) != null) {
|
||||
item.setIcon(optionsMenuAdapter.getImage(app, j, isLightActionBar()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -177,10 +177,6 @@ public class UpdatesIndexFragment extends ListFragment {
|
|||
return getDownloadActivity().getMyApplication();
|
||||
}
|
||||
|
||||
public boolean isLightActionBar() {
|
||||
return ((OsmandApplication) getActivity().getApplication()).getSettings().isLightActionBar();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == DownloadIndexFragment.RELOAD_ID) {
|
||||
|
|
|
@ -56,8 +56,8 @@ public class AvoidSpecificRoads {
|
|||
}
|
||||
final RouteDataObject obj = getItem(position);
|
||||
v.findViewById(R.id.all_points).setVisibility(View.GONE);
|
||||
((ImageView) v.findViewById(R.id.waypoint_icon)).setImageResource(app.getSettings().isLightContent() ?
|
||||
R.drawable.ic_action_road_works_light : R.drawable.ic_action_road_works_dark);
|
||||
((ImageView) v.findViewById(R.id.waypoint_icon)).setImageDrawable(
|
||||
app.getIconsCache().getContentIcon(R.drawable.ic_action_road_works_dark));
|
||||
double dist = MapUtils.getDistance(mapLocation, MapUtils.get31LatitudeY(obj.getPoint31YTile(0)),
|
||||
MapUtils.get31LongitudeX(obj.getPoint31XTile(0)));
|
||||
((TextView) v.findViewById(R.id.waypoint_dist)).setText(OsmAndFormatter.getFormattedDistance((float) dist, app));
|
||||
|
|
|
@ -1,5 +1,45 @@
|
|||
package net.osmand.plus.myplaces;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.Collator;
|
||||
import java.text.DateFormat;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
import net.osmand.plus.GPXUtilities;
|
||||
import net.osmand.plus.GPXUtilities.GPXFile;
|
||||
import net.osmand.plus.GPXUtilities.GPXTrackAnalysis;
|
||||
import net.osmand.plus.GPXUtilities.WptPt;
|
||||
import net.osmand.plus.GpxSelectionHelper;
|
||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
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.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.ScreenOrientationHelper;
|
||||
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
||||
import net.osmand.plus.osmedit.OsmEditingPlugin;
|
||||
import net.osmand.util.Algorithms;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.AlertDialog.Builder;
|
||||
|
@ -28,7 +68,6 @@ import android.view.ViewGroup;
|
|||
import android.widget.ArrayAdapter;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ExpandableListView;
|
||||
import android.widget.Filter;
|
||||
import android.widget.Filterable;
|
||||
|
@ -37,47 +76,6 @@ import android.widget.ImageView;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
import net.osmand.plus.GPXUtilities;
|
||||
import net.osmand.plus.GPXUtilities.GPXFile;
|
||||
import net.osmand.plus.GPXUtilities.GPXTrackAnalysis;
|
||||
import net.osmand.plus.GPXUtilities.WptPt;
|
||||
import net.osmand.plus.GpxSelectionHelper;
|
||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
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.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.ScreenOrientationHelper;
|
||||
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
||||
import net.osmand.plus.osmedit.OsmEditingPlugin;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.Collator;
|
||||
import java.text.DateFormat;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
||||
|
||||
public static final int SEARCH_ID = -1;
|
||||
|
@ -370,8 +368,9 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
}
|
||||
});
|
||||
}
|
||||
if (optionsMenuAdapter.getImageId(j, isLightActionBar()) != 0) {
|
||||
item.setIcon(optionsMenuAdapter.getImageId(j, false));
|
||||
OsmandApplication app = getMyApplication();
|
||||
if (optionsMenuAdapter.getImage(app, j, isLightActionBar()) != null) {
|
||||
item.setIcon(optionsMenuAdapter.getImage(app, j, isLightActionBar()));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -543,44 +542,6 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
allGpxAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
private void renameFile(GpxInfo info) {
|
||||
final File f = info.file;
|
||||
Builder b = new AlertDialog.Builder(getActivity());
|
||||
if (f.exists()) {
|
||||
final EditText editText = new EditText(getActivity());
|
||||
editText.setPadding(7, 3, 7, 3);
|
||||
editText.setText(f.getName());
|
||||
b.setView(editText);
|
||||
b.setPositiveButton(R.string.shared_string_save, new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
String newName = editText.getText().toString();
|
||||
File dest = new File(f.getParentFile(), newName);
|
||||
if (dest.exists()) {
|
||||
AccessibleToast.makeText(getActivity(), R.string.file_with_name_already_exists,
|
||||
Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
if (!f.getParentFile().exists()) {
|
||||
f.getParentFile().mkdirs();
|
||||
}
|
||||
if (f.renameTo(dest)) {
|
||||
asyncLoader = new LoadGpxTask();
|
||||
asyncLoader.execute(getActivity());
|
||||
} else {
|
||||
AccessibleToast
|
||||
.makeText(getActivity(), R.string.file_can_not_be_renamed, Toast.LENGTH_LONG)
|
||||
.show();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
b.setNegativeButton(R.string.shared_string_cancel, null);
|
||||
b.show();
|
||||
}
|
||||
}
|
||||
|
||||
private void showGpxOnMap(GpxInfo info) {
|
||||
info.setGpx(GPXUtilities.loadGPXFile(app, info.file));
|
||||
boolean e = true;
|
||||
|
|
|
@ -10,13 +10,12 @@ 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;
|
||||
import net.osmand.plus.audionotes.NotesFragment;
|
||||
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;
|
||||
import net.osmand.plus.activities.TabActivity;
|
||||
import net.osmand.plus.myplaces.AvailableGPXFragment;
|
||||
import net.osmand.plus.myplaces.AvailableGPXFragment.GpxInfo;
|
||||
import net.osmand.plus.myplaces.FavoritesActivity;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
@ -128,16 +127,12 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
|||
}
|
||||
};
|
||||
if(selectedObj instanceof Amenity) {
|
||||
adapter.item(R.string.poi_context_menu_modify).icons(R.drawable.ic_action_edit_dark,
|
||||
R.drawable.ic_action_edit_light).listen(listener).position(1).reg();
|
||||
adapter.item(R.string.poi_context_menu_delete).icons(R.drawable.ic_action_delete_dark,
|
||||
R.drawable.ic_action_delete_light).listen(listener).position(2).reg();
|
||||
adapter.item(R.string.poi_context_menu_modify).iconColor(R.drawable.ic_action_edit_dark).listen(listener).position(1).reg();
|
||||
adapter.item(R.string.poi_context_menu_delete).iconColor(R.drawable.ic_action_delete_dark).listen(listener).position(2).reg();
|
||||
} else {
|
||||
adapter.item(R.string.context_menu_item_create_poi).icons(R.drawable.ic_action_plus_dark,
|
||||
R.drawable.ic_action_plus_light).listen(listener).position(-1).reg();
|
||||
adapter.item(R.string.context_menu_item_create_poi).iconColor(R.drawable.ic_action_plus_dark).listen(listener).position(-1).reg();
|
||||
}
|
||||
adapter.item(R.string.context_menu_item_open_bug).icons(R.drawable.ic_action_bug_dark,
|
||||
R.drawable.ic_action_bug_light).listen(listener).reg();
|
||||
adapter.item(R.string.context_menu_item_open_bug).iconColor(R.drawable.ic_action_bug_dark).listen(listener).reg();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -155,7 +150,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
|||
@Override
|
||||
public void registerLayerContextMenuActions(OsmandMapTileView mapView, ContextMenuAdapter adapter, MapActivity mapActivity) {
|
||||
adapter.item(R.string.layer_osm_bugs).selected(settings.SHOW_OSM_BUGS.get() ? 1 : 0)
|
||||
.icons(R.drawable.ic_action_bug_dark, R.drawable.ic_action_bug_light).listen(new OnContextMenuClick() {
|
||||
.iconColor(R.drawable.ic_action_bug_dark).listen(new OnContextMenuClick() {
|
||||
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
|
@ -177,7 +172,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
|||
public void contextMenuFragment(final Activity la, final Fragment fragment, final Object info, ContextMenuAdapter adapter) {
|
||||
if (fragment instanceof AvailableGPXFragment) {
|
||||
adapter.item(R.string.local_index_mi_upload_gpx)
|
||||
.icons(R.drawable.ic_action_gup_dark, R.drawable.ic_action_gup_light)
|
||||
.iconColor(R.drawable.ic_action_gup_dark)
|
||||
.listen(new OnContextMenuClick() {
|
||||
|
||||
@Override
|
||||
|
@ -194,7 +189,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
|||
if (fragment instanceof AvailableGPXFragment) {
|
||||
final AvailableGPXFragment f = ((AvailableGPXFragment) fragment);
|
||||
optionsMenuAdapter.item(R.string.local_index_mi_upload_gpx)
|
||||
.icon(R.drawable.ic_action_export)
|
||||
.iconColor(R.drawable.ic_action_export)
|
||||
.listen(new OnContextMenuClick() {
|
||||
|
||||
@Override
|
||||
|
|