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:contentInsetStart="@dimen/settings_divider_margin_start"/>
|
||||
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
android:layout_width="match_parent"
|
||||
<ScrollView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:fillViewport="true">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
|
@ -118,14 +123,12 @@
|
|||
app:tabTextColor="@android:color/darker_gray"/>
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
|
||||
<android.support.v4.view.ViewPager
|
||||
<net.osmand.plus.osmedit.EditPoiViewPager
|
||||
android:id="@+id/viewpager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
<View
|
||||
android:id="@+id/buttonDivider"
|
||||
|
|
|
@ -104,7 +104,7 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
|
|||
}
|
||||
|
||||
private EditPoiData editPoiData;
|
||||
private ViewPager viewPager;
|
||||
private EditPoiViewPager viewPager;
|
||||
private AutoCompleteTextView poiTypeEditText;
|
||||
|
||||
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 extendedTitle = getResources().getString(R.string.tab_title_advanced);
|
||||
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