Fix fav/wpt edit layout bugs

This commit is contained in:
Alexey Kulish 2018-04-18 16:26:17 +03:00
parent 78937746a1
commit dd9b8d52ba
22 changed files with 140 additions and 123 deletions

View file

@ -1,11 +1,12 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout <FrameLayout
android:id="@+id/point_edit_layout"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/point_edit_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:background="@android:color/transparent"> android:background="@android:color/transparent">
<LinearLayout <LinearLayout
@ -31,7 +32,8 @@
<ScrollView <ScrollView
android:id="@+id/editor_scroll_view" android:id="@+id/editor_scroll_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="0dp"
android:layout_weight="1"
android:fillViewport="true"> android:fillViewport="true">
<LinearLayout <LinearLayout
@ -43,7 +45,6 @@
android:id="@+id/main_view" android:id="@+id/main_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <LinearLayout
@ -171,7 +172,6 @@
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="48dp"
android:foreground="@drawable/bg_contextmenu_shadow" android:foreground="@drawable/bg_contextmenu_shadow"
android:foregroundGravity="top|fill_horizontal"> android:foregroundGravity="top|fill_horizontal">
@ -231,76 +231,75 @@
</ScrollView> </ScrollView>
</LinearLayout>
<LinearLayout
android:id="@+id/buttons_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="bottom">
<View
android:id="@+id/buttons_top_border"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/divider_color"/>
<LinearLayout <LinearLayout
android:id="@+id/buttons_layout" android:id="@+id/buttons_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/ctx_menu_info_view_bg" android:orientation="vertical">
android:orientation="horizontal">
<Button
android:id="@+id/delete_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="@string/shared_string_delete"
android:textColor="?attr/contextMenuButtonColor"/>
<Button
android:id="@+id/replace_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="@string/update_existing"
android:textColor="?attr/contextMenuButtonColor"
android:visibility="gone"/>
<View <View
android:layout_width="0dp" android:id="@+id/buttons_top_border"
android:layout_width="match_parent"
android:layout_height="1dp" android:layout_height="1dp"
android:layout_weight="1"/> android:background="@color/divider_color"/>
<Button <LinearLayout
android:id="@+id/cancel_button" android:id="@+id/buttons_layout"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground" android:background="?attr/ctx_menu_info_view_bg"
android:paddingLeft="10dp" android:orientation="horizontal">
android:paddingRight="10dp"
android:text="@string/shared_string_cancel"
android:textColor="?attr/contextMenuButtonColor"/>
<Button <Button
android:id="@+id/save_button" android:id="@+id/delete_button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:paddingLeft="10dp" android:paddingLeft="10dp"
android:paddingRight="10dp" android:paddingRight="10dp"
android:text="@string/shared_string_save" android:text="@string/shared_string_delete"
android:textColor="?attr/contextMenuButtonColor"/> android:textColor="?attr/contextMenuButtonColor"/>
<Button
android:id="@+id/replace_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="@string/update_existing"
android:textColor="?attr/contextMenuButtonColor"
android:visibility="gone"/>
<View
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1"/>
<Button
android:id="@+id/cancel_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="@string/shared_string_cancel"
android:textColor="?attr/contextMenuButtonColor"/>
<Button
android:id="@+id/save_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="@string/shared_string_save"
android:textColor="?attr/contextMenuButtonColor"/>
</LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</FrameLayout> </FrameLayout>

View file

@ -10,6 +10,7 @@ import android.graphics.drawable.Drawable;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.support.v4.content.FileProvider; import android.support.v4.content.FileProvider;
import android.support.v4.view.MenuItemCompat; import android.support.v4.view.MenuItemCompat;
@ -139,7 +140,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
} }
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.favorites_tree, container, false); View view = inflater.inflate(R.layout.favorites_tree, container, false);
ExpandableListView listView = (ExpandableListView) view.findViewById(android.R.id.list); ExpandableListView listView = (ExpandableListView) view.findViewById(android.R.id.list);
favouritesAdapter.synchronizeGroups(); favouritesAdapter.synchronizeGroups();

