Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
4c20ae48e6
18 changed files with 149 additions and 48 deletions
|
@ -59,9 +59,9 @@ public class OpeningHoursParser {
|
|||
for (int i = 0; i < strings.length; i++) {
|
||||
if (strings[i] != null) {
|
||||
if (strings[i].length() > 2) {
|
||||
newStrings[i] = strings[i].substring(0, 2);
|
||||
newStrings[i] = Algorithms.capitalizeFirstLetter(strings[i].substring(0, 2));
|
||||
} else {
|
||||
newStrings[i] = strings[i];
|
||||
newStrings[i] = Algorithms.capitalizeFirstLetter(strings[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
android:layout_width="@dimen/context_img_card_width"
|
||||
android:layout_height="@dimen/context_img_card_height"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:background="?attr/bg_color"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:background="?attr/bg_color"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
|
@ -17,7 +18,7 @@
|
|||
android:maxLines="4"
|
||||
android:gravity="center"
|
||||
android:ellipsize="end"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
tools:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
android:text="@string/mapillary_action_descr"/>
|
||||
|
||||
|
@ -38,8 +39,9 @@
|
|||
android:text="@string/shared_string_add_photos"/>
|
||||
|
||||
<View
|
||||
android:id="@+id/card_background"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/context_menu_card"/>
|
||||
tools:background="?attr/context_menu_card"/>
|
||||
|
||||
</FrameLayout>
|
|
@ -80,6 +80,7 @@
|
|||
android:visibility="gone"/>
|
||||
|
||||
<View
|
||||
android:id="@+id/card_background"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/context_menu_card"/>
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
android:layout_width="@dimen/context_img_card_width"
|
||||
android:layout_height="@dimen/context_img_card_height"
|
||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||
android:background="?attr/bg_color"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:background="?attr/bg_color"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
|
@ -14,11 +15,12 @@
|
|||
android:orientation="horizontal">
|
||||
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
android:id="@+id/icon_sadface"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:tint="?attr/primary_icon_color"
|
||||
android:src="@drawable/ic_action_sadface"/>
|
||||
tools:tint="?attr/primary_icon_color"
|
||||
tools:src="@drawable/ic_action_sadface"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
|
@ -30,17 +32,18 @@
|
|||
android:maxLines="4"
|
||||
android:gravity="center_vertical"
|
||||
android:ellipsize="end"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
tools:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
android:text="@string/no_photos_descr"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/button_background"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="?attr/ctx_menu_card_btn"
|
||||
tools:background="?attr/ctx_menu_card_btn"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
|
@ -57,20 +60,22 @@
|
|||
android:orientation="horizontal">
|
||||
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
android:id="@+id/icon_add_photos"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:tint="?attr/color_dialog_buttons"
|
||||
android:src="@drawable/ic_action_add_photos"/>
|
||||
tools:tint="?attr/color_dialog_buttons"
|
||||
tools:src="@drawable/ic_action_add_photos"/>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/app_photos_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
osmand:textAllCapsCompat="true"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
android:textColor="?attr/color_dialog_buttons"
|
||||
tools:textColor="?attr/color_dialog_buttons"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/shared_string_add_photos"/>
|
||||
|
||||
|
@ -81,8 +86,9 @@
|
|||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/card_background"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/context_menu_card"/>
|
||||
tools:background="?attr/context_menu_card"/>
|
||||
|
||||
</FrameLayout>
|
|
@ -1,11 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="@dimen/context_img_card_width"
|
||||
android:layout_height="@dimen/context_img_card_height"
|
||||
android:background="?attr/bg_card"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
tools:background="?attr/bg_card">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress"
|
||||
|
|
|
@ -354,6 +354,8 @@
|
|||
<color name="ctx_menu_bottom_view_url_color_dark">#d28521</color>
|
||||
<color name="ctx_menu_controller_disabled_text_color_light">#b3b3b3</color>
|
||||
<color name="ctx_menu_controller_disabled_text_color_dark">#666666</color>
|
||||
<color name="ctx_menu_collapse_icon_color_light">#727272</color>
|
||||
<color name="ctx_menu_collapse_icon_color_dark">#a6a6a6</color>
|
||||
|
||||
<color name="route_info_bg_light">#ffffff</color>
|
||||
<color name="route_info_bg_dark">#17191a</color>
|
||||
|
|
|
@ -15,8 +15,12 @@ import android.os.IBinder;
|
|||
import android.support.annotation.ColorRes;
|
||||
import android.support.annotation.DrawableRes;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableString;
|
||||
import android.text.TextPaint;
|
||||
import android.text.TextUtils;
|
||||
import android.text.format.DateFormat;
|
||||
import android.text.style.URLSpan;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.TypedValue;
|
||||
import android.view.View;
|
||||
|
@ -92,6 +96,24 @@ public class AndroidUtils {
|
|||
return src;
|
||||
}
|
||||
|
||||
public static void removeLinkUnderline(TextView textView) {
|
||||
Spannable s = new SpannableString(textView.getText());
|
||||
for (URLSpan span : s.getSpans(0, s.length(), URLSpan.class)) {
|
||||
int start = s.getSpanStart(span);
|
||||
int end = s.getSpanEnd(span);
|
||||
s.removeSpan(span);
|
||||
span = new URLSpan(span.getURL()) {
|
||||
@Override
|
||||
public void updateDrawState(TextPaint ds) {
|
||||
super.updateDrawState(ds);
|
||||
ds.setUnderlineText(false);
|
||||
}
|
||||
};
|
||||
s.setSpan(span, start, end, 0);
|
||||
}
|
||||
textView.setText(s);
|
||||
}
|
||||
|
||||
public static String formatDate(Context ctx, long time) {
|
||||
return DateFormat.getDateFormat(ctx).format(new Date(time));
|
||||
}
|
||||
|
|
|
@ -378,6 +378,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
|||
@Nullable PointDescription pointDescription,
|
||||
@Nullable Object object) {
|
||||
if (init(latLon, pointDescription, object)) {
|
||||
mapActivity.getMyApplication().logEvent(mapActivity, "open_context_menu");
|
||||
showInternal();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -309,7 +309,7 @@ public class MenuBuilder {
|
|||
buildNearestPhotosRow(view);
|
||||
}
|
||||
buildPluginRows(view);
|
||||
buildAfter(view);
|
||||
// buildAfter(view);
|
||||
}
|
||||
|
||||
private boolean showTransportRoutes() {
|
||||
|
@ -517,11 +517,15 @@ public class MenuBuilder {
|
|||
textView.setTextSize(16);
|
||||
textView.setTextColor(app.getResources().getColor(light ? R.color.ctx_menu_bottom_view_text_color_light : R.color.ctx_menu_bottom_view_text_color_dark));
|
||||
|
||||
int linkTextColor = ContextCompat.getColor(view.getContext(), light ? R.color.ctx_menu_bottom_view_url_color_light : R.color.ctx_menu_bottom_view_url_color_dark);
|
||||
|
||||
if (isUrl) {
|
||||
textView.setTextColor(ContextCompat.getColor(view.getContext(), light ? R.color.ctx_menu_bottom_view_url_color_light : R.color.ctx_menu_bottom_view_url_color_dark));
|
||||
textView.setTextColor(linkTextColor);
|
||||
} else if (needLinks) {
|
||||
textView.setAutoLinkMask(Linkify.ALL);
|
||||
Linkify.addLinks(textView, Linkify.ALL);
|
||||
textView.setLinksClickable(true);
|
||||
textView.setLinkTextColor(linkTextColor);
|
||||
AndroidUtils.removeLinkUnderline(textView);
|
||||
}
|
||||
if (textLinesLimit > 0) {
|
||||
textView.setMinLines(1);
|
||||
|
@ -574,8 +578,7 @@ public class MenuBuilder {
|
|||
llIconCollapseParams.gravity = Gravity.CENTER_VERTICAL;
|
||||
iconViewCollapse.setLayoutParams(llIconCollapseParams);
|
||||
iconViewCollapse.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
|
||||
iconViewCollapse.setImageDrawable(app.getIconsCache().getIcon(collapsableView.getContenView().getVisibility() == View.GONE ?
|
||||
R.drawable.ic_action_arrow_down : R.drawable.ic_action_arrow_up, light ? R.color.ctx_menu_bottom_view_icon_light : R.color.ctx_menu_bottom_view_icon_dark));
|
||||
iconViewCollapse.setImageDrawable(getCollapseIcon(collapsableView.getContenView().getVisibility() == View.GONE));
|
||||
llIconCollapse.addView(iconViewCollapse);
|
||||
ll.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -583,17 +586,17 @@ public class MenuBuilder {
|
|||
if (collapsableView.getContenView().getVisibility() == View.VISIBLE) {
|
||||
collapsableView.setCollapsed(true);
|
||||
collapsableView.getContenView().setVisibility(View.GONE);
|
||||
iconViewCollapse.setImageDrawable(app.getIconsCache().getIcon(R.drawable.ic_action_arrow_down, light ? R.color.ctx_menu_bottom_view_icon_light : R.color.ctx_menu_bottom_view_icon_dark));
|
||||
iconViewCollapse.setImageDrawable(getCollapseIcon(true));
|
||||
} else {
|
||||
collapsableView.setCollapsed(false);
|
||||
collapsableView.getContenView().setVisibility(View.VISIBLE);
|
||||
iconViewCollapse.setImageDrawable(app.getIconsCache().getIcon(R.drawable.ic_action_arrow_up, light ? R.color.ctx_menu_bottom_view_icon_light : R.color.ctx_menu_bottom_view_icon_dark));
|
||||
iconViewCollapse.setImageDrawable(getCollapseIcon(false));
|
||||
}
|
||||
}
|
||||
});
|
||||
if (collapsableView.isCollapsed()) {
|
||||
collapsableView.getContenView().setVisibility(View.GONE);
|
||||
iconViewCollapse.setImageDrawable(app.getIconsCache().getIcon(R.drawable.ic_action_arrow_down, light ? R.color.ctx_menu_bottom_view_icon_light : R.color.ctx_menu_bottom_view_icon_dark));
|
||||
iconViewCollapse.setImageDrawable(getCollapseIcon(true));
|
||||
}
|
||||
baseView.addView(collapsableView.getContenView());
|
||||
}
|
||||
|
@ -734,6 +737,11 @@ public class MenuBuilder {
|
|||
);
|
||||
}
|
||||
|
||||
public Drawable getCollapseIcon(boolean collapsed) {
|
||||
return app.getIconsCache().getIcon(collapsed ? R.drawable.ic_action_arrow_down : R.drawable.ic_action_arrow_up,
|
||||
light ? R.color.ctx_menu_collapse_icon_color_light : R.color.ctx_menu_collapse_icon_color_dark);
|
||||
}
|
||||
|
||||
private View buildTransportRowItem(View view, TransportStopRoute route, OnClickListener listener) {
|
||||
LinearLayout baseView = new LinearLayout(view.getContext());
|
||||
baseView.setOrientation(LinearLayout.HORIZONTAL);
|
||||
|
@ -796,6 +804,7 @@ public class MenuBuilder {
|
|||
LinearLayout.LayoutParams typeTextParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
typeTextView.setLayoutParams(typeTextParams);
|
||||
typeTextView.setText(route.getTypeStrRes());
|
||||
AndroidUtils.setTextSecondaryColor(getMapActivity(), typeTextView, getApplication().getDaynightHelper().isNightModeForMapControls());
|
||||
typeView.addView(typeTextView);
|
||||
|
||||
baseView.setOnClickListener(listener);
|
||||
|
|
|
@ -3,6 +3,7 @@ package net.osmand.plus.mapcontextmenu;
|
|||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.StateListDrawable;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.DrawableRes;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
|
@ -594,12 +595,13 @@ public abstract class MenuController extends BaseMenuController {
|
|||
}
|
||||
|
||||
public void updateStateListDrawableIcon(@DrawableRes int resId, boolean left) {
|
||||
boolean useStateList = enabled && Build.VERSION.SDK_INT >= 21;
|
||||
if (left) {
|
||||
leftIcon = enabled ? getStateListDrawable(resId) : null;
|
||||
leftIconId = enabled ? 0 : resId;
|
||||
leftIcon = useStateList ? getStateListDrawable(resId) : null;
|
||||
leftIconId = useStateList ? 0 : resId;
|
||||
} else {
|
||||
rightIcon = enabled ? getStateListDrawable(resId) : null;
|
||||
rightIconId = enabled ? 0 : resId;
|
||||
rightIcon = useStateList ? getStateListDrawable(resId) : null;
|
||||
rightIconId = useStateList ? 0 : resId;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@ import android.content.Intent;
|
|||
import android.content.res.ColorStateList;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.view.ContextThemeWrapper;
|
||||
import android.text.Html;
|
||||
|
@ -135,19 +137,29 @@ public class AmenityMenuBuilder extends MenuBuilder {
|
|||
textView.setTextSize(16);
|
||||
textView.setTextColor(app.getResources().getColor(light ? R.color.ctx_menu_bottom_view_text_color_light : R.color.ctx_menu_bottom_view_text_color_dark));
|
||||
|
||||
int linkTextColor = ContextCompat.getColor(view.getContext(), light ? R.color.ctx_menu_bottom_view_url_color_light : R.color.ctx_menu_bottom_view_url_color_dark);
|
||||
|
||||
boolean textDefined = false;
|
||||
if (isPhoneNumber || isUrl) {
|
||||
if (!Algorithms.isEmpty(textPrefix)) {
|
||||
SpannableString spannableString = new SpannableString(txt);
|
||||
spannableString.setSpan(new URLSpan(txt), textPrefix.length() + 2, txt.length(), 0);
|
||||
textView.setText(spannableString);
|
||||
textView.setLinkTextColor(linkTextColor);
|
||||
textDefined = true;
|
||||
} else {
|
||||
textView.setTextColor(textView.getLinkTextColors());
|
||||
textView.setTextColor(linkTextColor);
|
||||
}
|
||||
} else if (needLinks) {
|
||||
textView.setAutoLinkMask(Linkify.ALL);
|
||||
needLinks = false;
|
||||
}
|
||||
if (!textDefined) {
|
||||
textView.setText(txt);
|
||||
}
|
||||
if (needLinks) {
|
||||
Linkify.addLinks(textView, Linkify.ALL);
|
||||
textView.setLinksClickable(true);
|
||||
textView.setLinkTextColor(linkTextColor);
|
||||
AndroidUtils.removeLinkUnderline(textView);
|
||||
}
|
||||
textView.setEllipsize(TextUtils.TruncateAt.END);
|
||||
if (isWiki) {
|
||||
|
@ -157,9 +169,6 @@ public class AmenityMenuBuilder extends MenuBuilder {
|
|||
textView.setMinLines(1);
|
||||
textView.setMaxLines(10);
|
||||
}
|
||||
if (!textDefined) {
|
||||
textView.setText(txt);
|
||||
}
|
||||
if (textColor > 0) {
|
||||
textView.setTextColor(view.getResources().getColor(textColor));
|
||||
}
|
||||
|
@ -185,8 +194,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
|
|||
llIconCollapseParams.gravity = Gravity.CENTER_VERTICAL;
|
||||
iconViewCollapse.setLayoutParams(llIconCollapseParams);
|
||||
iconViewCollapse.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
|
||||
iconViewCollapse.setImageDrawable(app.getIconsCache().getThemedIcon(collapsableView.getContenView().getVisibility() == View.GONE ?
|
||||
R.drawable.ic_action_arrow_down : R.drawable.ic_action_arrow_up));
|
||||
iconViewCollapse.setImageDrawable(getCollapseIcon(collapsableView.getContenView().getVisibility() == View.GONE));
|
||||
llIconCollapse.addView(iconViewCollapse);
|
||||
ll.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -194,17 +202,17 @@ public class AmenityMenuBuilder extends MenuBuilder {
|
|||
if (collapsableView.getContenView().getVisibility() == View.VISIBLE) {
|
||||
collapsableView.setCollapsed(true);
|
||||
collapsableView.getContenView().setVisibility(View.GONE);
|
||||
iconViewCollapse.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_action_arrow_down));
|
||||
iconViewCollapse.setImageDrawable(getCollapseIcon(true));
|
||||
} else {
|
||||
collapsableView.setCollapsed(false);
|
||||
collapsableView.getContenView().setVisibility(View.VISIBLE);
|
||||
iconViewCollapse.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_action_arrow_up));
|
||||
iconViewCollapse.setImageDrawable(getCollapseIcon(false));
|
||||
}
|
||||
}
|
||||
});
|
||||
if (collapsableView.isCollapsed()) {
|
||||
collapsableView.getContenView().setVisibility(View.GONE);
|
||||
iconViewCollapse.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_action_arrow_down));
|
||||
iconViewCollapse.setImageDrawable(getCollapseIcon(true));
|
||||
}
|
||||
baseView.addView(collapsableView.getContenView());
|
||||
}
|
||||
|
@ -238,7 +246,8 @@ public class AmenityMenuBuilder extends MenuBuilder {
|
|||
light ? R.color.ctx_menu_controller_button_text_color_light_n : R.color.ctx_menu_controller_button_text_color_dark_n);
|
||||
Drawable pressed = app.getIconsCache().getIcon(R.drawable.ic_action_read_text,
|
||||
light ? R.color.ctx_menu_controller_button_text_color_light_p : R.color.ctx_menu_controller_button_text_color_dark_p);
|
||||
button.setCompoundDrawablesWithIntrinsicBounds(AndroidUtils.createStateListDrawable(normal, pressed), null, null, null);
|
||||
button.setCompoundDrawablesWithIntrinsicBounds(Build.VERSION.SDK_INT >= 21
|
||||
? AndroidUtils.createStateListDrawable(normal, pressed) : normal, null, null, null);
|
||||
button.setCompoundDrawablePadding(dpToPx(8f));
|
||||
llText.addView(button);
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import android.widget.ProgressBar;
|
|||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.AndroidNetworkUtils;
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.Location;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
|
@ -322,6 +323,10 @@ public abstract class ImageCard extends AbstractCard {
|
|||
ProgressBar progress = (ProgressBar) view.findViewById(R.id.progress);
|
||||
AppCompatButton button = (AppCompatButton) view.findViewById(R.id.button);
|
||||
|
||||
boolean night = getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||
AndroidUtils.setBackground(getMapActivity(), view.findViewById(R.id.card_background), night,
|
||||
R.drawable.context_menu_card_light, R.drawable.context_menu_card_dark);
|
||||
|
||||
if (icon == null && topIconId != 0) {
|
||||
icon = getMyApplication().getIconsCache().getIcon(topIconId);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
package net.osmand.plus.mapcontextmenu.builders.cards;
|
||||
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.mapillary.MapillaryPlugin;
|
||||
|
@ -20,6 +25,21 @@ public class NoImagesCard extends AbstractCard {
|
|||
@Override
|
||||
public void update() {
|
||||
if (view != null) {
|
||||
IconsCache ic = getMyApplication().getIconsCache();
|
||||
boolean night = getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||
MapActivity ctx = getMapActivity();
|
||||
AndroidUtils.setBackgroundColor(ctx, view, night, R.color.bg_color_light, R.color.bg_color_dark);
|
||||
((ImageView) view.findViewById(R.id.icon_sadface)).setImageDrawable(ic.getIcon(R.drawable.ic_action_sadface,
|
||||
night ? R.color.color_white : R.color.icon_color));
|
||||
AndroidUtils.setTextPrimaryColor(ctx, (TextView) view.findViewById(R.id.title), night);
|
||||
AndroidUtils.setBackgroundColor(ctx, view.findViewById(R.id.button_background), night,
|
||||
R.color.ctx_menu_card_btn_light, R.color.ctx_menu_card_btn_dark);
|
||||
((ImageView) view.findViewById(R.id.icon_add_photos)).setImageDrawable(ic.getIcon(R.drawable.ic_action_add_photos,
|
||||
night ? R.color.color_dialog_buttons_dark : R.color.color_dialog_buttons_light));
|
||||
((TextView) view.findViewById(R.id.app_photos_text_view)).setTextColor(ContextCompat.getColor(ctx,
|
||||
night ? R.color.color_dialog_buttons_dark : R.color.color_dialog_buttons_light));
|
||||
AndroidUtils.setBackground(ctx, view.findViewById(R.id.card_background), night,
|
||||
R.drawable.context_menu_card_light, R.drawable.context_menu_card_dark);
|
||||
view.findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package net.osmand.plus.mapcontextmenu.builders.cards;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
|
||||
|
@ -16,5 +17,7 @@ public class ProgressCard extends AbstractCard {
|
|||
|
||||
@Override
|
||||
public void update() {
|
||||
boolean night = getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||
AndroidUtils.setBackgroundColor(getMapActivity(), view, night, R.color.bg_color_light, R.color.bg_color_dark);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import android.graphics.drawable.LayerDrawable;
|
|||
import android.graphics.drawable.ShapeDrawable;
|
||||
import android.graphics.drawable.StateListDrawable;
|
||||
import android.graphics.drawable.shapes.OvalShape;
|
||||
import android.os.Build;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
|
@ -27,6 +28,7 @@ public class MapMarkerMenuController extends MenuController {
|
|||
public MapMarkerMenuController(MapActivity mapActivity, PointDescription pointDescription, MapMarker mapMarker) {
|
||||
super(new MenuBuilder(mapActivity), pointDescription, mapActivity);
|
||||
final OsmandApplication app = mapActivity.getMyApplication();
|
||||
final boolean useStateList = Build.VERSION.SDK_INT >= 21;
|
||||
this.mapMarker = mapMarker;
|
||||
builder.setShowNearestWiki(true);
|
||||
|
||||
|
@ -39,7 +41,8 @@ public class MapMarkerMenuController extends MenuController {
|
|||
}
|
||||
};
|
||||
leftTitleButtonController.caption = getMapActivity().getString(R.string.mark_passed);
|
||||
leftTitleButtonController.leftIcon = createStateListPassedIcon();
|
||||
leftTitleButtonController.leftIcon = useStateList ? createStateListPassedIcon()
|
||||
: createPassedIcon(getPassedIconBgNormalColorId(), 0);
|
||||
|
||||
rightTitleButtonController = new TitleButtonController() {
|
||||
@Override
|
||||
|
@ -54,16 +57,20 @@ public class MapMarkerMenuController extends MenuController {
|
|||
}
|
||||
};
|
||||
rightTitleButtonController.caption = getMapActivity().getString(R.string.make_active);
|
||||
rightTitleButtonController.leftIcon = createStateListShowOnTopbarIcon();
|
||||
rightTitleButtonController.leftIcon = useStateList ? createStateListShowOnTopbarIcon()
|
||||
: createShowOnTopbarIcon(getDeviceTopNormalColorId(), R.color.dashboard_blue);
|
||||
}
|
||||
|
||||
private int getPassedIconBgNormalColorId() {
|
||||
return isLight() ? R.color.map_widget_blue : R.color.osmand_orange;
|
||||
}
|
||||
|
||||
private StateListDrawable createStateListPassedIcon() {
|
||||
int bgNormal = isLight() ? R.color.map_widget_blue : R.color.osmand_orange;
|
||||
int bgPressed = isLight() ? R.color.ctx_menu_controller_button_text_color_light_p
|
||||
: R.color.ctx_menu_controller_button_text_color_dark_p;
|
||||
int icPressed = isLight() ? R.color.ctx_menu_controller_button_text_color_light_n
|
||||
: R.color.ctx_menu_controller_button_bg_color_dark_p;
|
||||
return AndroidUtils.createStateListDrawable(createPassedIcon(bgNormal, 0),
|
||||
return AndroidUtils.createStateListDrawable(createPassedIcon(getPassedIconBgNormalColorId(), 0),
|
||||
createPassedIcon(bgPressed, icPressed));
|
||||
}
|
||||
|
||||
|
@ -74,12 +81,15 @@ public class MapMarkerMenuController extends MenuController {
|
|||
return new LayerDrawable(new Drawable[]{bg, ic});
|
||||
}
|
||||
|
||||
private int getDeviceTopNormalColorId() {
|
||||
return isLight() ? R.color.on_map_icon_color : R.color.ctx_menu_info_text_dark;
|
||||
}
|
||||
|
||||
private StateListDrawable createStateListShowOnTopbarIcon() {
|
||||
int bgNormal = isLight() ? R.color.on_map_icon_color : R.color.ctx_menu_info_text_dark;
|
||||
int bgPressed = isLight() ? R.color.ctx_menu_controller_button_text_color_light_p
|
||||
: R.color.ctx_menu_controller_button_text_color_dark_p;
|
||||
int icPressed = isLight() ? R.color.osmand_orange : R.color.route_info_go_btn_bg_dark_p;
|
||||
return AndroidUtils.createStateListDrawable(createShowOnTopbarIcon(bgNormal, R.color.dashboard_blue),
|
||||
return AndroidUtils.createStateListDrawable(createShowOnTopbarIcon(getDeviceTopNormalColorId(), R.color.dashboard_blue),
|
||||
createShowOnTopbarIcon(bgPressed, icPressed));
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package net.osmand.plus.mapillary;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.mapcontextmenu.builders.cards.ImageCard;
|
||||
|
@ -22,6 +24,12 @@ public class MapillaryContributeCard extends ImageCard {
|
|||
@Override
|
||||
public void update() {
|
||||
if (view != null) {
|
||||
boolean night = getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||
MapActivity ctx = getMapActivity();
|
||||
AndroidUtils.setBackgroundColor(ctx, view, night, R.color.bg_color_light, R.color.bg_color_dark);
|
||||
AndroidUtils.setTextPrimaryColor(ctx, (TextView) view.findViewById(R.id.title), night);
|
||||
AndroidUtils.setBackground(ctx, view.findViewById(R.id.card_background), night,
|
||||
R.drawable.context_menu_card_light, R.drawable.context_menu_card_dark);
|
||||
view.findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
|
|
@ -74,7 +74,7 @@ public class ParkingPositionMenuController extends MenuController {
|
|||
|
||||
@Override
|
||||
public int getAdditionalInfoColor() {
|
||||
return plugin.getParkingType() ? R.color.ctx_menu_amenity_closed_text_color : isLight() ? R.color.icon_color : R.color.dash_search_icon_dark;
|
||||
return plugin.getParkingType() ? R.color.ctx_menu_amenity_closed_text_color : R.color.icon_color;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -248,7 +248,7 @@ public class ParkingPositionPlugin extends OsmandPlugin {
|
|||
.setIcon(R.drawable.ic_action_time_span).setTag(2).createItem());
|
||||
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(mapActivity);
|
||||
boolean light = app.getSettings().isLightContent() && !app.getDaynightHelper().isNightMode();
|
||||
boolean light = app.getSettings().isLightContent();
|
||||
final ArrayAdapter<ContextMenuItem> listAdapter = menuAdapter.createListAdapter(mapActivity, light);
|
||||
builder.setTitle(R.string.parking_options);
|
||||
builder.setAdapter(listAdapter, new DialogInterface.OnClickListener() {
|
||||
|
|
Loading…
Reference in a new issue