address field added
This commit is contained in:
parent
64390ae596
commit
39b97a110e
12 changed files with 61 additions and 30 deletions
|
@ -11,6 +11,7 @@ public class AFavorite extends AidlParams {
|
||||||
private double lon;
|
private double lon;
|
||||||
private String name;
|
private String name;
|
||||||
private String description;
|
private String description;
|
||||||
|
private String address;
|
||||||
private String category;
|
private String category;
|
||||||
private String color;
|
private String color;
|
||||||
private boolean visible;
|
private boolean visible;
|
||||||
|
@ -58,6 +59,8 @@ public class AFavorite extends AidlParams {
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getAddress() { return description; }
|
||||||
|
|
||||||
public String getCategory() {
|
public String getCategory() {
|
||||||
return category;
|
return category;
|
||||||
}
|
}
|
||||||
|
@ -76,6 +79,7 @@ public class AFavorite extends AidlParams {
|
||||||
bundle.putDouble("lon", lon);
|
bundle.putDouble("lon", lon);
|
||||||
bundle.putString("name", name);
|
bundle.putString("name", name);
|
||||||
bundle.putString("description", description);
|
bundle.putString("description", description);
|
||||||
|
bundle.putString("address", address);
|
||||||
bundle.putString("category", category);
|
bundle.putString("category", category);
|
||||||
bundle.putString("color", color);
|
bundle.putString("color", color);
|
||||||
bundle.putBoolean("visible", visible);
|
bundle.putBoolean("visible", visible);
|
||||||
|
@ -87,6 +91,7 @@ public class AFavorite extends AidlParams {
|
||||||
lon = bundle.getDouble("lon");
|
lon = bundle.getDouble("lon");
|
||||||
name = bundle.getString("name");
|
name = bundle.getString("name");
|
||||||
description = bundle.getString("description");
|
description = bundle.getString("description");
|
||||||
|
address = bundle.getString("address");
|
||||||
category = bundle.getString("category");
|
category = bundle.getString("category");
|
||||||
color = bundle.getString("color");
|
color = bundle.getString("color");
|
||||||
visible = bundle.getBoolean("visible");
|
visible = bundle.getBoolean("visible");
|
||||||
|
|
|
@ -967,7 +967,7 @@ public class OsmandAidlApi {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean updateFavorite(String prevName, String prevCategory, double prevLat, double prevLon, String newName, String newCategory, String newDescription, double newLat, double newLon) {
|
boolean updateFavorite(String prevName, String prevCategory, double prevLat, double prevLon, String newName, String newCategory, String newDescription, String newAddress, double newLat, double newLon) {
|
||||||
FavouritesDbHelper favoritesHelper = app.getFavorites();
|
FavouritesDbHelper favoritesHelper = app.getFavorites();
|
||||||
List<FavouritePoint> favorites = favoritesHelper.getFavouritePoints();
|
List<FavouritePoint> favorites = favoritesHelper.getFavouritePoints();
|
||||||
for (FavouritePoint f : favorites) {
|
for (FavouritePoint f : favorites) {
|
||||||
|
@ -977,8 +977,8 @@ public class OsmandAidlApi {
|
||||||
favoritesHelper.editFavourite(f, newLat, newLon);
|
favoritesHelper.editFavourite(f, newLat, newLon);
|
||||||
}
|
}
|
||||||
if (!newName.equals(f.getName()) || !newDescription.equals(f.getDescription()) ||
|
if (!newName.equals(f.getName()) || !newDescription.equals(f.getDescription()) ||
|
||||||
!newCategory.equals(f.getCategory())) {
|
!newCategory.equals(f.getCategory()) || !newAddress.equals(f.getAddress())) {
|
||||||
favoritesHelper.editFavouriteName(f, newName, newCategory, newDescription);
|
favoritesHelper.editFavouriteName(f, newName, newCategory, newDescription,newAddress);
|
||||||
}
|
}
|
||||||
refreshMap();
|
refreshMap();
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -311,7 +311,7 @@ public class OsmandAidlService extends Service implements AidlCallbackListener {
|
||||||
AFavorite newFav = params.getFavoriteNew();
|
AFavorite newFav = params.getFavoriteNew();
|
||||||
if (prevFav != null && newFav != null) {
|
if (prevFav != null && newFav != null) {
|
||||||
return api.updateFavorite(prevFav.getName(), prevFav.getCategory(), prevFav.getLat(), prevFav.getLon(),
|
return api.updateFavorite(prevFav.getName(), prevFav.getCategory(), prevFav.getLat(), prevFav.getLon(),
|
||||||
newFav.getName(), newFav.getCategory(), newFav.getDescription(), newFav.getLat(), newFav.getLon());
|
newFav.getName(), newFav.getCategory(), newFav.getDescription(), newFav.getAddress(), newFav.getLat(), newFav.getLon());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -314,7 +314,7 @@ public class OsmandAidlServiceV2 extends Service implements AidlCallbackListener
|
||||||
AFavorite newFav = params.getFavoriteNew();
|
AFavorite newFav = params.getFavoriteNew();
|
||||||
if (prevFav != null && newFav != null) {
|
if (prevFav != null && newFav != null) {
|
||||||
return api.updateFavorite(prevFav.getName(), prevFav.getCategory(), prevFav.getLat(), prevFav.getLon(),
|
return api.updateFavorite(prevFav.getName(), prevFav.getCategory(), prevFav.getLat(), prevFav.getLon(),
|
||||||
newFav.getName(), newFav.getCategory(), newFav.getDescription(), newFav.getLat(), newFav.getLon());
|
newFav.getName(), newFav.getCategory(), newFav.getDescription(), newFav.getAddress(), newFav.getLat(), newFav.getLon());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -9,16 +9,18 @@ public class AFavorite implements Parcelable {
|
||||||
private double lon;
|
private double lon;
|
||||||
private String name;
|
private String name;
|
||||||
private String description;
|
private String description;
|
||||||
|
private String address;
|
||||||
private String category;
|
private String category;
|
||||||
private String color;
|
private String color;
|
||||||
private boolean visible;
|
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) {
|
String category, String color, boolean visible) {
|
||||||
this.lat = lat;
|
this.lat = lat;
|
||||||
this.lon = lon;
|
this.lon = lon;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
|
this.address = address;
|
||||||
this.category = category;
|
this.category = category;
|
||||||
this.color = color;
|
this.color = color;
|
||||||
this.visible = visible;
|
this.visible = visible;
|
||||||
|
@ -56,6 +58,8 @@ public class AFavorite implements Parcelable {
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getAddress() { return address; }
|
||||||
|
|
||||||
public String getCategory() {
|
public String getCategory() {
|
||||||
return category;
|
return category;
|
||||||
}
|
}
|
||||||
|
@ -74,6 +78,7 @@ public class AFavorite implements Parcelable {
|
||||||
out.writeDouble(lon);
|
out.writeDouble(lon);
|
||||||
out.writeString(name);
|
out.writeString(name);
|
||||||
out.writeString(description);
|
out.writeString(description);
|
||||||
|
out.writeString(address);
|
||||||
out.writeString(category);
|
out.writeString(category);
|
||||||
out.writeString(color);
|
out.writeString(color);
|
||||||
out.writeByte((byte) (visible ? 1 : 0));
|
out.writeByte((byte) (visible ? 1 : 0));
|
||||||
|
@ -84,6 +89,7 @@ public class AFavorite implements Parcelable {
|
||||||
lon = in.readDouble();
|
lon = in.readDouble();
|
||||||
name = in.readString();
|
name = in.readString();
|
||||||
description = in.readString();
|
description = in.readString();
|
||||||
|
address = in.readString();
|
||||||
category = in.readString();
|
category = in.readString();
|
||||||
color = in.readString();
|
color = in.readString();
|
||||||
visible = in.readByte() != 0;
|
visible = in.readByte() != 0;
|
||||||
|
|
|
@ -487,11 +487,12 @@ public class FavouritesDbHelper {
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean editFavouriteName(FavouritePoint p, String newName, String category, String descr) {
|
public boolean editFavouriteName(FavouritePoint p, String newName, String category, String descr, String address) {
|
||||||
String oldCategory = p.getCategory();
|
String oldCategory = p.getCategory();
|
||||||
p.setName(newName);
|
p.setName(newName);
|
||||||
p.setCategory(category);
|
p.setCategory(category);
|
||||||
p.setDescription(descr);
|
p.setDescription(descr);
|
||||||
|
p.setAddress(address);
|
||||||
if (!oldCategory.equals(category)) {
|
if (!oldCategory.equals(category)) {
|
||||||
FavoriteGroup old = flatGroups.get(oldCategory);
|
FavoriteGroup old = flatGroups.get(oldCategory);
|
||||||
if (old != null) {
|
if (old != null) {
|
||||||
|
|
|
@ -1042,7 +1042,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
||||||
}
|
}
|
||||||
FavoritePointEditor favoritePointEditor = getFavoritePointEditor();
|
FavoritePointEditor favoritePointEditor = getFavoritePointEditor();
|
||||||
if (favoritePointEditor != null) {
|
if (favoritePointEditor != null) {
|
||||||
favoritePointEditor.add(getLatLon(), title, originObjectName);
|
favoritePointEditor.add(getLatLon(), title, getStreetStr(), originObjectName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class FavoritePointEditor extends PointEditor {
|
||||||
return favorite;
|
return favorite;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(LatLon latLon, String title, String originObjectName) {
|
public void add(LatLon latLon, String title, String address, String originObjectName) {
|
||||||
MapActivity mapActivity = getMapActivity();
|
MapActivity mapActivity = getMapActivity();
|
||||||
if (latLon == null || mapActivity == null) {
|
if (latLon == null || mapActivity == null) {
|
||||||
return;
|
return;
|
||||||
|
@ -39,6 +39,7 @@ public class FavoritePointEditor extends PointEditor {
|
||||||
}
|
}
|
||||||
favorite = new FavouritePoint(latLon.getLatitude(), latLon.getLongitude(), title, lastCategory);
|
favorite = new FavouritePoint(latLon.getLatitude(), latLon.getLongitude(), title, lastCategory);
|
||||||
favorite.setDescription("");
|
favorite.setDescription("");
|
||||||
|
favorite.setAddress(address);
|
||||||
favorite.setOriginObjectName(originObjectName);
|
favorite.setOriginObjectName(originObjectName);
|
||||||
FavoritePointEditorFragmentNew.showInstance(mapActivity);
|
FavoritePointEditorFragmentNew.showInstance(mapActivity);
|
||||||
}
|
}
|
||||||
|
@ -61,6 +62,7 @@ public class FavoritePointEditor extends PointEditor {
|
||||||
|
|
||||||
favorite = new FavouritePoint(latLon.getLatitude(), latLon.getLongitude(), title, categoryName);
|
favorite = new FavouritePoint(latLon.getLatitude(), latLon.getLongitude(), title, categoryName);
|
||||||
favorite.setDescription("");
|
favorite.setDescription("");
|
||||||
|
favorite.setAddress(title);
|
||||||
favorite.setOriginObjectName(originObjectName);
|
favorite.setOriginObjectName(originObjectName);
|
||||||
|
|
||||||
FavoritePointEditorFragmentNew.showAutoFillInstance(mapActivity, autoFill);
|
FavoritePointEditorFragmentNew.showAutoFillInstance(mapActivity, autoFill);
|
||||||
|
|
|
@ -192,12 +192,13 @@ public class FavoritePointEditorFragment extends PointEditorFragment {
|
||||||
final FavouritePoint point = new FavouritePoint(favorite.getLatitude(), favorite.getLongitude(),
|
final FavouritePoint point = new FavouritePoint(favorite.getLatitude(), favorite.getLongitude(),
|
||||||
getNameTextValue(), getCategoryTextValue());
|
getNameTextValue(), getCategoryTextValue());
|
||||||
point.setDescription(getDescriptionTextValue());
|
point.setDescription(getDescriptionTextValue());
|
||||||
|
point.setAddress(getAddressTextValue());
|
||||||
AlertDialog.Builder builder = FavouritesDbHelper.checkDuplicates(point, helper, getMapActivity());
|
AlertDialog.Builder builder = FavouritesDbHelper.checkDuplicates(point, helper, getMapActivity());
|
||||||
|
|
||||||
if (favorite.getName().equals(point.getName()) &&
|
if (favorite.getName().equals(point.getName()) &&
|
||||||
favorite.getCategory().equals(point.getCategory()) &&
|
favorite.getCategory().equals(point.getCategory()) &&
|
||||||
Algorithms.stringsEqual(favorite.getDescription(), point.getDescription())) {
|
Algorithms.stringsEqual(favorite.getDescription(), point.getDescription()) &&
|
||||||
|
Algorithms.stringsEqual(favorite.getAddress(),point.getAddress())) {
|
||||||
if (needDismiss) {
|
if (needDismiss) {
|
||||||
dismiss(false);
|
dismiss(false);
|
||||||
}
|
}
|
||||||
|
@ -208,25 +209,25 @@ public class FavoritePointEditorFragment extends PointEditorFragment {
|
||||||
builder.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
|
builder.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
doSave(favorite, point.getName(), point.getCategory(), point.getDescription(), needDismiss);
|
doSave(favorite, point.getName(), point.getCategory(), point.getDescription(),point.getAddress(), needDismiss);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
builder.create().show();
|
builder.create().show();
|
||||||
} else {
|
} else {
|
||||||
doSave(favorite, point.getName(), point.getCategory(), point.getDescription(), needDismiss);
|
doSave(favorite, point.getName(), point.getCategory(), point.getDescription(), point.getAddress(), needDismiss);
|
||||||
}
|
}
|
||||||
saved = true;
|
saved = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doSave(FavouritePoint favorite, String name, String category, String description, boolean needDismiss) {
|
private void doSave(FavouritePoint favorite, String name, String category, String description, String address, boolean needDismiss) {
|
||||||
FavouritesDbHelper helper = getHelper();
|
FavouritesDbHelper helper = getHelper();
|
||||||
FavoritePointEditor editor = getFavoritePointEditor();
|
FavoritePointEditor editor = getFavoritePointEditor();
|
||||||
if (editor != null && helper != null) {
|
if (editor != null && helper != null) {
|
||||||
if (editor.isNew()) {
|
if (editor.isNew()) {
|
||||||
doAddFavorite(name, category, description);
|
doAddFavorite(name, category, description,address);
|
||||||
} else {
|
} else {
|
||||||
helper.editFavouriteName(favorite, name, category, description);
|
helper.editFavouriteName(favorite, name, category, description,address);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MapActivity mapActivity = getMapActivity();
|
MapActivity mapActivity = getMapActivity();
|
||||||
|
@ -245,7 +246,7 @@ public class FavoritePointEditorFragment extends PointEditorFragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doAddFavorite(String name, String category, String description) {
|
private void doAddFavorite(String name, String category, String description, String address) {
|
||||||
OsmandApplication app = getMyApplication();
|
OsmandApplication app = getMyApplication();
|
||||||
FavouritesDbHelper helper = getHelper();
|
FavouritesDbHelper helper = getHelper();
|
||||||
FavouritePoint favorite = getFavorite();
|
FavouritePoint favorite = getFavorite();
|
||||||
|
@ -253,6 +254,7 @@ public class FavoritePointEditorFragment extends PointEditorFragment {
|
||||||
favorite.setName(name);
|
favorite.setName(name);
|
||||||
favorite.setCategory(category);
|
favorite.setCategory(category);
|
||||||
favorite.setDescription(description);
|
favorite.setDescription(description);
|
||||||
|
favorite.setAddress(address);
|
||||||
app.getSettings().LAST_FAV_CATEGORY_ENTERED.set(category);
|
app.getSettings().LAST_FAV_CATEGORY_ENTERED.set(category);
|
||||||
helper.addFavourite(favorite);
|
helper.addFavourite(favorite);
|
||||||
}
|
}
|
||||||
|
|
|
@ -244,6 +244,7 @@ public class FavoritePointEditorFragmentNew extends PointEditorFragmentNew {
|
||||||
final FavouritePoint point = new FavouritePoint(favorite.getLatitude(), favorite.getLongitude(),
|
final FavouritePoint point = new FavouritePoint(favorite.getLatitude(), favorite.getLongitude(),
|
||||||
getNameTextValue(), getCategoryTextValue());
|
getNameTextValue(), getCategoryTextValue());
|
||||||
point.setDescription(getDescriptionTextValue());
|
point.setDescription(getDescriptionTextValue());
|
||||||
|
point.setAddress(getAddressTextValue());
|
||||||
point.setColor(color);
|
point.setColor(color);
|
||||||
point.setBackgroundType(backgroundType);
|
point.setBackgroundType(backgroundType);
|
||||||
point.setIconId(iconId);
|
point.setIconId(iconId);
|
||||||
|
@ -259,6 +260,7 @@ public class FavoritePointEditorFragmentNew extends PointEditorFragmentNew {
|
||||||
final FavouritePoint point = new FavouritePoint(favorite.getLatitude(), favorite.getLongitude(),
|
final FavouritePoint point = new FavouritePoint(favorite.getLatitude(), favorite.getLongitude(),
|
||||||
getNameTextValue(), getCategoryTextValue());
|
getNameTextValue(), getCategoryTextValue());
|
||||||
point.setDescription(getDescriptionTextValue());
|
point.setDescription(getDescriptionTextValue());
|
||||||
|
point.setAddress(getAddressTextValue());
|
||||||
point.setColor(color);
|
point.setColor(color);
|
||||||
point.setBackgroundType(backgroundType);
|
point.setBackgroundType(backgroundType);
|
||||||
point.setIconId(iconId);
|
point.setIconId(iconId);
|
||||||
|
@ -276,13 +278,13 @@ public class FavoritePointEditorFragmentNew extends PointEditorFragmentNew {
|
||||||
builder.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
|
builder.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
doSave(favorite, point.getName(), point.getCategory(), point.getDescription(),
|
doSave(favorite, point.getName(), point.getCategory(), point.getDescription(), point.getAddress(),
|
||||||
point.getColor(), point.getBackgroundType(), point.getIconId(), needDismiss);
|
point.getColor(), point.getBackgroundType(), point.getIconId(), needDismiss);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
builder.create().show();
|
builder.create().show();
|
||||||
} else {
|
} else {
|
||||||
doSave(favorite, point.getName(), point.getCategory(), point.getDescription(),
|
doSave(favorite, point.getName(), point.getCategory(), point.getDescription(), point.getAddress(),
|
||||||
point.getColor(), point.getBackgroundType(), point.getIconId(), needDismiss);
|
point.getColor(), point.getBackgroundType(), point.getIconId(), needDismiss);
|
||||||
}
|
}
|
||||||
saved = true;
|
saved = true;
|
||||||
|
@ -295,10 +297,11 @@ public class FavoritePointEditorFragmentNew extends PointEditorFragmentNew {
|
||||||
favorite.getName().equals(point.getName()) &&
|
favorite.getName().equals(point.getName()) &&
|
||||||
favorite.getCategory().equals(point.getCategory()) &&
|
favorite.getCategory().equals(point.getCategory()) &&
|
||||||
favorite.getBackgroundType().equals(point.getBackgroundType()) &&
|
favorite.getBackgroundType().equals(point.getBackgroundType()) &&
|
||||||
Algorithms.stringsEqual(favorite.getDescription(), point.getDescription());
|
Algorithms.stringsEqual(favorite.getDescription(), point.getDescription()) &&
|
||||||
|
Algorithms.stringsEqual(favorite.getAddress(), point.getAddress());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doSave(FavouritePoint favorite, String name, String category, String description,
|
private void doSave(FavouritePoint favorite, String name, String category, String description, String address,
|
||||||
@ColorInt int color, BackgroundType backgroundType, @DrawableRes int iconId, boolean needDismiss) {
|
@ColorInt int color, BackgroundType backgroundType, @DrawableRes int iconId, boolean needDismiss) {
|
||||||
FavouritesDbHelper helper = getHelper();
|
FavouritesDbHelper helper = getHelper();
|
||||||
FavoritePointEditor editor = getFavoritePointEditor();
|
FavoritePointEditor editor = getFavoritePointEditor();
|
||||||
|
@ -306,7 +309,7 @@ public class FavoritePointEditorFragmentNew extends PointEditorFragmentNew {
|
||||||
if (editor.isNew()) {
|
if (editor.isNew()) {
|
||||||
doAddFavorite(name, category, description, color, backgroundType, iconId);
|
doAddFavorite(name, category, description, color, backgroundType, iconId);
|
||||||
} else {
|
} else {
|
||||||
doEditFavorite(favorite, name, category, description, color, backgroundType, iconId, helper);
|
doEditFavorite(favorite, name, category, description, address, color, backgroundType, iconId, helper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MapActivity mapActivity = getMapActivity();
|
MapActivity mapActivity = getMapActivity();
|
||||||
|
@ -325,7 +328,7 @@ public class FavoritePointEditorFragmentNew extends PointEditorFragmentNew {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doEditFavorite(FavouritePoint favorite, String name, String category, String description,
|
private void doEditFavorite(FavouritePoint favorite, String name, String category, String description, String address,
|
||||||
@ColorInt int color, BackgroundType backgroundType, @DrawableRes int iconId,
|
@ColorInt int color, BackgroundType backgroundType, @DrawableRes int iconId,
|
||||||
FavouritesDbHelper helper) {
|
FavouritesDbHelper helper) {
|
||||||
OsmandApplication app = getMyApplication();
|
OsmandApplication app = getMyApplication();
|
||||||
|
@ -334,7 +337,7 @@ public class FavoritePointEditorFragmentNew extends PointEditorFragmentNew {
|
||||||
favorite.setColor(color);
|
favorite.setColor(color);
|
||||||
favorite.setBackgroundType(backgroundType);
|
favorite.setBackgroundType(backgroundType);
|
||||||
favorite.setIconId(iconId);
|
favorite.setIconId(iconId);
|
||||||
helper.editFavouriteName(favorite, name, category, description);
|
helper.editFavouriteName(favorite, name, category, description, address);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -408,7 +411,7 @@ public class FavoritePointEditorFragmentNew extends PointEditorFragmentNew {
|
||||||
@Override
|
@Override
|
||||||
public String getAddressInitValue() {
|
public String getAddressInitValue() {
|
||||||
FavouritePoint favourite = getFavorite();
|
FavouritePoint favourite = getFavorite();
|
||||||
return favorite != null ? favorite.getAddress() : "";
|
return favourite != null ? favourite.getAddress() : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -373,6 +373,12 @@ public abstract class PointEditorFragment extends BaseOsmAndFragment {
|
||||||
return Algorithms.isEmpty(res) ? null : res;
|
return Algorithms.isEmpty(res) ? null : res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getAddressTextValue() {
|
||||||
|
EditText addressEdit = (EditText) view.findViewById(R.id.address_edit);
|
||||||
|
String res = addressEdit.getText().toString().trim();
|
||||||
|
return Algorithms.isEmpty(res) ? null : res;
|
||||||
|
}
|
||||||
|
|
||||||
protected Drawable getPaintedIcon(int iconId, int color) {
|
protected Drawable getPaintedIcon(int iconId, int color) {
|
||||||
return getPaintedContentIcon(iconId, color);
|
return getPaintedContentIcon(iconId, color);
|
||||||
}
|
}
|
||||||
|
|
|
@ -241,9 +241,9 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
addDelDescription.setTextColor(getResources().getColor(activeColorResId));
|
addDelDescription.setTextColor(getResources().getColor(activeColorResId));
|
||||||
addAddressBtn.setTextColor(getResources().getColor(activeColorResId));
|
addAddressBtn.setTextColor(getResources().getColor(activeColorResId));
|
||||||
addAddressBtn.setCompoundDrawablesWithIntrinsicBounds(
|
addAddressBtn.setCompoundDrawablesWithIntrinsicBounds(
|
||||||
app.getUIUtilities().getIcon(R.drawable.ic_action_location_off, activeColorResId),null,null,null);
|
app.getUIUtilities().getIcon(R.drawable.ic_action_location_16, activeColorResId),null,null,null);
|
||||||
addDelDescription.setCompoundDrawablesWithIntrinsicBounds(
|
addDelDescription.setCompoundDrawablesWithIntrinsicBounds(
|
||||||
app.getUIUtilities().getIcon(R.drawable.ic_action_description, activeColorResId),null,null,null);
|
app.getUIUtilities().getIcon(R.drawable.ic_action_description_16, activeColorResId),null,null,null);
|
||||||
addDelDescription.setOnClickListener(new View.OnClickListener() {
|
addDelDescription.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -251,7 +251,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
descriptionCaption.setVisibility(View.VISIBLE);
|
descriptionCaption.setVisibility(View.VISIBLE);
|
||||||
addDelDescription.setText(view.getResources().getString(R.string.delete_description));
|
addDelDescription.setText(view.getResources().getString(R.string.delete_description));
|
||||||
addDelDescription.setCompoundDrawablesWithIntrinsicBounds(
|
addDelDescription.setCompoundDrawablesWithIntrinsicBounds(
|
||||||
app.getUIUtilities().getIcon(R.drawable.ic_action_delete_item,
|
app.getUIUtilities().getIcon(R.drawable.ic_action_trash_basket_16,
|
||||||
activeColorResId),null,null,null);
|
activeColorResId),null,null,null);
|
||||||
View descriptionEdit = view.findViewById(R.id.description_edit);
|
View descriptionEdit = view.findViewById(R.id.description_edit);
|
||||||
descriptionEdit.requestFocus();
|
descriptionEdit.requestFocus();
|
||||||
|
@ -260,7 +260,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
descriptionCaption.setVisibility(View.GONE);
|
descriptionCaption.setVisibility(View.GONE);
|
||||||
addDelDescription.setText(view.getResources().getString(R.string.add_description));
|
addDelDescription.setText(view.getResources().getString(R.string.add_description));
|
||||||
addDelDescription.setCompoundDrawablesWithIntrinsicBounds(
|
addDelDescription.setCompoundDrawablesWithIntrinsicBounds(
|
||||||
app.getUIUtilities().getIcon(R.drawable.ic_action_location_off,
|
app.getUIUtilities().getIcon(R.drawable.ic_action_description_16,
|
||||||
activeColorResId),null,null,null);
|
activeColorResId),null,null,null);
|
||||||
AndroidUtils.hideSoftKeyboard(requireActivity(), descriptionEdit);
|
AndroidUtils.hideSoftKeyboard(requireActivity(), descriptionEdit);
|
||||||
descriptionEdit.clearFocus();
|
descriptionEdit.clearFocus();
|
||||||
|
@ -275,7 +275,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
addAddressBtn.setText(view.getResources().getString(R.string.delete_address));
|
addAddressBtn.setText(view.getResources().getString(R.string.delete_address));
|
||||||
View addressEdit = view.findViewById(R.id.address_edit);
|
View addressEdit = view.findViewById(R.id.address_edit);
|
||||||
addressEdit.requestFocus();
|
addressEdit.requestFocus();
|
||||||
AndroidUtils.softKeyboardDelayed(addressEdit);
|
AndroidUtils.softKeyboardDelayed(requireActivity(),addressEdit);
|
||||||
} else {
|
} else {
|
||||||
addressCaption.setVisibility(View.GONE);
|
addressCaption.setVisibility(View.GONE);
|
||||||
addAddressBtn.setText(view.getResources().getString(R.string.add_address));
|
addAddressBtn.setText(view.getResources().getString(R.string.add_address));
|
||||||
|
@ -848,6 +848,12 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
return Algorithms.isEmpty(res) ? null : res;
|
return Algorithms.isEmpty(res) ? null : res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getAddressTextValue() {
|
||||||
|
EditText addressEdit = view.findViewById(R.id.address_edit);
|
||||||
|
String res = addressEdit.getText().toString().trim();
|
||||||
|
return Algorithms.isEmpty(res) ? null : res;
|
||||||
|
}
|
||||||
|
|
||||||
protected Drawable getPaintedIcon(int iconId, int color) {
|
protected Drawable getPaintedIcon(int iconId, int color) {
|
||||||
return getPaintedContentIcon(iconId, color);
|
return getPaintedContentIcon(iconId, color);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue