favorite changes
This commit is contained in:
parent
c757ef3a0b
commit
1c1a60863c
8 changed files with 659 additions and 595 deletions
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -128,8 +128,8 @@
|
|||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:layout_weight="1"
|
||||
android:hint="@string/shared_string_address"
|
||||
app:hintAnimationEnabled="false"
|
||||
app:boxBackgroundColor="@color/material_text_input_layout_bg">
|
||||
app:boxBackgroundColor="@color/material_text_input_layout_bg"
|
||||
app:hintAnimationEnabled="false">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/address_edit"
|
||||
|
@ -149,11 +149,12 @@
|
|||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/address_button"
|
||||
android:layout_marginTop="@dimen/content_padding_small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/context_menu_buttons_bottom_height"
|
||||
android:layout_marginStart="@dimen/content_padding_half"
|
||||
android:layout_marginLeft="@dimen/content_padding_half"
|
||||
android:layout_marginTop="@dimen/content_padding_small"
|
||||
android:drawablePadding="8dp"
|
||||
android:duplicateParentState="true"
|
||||
android:gravity="center"
|
||||
android:paddingStart="@dimen/content_padding_half"
|
||||
|
@ -161,7 +162,6 @@
|
|||
android:paddingEnd="@dimen/content_padding_half"
|
||||
android:paddingRight="@dimen/content_padding_half"
|
||||
android:text="@string/add_address"
|
||||
android:drawablePadding="8dp"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:text="@string/add_address" />
|
||||
|
@ -183,8 +183,8 @@
|
|||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:layout_weight="1"
|
||||
android:hint="@string/shared_string_description"
|
||||
app:hintAnimationEnabled="false"
|
||||
app:boxBackgroundColor="@color/material_text_input_layout_bg">
|
||||
app:boxBackgroundColor="@color/material_text_input_layout_bg"
|
||||
app:hintAnimationEnabled="false">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/description_edit"
|
||||
|
@ -209,13 +209,13 @@
|
|||
android:layout_height="@dimen/context_menu_buttons_bottom_height"
|
||||
android:layout_marginStart="@dimen/content_padding_half"
|
||||
android:layout_marginLeft="@dimen/content_padding_half"
|
||||
android:drawablePadding="8dp"
|
||||
android:duplicateParentState="true"
|
||||
android:gravity="center"
|
||||
android:paddingStart="@dimen/content_padding_half"
|
||||
android:paddingLeft="@dimen/content_padding_half"
|
||||
android:paddingEnd="@dimen/content_padding_half"
|
||||
android:paddingRight="@dimen/content_padding_half"
|
||||
android:drawablePadding="8dp"
|
||||
android:text="@string/add_description"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
|
|
59
OsmAnd/src/androidhttpweb/ServerActivity.java
Normal file
59
OsmAnd/src/androidhttpweb/ServerActivity.java
Normal file
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue