Merge pull request #8552 from osmandapp/Fix_6669_save_button
Fix 6669 OSM Editing screen: show Save button above keyboard.
This commit is contained in:
commit
1598a6d5d3
3 changed files with 72 additions and 17 deletions
|
@ -19,10 +19,15 @@
|
||||||
app:contentInsetLeft="@dimen/settings_divider_margin_start"
|
app:contentInsetLeft="@dimen/settings_divider_margin_start"
|
||||||
app:contentInsetStart="@dimen/settings_divider_margin_start"/>
|
app:contentInsetStart="@dimen/settings_divider_margin_start"/>
|
||||||
|
|
||||||
<android.support.design.widget.CoordinatorLayout
|
<ScrollView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
android:fillViewport="true">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<android.support.design.widget.AppBarLayout
|
<android.support.design.widget.AppBarLayout
|
||||||
|
@ -43,8 +48,8 @@
|
||||||
android:importantForAutofill="noExcludeDescendants"
|
android:importantForAutofill="noExcludeDescendants"
|
||||||
android:layout_marginLeft="@dimen/settings_divider_margin_start"
|
android:layout_marginLeft="@dimen/settings_divider_margin_start"
|
||||||
android:layout_marginRight="@dimen/content_padding"
|
android:layout_marginRight="@dimen/content_padding"
|
||||||
android:layout_marginStart="@dimen/settings_divider_margin_start"
|
android:layout_marginStart="@dimen/settings_divider_margin_start"
|
||||||
android:layout_marginEnd="@dimen/content_padding">
|
android:layout_marginEnd="@dimen/content_padding">
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/poiNameEditText"
|
android:id="@+id/poiNameEditText"
|
||||||
|
@ -81,7 +86,7 @@
|
||||||
android:importantForAutofill="noExcludeDescendants"
|
android:importantForAutofill="noExcludeDescendants"
|
||||||
android:layout_marginLeft="24dp"
|
android:layout_marginLeft="24dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_marginStart="24dp">
|
android:layout_marginStart="24dp">
|
||||||
|
|
||||||
<AutoCompleteTextView
|
<AutoCompleteTextView
|
||||||
android:id="@+id/poiTypeEditText"
|
android:id="@+id/poiTypeEditText"
|
||||||
|
@ -93,7 +98,7 @@
|
||||||
android:imeOptions="actionSend"
|
android:imeOptions="actionSend"
|
||||||
android:inputType="text"
|
android:inputType="text"
|
||||||
tools:text="@string/lorem_ipsum"
|
tools:text="@string/lorem_ipsum"
|
||||||
android:drawableEnd="@drawable/ic_action_arrow_drop_down" />
|
android:drawableEnd="@drawable/ic_action_arrow_drop_down" />
|
||||||
|
|
||||||
</android.support.design.widget.TextInputLayout>
|
</android.support.design.widget.TextInputLayout>
|
||||||
|
|
||||||
|
@ -118,14 +123,12 @@
|
||||||
app:tabTextColor="@android:color/darker_gray"/>
|
app:tabTextColor="@android:color/darker_gray"/>
|
||||||
</android.support.design.widget.AppBarLayout>
|
</android.support.design.widget.AppBarLayout>
|
||||||
|
|
||||||
|
<net.osmand.plus.osmedit.EditPoiViewPager
|
||||||
<android.support.v4.view.ViewPager
|
android:id="@+id/viewpager"
|
||||||
android:id="@+id/viewpager"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="match_parent"
|
android:layout_height="wrap_content" />
|
||||||
android:layout_height="match_parent"
|
</LinearLayout>
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
|
</ScrollView>
|
||||||
|
|
||||||
</android.support.design.widget.CoordinatorLayout>
|
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/buttonDivider"
|
android:id="@+id/buttonDivider"
|
||||||
|
@ -149,7 +152,7 @@
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
app:textAllCapsCompat="true"
|
app:textAllCapsCompat="true"
|
||||||
tools:visibility="visible"
|
tools:visibility="visible"
|
||||||
android:layout_marginStart="@dimen/showAllButtonMarginRight" />
|
android:layout_marginStart="@dimen/showAllButtonMarginRight" />
|
||||||
|
|
||||||
<Space
|
<Space
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
|
|
@ -104,7 +104,7 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private EditPoiData editPoiData;
|
private EditPoiData editPoiData;
|
||||||
private ViewPager viewPager;
|
private EditPoiViewPager viewPager;
|
||||||
private AutoCompleteTextView poiTypeEditText;
|
private AutoCompleteTextView poiTypeEditText;
|
||||||
|
|
||||||
private OpenstreetmapUtil mOpenstreetmapUtil;
|
private OpenstreetmapUtil mOpenstreetmapUtil;
|
||||||
|
@ -153,7 +153,7 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
viewPager = (ViewPager) view.findViewById(R.id.viewpager);
|
viewPager = (EditPoiViewPager) view.findViewById(R.id.viewpager);
|
||||||
String basicTitle = getResources().getString(R.string.tab_title_basic);
|
String basicTitle = getResources().getString(R.string.tab_title_basic);
|
||||||
String extendedTitle = getResources().getString(R.string.tab_title_advanced);
|
String extendedTitle = getResources().getString(R.string.tab_title_advanced);
|
||||||
final MyAdapter pagerAdapter = new MyAdapter(getChildFragmentManager(), basicTitle, extendedTitle);
|
final MyAdapter pagerAdapter = new MyAdapter(getChildFragmentManager(), basicTitle, extendedTitle);
|
||||||
|
|
52
OsmAnd/src/net/osmand/plus/osmedit/EditPoiViewPager.java
Normal file
52
OsmAnd/src/net/osmand/plus/osmedit/EditPoiViewPager.java
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
package net.osmand.plus.osmedit;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.support.v4.view.ViewPager;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
public class EditPoiViewPager extends ViewPager {
|
||||||
|
public EditPoiViewPager(Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public EditPoiViewPager(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||||
|
int height = 0;
|
||||||
|
View view = null;
|
||||||
|
for (int i = 0; i < getChildCount(); i++) {
|
||||||
|
view = getChildAt(i);
|
||||||
|
view.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
|
||||||
|
int h = view.getMeasuredHeight();
|
||||||
|
if (h > height) height = h;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (height != 0) {
|
||||||
|
heightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY);
|
||||||
|
}
|
||||||
|
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||||
|
setMeasuredDimension(getMeasuredWidth(), measureHeight(heightMeasureSpec, view));
|
||||||
|
}
|
||||||
|
|
||||||
|
private int measureHeight(int measureSpec, View view) {
|
||||||
|
int result = 0;
|
||||||
|
int specMode = MeasureSpec.getMode(measureSpec);
|
||||||
|
int specSize = MeasureSpec.getSize(measureSpec);
|
||||||
|
|
||||||
|
if (specMode == MeasureSpec.EXACTLY) {
|
||||||
|
result = specSize;
|
||||||
|
} else {
|
||||||
|
if (view != null) {
|
||||||
|
result = view.getMeasuredHeight();
|
||||||
|
}
|
||||||
|
if (specMode == MeasureSpec.AT_MOST) {
|
||||||
|
result = Math.min(result, specSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue