Ctx menu in progress, IconCache fix
This commit is contained in:
parent
9b9f9c9c04
commit
0ba3f9072b
7 changed files with 33 additions and 33 deletions
|
@ -37,11 +37,11 @@
|
|||
<ImageView
|
||||
android:id="@+id/context_menu_icon_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="center"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginTop="18dp"
|
||||
android:src="@drawable/ic_action_building_number"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -50,7 +50,7 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
@ -71,7 +71,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginRight="12dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:text="@string/other_location"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"/>
|
||||
|
@ -170,7 +170,8 @@
|
|||
android:id="@+id/context_menu_bottom_view"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:background="?attr/ctx_menu_info_view_bg">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
|
@ -186,7 +187,7 @@
|
|||
android:id="@+id/context_menu_bottom_border"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0dp"
|
||||
android:background="?attr/bg_map_context_menu"
|
||||
android:background="?attr/ctx_menu_info_view_bg"
|
||||
android:orientation="vertical">
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
<attr name="bg_color" format="reference" />
|
||||
<attr name="bg_card" format="reference" />
|
||||
<attr name="bg_map_context_menu" format="reference" />
|
||||
<attr name="ctx_menu_info_view_bg" format="reference" />
|
||||
|
||||
<attr name="dashboard_divider" format="reference" />
|
||||
<attr name="dashboard_button" format="reference" />
|
||||
|
|
|
@ -58,6 +58,13 @@
|
|||
<color name="icon_color">#727272</color>
|
||||
<color name="icon_color_light">#ccc</color>
|
||||
|
||||
<color name="ctx_menu_info_view_bg_light">#eaeaea</color>
|
||||
<color name="ctx_menu_info_view_bg_dark">#292f33</color>
|
||||
<color name="ctx_menu_info_text_light">#212121</color>
|
||||
<color name="ctx_menu_info_text_dark">#b4c3cc</color>
|
||||
<color name="ctx_menu_info_divider_light">#d9d9d9</color>
|
||||
<color name="ctx_menu_info_divider_dark">#333b40</color>
|
||||
|
||||
<color name="dashboard_gpx_on_map">#448AFF</color>
|
||||
<color name="dashboard_background">#eaeaea</color>
|
||||
<color name="dashboard_divider_light">#F0F0F0</color>
|
||||
|
|
|
@ -69,6 +69,7 @@
|
|||
<item name="bg_map_context_menu">@drawable/bg_map_context_menu_light</item>
|
||||
<item name="dashboard_divider">@color/dashboard_divider_light</item>
|
||||
<item name="dashboard_button">@drawable/dashboard_button_light</item>
|
||||
<item name="ctx_menu_info_view_bg">@color/ctx_menu_info_view_bg_light</item>
|
||||
<item name="search_background">@color/search_background_dark</item>
|
||||
<item name="actionModeCloseDrawable">@drawable/ic_action_mode_back</item>
|
||||
<item name="actionModeStyle">@style/WhiteActionMode</item>
|
||||
|
@ -164,6 +165,7 @@
|
|||
<item name="bg_map_context_menu">@drawable/bg_map_context_menu_dark</item>
|
||||
<item name="dashboard_divider">@color/dashboard_divider_dark</item>
|
||||
<item name="dashboard_button">@drawable/dashboard_button_dark</item>
|
||||
<item name="ctx_menu_info_view_bg">@color/ctx_menu_info_view_bg_dark</item>
|
||||
<item name="search_background">@color/color_white</item>
|
||||
<item name="switch_ex_background">@drawable/switch_ex_background_dark</item>
|
||||
<item name="switch_ex_text_color">@color/switch_ex_button_text_dark</item>
|
||||
|
|
|
@ -22,7 +22,7 @@ public class IconsCache {
|
|||
d = app.getResources().getDrawable(resId).mutate();
|
||||
d.clearColorFilter();
|
||||
if (clrId != 0) {
|
||||
d.setColorFilter(app.getResources().getColor(clrId), PorterDuff.Mode.MULTIPLY);
|
||||
d.setColorFilter(app.getResources().getColor(clrId), PorterDuff.Mode.SRC_IN);
|
||||
}
|
||||
drawable.put(hash, d);
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ public class IconsCache {
|
|||
if(d == null) {
|
||||
d = app.getResources().getDrawable(resId).mutate();
|
||||
d.clearColorFilter();
|
||||
d.setColorFilter(color, PorterDuff.Mode.MULTIPLY);
|
||||
d.setColorFilter(color, PorterDuff.Mode.SRC_IN);
|
||||
drawable.put(hash, d);
|
||||
}
|
||||
return d;
|
||||
|
|
|
@ -249,7 +249,7 @@ public class MapContextMenuFragment extends Fragment {
|
|||
iconLayout.setVisibility(View.GONE);
|
||||
} else {
|
||||
iconView.setImageDrawable(iconsCache.getIcon(iconId,
|
||||
light ? R.color.icon_color : R.color.icon_color_light));
|
||||
light ? R.color.osmand_orange : R.color.osmand_orange_dark));
|
||||
}
|
||||
|
||||
// Text line 1
|
||||
|
@ -263,7 +263,7 @@ public class MapContextMenuFragment extends Fragment {
|
|||
// Close button
|
||||
final ImageView closeButtonView = (ImageView)view.findViewById(R.id.context_menu_close_btn_view);
|
||||
closeButtonView.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_remove_dark,
|
||||
light ? R.color.actionbar_dark_color : R.color.actionbar_light_color));
|
||||
light ? R.color.icon_color_light : R.color.dash_search_icon_dark));
|
||||
closeButtonView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -275,7 +275,7 @@ public class MapContextMenuFragment extends Fragment {
|
|||
// Action buttons
|
||||
final ImageButton buttonNavigate = (ImageButton) view.findViewById(R.id.context_menu_route_button);
|
||||
buttonNavigate.setImageDrawable(iconsCache.getIcon(R.drawable.map_directions,
|
||||
light ? R.color.actionbar_dark_color : R.color.actionbar_light_color));
|
||||
light ? R.color.icon_color : R.color.dash_search_icon_dark));
|
||||
buttonNavigate.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -285,7 +285,7 @@ public class MapContextMenuFragment extends Fragment {
|
|||
|
||||
final ImageButton buttonFavorite = (ImageButton) view.findViewById(R.id.context_menu_fav_button);
|
||||
buttonFavorite.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_fav_dark,
|
||||
light ? R.color.actionbar_dark_color : R.color.actionbar_light_color));
|
||||
light ? R.color.icon_color : R.color.dash_search_icon_dark));
|
||||
buttonFavorite.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -295,7 +295,7 @@ public class MapContextMenuFragment extends Fragment {
|
|||
|
||||
final ImageButton buttonShare = (ImageButton) view.findViewById(R.id.context_menu_share_button);
|
||||
buttonShare.setImageDrawable(iconsCache.getIcon(R.drawable.abc_ic_menu_share_mtrl_alpha,
|
||||
light ? R.color.actionbar_dark_color : R.color.actionbar_light_color));
|
||||
light ? R.color.icon_color : R.color.dash_search_icon_dark));
|
||||
buttonShare.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -305,7 +305,7 @@ public class MapContextMenuFragment extends Fragment {
|
|||
|
||||
final ImageButton buttonMore = (ImageButton) view.findViewById(R.id.context_menu_more_button);
|
||||
buttonMore.setImageDrawable(iconsCache.getIcon(R.drawable.ic_overflow_menu_white,
|
||||
light ? R.color.actionbar_dark_color : R.color.actionbar_light_color));
|
||||
light ? R.color.icon_color : R.color.dash_search_icon_dark));
|
||||
buttonMore.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package net.osmand.plus.mapcontextmenu.sections;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
|
@ -16,6 +15,7 @@ import net.osmand.osm.MapPoiTypes;
|
|||
import net.osmand.osm.PoiType;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -31,7 +31,7 @@ public class AmenityInfoMenuBuilder extends MenuBuilder {
|
|||
}
|
||||
|
||||
private void buildRow(View view, int iconId, String text) {
|
||||
Resources.Theme theme = view.getContext().getTheme();
|
||||
boolean light = app.getSettings().isLightContent();
|
||||
|
||||
LinearLayout ll = new LinearLayout(view.getContext());
|
||||
ll.setOrientation(LinearLayout.HORIZONTAL);
|
||||
|
@ -64,16 +64,8 @@ public class AmenityInfoMenuBuilder extends MenuBuilder {
|
|||
ll.addView(llText);
|
||||
|
||||
TextView textView = new TextView(view.getContext());
|
||||
|
||||
// TypedValue typedValueTextSize = new TypedValue();
|
||||
// theme.resolveAttribute(R.dimen.default_desc_text_size, typedValueTextSize, true);
|
||||
// int textSize = typedValueTextSize.data;
|
||||
textView.setTextSize(14);
|
||||
|
||||
// TypedValue typedValueTextColor = new TypedValue();
|
||||
// theme.resolveAttribute(android.R.attr.textColorSecondary, typedValueTextColor, true);
|
||||
// int textColor = typedValueTextColor.data;
|
||||
//textView.setTextColor(textColor);
|
||||
textView.setTextSize(18); // todo: create constant
|
||||
textView.setTextColor(app.getResources().getColor(light ? R.color.ctx_menu_info_text_light : R.color.ctx_menu_info_text_dark));
|
||||
|
||||
textView.setText(text);
|
||||
//textView.setText("sdf dsaf fsdasdfg adsf asdsfd asdf sdf adsfg asdf sdfa sdf dsf agsfdgd fgsfd sdf asdf adg adf sdf asdf dfgdfsg sdfg adsf asdf asdf sdf SDF ASDF ADSF ASDF ASDF DAF SDAF dfg dsfg dfg sdfg rg rth sfghs dfgs dfgsdfg adfg dfg sdfg dfs ");
|
||||
|
@ -91,10 +83,7 @@ public class AmenityInfoMenuBuilder extends MenuBuilder {
|
|||
llHorLineParams.gravity = Gravity.BOTTOM;
|
||||
horizontalLine.setLayoutParams(llHorLineParams);
|
||||
|
||||
TypedValue typedValueColor = new TypedValue();
|
||||
theme.resolveAttribute(R.attr.dashboard_divider, typedValueColor, true);
|
||||
int color = typedValueColor.data;
|
||||
horizontalLine.setBackgroundColor(color);
|
||||
horizontalLine.setBackgroundColor(app.getResources().getColor(light ? R.color.ctx_menu_info_divider_light : R.color.ctx_menu_info_divider_dark));
|
||||
|
||||
((LinearLayout)view).addView(horizontalLine);
|
||||
}
|
||||
|
@ -135,11 +124,11 @@ public class AmenityInfoMenuBuilder extends MenuBuilder {
|
|||
if(pt instanceof PoiType && !((PoiType) pt).isText()) {
|
||||
vl = pt.getTranslation();
|
||||
} else {
|
||||
vl = /*pt.getTranslation() + ": " + */amenity.unzipContent(e.getValue());
|
||||
vl = pt.getTranslation() + ": " + amenity.unzipContent(e.getValue());
|
||||
}
|
||||
} else {
|
||||
vl = /*Algorithms.capitalizeFirstLetterAndLowercase(e.getKey()) +
|
||||
": " + */amenity.unzipContent(e.getValue());
|
||||
vl = Algorithms.capitalizeFirstLetterAndLowercase(e.getKey()) +
|
||||
": " + amenity.unzipContent(e.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue