Merge pull request #8364 from osmandapp/Fix_icon_size

Fix icon size
This commit is contained in:
max-klaus 2020-01-31 18:49:27 +03:00 committed by GitHub
commit 209ae36bf8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 4 deletions

View file

@ -51,8 +51,8 @@
<ImageView
android:id="@+id/context_menu_icon_view"
android:layout_width="@dimen/dialog_button_height"
android:layout_height="@dimen/dialog_button_height"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:src="@drawable/ic_action_building_number"/>
</LinearLayout>

View file

@ -1280,8 +1280,10 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
final ImageView iconView = (ImageView) view.findViewById(R.id.context_menu_icon_view);
Drawable icon = menu.getRightIcon();
int iconId = menu.getRightIconId();
int sizeId = menu.isBigRightIcon() ? R.dimen.context_menu_big_icon_size : R.dimen.dialog_button_height;
int sizeId = menu.isBigRightIcon() ? R.dimen.context_menu_big_icon_size : R.dimen.map_widget_icon;
if (menu.getPointDescription().isFavorite() || menu.getPointDescription().isWpt()) {
sizeId = R.dimen.dialog_button_height;
}
int iconViewSize = getResources().getDimensionPixelSize(sizeId);
ViewGroup.LayoutParams params = iconView.getLayoutParams();
params.width = iconViewSize;

View file

@ -53,6 +53,12 @@ public class MultiSelectionArrayAdapter extends ArrayAdapter<MapMultiSelectionMe
UiUtilities iconsCache = menu.getMapActivity().getMyApplication().getUIUtilities();
final View iconLayout = convertView.findViewById(R.id.context_menu_icon_layout);
final ImageView iconView = (ImageView) convertView.findViewById(R.id.context_menu_icon_view);
if (item.getPointDescription().isFavorite() || item.getPointDescription().isWpt()) {
int iconSize = getContext().getResources().getDimensionPixelSize(R.dimen.dialog_button_height);
iconView.getLayoutParams().height = iconSize;
iconView.getLayoutParams().width = iconSize;
iconView.requestLayout();
}
Drawable icon = item.getRightIcon();
int iconId = item.getRightIconId();
if (icon != null) {