Fix tablet sizes

This commit is contained in:
Dima-1 2020-05-19 16:35:42 +03:00
parent f71f606279
commit a55230af45
16 changed files with 103 additions and 112 deletions

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -11,64 +10,41 @@
android:id="@+id/background_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:background="@color/list_background_color_dark"/>
android:background="@color/list_background_color_dark"
android:scaleType="centerCrop" />
<LinearLayout
<net.osmand.plus.widgets.TextViewEx
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:background="@color/color_transparent"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical"
android:paddingLeft="40dp"
android:paddingRight="40dp"
android:paddingTop="@dimen/first_usage_title_margin"
android:paddingStart="40dp"
android:paddingEnd="40dp">
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginStart="40dp"
android:layout_marginLeft="40dp"
android:layout_marginEnd="40dp"
android:layout_marginRight="40dp"
android:gravity="center_horizontal"
android:text="@string/first_usage_greeting"
android:textColor="@color/color_white"
android:textSize="@dimen/first_usage_subtitle_text_size"
android:textStyle="bold"
osmand:typeface="@string/font_roboto_regular" />
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
osmand:srcCompat="@drawable/osmand_logo"/>
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/first_usage_title_margin"
osmand:srcCompat="@drawable/osmand_logo" />
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/start_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="@dimen/first_usage_title_margin_bottom"
android:background="@drawable/btn_round_light"
android:padding="14dp"
android:text="@string/get_started"
android:textColor="@color/color_white" />
<net.osmand.plus.widgets.TextViewEx
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/first_usage_greeting"
android:textColor="@color/color_white"
android:layout_marginLeft="180dp"
android:layout_marginRight="180dp"
android:textSize="@dimen/first_usage_subtitle_text_size"
android:textStyle="bold"
osmand:typeface="@string/font_roboto_regular"
android:layout_marginEnd="180dp"
android:layout_marginStart="180dp" />
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/start_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="@dimen/first_usage_title_margin_bottom"
android:background="@drawable/btn_round_light"
android:padding="14dp"
android:text="@string/get_started"
android:textColor="@color/color_white"/>
</LinearLayout>
</FrameLayout>
</RelativeLayout>

View file

@ -18,8 +18,8 @@
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/route_info_icon_padding_right"
android:layout_marginRight="@dimen/route_info_icon_padding_right"
android:layout_marginEnd="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
osmand:srcCompat="@drawable/map_favorite" />
<LinearLayout

View file

@ -122,8 +122,8 @@
android:id="@+id/nearby_routes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/context_menu_direction_margin"
android:layout_marginTop="@dimen/context_menu_padding_margin_tiny"
android:layout_marginBottom="@dimen/content_padding_small"
android:layout_marginTop="@dimen/guide_line_vertical_offset"
android:gravity="top"
android:orientation="horizontal"
android:paddingTop="3dp"

View file

@ -6,8 +6,8 @@
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/app_mode_icon"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_width="@dimen/map_widget_icon"
android:layout_height="@dimen/map_widget_icon"
android:layout_gravity="center"
tools:src="@drawable/ic_dashboard_dark"
android:background="?attr/dashboard_button" />

View file

@ -6,8 +6,8 @@
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/app_mode_icon"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_width="@dimen/map_widget_icon"
android:layout_height="@dimen/map_widget_icon"
android:layout_gravity="center"
tools:src="@drawable/ic_dashboard_dark" />

View file

@ -45,7 +45,7 @@
android:paddingStart="@dimen/content_padding_half"
android:paddingRight="@dimen/content_padding_half"
android:paddingEnd="@dimen/content_padding_half"
android:paddingTop="@dimen/context_menu_transport_grid_item_width"
android:paddingTop="@dimen/list_content_padding_large"
tools:text="@string/favorite" />
</FrameLayout>

View file

@ -39,15 +39,12 @@
<dimen name="map_routing_progress_width">150dp</dimen>
<dimen name="map_mode_button_width">48dp</dimen>
<dimen name="map_button_inset_shadow">3dp</dimen>
<dimen name="map_button_inset">3dp</dimen>
<dimen name="map_button_rect_rad">3dp</dimen>
<dimen name="map_widget_icon_margin">3dp</dimen>
<!-- ContextMenu -->
<dimen name="context_menu_top_shadow_h">30dp</dimen>
<dimen name="context_menu_icon_top_padding">25dp</dimen>
@ -56,33 +53,22 @@
<dimen name="context_menu_top_right_button_min_width">114dp</dimen>
<dimen name="context_menu_button_padding_x">15dp</dimen>
<dimen name="context_menu_buttons_top_margin">-24dp</dimen>
<dimen name="context_menu_buttons_padding_bottom">6dp</dimen>
<dimen name="context_menu_progress_min_height">80dp</dimen>
<dimen name="context_menu_progress_cancel_button_size">66dp</dimen>
<dimen name="context_menu_action_buttons_h">80dp</dimen>
<dimen name="context_menu_sub_info_height">36dp</dimen>
<dimen name="context_menu_buttons_bottom_height">63dp</dimen>
<dimen name="context_menu_padding_margin_large">30dp</dimen>
<dimen name="context_menu_padding_margin_default">24dp</dimen>
<dimen name="context_menu_padding_margin_medium">15dp</dimen>
<dimen name="context_menu_padding_margin_small">12dp</dimen>
<dimen name="context_menu_padding_margin_tiny">9dp</dimen>
<dimen name="context_menu_title_padding">23dp</dimen>
<dimen name="context_menu_controller_height">54dp</dimen>
<dimen name="context_menu_progress_padding_left">27dp</dimen>
<dimen name="context_menu_progress_padding_right">3dp</dimen>
<dimen name="context_menu_action_buttons_height">84dp</dimen>
<dimen name="context_menu_subtitle_margin">5dp</dimen>
<dimen name="context_menu_direction_margin">18dp</dimen>
<dimen name="context_menu_transport_stop_item_height">24dp</dimen>
<dimen name="context_menu_main_actions_padding_top">11dp</dimen>
<dimen name="context_menu_main_actions_padding_bottom">9dp</dimen>
<dimen name="context_menu_main_actions_icon_margin">5dp</dimen>
<dimen name="context_menu_transport_grid_spacing">6dp</dimen>
<dimen name="context_menu_transport_grid_item_width">48dp</dimen>
<dimen name="context_menu_transport_grid_item_height">27dp</dimen>
<dimen name="context_menu_transport_icon_size">24dp</dimen>
<dimen name="context_menu_transport_padding_top">18dp</dimen>
<dimen name="context_menu_big_icon_size">54dp</dimen>
<dimen name="fab_size_with_shadow">90dp</dimen>
@ -91,7 +77,6 @@
<!-- General -->
<dimen name="measurement_tool_select_radius">30dp</dimen>
<dimen name="measurement_tool_divider_margin">12dp</dimen>
<dimen name="measurement_tool_content_padding_medium">18dp</dimen>
@ -108,33 +93,22 @@
<dimen name="measurement_tool_button_padding">12dp</dimen>
<dimen name="measurement_tool_button_height">54dp</dimen>
<dimen name="shadow_height">8dp</dimen>
<!--Route info-->
<dimen name="route_info_buttons_padding_top_bottom">24dp</dimen>
<dimen name="route_info_buttons_padding_left_right">33dp</dimen>
<dimen name="route_info_button_go_margin">5dp</dimen>
<dimen name="route_info_button_go_drawable_padding">21dp</dimen>
<dimen name="route_info_directions_margin">72dp</dimen>
<dimen name="route_info_icon_padding_left">18dp</dimen>
<dimen name="route_info_icon_padding_right">24dp</dimen>
<dimen name="route_info_modes_height">72dp</dimen>
<dimen name="route_info_start_divider_margin">96dp</dimen>
<dimen name="route_info_end_divider_margin">84dp</dimen>
<dimen name="route_info_list_item_height">72dp</dimen>
<dimen name="route_info_buttons_height">54dp</dimen>
<dimen name="route_info_details_padding">18dp</dimen>
<dimen name="route_info_icon_vertical_padding">9dp</dimen>
<dimen name="route_info_settings_buttons_height">48dp</dimen>
<dimen name="route_info_app_modes_padding">60dp</dimen>
<dimen name="route_info_card_row_min_height">90dp</dimen>
<dimen name="route_info_card_item_height">84dp</dimen>
<dimen name="route_info_list_text_padding">78dp</dimen>
<dimen name="route_info_legend_padding">12dp</dimen>
<dimen name="route_info_warning_padding">27dp</dimen>
<dimen name="route_info_chart_height">106dp</dimen>
<dimen name="route_info_control_buttons_height">72dp</dimen>
<dimen name="route_info_button_bg_line_radius">27dp</dimen>
<dimen name="route_info_card_details_margin">13dp</dimen>
<dimen name="route_info_legend_item_size">60dp</dimen>
@ -153,4 +127,6 @@
<dimen name="bottom_sheet_menu_peek_height">450dp</dimen>
<dimen name="side_of_the_world_button_size">54dp</dimen>
<dimen name="toolbar_height">64dp</dimen>
</resources>