View file

@ -1,5 +1,6 @@
package net.osmand.plus.base; package net.osmand.plus.base;
import android.annotation.TargetApi;
import android.app.Activity; import android.app.Activity;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Build; import android.os.Build;
@ -10,6 +11,7 @@ import android.support.annotation.IdRes;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.view.View; import android.view.View;
import android.view.ViewTreeObserver;
import android.view.animation.Animation; import android.view.animation.Animation;
import android.widget.ImageView; import android.widget.ImageView;
@ -40,6 +42,24 @@ public class BaseOsmAndFragment extends Fragment implements TransitionAnimator {
} }
} }
if (!isFullScreenAllowed() && activity instanceof MapActivity) { if (!isFullScreenAllowed() && activity instanceof MapActivity) {
View view = getView();
if (view != null) {
ViewTreeObserver vto = view.getViewTreeObserver();
vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
public void onGlobalLayout() {
View view = getView();
if (view != null) {
ViewTreeObserver obs = view.getViewTreeObserver();
obs.removeOnGlobalLayoutListener(this);
view.requestLayout();
}
}
});
}
((MapActivity) activity).exitFromFullScreen(); ((MapActivity) activity).exitFromFullScreen();
} }
} }
@ -115,15 +135,15 @@ public class BaseOsmAndFragment extends Fragment implements TransitionAnimator {
return iconsCache; return iconsCache;
} }
protected Drawable getPaintedContentIcon(@DrawableRes int id, @ColorInt int color){ protected Drawable getPaintedContentIcon(@DrawableRes int id, @ColorInt int color) {
return getIconsCache().getPaintedIcon(id, color); return getIconsCache().getPaintedIcon(id, color);
} }
protected Drawable getIcon(@DrawableRes int id, @ColorRes int colorId){ protected Drawable getIcon(@DrawableRes int id, @ColorRes int colorId) {
return getIconsCache().getIcon(id, colorId); return getIconsCache().getIcon(id, colorId);
} }
protected Drawable getContentIcon(@DrawableRes int id){ protected Drawable getContentIcon(@DrawableRes int id) {
return getIconsCache().getThemedIcon(id); return getIconsCache().getThemedIcon(id);
} }

View file

@ -4,6 +4,7 @@ import android.graphics.Shader.TileMode;
import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.view.MenuItemCompat; import android.support.v4.view.MenuItemCompat;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
@ -24,7 +25,7 @@ public abstract class OsmandExpandableListFragment extends BaseOsmAndFragment
protected ExpandableListAdapter adapter; protected ExpandableListAdapter adapter;
@Override @Override
public View onCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container, Bundle savedInstanceState) { public View onCreateView(@NonNull android.view.LayoutInflater inflater, android.view.ViewGroup container, Bundle savedInstanceState) {
View v = createView(inflater, container); View v = createView(inflater, container);
listView = (ExpandableListView) v.findViewById(android.R.id.list); listView = (ExpandableListView) v.findViewById(android.R.id.list);
listView.setOnChildClickListener(this); listView.setOnChildClickListener(this);

View file

@ -7,6 +7,7 @@ import android.graphics.Typeface;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.support.v4.view.MenuItemCompat; import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBar;
@ -88,7 +89,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
private ActionMode actionMode; private ActionMode actionMode;
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.local_index, container, false); View view = inflater.inflate(R.layout.local_index, container, false);
getDownloadActivity().setSupportProgressBarIndeterminateVisibility(false); getDownloadActivity().setSupportProgressBarIndeterminateVisibility(false);

View file

@ -7,6 +7,7 @@ import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.os.StatFs; import android.os.StatFs;
import android.provider.Settings.Secure; import android.provider.Settings.Secure;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v4.app.ActivityCompat; import android.support.v4.app.ActivityCompat;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
@ -118,7 +119,7 @@ public class FirstUsageWizardFragment extends BaseOsmAndFragment implements OsmA
@Nullable @Nullable
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
view = inflater.inflate(R.layout.first_usage_wizard_fragment, container, false); view = inflater.inflate(R.layout.first_usage_wizard_fragment, container, false);
AndroidUtils.addStatusBarPadding21v(getActivity(), view); AndroidUtils.addStatusBarPadding21v(getActivity(), view);

View file

@ -110,7 +110,7 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppList
} }
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_live_updates, container, false); View view = inflater.inflate(R.layout.fragment_live_updates, container, false);
listView = (ExpandableListView) view.findViewById(android.R.id.list); listView = (ExpandableListView) view.findViewById(android.R.id.list);

