Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
ff6a963e93
13 changed files with 138 additions and 54 deletions
|
@ -1,11 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
<application tools:replace="android:icon"
|
||||
android:icon="@drawable/icon_free">
|
||||
<service tools:replace="android:process"
|
||||
android:process="net.osmand"
|
||||
android:name="net.osmand.plus.NavigationService"/>
|
||||
|
||||
</application>
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<application
|
||||
android:icon="@drawable/icon_free"
|
||||
tools:replace="android:icon">
|
||||
|
||||
<service
|
||||
android:name="net.osmand.plus.NavigationService"
|
||||
tools:replace="android:process"
|
||||
android:process="net.osmand"/>
|
||||
|
||||
<provider
|
||||
android:name="android.support.v4.content.FileProvider"
|
||||
tools:replace="android:authorities"
|
||||
android:authorities="net.osmand.fileprovider"/>
|
||||
</application>
|
||||
</manifest>
|
|
@ -1,11 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
<application tools:replace="android:icon"
|
||||
android:icon="@drawable/icon_free">
|
||||
<service tools:replace="android:process"
|
||||
android:process="net.osmand.dev"
|
||||
android:name="net.osmand.plus.NavigationService"/>
|
||||
|
||||
</application>
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<application
|
||||
android:icon="@drawable/icon_free"
|
||||
tools:replace="android:icon">
|
||||
<service
|
||||
android:name="net.osmand.plus.NavigationService"
|
||||
android:process="net.osmand.dev"
|
||||
tools:replace="android:process"/>
|
||||
<provider
|
||||
android:name="android.support.v4.content.FileProvider"
|
||||
android:authorities="net.osmand.dev.fileprovider"
|
||||
tools:replace="android:authorities"/>
|
||||
</application>
|
||||
</manifest>
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
|
||||
<provider
|
||||
android:name="android.support.v4.content.FileProvider"
|
||||
android:authorities="net.osmand.fileprovider"
|
||||
android:authorities="net.osmand.plus.fileprovider"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true" >
|
||||
<meta-data
|
||||
|
|
|
@ -88,5 +88,4 @@
|
|||
android:src="@drawable/ic_action_edit_dark"
|
||||
android:visibility="gone"/>
|
||||
|
||||
|
||||
</android.support.v7.widget.Toolbar>
|
46
OsmAnd/res/layout/list_item_icon_and_menu.xml
Normal file
46
OsmAnd/res/layout/list_item_icon_and_menu.xml
Normal file
|
@ -0,0 +1,46 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="54dp"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginRight="32dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
tools:src="@drawable/ic_action_gabout_dark" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
android:layout_weight="1"
|
||||
android:layout_gravity="center_vertical"
|
||||
tools:text="Some title text" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/menu"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
tools:src="@drawable/ic_action_gabout_dark" />
|
||||
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:id="@+id/check_item"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:focusable="false"
|
||||
android:layout_gravity="center_vertical" />
|
||||
|
||||
</LinearLayout>
|
|
@ -1,7 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<item android:id="@+id/showmod" android:title="@string/shared_string_show_on_map"></item>
|
||||
<item android:id="@+id/deletemod" android:title="@string/local_openstreetmap_delete"></item>
|
||||
<item android:id="@+id/uploadmods" android:title="@string/local_openstreetmap_upload"></item>
|
||||
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:id="@+id/showmod"
|
||||
android:title="@string/shared_string_show_on_map"/>
|
||||
<item
|
||||
android:id="@+id/deletemod"
|
||||
android:title="@string/local_openstreetmap_delete"/>
|
||||
<item
|
||||
android:id="@+id/uploadmods"
|
||||
android:title="@string/local_openstreetmap_upload"/>
|
||||
</menu>
|
9
OsmAnd/res/menu/refresh_menu.xml
Normal file
9
OsmAnd/res/menu/refresh_menu.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item
|
||||
android:id="@+id/action_refresh"
|
||||
android:icon="@drawable/ic_action_refresh_dark"
|
||||
android:title="@string/shared_string_refresh"
|
||||
app:showAsAction="ifRoom"/>
|
||||
</menu>
|
|
@ -5,6 +5,7 @@ import android.content.Context;
|
|||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.LayoutRes;
|
||||
import android.support.annotation.StringRes;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -36,11 +37,11 @@ public class ContextMenuAdapter {
|
|||
|
||||
public interface OnContextMenuClick {
|
||||
//boolean return type needed to desribe if drawer needed to be close or not
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked);
|
||||
boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked);
|
||||
}
|
||||
|
||||
public interface OnIntegerValueChangedListener {
|
||||
public boolean onIntegerValueChangedListener(int newValue);
|
||||
boolean onIntegerValueChangedListener(int newValue);
|
||||
}
|
||||
|
||||
public static abstract class OnRowItemClick implements OnContextMenuClick {
|
||||
|
@ -74,6 +75,7 @@ public class ContextMenuAdapter {
|
|||
|
||||
private final Context ctx;
|
||||
private View anchor;
|
||||
@LayoutRes
|
||||
private int defaultLayoutId = Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB ?
|
||||
R.layout.list_menu_item : R.layout.list_menu_item_native;
|
||||
final TIntArrayList items = new TIntArrayList();
|
||||
|
|
|
@ -580,7 +580,9 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
|
|||
sendIntent.setAction(Intent.ACTION_SEND);
|
||||
sendIntent.putExtra(Intent.EXTRA_TEXT, "Favourites.gpx:\n\n\n" + GPXUtilities.asString(gpxFile, getMyApplication()));
|
||||
sendIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.share_fav_subject));
|
||||
sendIntent.putExtra(Intent.EXTRA_STREAM, FileProvider.getUriForFile(getActivity(), "net.osmand.fileprovider", dst));
|
||||
sendIntent.putExtra(Intent.EXTRA_STREAM,
|
||||
FileProvider.getUriForFile(getActivity(),
|
||||
getActivity().getPackageName() + ".fileprovider", dst));
|
||||
sendIntent.setType("text/plain");
|
||||
startActivity(sendIntent);
|
||||
} catch (IOException e) {
|
||||
|
|
|
@ -13,6 +13,7 @@ import android.support.v4.view.ViewCompat;
|
|||
import android.support.v7.widget.Toolbar;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.animation.Animation;
|
||||
|
@ -74,6 +75,7 @@ import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
|
|||
import net.osmand.plus.routing.RoutingHelper;
|
||||
import net.osmand.plus.routing.RoutingHelper.IRouteInformationListener;
|
||||
import net.osmand.plus.views.DownloadedRegionsLayer;
|
||||
import net.osmand.plus.views.MapInfoLayer;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
import net.osmand.plus.views.controls.DynamicListView;
|
||||
import net.osmand.plus.views.controls.DynamicListViewCallbacks;
|
||||
|
@ -81,6 +83,7 @@ import net.osmand.plus.views.controls.StableArrayAdapter;
|
|||
import net.osmand.plus.views.controls.SwipeDismissListViewTouchListener;
|
||||
import net.osmand.plus.views.controls.SwipeDismissListViewTouchListener.DismissCallbacks;
|
||||
import net.osmand.plus.views.controls.SwipeDismissListViewTouchListener.Undoable;
|
||||
import net.osmand.plus.views.mapwidgets.MapWidgetRegistry;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
|
@ -537,6 +540,24 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
toolbar.getMenu().clear();
|
||||
toolbar.inflateMenu(R.menu.refresh_menu);
|
||||
toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem menuItem) {
|
||||
if (menuItem.getItemId() == R.id.action_refresh) {
|
||||
MapWidgetRegistry registry = mapActivity.getMapLayers().getMapWidgetRegistry();
|
||||
registry.resetToDefault();
|
||||
MapInfoLayer mil = mapActivity.getMapLayers().getMapInfoLayer();
|
||||
if (mil != null) {
|
||||
mil.recreateControls();
|
||||
}
|
||||
updateListAdapter(registry.getViewConfigureMenuAdapter(mapActivity));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ public class RasterMapMenu {
|
|||
public static ContextMenuAdapter createListAdapter(final MapActivity mapActivity,
|
||||
final OsmandRasterMapsPlugin.RasterMapType type) {
|
||||
ContextMenuAdapter adapter = new ContextMenuAdapter(mapActivity, false);
|
||||
adapter.setDefaultLayoutId(R.layout.drawer_list_material_item);
|
||||
adapter.setDefaultLayoutId(R.layout.list_item_basic);
|
||||
createLayersItems(adapter, mapActivity, type);
|
||||
return adapter;
|
||||
}
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
package net.osmand.plus.views.mapwidgets;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
|
@ -21,11 +19,13 @@ import net.osmand.plus.views.MapInfoLayer;
|
|||
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.LinearLayout;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
public class MapWidgetRegistry {
|
||||
|
||||
|
@ -479,7 +479,7 @@ public class MapWidgetRegistry {
|
|||
|
||||
public ContextMenuAdapter getViewConfigureMenuAdapter(final MapActivity map) {
|
||||
final ContextMenuAdapter cm = new ContextMenuAdapter(map);
|
||||
cm.setDefaultLayoutId(R.layout.drawer_list_item);
|
||||
cm.setDefaultLayoutId(R.layout.list_item_icon_and_menu);
|
||||
cm.item(R.string.app_modes_choose).layout(R.layout.mode_toggles).reg();
|
||||
cm.setChangeAppModeListener(new ConfigureMapMenu.OnClickListener() {
|
||||
|
||||
|
@ -488,20 +488,6 @@ public class MapWidgetRegistry {
|
|||
map.getDashboard().updateListAdapter(getViewConfigureMenuAdapter(map));
|
||||
}
|
||||
});
|
||||
cm.item(R.string.map_widget_reset).iconColor(R.drawable.ic_action_reset_to_default_dark)
|
||||
.listen(new OnContextMenuClick() {
|
||||
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
resetToDefault();
|
||||
MapInfoLayer mil = map.getMapLayers().getMapInfoLayer();
|
||||
if (mil != null) {
|
||||
mil.recreateControls();
|
||||
}
|
||||
map.getDashboard().updateListAdapter(getViewConfigureMenuAdapter(map));
|
||||
return false;
|
||||
}
|
||||
}).reg();
|
||||
final ApplicationMode mode = settings.getApplicationMode();
|
||||
addControls(map, cm, mode);
|
||||
return cm;
|
||||
|
|
Loading…
Reference in a new issue