Fix context menu after screen rotation, fix description hide.
This commit is contained in:
parent
0994c6ab21
commit
e2ee35da66
3 changed files with 21 additions and 30 deletions
|
@ -449,9 +449,9 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:lines="1"
|
android:lines="1"
|
||||||
android:text="@string/update_existing"
|
android:text="@string/replace_point_descr"
|
||||||
android:textAppearance="@style/TextAppearance.ContextMenuSubtitle"
|
android:textAppearance="@style/TextAppearance.ContextMenuSubtitle"
|
||||||
tools:text="@string/update_existing" />
|
tools:text="@string/replace_point_descr" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
Thx - Hardy
|
Thx - Hardy
|
||||||
|
|
||||||
-->
|
-->
|
||||||
|
<string name="replace_point_descr">Replace another point with this</string>
|
||||||
<string name="shared_string_min">Min</string>
|
<string name="shared_string_min">Min</string>
|
||||||
<string name="shared_string_square">Square</string>
|
<string name="shared_string_square">Square</string>
|
||||||
<string name="shared_string_octagon">Octagon</string>
|
<string name="shared_string_octagon">Octagon</string>
|
||||||
|
|
|
@ -84,6 +84,8 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
private String selectedIconCategory;
|
private String selectedIconCategory;
|
||||||
private LinkedHashMap<String, JSONArray> iconCategories;
|
private LinkedHashMap<String, JSONArray> iconCategories;
|
||||||
private OsmandApplication app;
|
private OsmandApplication app;
|
||||||
|
private View descriptionCaption;
|
||||||
|
private EditText descriptionEdit;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||||
|
@ -186,14 +188,14 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
categoryEdit.setText(getCategoryInitValue());
|
categoryEdit.setText(getCategoryInitValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
final EditText descriptionEdit = (EditText) view.findViewById(R.id.description_edit);
|
descriptionEdit = (EditText) view.findViewById(R.id.description_edit);
|
||||||
AndroidUtils.setTextPrimaryColor(view.getContext(), descriptionEdit, nightMode);
|
AndroidUtils.setTextPrimaryColor(view.getContext(), descriptionEdit, nightMode);
|
||||||
AndroidUtils.setHintTextSecondaryColor(view.getContext(), descriptionEdit, nightMode);
|
AndroidUtils.setHintTextSecondaryColor(view.getContext(), descriptionEdit, nightMode);
|
||||||
if (getDescriptionInitValue() != null) {
|
if (getDescriptionInitValue() != null) {
|
||||||
descriptionEdit.setText(getDescriptionInitValue());
|
descriptionEdit.setText(getDescriptionInitValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
final View descriptionCaption = view.findViewById(R.id.description);
|
descriptionCaption = view.findViewById(R.id.description);
|
||||||
addDelDescription = (TextView) view.findViewById(R.id.description_button);
|
addDelDescription = (TextView) view.findViewById(R.id.description_button);
|
||||||
addDelDescription.setTextColor(getResources().getColor(activeColorResId));
|
addDelDescription.setTextColor(getResources().getColor(activeColorResId));
|
||||||
addDelDescription.setOnClickListener(new View.OnClickListener() {
|
addDelDescription.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@ -209,6 +211,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
descriptionCaption.setVisibility(View.GONE);
|
descriptionCaption.setVisibility(View.GONE);
|
||||||
addDelDescription.setText(view.getResources().getString(R.string.add_description));
|
addDelDescription.setText(view.getResources().getString(R.string.add_description));
|
||||||
AndroidUtils.hideSoftKeyboard(requireActivity(), descriptionEdit);
|
AndroidUtils.hideSoftKeyboard(requireActivity(), descriptionEdit);
|
||||||
|
descriptionEdit.clearFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -240,13 +243,6 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
toolbarAction.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_delete_dark, activeColorResId));
|
toolbarAction.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_delete_dark, activeColorResId));
|
||||||
deleteButton.setVisibility(View.VISIBLE);
|
deleteButton.setVisibility(View.VISIBLE);
|
||||||
deleteIcon.setVisibility(View.VISIBLE);
|
deleteIcon.setVisibility(View.VISIBLE);
|
||||||
if (!descriptionEdit.getText().toString().isEmpty() || descriptionCaption.getVisibility() != View.VISIBLE) {
|
|
||||||
descriptionCaption.setVisibility(View.VISIBLE);
|
|
||||||
addDelDescription.setText(app.getString(R.string.delete_description));
|
|
||||||
} else {
|
|
||||||
descriptionCaption.setVisibility(View.GONE);
|
|
||||||
addDelDescription.setText(app.getString(R.string.add_description));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
toolbarAction.setOnClickListener(new View.OnClickListener() {
|
toolbarAction.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@ -267,6 +263,19 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
if (!descriptionEdit.getText().toString().isEmpty() || descriptionCaption.getVisibility() != View.VISIBLE
|
||||||
|
|| descriptionEdit.hasFocus()) {
|
||||||
|
descriptionCaption.setVisibility(View.VISIBLE);
|
||||||
|
addDelDescription.setText(app.getString(R.string.delete_description));
|
||||||
|
} else {
|
||||||
|
descriptionCaption.setVisibility(View.GONE);
|
||||||
|
addDelDescription.setText(app.getString(R.string.add_description));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void createGroupSelector() {
|
private void createGroupSelector() {
|
||||||
groupListAdapter = new GroupAdapter();
|
groupListAdapter = new GroupAdapter();
|
||||||
groupRecyclerView = view.findViewById(R.id.group_recycler_view);
|
groupRecyclerView = view.findViewById(R.id.group_recycler_view);
|
||||||
|
@ -533,25 +542,6 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStart() {
|
|
||||||
super.onStart();
|
|
||||||
MapActivity mapActivity = getMapActivity();
|
|
||||||
if (mapActivity != null) {
|
|
||||||
mapActivity.getContextMenu().setBaseFragmentVisibility(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStop() {
|
|
||||||
super.onStop();
|
|
||||||
hideKeyboard();
|
|
||||||
MapActivity mapActivity = getMapActivity();
|
|
||||||
if (mapActivity != null) {
|
|
||||||
mapActivity.getContextMenu().setBaseFragmentVisibility(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroyView() {
|
public void onDestroyView() {
|
||||||
PointEditor editor = getEditor();
|
PointEditor editor = getEditor();
|
||||||
|
|
Loading…
Reference in a new issue