favorite screen changes
This commit is contained in:
parent
e19935563a
commit
8f0c7341cf
5 changed files with 582 additions and 464 deletions
|
@ -21,8 +21,8 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/toolbar_height"
|
||||
android:background="?attr/card_and_list_background_basic"
|
||||
osmand:subtitleTextColor="?android:textColorPrimary"
|
||||
app:contentInsetStartWithNavigation="@dimen/toolbar_inset_start_with_navigation"
|
||||
osmand:subtitleTextColor="?android:textColorPrimary"
|
||||
osmand:theme="@style/ThemeOverlay.AppCompat.ActionBar"
|
||||
osmand:titleTextColor="?android:textColorPrimary">
|
||||
|
||||
|
@ -69,8 +69,8 @@
|
|||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox"
|
||||
android:id="@+id/name_caption"
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
|
@ -89,8 +89,8 @@
|
|||
android:minHeight="@dimen/favorites_list_item_height"
|
||||
android:paddingStart="@dimen/content_padding_small"
|
||||
android:paddingLeft="@dimen/content_padding_small"
|
||||
android:paddingRight="@dimen/content_padding_small"
|
||||
android:paddingEnd="@dimen/content_padding_small"
|
||||
android:paddingRight="@dimen/content_padding_small"
|
||||
android:scrollHorizontally="false"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
tools:text="@string/lorem_ipsum" />
|
||||
|
@ -103,14 +103,69 @@
|
|||
android:id="@+id/name_icon"
|
||||
android:layout_width="@dimen/favorites_icon_size"
|
||||
android:layout_height="@dimen/favorites_icon_size"
|
||||
android:padding="@dimen/favorites_icon_padding"
|
||||
android:layout_gravity="end"
|
||||
android:layout_margin="@dimen/content_padding_small"
|
||||
android:contentDescription="@string/icon"
|
||||
android:padding="@dimen/favorites_icon_padding"
|
||||
app:srcCompat="@drawable/ic_action_home_dark" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/address"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/content_padding_small"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/address_caption"
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:layout_weight="1"
|
||||
android:hint="@string/shared_string_address"
|
||||
app:hintAnimationEnabled="false"
|
||||
app:boxBackgroundColor="@color/material_text_input_layout_bg">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/address_edit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="4"
|
||||
android:minHeight="@dimen/favorites_list_item_height"
|
||||
android:paddingStart="@dimen/content_padding_small"
|
||||
android:paddingLeft="@dimen/content_padding_small"
|
||||
android:paddingEnd="@dimen/content_padding_small"
|
||||
android:paddingRight="@dimen/content_padding_small"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
tools:text="@string/lorem_ipsum" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/address_button"
|
||||
android:layout_marginTop="@dimen/content_padding_small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/context_menu_buttons_bottom_height"
|
||||
android:layout_marginStart="@dimen/content_padding_half"
|
||||
android:layout_marginLeft="@dimen/content_padding_half"
|
||||
android:duplicateParentState="true"
|
||||
android:gravity="center"
|
||||
android:paddingStart="@dimen/content_padding_half"
|
||||
android:paddingLeft="@dimen/content_padding_half"
|
||||
android:paddingEnd="@dimen/content_padding_half"
|
||||
android:paddingRight="@dimen/content_padding_half"
|
||||
android:text="@string/add_address"
|
||||
android:drawablePadding="8dp"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:text="@string/add_address" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/description"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -120,14 +175,15 @@
|
|||
android:orientation="horizontal">
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox"
|
||||
android:id="@+id/description_caption"
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:layout_weight="1"
|
||||
android:hint="@string/shared_string_description"
|
||||
app:hintAnimationEnabled="false"
|
||||
app:boxBackgroundColor="@color/material_text_input_layout_bg">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
|
@ -139,8 +195,8 @@
|
|||
android:minHeight="@dimen/favorites_list_item_height"
|
||||
android:paddingStart="@dimen/content_padding_small"
|
||||
android:paddingLeft="@dimen/content_padding_small"
|
||||
android:paddingRight="@dimen/content_padding_small"
|
||||
android:paddingEnd="@dimen/content_padding_small"
|
||||
android:paddingRight="@dimen/content_padding_small"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
tools:text="@string/lorem_ipsum" />
|
||||
|
||||
|
@ -153,16 +209,17 @@
|
|||
android:layout_height="@dimen/context_menu_buttons_bottom_height"
|
||||
android:layout_marginStart="@dimen/content_padding_half"
|
||||
android:layout_marginLeft="@dimen/content_padding_half"
|
||||
android:paddingLeft="@dimen/content_padding_half"
|
||||
android:paddingRight="@dimen/content_padding_half"
|
||||
android:duplicateParentState="true"
|
||||
android:gravity="center"
|
||||
android:paddingStart="@dimen/content_padding_half"
|
||||
android:paddingLeft="@dimen/content_padding_half"
|
||||
android:paddingEnd="@dimen/content_padding_half"
|
||||
android:paddingRight="@dimen/content_padding_half"
|
||||
android:drawablePadding="8dp"
|
||||
android:text="@string/add_description"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
android:duplicateParentState="true"
|
||||
android:text="@string/add_description"
|
||||
tools:text="@string/add_description"
|
||||
android:paddingStart="@dimen/content_padding_half"
|
||||
android:paddingEnd="@dimen/content_padding_half"/>
|
||||
tools:text="@string/add_description" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
|
@ -174,8 +231,8 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="@dimen/toolbar_height"
|
||||
android:paddingBottom="@dimen/content_padding_half"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/content_padding_half">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -227,8 +284,8 @@
|
|||
android:layout_marginLeft="@dimen/content_padding_small"
|
||||
android:layout_marginEnd="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
app:srcCompat="@drawable/ic_action_folder"
|
||||
android:contentDescription="@string/shared_string_list" />
|
||||
android:contentDescription="@string/shared_string_list"
|
||||
app:srcCompat="@drawable/ic_action_folder" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
@ -242,18 +299,18 @@
|
|||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/group_recycler_view"
|
||||
android:paddingLeft="@dimen/content_padding_half"
|
||||
android:paddingStart="@dimen/content_padding_half"
|
||||
android:paddingRight="@dimen/content_padding"
|
||||
android:paddingEnd="@dimen/content_padding"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:clipToPadding="false"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="@dimen/content_padding_half"
|
||||
android:paddingLeft="@dimen/content_padding_half"
|
||||
android:paddingEnd="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding"
|
||||
tools:itemCount="3"
|
||||
tools:orientation="horizontal"
|
||||
tools:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
tools:listitem="@layout/point_editor_group_select_item" />
|
||||
tools:listitem="@layout/point_editor_group_select_item"
|
||||
tools:orientation="horizontal" />
|
||||
</LinearLayout>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
|
@ -262,13 +319,13 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/content_padding"
|
||||
android:layout_marginEnd="@dimen/content_padding"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
osmand:typeface="@string/font_roboto_regular"
|
||||
android:lineSpacingMultiplier="@dimen/bottom_sheet_text_spacing_multiplier"
|
||||
android:letterSpacing="@dimen/description_letter_spacing"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:lineSpacingMultiplier="@dimen/bottom_sheet_text_spacing_multiplier"
|
||||
android:text="@string/add_hidden_group_info"
|
||||
android:visibility="gone" />
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
android:visibility="gone"
|
||||
osmand:typeface="@string/font_roboto_regular" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
|
@ -293,16 +350,16 @@
|
|||
android:id="@+id/group_name_recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding"
|
||||
android:paddingStart="@dimen/content_padding"
|
||||
android:paddingEnd="@dimen/content_padding"
|
||||
android:clipToPadding="false"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="@dimen/content_padding"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingEnd="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding"
|
||||
tools:itemCount="3"
|
||||
tools:orientation="horizontal"
|
||||
tools:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
tools:listitem="@layout/point_editor_icon_category_item" />
|
||||
tools:listitem="@layout/point_editor_icon_category_item"
|
||||
tools:orientation="horizontal" />
|
||||
|
||||
<net.osmand.plus.widgets.FlowLayout
|
||||
android:id="@+id/select_icon"
|
||||
|
@ -361,6 +418,7 @@
|
|||
android:layout_marginLeft="@dimen/content_padding_small"
|
||||
android:layout_marginTop="@dimen/context_menu_padding_margin_tiny"
|
||||
android:layout_marginBottom="@dimen/content_padding_half" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
|
@ -405,11 +463,11 @@
|
|||
android:id="@+id/select_shape"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start"
|
||||
android:layout_marginStart="@dimen/content_padding_small"
|
||||
android:layout_marginLeft="@dimen/content_padding_small"
|
||||
android:layout_marginTop="@dimen/context_menu_padding_margin_tiny"
|
||||
android:layout_marginBottom="@dimen/content_padding_half" />
|
||||
android:layout_marginBottom="@dimen/content_padding_half"
|
||||
android:gravity="start" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
|
@ -479,11 +537,11 @@
|
|||
android:id="@+id/delete_action_icon"
|
||||
android:layout_width="@dimen/standard_icon_size"
|
||||
android:layout_height="@dimen/standard_icon_size"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="@dimen/content_padding"
|
||||
android:layout_marginLeft="@dimen/content_padding"
|
||||
android:layout_marginEnd="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:contentDescription="@string/delete_point"
|
||||
app:srcCompat="@drawable/ic_action_delete_dark" />
|
||||
|
||||
|
|
|
@ -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