View file

@ -9,6 +9,7 @@ import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.AttrRes; import android.support.annotation.AttrRes;
import android.support.annotation.ColorInt; import android.support.annotation.ColorInt;
import android.support.annotation.NonNull;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MotionEvent; import android.view.MotionEvent;
@ -88,7 +89,7 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
private int textColorSecondary; private int textColorSecondary;
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_reports, container, false); View view = inflater.inflate(R.layout.fragment_reports, container, false);
monthReportsSpinner = (Spinner) view.findViewById(R.id.monthReportsSpinner); monthReportsSpinner = (Spinner) view.findViewById(R.id.monthReportsSpinner);

View file

@ -8,6 +8,7 @@ import android.content.res.Resources;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
@ -93,6 +94,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
private MapContextMenu menu; private MapContextMenu menu;
private OnLayoutChangeListener containerLayoutListener; private OnLayoutChangeListener containerLayoutListener;
private boolean forceUpdateLayout;
private int menuTopViewHeight; private int menuTopViewHeight;
private int menuTopShadowAllHeight; private int menuTopShadowAllHeight;
@ -133,7 +135,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
private boolean created; private boolean created;
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
processScreenHeight(container); processScreenHeight(container);
@ -628,7 +630,8 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
@Override @Override
public void onLayoutChange(View view, int left, int top, int right, int bottom, public void onLayoutChange(View view, int left, int top, int right, int bottom,
int oldLeft, int oldTop, int oldRight, int oldBottom) { int oldLeft, int oldTop, int oldRight, int oldBottom) {
if (bottom != oldBottom) { if (forceUpdateLayout || bottom != oldBottom) {
forceUpdateLayout = false;
processScreenHeight(view.getParent()); processScreenHeight(view.getParent());
runLayoutListener(); runLayoutListener();
} }
@ -1748,6 +1751,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
public void setFragmentVisibility(boolean visible) { public void setFragmentVisibility(boolean visible) {
if (view != null) { if (view != null) {
if (visible) { if (visible) {
forceUpdateLayout = true;
view.setVisibility(View.VISIBLE); view.setVisibility(View.VISIBLE);
if (mapCenter != null) { if (mapCenter != null) {
map.setLatLon(mapCenter.getLatitude(), mapCenter.getLongitude()); map.setLatLon(mapCenter.getLatitude(), mapCenter.getLongitude());

View file

@ -1,6 +1,7 @@
package net.osmand.plus.mapcontextmenu.builders.cards.dialogs; package net.osmand.plus.mapcontextmenu.builders.cards.dialogs;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
@ -39,7 +40,7 @@ public class ContextMenuCardDialogFragment extends BaseOsmAndFragment {
@Nullable @Nullable
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.context_menu_card_dialog, container, false); View view = inflater.inflate(R.layout.context_menu_card_dialog, container, false);
AndroidUtils.addStatusBarPadding21v(getActivity(), view); AndroidUtils.addStatusBarPadding21v(getActivity(), view);
if (dialog.getType() == ContextMenuCardDialog.CardDialogType.MAPILLARY) { if (dialog.getType() == ContextMenuCardDialog.CardDialogType.MAPILLARY) {

View file

@ -4,6 +4,7 @@ import android.app.Activity;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -52,7 +53,7 @@ public class FavoritePointEditorFragment extends PointEditorFragment {
} }
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = super.onCreateView(inflater, container, savedInstanceState); View view = super.onCreateView(inflater, container, savedInstanceState);
if (view != null && editor.isNew()) { if (view != null && editor.isNew()) {
Button replaceButton = (Button) view.findViewById(R.id.replace_button); Button replaceButton = (Button) view.findViewById(R.id.replace_button);

View file

@ -3,11 +3,11 @@ package net.osmand.plus.mapcontextmenu.editors;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.graphics.Rect;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.IBinder; import android.os.IBinder;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment; import android.support.v4.app.DialogFragment;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.util.TypedValue; import android.util.TypedValue;
@ -15,12 +15,10 @@ import android.view.LayoutInflater;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.ScrollView;
import android.widget.TextView; import android.widget.TextView;
import net.osmand.AndroidUtils; import net.osmand.AndroidUtils;
@ -28,7 +26,6 @@ import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.BaseOsmAndFragment; import net.osmand.plus.base.BaseOsmAndFragment;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.widgets.AutoCompleteTextViewEx; import net.osmand.plus.widgets.AutoCompleteTextViewEx;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
@ -40,11 +37,10 @@ public abstract class PointEditorFragment extends BaseOsmAndFragment {
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
view = inflater.inflate(R.layout.point_editor_fragment, container, false); view = inflater.inflate(R.layout.point_editor_fragment, container, false);
AndroidUtils.addStatusBarPadding21v(getActivity(), view);
getEditor().updateLandscapePortrait(); getEditor().updateLandscapePortrait();
getEditor().updateNightMode(); getEditor().updateNightMode();
@ -135,36 +131,6 @@ public abstract class PointEditorFragment extends BaseOsmAndFragment {
descriptionEdit.setText(getDescriptionInitValue()); descriptionEdit.setText(getDescriptionInitValue());
} }
if (Build.VERSION.SDK_INT >= 11) {
view.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
@Override
public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
if (descriptionEdit.isFocused()) {
ScrollView scrollView = (ScrollView) view.findViewById(R.id.editor_scroll_view);
scrollView.scrollTo(0, bottom);
}
if (Build.VERSION.SDK_INT >= 21 && AndroidUiHelper.isOrientationPortrait(getActivity())) {
Rect rect = new Rect();
getActivity().getWindow().getDecorView().getWindowVisibleDisplayFrame(rect);
int heightDiff = getResources().getDisplayMetrics().heightPixels - rect.bottom;
view.findViewById(R.id.buttons_container).setPadding(0, 0, 0, heightDiff);
}
}
});
} else {
ViewTreeObserver vto = view.getViewTreeObserver();
vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
if (descriptionEdit.isFocused()) {
ScrollView scrollView = (ScrollView) view.findViewById(R.id.editor_scroll_view);
scrollView.scrollTo(0, view.getBottom());
}
}
});
}
ImageView nameImage = (ImageView) view.findViewById(R.id.name_image); ImageView nameImage = (ImageView) view.findViewById(R.id.name_image);
nameImage.setImageDrawable(getNameIcon()); nameImage.setImageDrawable(getNameIcon());
ImageView categoryImage = (ImageView) view.findViewById(R.id.category_image); ImageView categoryImage = (ImageView) view.findViewById(R.id.category_image);
@ -228,6 +194,11 @@ public abstract class PointEditorFragment extends BaseOsmAndFragment {
return R.color.status_bar_light; return R.color.status_bar_light;
} }
@Override
protected boolean isFullScreenAllowed() {
return false;
}
private void hideKeyboard() { private void hideKeyboard() {
InputMethodManager inputMethodManager = (InputMethodManager) getActivity().getSystemService(Activity.INPUT_METHOD_SERVICE); InputMethodManager inputMethodManager = (InputMethodManager) getActivity().getSystemService(Activity.INPUT_METHOD_SERVICE);
if (inputMethodManager != null) { if (inputMethodManager != null) {
@ -250,7 +221,9 @@ public abstract class PointEditorFragment extends BaseOsmAndFragment {
} }
protected abstract boolean wasSaved(); protected abstract boolean wasSaved();
protected abstract void save(boolean needDismiss); protected abstract void save(boolean needDismiss);
protected abstract void delete(boolean needDismiss); protected abstract void delete(boolean needDismiss);
static int getResIdFromAttribute(final Context ctx, final int attr) { static int getResIdFromAttribute(final Context ctx, final int attr) {
@ -262,6 +235,7 @@ public abstract class PointEditorFragment extends BaseOsmAndFragment {
} }
public abstract PointEditor getEditor(); public abstract PointEditor getEditor();
public abstract String getToolbarTitle(); public abstract String getToolbarTitle();
public void setCategory(String name) { public void setCategory(String name) {
@ -279,7 +253,7 @@ public abstract class PointEditorFragment extends BaseOsmAndFragment {
} }
protected MapActivity getMapActivity() { protected MapActivity getMapActivity() {
return (MapActivity)getActivity(); return (MapActivity) getActivity();
} }
protected OsmandApplication getMyApplication() { protected OsmandApplication getMyApplication() {
@ -307,15 +281,19 @@ public abstract class PointEditorFragment extends BaseOsmAndFragment {
public String getNameCaption() { public String getNameCaption() {
return getMapActivity().getResources().getString(R.string.shared_string_name); return getMapActivity().getResources().getString(R.string.shared_string_name);
} }
public String getCategoryCaption() { public String getCategoryCaption() {
return getMapActivity().getResources().getString(R.string.favourites_edit_dialog_category); return getMapActivity().getResources().getString(R.string.favourites_edit_dialog_category);
} }
public abstract String getNameInitValue(); public abstract String getNameInitValue();
public abstract String getCategoryInitValue(); public abstract String getCategoryInitValue();
public abstract String getDescriptionInitValue(); public abstract String getDescriptionInitValue();
public abstract Drawable getNameIcon(); public abstract Drawable getNameIcon();
public abstract Drawable getCategoryIcon(); public abstract Drawable getCategoryIcon();
public String getNameTextValue() { public String getNameTextValue() {

View file

@ -1,6 +1,7 @@
package net.osmand.plus.mapcontextmenu.other; package net.osmand.plus.mapcontextmenu.other;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -27,7 +28,7 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment {
} }
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
MapActivity mapActivity = getMapActivity(); MapActivity mapActivity = getMapActivity();

View file

@ -2,6 +2,7 @@ package net.osmand.plus.mapcontextmenu.other;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -29,7 +30,7 @@ public class TrackDetailsMenuFragment extends BaseOsmAndFragment {
} }
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
MapActivity mapActivity = getMapActivity(); MapActivity mapActivity = getMapActivity();

View file

@ -5,6 +5,7 @@ import android.app.DatePickerDialog;
import android.content.Context; import android.content.Context;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.support.v7.widget.AppCompatImageView; import android.support.v7.widget.AppCompatImageView;
import android.support.v7.widget.AppCompatTextView; import android.support.v7.widget.AppCompatTextView;
@ -48,7 +49,7 @@ public class MapillaryFiltersFragment extends BaseOsmAndFragment {
} }
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final MapActivity mapActivity = (MapActivity) getActivity(); final MapActivity mapActivity = (MapActivity) getActivity();
final OsmandSettings settings = getSettings(); final OsmandSettings settings = getSettings();
final MapillaryPlugin plugin = OsmandPlugin.getPlugin(MapillaryPlugin.class); final MapillaryPlugin plugin = OsmandPlugin.getPlugin(MapillaryPlugin.class);

View file

@ -6,6 +6,7 @@ import android.os.AsyncTask;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.DrawableRes; import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.design.widget.Snackbar; import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
@ -94,7 +95,7 @@ public class PlanRouteFragment extends BaseOsmAndFragment implements OsmAndLocat
@Nullable @Nullable
@Override @Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
final MapActivity mapActivity = getMapActivity(); final MapActivity mapActivity = getMapActivity();
markersHelper = mapActivity.getMyApplication().getMapMarkersHelper(); markersHelper = mapActivity.getMyApplication().getMapMarkersHelper();
planRouteContext = markersHelper.getPlanRouteContext(); planRouteContext = markersHelper.getPlanRouteContext();

View file

@ -8,6 +8,7 @@ import android.os.AsyncTask;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.DrawableRes; import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
@ -122,7 +123,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
@Nullable @Nullable
@Override @Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
final MapActivity mapActivity = (MapActivity) getActivity(); final MapActivity mapActivity = (MapActivity) getActivity();
final MeasurementToolLayer measurementLayer = mapActivity.getMapLayers().getMeasurementToolLayer(); final MeasurementToolLayer measurementLayer = mapActivity.getMapLayers().getMeasurementToolLayer();

View file

@ -12,6 +12,7 @@ import android.os.AsyncTask;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.support.v4.view.MenuItemCompat; import android.support.v4.view.MenuItemCompat;
@ -300,7 +301,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
} }
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.available_gpx, container, false); View v = inflater.inflate(R.layout.available_gpx, container, false);
listView = (ExpandableListView) v.findViewById(android.R.id.list); listView = (ExpandableListView) v.findViewById(android.R.id.list);
setHasOptionsMenu(true); setHasOptionsMenu(true);

View file

@ -190,7 +190,7 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
}; };
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
mainView = inflater.inflate(R.layout.track_points_tree, container, false); mainView = inflater.inflate(R.layout.track_points_tree, container, false);
ExpandableListView listView = (ExpandableListView) mainView.findViewById(android.R.id.list); ExpandableListView listView = (ExpandableListView) mainView.findViewById(android.R.id.list);
setHasOptionsMenu(true); setHasOptionsMenu(true);

View file

@ -2,6 +2,7 @@ package net.osmand.plus.osmedit;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.text.Editable; import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
@ -53,7 +54,7 @@ public class AdvancedEditPoiFragment extends BaseOsmAndFragment
@Nullable @Nullable
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.fragment_edit_poi_advanced, container, false); final View view = inflater.inflate(R.layout.fragment_edit_poi_advanced, container, false);
deleteDrawable = getPaintedContentIcon(R.drawable.ic_action_remove_dark, deleteDrawable = getPaintedContentIcon(R.drawable.ic_action_remove_dark,

View file

@ -3,6 +3,7 @@ package net.osmand.plus.osmedit;
import android.content.res.Resources; import android.content.res.Resources;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.text.Editable; import android.text.Editable;
import android.text.TextUtils; import android.text.TextUtils;
@ -45,7 +46,7 @@ public class BasicEditPoiFragment extends BaseOsmAndFragment
@Nullable @Nullable
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_edit_poi_normal, container, false); View view = inflater.inflate(R.layout.fragment_edit_poi_normal, container, false);
TypedValue typedValue = new TypedValue(); TypedValue typedValue = new TypedValue();

View file

@ -5,6 +5,7 @@ import android.content.res.Resources;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.design.widget.FloatingActionButton; import android.support.design.widget.FloatingActionButton;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
@ -52,7 +53,7 @@ public class QuickActionListFragment extends BaseOsmAndFragment implements Quick
@Nullable @Nullable
@Override @Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.quick_action_list, container, false); View view = inflater.inflate(R.layout.quick_action_list, container, false);