Merge pull request #9794 from osmandapp/favorites_allow_to_edit_address
Add_favorite_screen
This commit is contained in:
commit
e7724307bb
4 changed files with 35 additions and 37 deletions
|
@ -174,38 +174,6 @@
|
||||||
android:paddingEnd="@dimen/context_menu_padding_margin_default"
|
android:paddingEnd="@dimen/context_menu_padding_margin_default"
|
||||||
android:paddingTop="3dp">
|
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
|
<LinearLayout
|
||||||
android:id="@+id/additional_info_row"
|
android:id="@+id/additional_info_row"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -254,6 +222,33 @@
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
tools:visibility="visible"/>
|
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>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -29,6 +29,7 @@ import net.osmand.plus.mapcontextmenu.editors.FavoritePointEditorFragmentNew;
|
||||||
import net.osmand.plus.transport.TransportStopRoute;
|
import net.osmand.plus.transport.TransportStopRoute;
|
||||||
import net.osmand.plus.widgets.style.CustomTypefaceSpan;
|
import net.osmand.plus.widgets.style.CustomTypefaceSpan;
|
||||||
import net.osmand.util.OpeningHoursParser;
|
import net.osmand.util.OpeningHoursParser;
|
||||||
|
import net.osmand.view.GravityDrawable;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -174,8 +175,10 @@ public class FavouritePointMenuController extends MenuController {
|
||||||
FavouritesDbHelper helper = app.getFavorites();
|
FavouritesDbHelper helper = app.getFavorites();
|
||||||
String group = fav.getCategory();
|
String group = fav.getCategory();
|
||||||
if (helper.getGroup(group) != null) {
|
if (helper.getGroup(group) != null) {
|
||||||
int colorId = R.color.color_favorite;
|
Drawable line2icon = helper.getColoredIconForGroup(group);
|
||||||
return getIcon(R.drawable.ic_action_group_name_16, colorId);
|
GravityDrawable gravityIcon = new GravityDrawable(line2icon);
|
||||||
|
gravityIcon.setBoundsFrom(line2icon);
|
||||||
|
return gravityIcon;
|
||||||
} else {
|
} else {
|
||||||
int colorId = isLight() ? R.color.icon_color_default_light : R.color.ctx_menu_bottom_view_icon_dark;
|
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);
|
return getIcon(R.drawable.ic_action_group_name_16, colorId);
|
||||||
|
|
|
@ -234,6 +234,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
}
|
}
|
||||||
if (getAddressInitValue() != null){
|
if (getAddressInitValue() != null){
|
||||||
addressEdit.setText(getAddressInitValue());
|
addressEdit.setText(getAddressInitValue());
|
||||||
|
addressEdit.setSelection(addressEdit.getText().length());
|
||||||
}
|
}
|
||||||
|
|
||||||
descriptionCaption = view.findViewById(R.id.description);
|
descriptionCaption = view.findViewById(R.id.description);
|
||||||
|
|
|
@ -64,10 +64,9 @@ public class GravityDrawable extends Drawable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Canvas canvas) {
|
public void draw(Canvas canvas) {
|
||||||
int halfCanvas = canvas.getHeight() / 2;
|
int halfCanvas = getBounds().height() / 3;
|
||||||
int halfDrawable = original.getIntrinsicHeight() / 2;
|
int halfDrawable = original.getIntrinsicHeight() / 3;
|
||||||
|
|
||||||
// align to top
|
|
||||||
canvas.save();
|
canvas.save();
|
||||||
canvas.translate(0, -halfCanvas + halfDrawable);
|
canvas.translate(0, -halfCanvas + halfDrawable);
|
||||||
original.draw(canvas);
|
original.draw(canvas);
|
||||||
|
|
Loading…
Reference in a new issue