Add_favorite_Screen

1. Skip first direction, then coma - address: "1.22 km, Bohdana Khmelnytskogo 1" (it destroy some fragmnet menu);
2. After the user tap on the text field, place the cursor at the end of the text;
3. Allign drawable icon.
This commit is contained in:
sergosm 2020-09-12 12:39:25 +03:00
parent f48d962ede
commit d8bd5f936e
4 changed files with 35 additions and 37 deletions

View file

@ -174,38 +174,6 @@
android:paddingEnd="@dimen/context_menu_padding_margin_default"
android:paddingTop="3dp">
<LinearLayout
android:id="@+id/compass_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/direction"
android:layout_width="@dimen/directionIconSize"
android:layout_height="@dimen/directionIconSize"
android:layout_gravity="center_vertical"
android:layout_marginTop="1sp"
tools:src="@drawable/ic_direction_arrow"/>
<TextView
android:id="@+id/distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="2dp"
android:layout_marginStart="2dp"
android:textSize="@dimen/default_desc_text_size"
tools:text="100500 km"
tools:textColor="?android:textColorSecondary"/>
<View
android:id="@+id/favourite_right_point_space"
android:layout_width="@dimen/text_margin_small"
android:layout_height="match_parent" />
</LinearLayout>
<LinearLayout
android:id="@+id/additional_info_row"
android:layout_width="wrap_content"
@ -254,6 +222,33 @@
android:visibility="gone"
tools:visibility="visible"/>
<LinearLayout
android:id="@+id/compass_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/direction"
android:layout_width="@dimen/directionIconSize"
android:layout_height="@dimen/directionIconSize"
android:layout_gravity="center_vertical"
android:layout_marginTop="1sp"
tools:src="@drawable/ic_direction_arrow"/>
<TextView
android:id="@+id/distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="2dp"
android:layout_marginStart="2dp"
android:textSize="@dimen/default_desc_text_size"
tools:text="100500 km"
tools:textColor="?android:textColorSecondary"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>

View file

@ -29,6 +29,7 @@ import net.osmand.plus.mapcontextmenu.editors.FavoritePointEditorFragmentNew;
import net.osmand.plus.transport.TransportStopRoute;
import net.osmand.plus.widgets.style.CustomTypefaceSpan;
import net.osmand.util.OpeningHoursParser;
import net.osmand.view.GravityDrawable;
import java.util.List;
@ -174,8 +175,10 @@ public class FavouritePointMenuController extends MenuController {
FavouritesDbHelper helper = app.getFavorites();
String group = fav.getCategory();
if (helper.getGroup(group) != null) {
int colorId = R.color.color_favorite;
return getIcon(R.drawable.ic_action_group_name_16, colorId);
Drawable line2icon = helper.getColoredIconForGroup(group);
GravityDrawable gravityIcon = new GravityDrawable(line2icon);
gravityIcon.setBoundsFrom(line2icon);
return gravityIcon;
} else {
int colorId = isLight() ? R.color.icon_color_default_light : R.color.ctx_menu_bottom_view_icon_dark;
return getIcon(R.drawable.ic_action_group_name_16, colorId);

View file

@ -233,6 +233,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
}
if (getAddressInitValue() != null){
addressEdit.setText(getAddressInitValue());
addressEdit.setSelection(addressEdit.getText().length());
}
descriptionCaption = view.findViewById(R.id.description);

View file

@ -64,10 +64,9 @@ public class GravityDrawable extends Drawable {
@Override
public void draw(Canvas canvas) {
int halfCanvas = canvas.getHeight() / 2;
int halfDrawable = original.getIntrinsicHeight() / 2;
int halfCanvas = getBounds().height() / 3;
int halfDrawable = original.getIntrinsicHeight() / 3;
// align to top
canvas.save();
canvas.translate(0, -halfCanvas + halfDrawable);
original.draw(canvas);