View file

@ -46,6 +46,7 @@ import android.view.ViewTreeObserver;
import android.view.inputmethod.InputMethodManager;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.AttrRes;
@ -375,12 +376,17 @@ public class AndroidUtils {
}
public static void updateImageButton(Context ctx, ImageButton button, int iconLightId, int iconDarkId, int bgLightId, int bgDarkId, boolean night) {
button.setImageDrawable(AppCompatResources.getDrawable(ctx, night ? iconDarkId : iconLightId));
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
button.setBackground(AppCompatResources.getDrawable(ctx, night ? bgDarkId : bgLightId));
} else {
button.setBackgroundDrawable(AppCompatResources.getDrawable(ctx, night ? bgDarkId : bgLightId));
}
int btnSizePx = button.getLayoutParams().height;
int iconSizePx = (int) button.getContext().getResources().getDimension(R.dimen.map_widget_icon);
int iconPadding = (btnSizePx - iconSizePx) / 2;
button.setPadding(iconPadding, iconPadding, iconPadding, iconPadding);
button.setScaleType(ImageView.ScaleType.FIT_CENTER);
button.setImageDrawable(AppCompatResources.getDrawable(ctx, night ? iconDarkId : iconLightId));
}
public static void setDashButtonBackground(Context ctx, View view, boolean night) {

View file

@ -98,7 +98,7 @@ public class SecondSplashScreenFragment extends BaseOsmAndFragment {
RelativeLayout.LayoutParams logoLayoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
if (isSmartphone()) {
logoLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
logoLayoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
logoLayoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
} else {
logoLayoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
}

View file

@ -407,7 +407,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, IRouteInfo
int btnSizePx = mapActivity.getResources().getDimensionPixelSize(R.dimen.map_button_size);
actionButton.setLayoutParams(getActionButtonLayoutParams(btnSizePx));
actionButton.setBackgroundResource(R.drawable.btn_circle_blue);
int iconSizePx = mapActivity.getResources().getDimensionPixelSize(R.dimen.standard_icon_size);
int iconSizePx = mapActivity.getResources().getDimensionPixelSize(R.dimen.map_widget_icon);
int iconPadding = (btnSizePx - iconSizePx) / 2;
actionButton.setPadding(iconPadding, iconPadding, iconPadding, iconPadding);
hideActionButton();

View file

@ -1574,7 +1574,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
private int getRoutesBadgesColumnsPerRow(@Nullable String nearInDistance, int minBadgeWidth) {
try {
double gridSpacing = getResources().getDimension(R.dimen.context_menu_transport_grid_spacing);
double gridPadding = getResources().getDimension(R.dimen.context_menu_padding_margin_default);
double gridPadding = getResources().getDimension(R.dimen.content_padding);
int availableSpace;
if (nearInDistance == null) {
availableSpace = (int) (routesBadgesContainer.getWidth() - gridPadding * 2);

View file

@ -824,8 +824,8 @@ public class MenuBuilder {
baseView.setOrientation(LinearLayout.HORIZONTAL);
LinearLayout.LayoutParams llBaseViewParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
baseView.setLayoutParams(llBaseViewParams);
AndroidUtils.setPadding(baseView, dpToPx(16), 0, dpToPx(16), dpToPx(12));
baseView.setBackgroundResource(AndroidUtils.resolveAttribute(view.getContext(), android.R.attr.selectableItemBackground));
AndroidUtils.setPadding(baseView, dpToPx(16), 0, dpToPx(16), dpToPx(12));
TextViewEx transportRect = new TextViewEx(view.getContext());
LinearLayout.LayoutParams trParams = new LinearLayout.LayoutParams(dpToPx(32), dpToPx(18));

View file

@ -128,7 +128,7 @@ public class RearrangeMenuItemsAdapter extends RecyclerView.Adapter<RecyclerView
if (holder instanceof DescriptionHolder) {
DescriptionHolder h = (DescriptionHolder) holder;
ScreenType screenType = (ScreenType) item.value;
int paddingStart = (int) app.getResources().getDimension(R.dimen.toolbar_height);
int paddingStart = (int) app.getResources().getDimension(R.dimen.dashboard_map_toolbar);
int paddingTop = (int) app.getResources().getDimension(R.dimen.content_padding);
h.description.setText(String.format(app.getString(R.string.reorder_or_hide_from), app.getString(screenType.titleRes)));
h.image.setImageResource(nightMode ? screenType.imageNightRes : screenType.imageDayRes);

View file

@ -282,10 +282,15 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
}
private void updateQuickActionButton(boolean widgetVisible) {
quickActionButton.setImageDrawable(app.getUIUtilities().getMapIcon(
quickActionButton.setBackgroundResource(
nightMode ? R.drawable.btn_circle_night : R.drawable.btn_circle_trans);
int btnSizePx = quickActionButton.getLayoutParams().height;
int iconSizePx = (int) quickActionButton.getContext().getResources().getDimension(R.dimen.map_widget_icon);
int iconPadding = (btnSizePx - iconSizePx) / 2;
quickActionButton.setPadding(iconPadding, iconPadding, iconPadding, iconPadding);
quickActionButton.setScaleType(ImageView.ScaleType.FIT_CENTER);
quickActionButton.setImageDrawable(app.getUIUtilities().getMapIcon(
!widgetVisible ? R.drawable.map_quick_action : R.drawable.ic_action_close, !nightMode));
quickActionButton.setBackgroundResource(
nightMode ? R.drawable.btn_circle_night : R.drawable.btn_circle_trans);
quickActionButton.setContentDescription(mapActivity.getString(!widgetVisible ? R.string.configure_screen_quick_action : R.string.shared_string_cancel));
}

View file

@ -10,6 +10,7 @@ import android.graphics.Paint;
import android.graphics.PointF;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.text.util.Linkify;
import android.util.TypedValue;
@ -65,6 +66,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
private Bitmap poiBackground;
private Bitmap poiBackgroundSmall;
private PorterDuffColorFilter poiColorFilter;
private float textScale;
private int poiSize;
private OsmandMapTileView view;
@ -84,6 +86,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
routingHelper = activity.getRoutingHelper();
routingHelper.addListener(this);
app = activity.getMyApplication();
textScale = app.getSettings().TEXT_SCALE.get();
data = new OsmandMapLayer.MapLayerData<List<Amenity>>() {
Set<PoiUIFilter> calculatedFilters;
@ -220,7 +223,8 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
data.queryNewData(tileBox);
objects = data.getResults();
if (objects != null) {
float iconSize = poiBackground.getWidth() * 3 / 2;
textScale = app.getSettings().TEXT_SCALE.get();
float iconSize = poiBackground.getWidth() * 3 / 2 * textScale;
QuadTree<QuadRect> boundIntersections = initBoundIntersections(tileBox);
WaypointHelper wph = app.getWaypointHelper();
@ -233,7 +237,11 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
if (tileBox.containsPoint(x, y, iconSize)) {
if (intersects(boundIntersections, x, y, iconSize, iconSize) ||
(app.getSettings().SHOW_NEARBY_POI.get() && wph.isRouteCalculated() && !wph.isAmenityNoPassed(o))) {
canvas.drawBitmap(poiBackgroundSmall, x - poiBackgroundSmall.getWidth() / 2, y - poiBackgroundSmall.getHeight() / 2, paintIconBackground);
float scaledWidth = poiBackgroundSmall.getWidth() * textScale;
float scaledHeight = poiBackgroundSmall.getHeight() * textScale;
RectF rct = new RectF(0, 0, scaledWidth, scaledHeight);
rct.offset(x - scaledWidth / 2f, y - scaledHeight / 2f);
canvas.drawBitmap(poiBackgroundSmall, null, rct, paintIconBackground);
smallObjectsLatLon.add(new LatLon(o.getLocation().getLatitude(),
o.getLocation().getLongitude()));
} else {
@ -249,7 +257,11 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
int y = (int) tileBox.getPixYFromLatLon(o.getLocation().getLatitude(), o.getLocation()
.getLongitude());
if (tileBox.containsPoint(x, y, iconSize)) {
canvas.drawBitmap(poiBackground, x - poiBackground.getWidth() / 2, y - poiBackground.getHeight() / 2, paintIconBackground);
float scaledWidth = poiBackground.getWidth() * textScale;
float scaledHeight = poiBackground.getHeight() * textScale;
RectF rct = new RectF(0, 0, scaledWidth, scaledHeight);
rct.offset(x - scaledWidth / 2f, y - scaledHeight / 2f);
canvas.drawBitmap(poiBackground, null, rct, paintIconBackground);
String id = null;
PoiType st = o.getType().getPoiTypeByKeyName(o.getSubType());
if (st != null) {
@ -262,9 +274,10 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
if (id != null) {
Drawable img = RenderingIcons.getDrawableIcon(view.getContext(), id, false);
if (img != null) {
int scaledPoiSize = (int) (poiSize * textScale);
canvas.save();
canvas.translate(x - poiSize / 2f, y - poiSize / 2f);
img.setBounds(0, 0, poiSize, poiSize);
canvas.translate(x - scaledPoiSize / 2f, y - scaledPoiSize / 2f);
img.setBounds(0, 0, scaledPoiSize, scaledPoiSize);
img.setColorFilter(poiColorFilter);
img.draw(canvas);
canvas.restore();

View file

@ -10,6 +10,8 @@ import android.graphics.Path;
import android.graphics.PointF;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.util.DisplayMetrics;
import android.view.WindowManager;
@ -65,11 +67,13 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
private Path path;
private float backgroundIconHalfWidth;
private float backgroundIconHalfHeight;
private float textScale;
public TransportStopsLayer(MapActivity mapActivity) {
this.mapActivity = mapActivity;
OsmandSettings settings = mapActivity.getMyApplication().getSettings();
showTransportStops = settings.getCustomRenderBooleanProperty(TRANSPORT_STOPS_OVER_MAP).cache();
textScale = settings.TEXT_SCALE.get();
}
@SuppressWarnings("deprecation")
@ -233,7 +237,8 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
}
if (objects != null) {
float iconSize = stopBus.getWidth() * 3 / 2.5f;
textScale = mapActivity.getMyApplication().getSettings().TEXT_SCALE.get();
float iconSize = stopBus.getWidth() * 3 / 2.5f * textScale;
QuadTree<QuadRect> boundIntersections = initBoundIntersections(tb);
List<TransportStop> fullObjects = new ArrayList<>();
for (TransportStop o : objects) {
@ -254,17 +259,27 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
TransportStopType type = TransportStopType.findType(stopRoute.route.getType());
if (type != null) {
Drawable foregroundIcon = RenderingIcons.getDrawableIcon(mapActivity, type.getResName(), false);
canvas.drawBitmap(backgroundIcon, x - backgroundIconHalfWidth, y - backgroundIconHalfHeight, paintIcon);
float scaledWidth = backgroundIcon.getWidth() * textScale;
float scaledHeight = backgroundIcon.getHeight() * textScale;
RectF rct = new RectF(0, 0, scaledWidth, scaledHeight);
rct.offset(x - scaledWidth / 2f, y - scaledHeight / 2f);
canvas.drawBitmap(backgroundIcon, null, rct, paintIcon);
canvas.save();
canvas.translate(x - foregroundIcon.getIntrinsicWidth() / 2f, y - foregroundIcon.getIntrinsicHeight() / 2f);
foregroundIcon.setBounds(0, 0, foregroundIcon.getIntrinsicWidth(), foregroundIcon.getIntrinsicHeight());
scaledWidth = foregroundIcon.getIntrinsicWidth() * textScale;
scaledHeight = foregroundIcon.getIntrinsicHeight() * textScale;
canvas.translate(x - scaledWidth / 2f, y - scaledHeight / 2f);
foregroundIcon.setBounds(0, 0, (int) scaledWidth, (int) scaledHeight);
foregroundIcon.setColorFilter(nightMode ? paintDarkIconFilter : paintLightIconFilter);
foregroundIcon.draw(canvas);
canvas.restore();
}
} else {
Bitmap b = stopBus;
canvas.drawBitmap(b, x - b.getWidth() / 2f, y - b.getHeight() / 2f, paintIcon);
float scaledWidth = b.getWidth() * textScale;
float scaledHeight = b.getHeight() * textScale;
RectF rct = new RectF(0, 0, scaledWidth, scaledHeight);
rct.offset(x - scaledWidth / 2f, y - scaledHeight / 2f);
canvas.drawBitmap(b, null, rct, paintIcon);
}
}
}