favorite screen changes
This commit is contained in:
parent
e19935563a
commit
8f0c7341cf
5 changed files with 582 additions and 464 deletions
File diff suppressed because it is too large
Load diff
|
@ -11,6 +11,9 @@
|
|||
Thx - Hardy
|
||||
|
||||
-->
|
||||
<string name="access_hint_enter_address">Enter address</string>
|
||||
<string name="add_address">Add address</string>
|
||||
<string name="delete_address">Delete address</string>
|
||||
<string name="street_level_imagery">Street-level imagery</string>
|
||||
<string name="rourte_between_points_add_track_desc">Select a track file for which a new segment will be added.</string>
|
||||
<string name="navigation_profile">Navigation profile</string>
|
||||
|
|
|
@ -405,6 +405,12 @@ public class FavoritePointEditorFragmentNew extends PointEditorFragmentNew {
|
|||
return favorite != null ? favorite.getDescription() : "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAddressInitValue() {
|
||||
FavouritePoint favourite = getFavorite();
|
||||
return favorite != null ? favorite.getAddress() : "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Drawable getNameIcon() {
|
||||
FavouritePoint favorite = getFavorite();
|
||||
|
|
|
@ -75,6 +75,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
|||
private View view;
|
||||
private EditText nameEdit;
|
||||
private TextView addDelDescription;
|
||||
private TextView addAddressBtn;
|
||||
private TextView addToHiddenGroupInfo;
|
||||
private boolean cancelled;
|
||||
private boolean nightMode;
|
||||
|
@ -91,7 +92,9 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
|||
private LinkedHashMap<String, JSONArray> iconCategories;
|
||||
private OsmandApplication app;
|
||||
private View descriptionCaption;
|
||||
private View addressCaption;
|
||||
private EditText descriptionEdit;
|
||||
private EditText addressEdit;
|
||||
private int layoutHeightPrevious = 0;
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
|
@ -142,11 +145,12 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
|||
hideKeyboard();
|
||||
descriptionEdit.clearFocus();
|
||||
nameEdit.clearFocus();
|
||||
addressEdit.clearFocus();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
int activeColorResId = nightMode ? R.color.active_color_primary_dark : R.color.active_color_primary_light;
|
||||
final int activeColorResId = nightMode ? R.color.active_color_primary_dark : R.color.active_color_primary_light;
|
||||
ImageView toolbarAction = (ImageView) view.findViewById(R.id.toolbar_action);
|
||||
view.findViewById(R.id.background_layout).setBackgroundResource(nightMode
|
||||
? R.color.app_bar_color_dark : R.color.list_background_color_light);
|
||||
|
@ -218,38 +222,73 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
|||
}
|
||||
|
||||
descriptionEdit = (EditText) view.findViewById(R.id.description_edit);
|
||||
addressEdit = (EditText) view.findViewById(R.id.address_edit);
|
||||
AndroidUtils.setTextPrimaryColor(view.getContext(), descriptionEdit, nightMode);
|
||||
AndroidUtils.setTextPrimaryColor(view.getContext(), addressEdit, nightMode);
|
||||
AndroidUtils.setHintTextSecondaryColor(view.getContext(), descriptionEdit, nightMode);
|
||||
AndroidUtils.setHintTextSecondaryColor(view.getContext(), addressEdit, nightMode);
|
||||
if (getDescriptionInitValue() != null) {
|
||||
descriptionEdit.setText(getDescriptionInitValue());
|
||||
}
|
||||
if (getAddressInitValue() != null){
|
||||
addressEdit.setText(getAddressInitValue());
|
||||
}
|
||||
|
||||
descriptionCaption = view.findViewById(R.id.description);
|
||||
addressCaption = view.findViewById(R.id.address);
|
||||
addDelDescription = (TextView) view.findViewById(R.id.description_button);
|
||||
addAddressBtn = view.findViewById(R.id.address_button);
|
||||
addDelDescription.setTextColor(getResources().getColor(activeColorResId));
|
||||
addAddressBtn.setTextColor(getResources().getColor(activeColorResId));
|
||||
addAddressBtn.setCompoundDrawablesWithIntrinsicBounds(
|
||||
app.getUIUtilities().getIcon(R.drawable.ic_action_location_off, activeColorResId),null,null,null);
|
||||
addDelDescription.setCompoundDrawablesWithIntrinsicBounds(
|
||||
app.getUIUtilities().getIcon(R.drawable.ic_action_description, activeColorResId),null,null,null);
|
||||
addDelDescription.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (descriptionCaption.getVisibility() != View.VISIBLE) {
|
||||
descriptionCaption.setVisibility(View.VISIBLE);
|
||||
addDelDescription.setText(view.getResources().getString(R.string.delete_description));
|
||||
addDelDescription.setCompoundDrawablesWithIntrinsicBounds(
|
||||
app.getUIUtilities().getIcon(R.drawable.ic_action_delete_item,
|
||||
activeColorResId),null,null,null);
|
||||
View descriptionEdit = view.findViewById(R.id.description_edit);
|
||||
descriptionEdit.requestFocus();
|
||||
AndroidUtils.softKeyboardDelayed(descriptionEdit);
|
||||
} else {
|
||||
descriptionCaption.setVisibility(View.GONE);
|
||||
addDelDescription.setText(view.getResources().getString(R.string.add_description));
|
||||
addDelDescription.setCompoundDrawablesWithIntrinsicBounds(
|
||||
app.getUIUtilities().getIcon(R.drawable.ic_action_location_off,
|
||||
activeColorResId),null,null,null);
|
||||
AndroidUtils.hideSoftKeyboard(requireActivity(), descriptionEdit);
|
||||
descriptionEdit.clearFocus();
|
||||
}
|
||||
}
|
||||
});
|
||||
addAddressBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (addressCaption.getVisibility() != View.VISIBLE) {
|
||||
addressCaption.setVisibility(View.VISIBLE);
|
||||
addAddressBtn.setText(view.getResources().getString(R.string.delete_address));
|
||||
View addressEdit = view.findViewById(R.id.address_edit);
|
||||
addressEdit.requestFocus();
|
||||
AndroidUtils.softKeyboardDelayed(addressEdit);
|
||||
} else {
|
||||
addressCaption.setVisibility(View.GONE);
|
||||
addAddressBtn.setText(view.getResources().getString(R.string.add_address));
|
||||
AndroidUtils.hideSoftKeyboard(requireActivity(), addressEdit);
|
||||
addressEdit.clearFocus();
|
||||
}
|
||||
}
|
||||
});
|
||||
nameIcon.setImageDrawable(getNameIcon());
|
||||
|
||||
if (app.accessibilityEnabled()) {
|
||||
nameCaption.setFocusable(true);
|
||||
nameEdit.setHint(R.string.access_hint_enter_name);
|
||||
descriptionEdit.setHint(R.string.access_hint_enter_description);
|
||||
}
|
||||
|
||||
View deleteButton = view.findViewById(R.id.button_delete_container);
|
||||
|
@ -348,6 +387,13 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
|||
descriptionCaption.setVisibility(View.GONE);
|
||||
addDelDescription.setText(app.getString(R.string.add_description));
|
||||
}
|
||||
if (!addressEdit.getText().toString().isEmpty() || addressEdit.hasFocus()) {
|
||||
addressCaption.setVisibility(View.VISIBLE);
|
||||
addAddressBtn.setText(app.getString(R.string.delete_address));
|
||||
} else {
|
||||
addressCaption.setVisibility(View.GONE);
|
||||
addAddressBtn.setText(app.getString(R.string.add_address));
|
||||
}
|
||||
}
|
||||
|
||||
private void createGroupSelector() {
|
||||
|
@ -754,6 +800,8 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
|||
|
||||
public abstract String getDescriptionInitValue();
|
||||
|
||||
public abstract String getAddressInitValue();
|
||||
|
||||
public abstract Drawable getNameIcon();
|
||||
|
||||
public abstract Drawable getCategoryIcon();
|
||||
|
|
|
@ -402,6 +402,9 @@ public class WptPtEditorFragmentNew extends PointEditorFragmentNew {
|
|||
return wpt != null ? wpt.desc : "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAddressInitValue() { return ""; }
|
||||
|
||||
@Override
|
||||
public Drawable getNameIcon() {
|
||||
WptPt wptPt = getWpt();
|
||||
|
|
Loading…
Reference in a new issue