Merge branch 'master' of https://github.com/osmandapp/Osmand
This commit is contained in:
commit
07faee07c4
12 changed files with 364 additions and 46 deletions
246
OsmAnd/res/layout/point_editor_fragment_land.xml
Normal file
246
OsmAnd/res/layout/point_editor_fragment_land.xml
Normal file
|
@ -0,0 +1,246 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/point_edit_layout"
|
||||
android:layout_width="350dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/transparent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="@dimen/dashboard_map_toolbar"
|
||||
android:background="?attr/pstsTabBackground"
|
||||
android:minHeight="@dimen/dashboard_map_toolbar"
|
||||
android:theme="?attr/toolbar_theme"
|
||||
app:contentInsetLeft="72dp"
|
||||
app:contentInsetStart="72dp">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/delete_button"
|
||||
android:layout_width="?attr/actionBarSize"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="right"
|
||||
android:background="@android:color/transparent"
|
||||
android:src="@drawable/ic_action_delete_dark"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/save_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="right"
|
||||
android:background="@android:color/transparent"
|
||||
android:text="@string/shared_string_save"/>
|
||||
|
||||
</android.support.v7.widget.Toolbar>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/ctx_menu_info_view_bg"
|
||||
android:fillViewport="true">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/main_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/title_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/bg_point_editor_view"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/header_caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="Point info"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:baselineAligned="false"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="42dp"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/name_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_action_building_number"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name_caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginRight="12dp"
|
||||
android:text="@string/favourites_edit_dialog_name"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_list_text_size"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/name_edit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textColorHint="?android:textColorSecondary"
|
||||
android:inputType="text"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:baselineAligned="false"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="42dp"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/category_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_action_building_number"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/category_caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginRight="12dp"
|
||||
android:text="@string/favourites_edit_dialog_name"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_list_text_size"/>
|
||||
|
||||
<net.osmand.plus.widgets.AutoCompleteTextViewEx
|
||||
android:id="@+id/category_edit"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginLeft="8dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:baselineAligned="false"
|
||||
android:background="?attr/ctx_menu_info_view_bg"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="42dp"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/description_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_action_note_dark"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/description_edit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:maxLines="8"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textColorHint="?android:textColorSecondary"
|
||||
android:inputType="textMultiLine"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
|
@ -2138,7 +2138,7 @@
|
|||
<string name="simulate_your_location_descr">Simuler ved brug af optaget GPX eller beregnet rute</string>
|
||||
<string name="downloads_left_template">%1$s filhentninger tilbage</string>
|
||||
<string name="roads">Veje</string>
|
||||
<string name="favourites_edit_dialog_title">Favorit information</string>
|
||||
<string name="favourites_edit_dialog_title">Favoritinformation</string>
|
||||
<string name="favourites_context_menu_add">Tilføj favorit</string>
|
||||
<string name="shared_string_trip_recording">Optag ture</string>
|
||||
<string name="shared_string_navigation">Navigation</string>
|
||||
|
|
|
@ -894,4 +894,5 @@
|
|||
<string name="shared_string_show_details">Näytä tiedot</string>
|
||||
<string name="layer_amenity_label">POI-nimet</string>
|
||||
<string name="context_menu_item_directions_to">Navigoi kohteeseen</string>
|
||||
</resources>
|
||||
<string name="interrupt_music">Keskeytä musiikki</string>
|
||||
</resources>
|
||||
|
|
|
@ -2140,7 +2140,7 @@ Si consiglia di aggiungere uno o più punti intermedi per migliorarne le prestaz
|
|||
<string name="rendering_value_boldOutline_name">Contorno in grassetto</string>
|
||||
<string name="traffic_warning_hazard">Pericolo</string>
|
||||
<string name="dahboard_options_dialog_title">Configura il pannello di controllo</string>
|
||||
<string name="shared_string_card_was_hidden">La carta era nascosta</string>
|
||||
<string name="shared_string_card_was_hidden">La scheda è stata nascosta</string>
|
||||
<string name="shared_string_undo">Annulla azione</string>
|
||||
<string name="shared_string_skip">Salta</string>
|
||||
<string name="app_name_osmand">OsmAnd</string>
|
||||
|
@ -2158,14 +2158,14 @@ Si consiglia di aggiungere uno o più punti intermedi per migliorarne le prestaz
|
|||
<string name="closing_at">Chiude alle</string>
|
||||
<string name="av_locations_descr">File GPX con note locali</string>
|
||||
<string name="av_locations">Località</string>
|
||||
<string name="tag_poi_name">Nome</string>
|
||||
<string name="tag_poi_name">nome</string>
|
||||
<string name="tag_poi_amenity">amenità</string>
|
||||
<string name="contact_info">Informazioni di contatto</string>
|
||||
<string name="description">Descrizione</string>
|
||||
<string name="add_opening_hours">Aggiungi orari di apertura</string>
|
||||
<string name="poi_dialog_poi_type">Tipo di PDI</string>
|
||||
<string name="number_of_rows_in_dash">Numero di righe del cruscotto %1$s</string>
|
||||
<string name="please_specify_poi_type">Per favore specifica il tipo si PDI.</string>
|
||||
<string name="please_specify_poi_type">Per favore specifica il tipo di PDI.</string>
|
||||
<string name="poi_action_delete">elimina</string>
|
||||
<string name="working_days">Giorni lavorativi</string>
|
||||
<string name="recent_places">Luoghi recenti</string>
|
||||
|
|
|
@ -27,6 +27,16 @@ public class FavouritePoint implements Serializable, LocationPoint {
|
|||
this.name = name;
|
||||
}
|
||||
|
||||
public FavouritePoint(FavouritePoint favouritePoint) {
|
||||
this.latitude = favouritePoint.latitude;
|
||||
this.longitude = favouritePoint.longitude;
|
||||
this.category = favouritePoint.category;
|
||||
this.name = favouritePoint.name;
|
||||
this.color = favouritePoint.color;
|
||||
this.description = favouritePoint.description;
|
||||
this.visible = favouritePoint.visible;
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import android.app.Activity;
|
|||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.util.Log;
|
||||
|
||||
import net.osmand.Location;
|
||||
import net.osmand.ResultMatcher;
|
||||
|
@ -52,7 +53,7 @@ public class MapContextMenu {
|
|||
private static final String KEY_CTX_MENU_STREET_STR = "key_ctx_menu_street_str";
|
||||
|
||||
public boolean isMenuVisible() {
|
||||
return mapActivity.getSupportFragmentManager().findFragmentByTag("MapContextMenuFragment") != null;
|
||||
return findMenuFragment() != null;
|
||||
}
|
||||
|
||||
public PointDescription getPointDescription() {
|
||||
|
@ -107,8 +108,9 @@ public class MapContextMenu {
|
|||
|
||||
public void hide() {
|
||||
MapContextMenuFragment fragment = findMenuFragment();
|
||||
if (fragment != null)
|
||||
if (fragment != null) {
|
||||
fragment.dismissMenu();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean needStreetName() {
|
||||
|
@ -138,11 +140,12 @@ public class MapContextMenu {
|
|||
}
|
||||
|
||||
private MapContextMenuFragment findMenuFragment() {
|
||||
Fragment fragment = mapActivity.getSupportFragmentManager().findFragmentByTag("MapContextMenuFragment");
|
||||
if (fragment != null)
|
||||
return (MapContextMenuFragment)fragment;
|
||||
else
|
||||
Fragment fragment = mapActivity.getSupportFragmentManager().findFragmentByTag(MapContextMenuFragment.TAG);
|
||||
if (fragment != null) {
|
||||
return (MapContextMenuFragment) fragment;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public int getLeftIconId() {
|
||||
|
@ -335,8 +338,11 @@ public class MapContextMenu {
|
|||
|
||||
public void saveMenuState(Bundle bundle) {
|
||||
if (object != null) {
|
||||
if (object instanceof Amenity)
|
||||
bundle.putSerializable(KEY_CTX_MENU_OBJECT, (Amenity)object);
|
||||
if (object instanceof Amenity) {
|
||||
bundle.putSerializable(KEY_CTX_MENU_OBJECT, (Amenity) object);
|
||||
} else if (object instanceof FavouritePoint) {
|
||||
bundle.putSerializable(KEY_CTX_MENU_OBJECT, (FavouritePoint) object);
|
||||
}
|
||||
}
|
||||
bundle.putSerializable(KEY_CTX_MENU_POINT_DESC, pointDescription);
|
||||
bundle.putSerializable(KEY_CTX_MENU_NAME_STR, nameStr);
|
||||
|
|
|
@ -10,6 +10,7 @@ import android.os.Build;
|
|||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.TypedValue;
|
||||
import android.view.GestureDetector;
|
||||
|
@ -511,7 +512,7 @@ public class MapContextMenuFragment extends Fragment {
|
|||
public void dismissMenu() {
|
||||
FragmentActivity activity = getActivity();
|
||||
if (activity != null) {
|
||||
activity.getSupportFragmentManager().popBackStack();
|
||||
activity.getSupportFragmentManager().popBackStack(TAG, FragmentManager.POP_BACK_STACK_INCLUSIVE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -540,8 +541,8 @@ public class MapContextMenuFragment extends Fragment {
|
|||
MapContextMenuFragment fragment = new MapContextMenuFragment();
|
||||
mapActivity.getSupportFragmentManager().beginTransaction()
|
||||
.setCustomAnimations(slideInAnim, slideOutAnim, slideInAnim, slideOutAnim)
|
||||
.add(R.id.fragmentContainer, fragment, "MapContextMenuFragment")
|
||||
.addToBackStack(null).commit();
|
||||
.add(R.id.fragmentContainer, fragment, TAG)
|
||||
.addToBackStack(TAG).commit();
|
||||
}
|
||||
|
||||
private MapContextMenu getCtxMenu() {
|
||||
|
|
|
@ -11,7 +11,8 @@ public class FavoritePointEditor extends PointEditor {
|
|||
|
||||
private FavouritePoint favorite;
|
||||
|
||||
public static final String FRAGMENT_NAME = "FavoritePointEditorFragment";
|
||||
public static final String TAG = "FavoritePointEditorFragment";
|
||||
private static final String KEY_CTX_EDIT_FAV_OBJECT = "key_ctx_edit_fav_object";
|
||||
|
||||
public FavoritePointEditor(OsmandApplication app, MapActivity mapActivity) {
|
||||
super(app, mapActivity);
|
||||
|
@ -19,17 +20,21 @@ public class FavoritePointEditor extends PointEditor {
|
|||
|
||||
@Override
|
||||
public void saveState(Bundle bundle) {
|
||||
bundle.putSerializable(KEY_CTX_EDIT_FAV_OBJECT, favorite);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreState(Bundle bundle) {
|
||||
|
||||
Object object = bundle.getSerializable(KEY_CTX_EDIT_FAV_OBJECT);
|
||||
if (object != null) {
|
||||
favorite = (FavouritePoint)object;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFragmentName() {
|
||||
return FRAGMENT_NAME;
|
||||
public String getFragmentTag() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
public FavouritePoint getFavorite() {
|
||||
|
|
|
@ -6,8 +6,10 @@ import android.content.DialogInterface;
|
|||
import android.content.res.Resources;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
|
||||
import net.osmand.data.FavouritePoint;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.FavouritesDbHelper;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
|
@ -28,6 +30,11 @@ public class FavoritePointEditorFragment extends PointEditorFragment {
|
|||
super.onAttach(activity);
|
||||
helper = getMyApplication().getFavorites();
|
||||
editor = getMapActivity().getFavoritePointEditor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
favorite = editor.getFavorite();
|
||||
}
|
||||
|
||||
|
@ -53,7 +60,7 @@ public class FavoritePointEditorFragment extends PointEditorFragment {
|
|||
FavoritePointEditorFragment fragment = new FavoritePointEditorFragment();
|
||||
mapActivity.getSupportFragmentManager().beginTransaction()
|
||||
//.setCustomAnimations(slideInAnim, slideOutAnim, slideInAnim, slideOutAnim)
|
||||
.add(R.id.fragmentContainer, fragment, editor.getFragmentName())
|
||||
.add(R.id.fragmentContainer, fragment, editor.getFragmentTag())
|
||||
.addToBackStack(null).commit();
|
||||
}
|
||||
|
||||
|
@ -82,32 +89,33 @@ public class FavoritePointEditorFragment extends PointEditorFragment {
|
|||
builder.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
if (editor.isNew()) {
|
||||
doAddFavorite(point.getName(), point.getCategory(), point.getDescription());
|
||||
} else {
|
||||
helper.editFavouriteName(favorite, point.getName(), point.getCategory(), point.getDescription());
|
||||
}
|
||||
getMapActivity().getMapView().refreshMap(true);
|
||||
if (needDismiss) {
|
||||
dismiss(true);
|
||||
}
|
||||
doSave(favorite, point.getName(), point.getCategory(), point.getDescription(), needDismiss);
|
||||
}
|
||||
});
|
||||
builder.create().show();
|
||||
} else {
|
||||
if (editor.isNew()) {
|
||||
doAddFavorite(point.getName(), point.getCategory(), point.getDescription());
|
||||
} else {
|
||||
helper.editFavouriteName(favorite, point.getName(), point.getCategory(), point.getDescription());
|
||||
}
|
||||
getMapActivity().getMapView().refreshMap(true);
|
||||
if (needDismiss) {
|
||||
dismiss(true);
|
||||
}
|
||||
doSave(favorite, point.getName(), point.getCategory(), point.getDescription(), needDismiss);
|
||||
}
|
||||
saved = true;
|
||||
}
|
||||
|
||||
private void doSave(FavouritePoint favorite, String name, String category, String description, boolean needDismiss) {
|
||||
if (editor.isNew()) {
|
||||
doAddFavorite(name, category, description);
|
||||
} else {
|
||||
helper.editFavouriteName(favorite, name, category, description);
|
||||
}
|
||||
getMapActivity().getMapView().refreshMap(true);
|
||||
if (needDismiss) {
|
||||
dismiss(false);
|
||||
}
|
||||
|
||||
PointDescription pointDescription = favorite.getPointDescription();
|
||||
pointDescription.setLat(favorite.getLatitude());
|
||||
pointDescription.setLon(favorite.getLongitude());
|
||||
getMapActivity().getContextMenu().show(pointDescription, new FavouritePoint(favorite));
|
||||
}
|
||||
|
||||
private void doAddFavorite(String name, String category, String description) {
|
||||
favorite.setName(name);
|
||||
favorite.setCategory(category);
|
||||
|
|
|
@ -13,7 +13,6 @@ public abstract class PointEditor {
|
|||
protected OsmandApplication app;
|
||||
protected final MapActivity mapActivity;
|
||||
|
||||
protected Object object;
|
||||
protected boolean isNew;
|
||||
|
||||
private boolean portraitMode;
|
||||
|
@ -53,10 +52,10 @@ public abstract class PointEditor {
|
|||
public abstract void saveState(Bundle bundle);
|
||||
public abstract void restoreState(Bundle bundle);
|
||||
|
||||
public abstract String getFragmentName();
|
||||
public abstract String getFragmentTag();
|
||||
|
||||
public void hide() {
|
||||
Fragment fragment = mapActivity.getSupportFragmentManager().findFragmentByTag(getFragmentName());
|
||||
Fragment fragment = mapActivity.getSupportFragmentManager().findFragmentByTag(getFragmentTag());
|
||||
if (fragment != null)
|
||||
((PointEditorFragment)fragment).dismiss();
|
||||
}
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
package net.osmand.plus.mapcontextmenu.editors;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -14,8 +17,11 @@ import android.view.ViewGroup;
|
|||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.plus.FavouritesDbHelper;
|
||||
|
@ -23,11 +29,14 @@ import net.osmand.plus.IconsCache;
|
|||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
import net.osmand.plus.widgets.AutoCompleteTextViewEx;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static android.util.TypedValue.COMPLEX_UNIT_DIP;
|
||||
|
||||
public abstract class PointEditorFragment extends Fragment {
|
||||
|
||||
@Override
|
||||
|
@ -36,16 +45,26 @@ public abstract class PointEditorFragment extends Fragment {
|
|||
getEditor().saveState(outState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (savedInstanceState != null)
|
||||
getEditor().restoreState(savedInstanceState);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
if (savedInstanceState != null)
|
||||
getEditor().restoreState(savedInstanceState);
|
||||
|
||||
View view = inflater.inflate(R.layout.point_editor_fragment, container, false);
|
||||
getActivity().findViewById(R.id.MapHudButtonsOverlay).setVisibility(View.INVISIBLE);
|
||||
|
||||
View view;
|
||||
if (getEditor().isLandscapeLayout()) {
|
||||
view = inflater.inflate(R.layout.point_editor_fragment_land, container, false);
|
||||
} else {
|
||||
view = inflater.inflate(R.layout.point_editor_fragment, container, false);
|
||||
}
|
||||
Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
|
||||
toolbar.setTitle(getToolbarTitle());
|
||||
toolbar.setNavigationIcon(getMyApplication().getIconsCache().getIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha));
|
||||
|
@ -128,6 +147,8 @@ public abstract class PointEditorFragment extends Fragment {
|
|||
save(false);
|
||||
}
|
||||
super.onDestroyView();
|
||||
|
||||
getActivity().findViewById(R.id.MapHudButtonsOverlay).setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
protected void savePressed() {
|
||||
|
@ -212,4 +233,20 @@ public abstract class PointEditorFragment extends Fragment {
|
|||
return Algorithms.isEmpty(res) ? null : res;
|
||||
}
|
||||
|
||||
// Utils
|
||||
private int getScreenHeight() {
|
||||
DisplayMetrics dm = new DisplayMetrics();
|
||||
getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
|
||||
return dm.heightPixels;
|
||||
}
|
||||
|
||||
private int dpToPx(float dp) {
|
||||
Resources r = getActivity().getResources();
|
||||
return (int) TypedValue.applyDimension(
|
||||
COMPLEX_UNIT_DIP,
|
||||
dp,
|
||||
r.getDisplayMetrics()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
package net.osmand.plus.mapcontextmenu.editors.dialogs;
|
||||
|
||||
public class CategoryDialogs {
|
||||
|
||||
}
|
Loading…
Reference in a new issue