This commit is contained in:
parent
27dbf3ee93
commit
f04f0512dc
3 changed files with 283 additions and 244 deletions
|
@ -71,7 +71,7 @@
|
|||
</provider>
|
||||
|
||||
<activity android:name="net.osmand.plus.activities.MapActivity" android:label="@string/app_name"
|
||||
android:screenOrientation="unspecified" android:launchMode="singleTop">
|
||||
android:screenOrientation="unspecified" android:launchMode="singleTop" android:windowSoftInputMode="adjustResize">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<action android:name="android.intent.action.SEND" />
|
||||
|
|
|
@ -1,12 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<FrameLayout
|
||||
android:id="@+id/point_edit_layout"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="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">
|
||||
|
||||
<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"
|
||||
|
@ -38,21 +44,39 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="right"
|
||||
android:background="@android:color/transparent"
|
||||
android:drawableLeft="@drawable/ic_action_done"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:background="@android:color/transparent"
|
||||
android:text="@string/shared_string_save"/>
|
||||
|
||||
|
||||
</android.support.v7.widget.Toolbar>
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/editor_scroll_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/editor_scroll_view_header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="550dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/main_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:clickable="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
|
@ -70,21 +94,21 @@
|
|||
android:id="@+id/header_caption"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
tools:text="Point info"
|
||||
android:layout_weight="1"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"/>
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
tools:text="Point info"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_replace"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:textColor="?attr/contextMenuButtonColor"
|
||||
android:text="@string/update_existing"
|
||||
android:textColor="?attr/contextMenuButtonColor"
|
||||
android:visibility="gone"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -104,9 +128,9 @@
|
|||
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:layout_marginTop="2dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_action_building_number"/>
|
||||
|
||||
|
@ -133,14 +157,14 @@
|
|||
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:layout_marginRight="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="text"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textColorHint="?android:textColorSecondary"
|
||||
tools:text="Name"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="text"/>
|
||||
tools:text="Name"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -162,9 +186,9 @@
|
|||
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:layout_marginTop="2dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_action_building_number"/>
|
||||
|
||||
|
@ -191,11 +215,11 @@
|
|||
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"
|
||||
android:editable="false"
|
||||
android:drawableRight="@drawable/ic_action_arrow_drop_down"/>
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:drawableRight="@drawable/ic_action_arrow_drop_down"
|
||||
android:editable="false"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -211,8 +235,8 @@
|
|||
android:id="@+id/description_info_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:baselineAligned="false"
|
||||
android:background="?attr/ctx_menu_info_view_bg"
|
||||
android:baselineAligned="false"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
|
@ -243,13 +267,13 @@
|
|||
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:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:inputType="textMultiLine"
|
||||
android:maxLines="8"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textColorHint="?android:textColorSecondary"
|
||||
android:inputType="textMultiLine"/>
|
||||
android:textColorHint="?android:textColorSecondary"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -260,4 +284,10 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
|
@ -3,7 +3,6 @@ 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;
|
||||
|
@ -39,8 +38,6 @@ import net.osmand.plus.views.OsmandMapTileView;
|
|||
import net.osmand.plus.widgets.AutoCompleteTextViewEx;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
import static android.util.TypedValue.COMPLEX_UNIT_DIP;
|
||||
|
||||
public abstract class PointEditorFragment extends Fragment {
|
||||
|
||||
private View view;
|
||||
|
@ -68,7 +65,7 @@ public abstract class PointEditorFragment extends Fragment {
|
|||
}
|
||||
|
||||
View editorScrollView = view.findViewById(R.id.editor_scroll_view);
|
||||
if (editorScrollView != null) {
|
||||
if (editorScrollView != null && getEditor().isLandscapeLayout()) {
|
||||
if (getEditor().isLight()) {
|
||||
editorScrollView.setBackgroundColor(getResources().getColor(R.color.ctx_menu_info_view_bg_light));
|
||||
} else {
|
||||
|
@ -95,6 +92,16 @@ public abstract class PointEditorFragment extends Fragment {
|
|||
}
|
||||
});
|
||||
|
||||
View scrollViewHeader = view.findViewById(R.id.editor_scroll_view_header);
|
||||
if (scrollViewHeader != null) {
|
||||
scrollViewHeader.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Button saveButton = (Button) toolbar.findViewById(R.id.save_button);
|
||||
saveButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -224,7 +231,7 @@ public abstract class PointEditorFragment extends Fragment {
|
|||
RotatedTileBox box = map.getCurrentRotatedTileBox();
|
||||
int origMarkerY = (int)box.getPixYFromLatLon(markerLat, markerLon);
|
||||
|
||||
int markerPaddingPx = dpToPx(MapContextMenuFragment.MARKER_PADDING_DP);
|
||||
int markerPaddingPx = AndroidUtils.dpToPx(getMapActivity(), MapContextMenuFragment.MARKER_PADDING_DP);
|
||||
|
||||
int y = view.getHeight() - mainViewHeight;
|
||||
|
||||
|
@ -272,12 +279,24 @@ public abstract class PointEditorFragment extends Fragment {
|
|||
} else {
|
||||
obs.removeGlobalOnLayoutListener(this);
|
||||
}
|
||||
updateScrollHeaderHeight();
|
||||
adjustMapPosition(true);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private void updateScrollHeaderHeight() {
|
||||
View scrollViewHeader = view.findViewById(R.id.editor_scroll_view_header);
|
||||
if (scrollViewHeader != null) {
|
||||
View scrollView = view.findViewById(R.id.editor_scroll_view);
|
||||
int headerHeight = scrollView.getHeight() - mainViewHeight;
|
||||
ViewGroup.LayoutParams p = scrollViewHeader.getLayoutParams();
|
||||
p.height = headerHeight;
|
||||
scrollViewHeader.setLayoutParams(p);
|
||||
}
|
||||
}
|
||||
|
||||
private void hideKeyboard() {
|
||||
InputMethodManager inputMethodManager = (InputMethodManager) getActivity().getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||
if (inputMethodManager != null) {
|
||||
|
@ -385,16 +404,6 @@ public abstract class PointEditorFragment extends Fragment {
|
|||
return Algorithms.isEmpty(res) ? null : res;
|
||||
}
|
||||
|
||||
// Utils
|
||||
private int dpToPx(float dp) {
|
||||
Resources r = getActivity().getResources();
|
||||
return (int) TypedValue.applyDimension(
|
||||
COMPLEX_UNIT_DIP,
|
||||
dp,
|
||||
r.getDisplayMetrics()
|
||||
);
|
||||
}
|
||||
|
||||
protected Drawable getPaintedIcon(int iconId, int color) {
|
||||
IconsCache iconsCache = getMapActivity().getMyApplication().getIconsCache();
|
||||
return iconsCache.getPaintedContentIcon(iconId, color);
|
||||
|
|
Loading…
Reference in a new issue