diff --git a/OsmAnd-api/src/net/osmand/aidlapi/favorite/AFavorite.java b/OsmAnd-api/src/net/osmand/aidlapi/favorite/AFavorite.java index ed2dabe064..39daf1d2a2 100644 --- a/OsmAnd-api/src/net/osmand/aidlapi/favorite/AFavorite.java +++ b/OsmAnd-api/src/net/osmand/aidlapi/favorite/AFavorite.java @@ -16,12 +16,13 @@ public class AFavorite extends AidlParams { private String color; private boolean visible; - public AFavorite(double lat, double lon, String name, String description, + public AFavorite(double lat, double lon, String name, String description, String address, String category, String color, boolean visible) { this.lat = lat; this.lon = lon; this.name = name; this.description = description; + this.address = address; this.category = category; this.color = color; this.visible = visible; @@ -59,7 +60,7 @@ public class AFavorite extends AidlParams { return description; } - public String getAddress() { return description; } + public String getAddress() { return address; } public String getCategory() { return category; diff --git a/OsmAnd/build.gradle b/OsmAnd/build.gradle index e33b1ca75f..48d2895f25 100644 --- a/OsmAnd/build.gradle +++ b/OsmAnd/build.gradle @@ -542,6 +542,7 @@ dependencies { //implementation 'com.atilika.kuromoji:kuromoji-ipadic:0.9.0' implementation 'com.squareup.picasso:picasso:2.71828' implementation 'me.zhanghai.android.materialprogressbar:library:1.4.2' + implementation 'org.nanohttpd:nanohttpd:2.2.0' // JS core implementation group: 'org.mozilla', name: 'rhino', version: '1.7.9' // size restrictions diff --git a/OsmAnd/res/layout/point_editor_fragment_new.xml b/OsmAnd/res/layout/point_editor_fragment_new.xml index 4dcaa46680..e20eabf662 100644 --- a/OsmAnd/res/layout/point_editor_fragment_new.xml +++ b/OsmAnd/res/layout/point_editor_fragment_new.xml @@ -1,586 +1,586 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:osmand="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:id="@+id/point_edit_layout" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="@android:color/transparent" + android:fitsSystemWindows="true"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OsmAnd/src/androidhttpweb/ServerActivity.java b/OsmAnd/src/androidhttpweb/ServerActivity.java new file mode 100644 index 0000000000..30ac61b6b4 --- /dev/null +++ b/OsmAnd/src/androidhttpweb/ServerActivity.java @@ -0,0 +1,59 @@ +package androidhttpweb; + +import android.net.TrafficStats; +import android.os.Bundle; +import android.view.View; +import android.widget.TextView; + +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; + +import net.osmand.plus.R; + +public class ServerActivity extends AppCompatActivity { + private boolean initialized = false; + + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.server_activity); + findViewById(R.id.Button01).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + if (!initialized) { + ((TextView) findViewById(R.id.TextView02)).setText("Click second button to deactivate server"); + initServer(); + } + } + }); + findViewById(R.id.Button03).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + if (initialized) { + ((TextView) findViewById(R.id.TextView02)).setText("Click first button to activate server"); + deInitServer(); + } + } + }); + } + + private void initServer() { + final String ip = "localhost"; + final int port = 24990; + final int THREAD_ID = 10000; + TrafficStats.setThreadStatsTag(THREAD_ID); + TinyWebServer.startServer(ip, port, "/web/public_html"); + TinyWebServer.object = ServerActivity.this; + } + + private void deInitServer() { + TinyWebServer.stopServer(); + initialized = false; + } + + @Override + protected void onDestroy() { + deInitServer(); + super.onDestroy(); + } +} diff --git a/OsmAnd/src/net/osmand/aidl/favorite/AFavorite.java b/OsmAnd/src/net/osmand/aidl/favorite/AFavorite.java index 376a958add..ebd1818c9b 100644 --- a/OsmAnd/src/net/osmand/aidl/favorite/AFavorite.java +++ b/OsmAnd/src/net/osmand/aidl/favorite/AFavorite.java @@ -78,10 +78,10 @@ public class AFavorite implements Parcelable { out.writeDouble(lon); out.writeString(name); out.writeString(description); - out.writeString(address); out.writeString(category); out.writeString(color); out.writeByte((byte) (visible ? 1 : 0)); + out.writeString(address); } private void readFromParcel(Parcel in) { @@ -89,10 +89,10 @@ public class AFavorite implements Parcelable { lon = in.readDouble(); name = in.readString(); description = in.readString(); - address = in.readString(); category = in.readString(); color = in.readString(); visible = in.readByte() != 0; + address = in.readString(); } @Override diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java index 1fb45a0c88..b29e9e1385 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java @@ -1828,14 +1828,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo String groupName = convertDisplayNameToGroupIdName(requireContext(), menu.getTypeStr()); if (menu.getMyApplication() != null){ - FavouritesDbHelper helper = menu.getMyApplication().getFavorites(); - if (helper != null && helper.getGroup(groupName) != null){ - Drawable line2icon = helper.getColoredIconForGroup(groupName); - GravityDrawable line2GravityDrawable = - new GravityDrawable(line2icon); - line2.setCompoundDrawablesWithIntrinsicBounds( - line2GravityDrawable, null, null, null); - } + } line2.setCompoundDrawablePadding(dpToPx(5f)); } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/FavouritePointMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/FavouritePointMenuController.java index ca01bf246e..e318bc5aa0 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/FavouritePointMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/FavouritePointMenuController.java @@ -11,6 +11,7 @@ import net.osmand.data.FavouritePoint; import net.osmand.data.LatLon; import net.osmand.data.PointDescription; import net.osmand.data.TransportStop; +import net.osmand.plus.FavouritesDbHelper; import net.osmand.plus.MapMarkersHelper; import net.osmand.plus.MapMarkersHelper.MapMarker; import net.osmand.plus.R; @@ -23,6 +24,7 @@ import net.osmand.plus.mapcontextmenu.editors.FavoritePointEditorFragment; import net.osmand.plus.mapcontextmenu.editors.FavoritePointEditorFragmentNew; import net.osmand.plus.transport.TransportStopRoute; import net.osmand.util.OpeningHoursParser; +import net.osmand.view.GravityDrawable; import java.util.List; @@ -158,6 +160,14 @@ public class FavouritePointMenuController extends MenuController { @Override public Drawable getSecondLineTypeIcon() { + + FavouritesDbHelper helper = menu.getMyApplication().getFavorites(); + if (helper != null && helper.getGroup(groupName) != null) { + Drawable line2icon = helper.getColoredIconForGroup(groupName); + GravityDrawable line2GravityDrawable = + new GravityDrawable(line2icon); + } + return getIcon(R.drawable.ic_action_group_name_16, isLight() ? R.color.icon_color_default_light : R.color.ctx_menu_bottom_view_icon_dark); } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/FavoritePointEditor.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/FavoritePointEditor.java index 021d8908e1..513cd707d5 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/FavoritePointEditor.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/FavoritePointEditor.java @@ -62,7 +62,7 @@ public class FavoritePointEditor extends PointEditor { favorite = new FavouritePoint(latLon.getLatitude(), latLon.getLongitude(), title, categoryName); favorite.setDescription(""); - favorite.setAddress(title); + favorite.setAddress(""); favorite.setOriginObjectName(originObjectName); FavoritePointEditorFragmentNew.showAutoFillInstance(mapActivity, autoFill);