Update colors

This commit is contained in:
Victor Shcherb 2015-04-21 00:25:30 +02:00
parent 1ffdabdd54
commit 5d24cf83d4
18 changed files with 79 additions and 54 deletions

View file

@ -35,8 +35,7 @@
<dimen name="map_button_inset_shadow">3dp</dimen>
<dimen name="map_button_inset">3dp</dimen>
<dimen name="map_button_rect_rad">4dp</dimen>
<dimen name="map_button_stroke">1dp</dimen>
<dimen name="map_button_stroke_dark">2dp</dimen>
<dimen name="map_widget_icon_margin">6dp</dimen>
<!-- General -->

View file

@ -29,9 +29,9 @@
<color name="map_widget_icon_color">#ff8f00</color>
<color name="map_widget_stroke">#4C000000</color>
<color name="map_widget_light">#ffffff</color>
<color name="map_widget_dark">#50000000</color>
<color name="map_widget_dark_stroke">#30ffffff</color>
<color name="map_widget_dark_pressed">#50ffffff</color>
<color name="map_widget_dark">#a0000000</color>
<color name="map_widget_dark_stroke">#d0ffffff</color>
<color name="map_widget_dark_pressed">#80ffffff</color>
<color name="map_widget_light_trans">#80ffffff</color>
<color name="map_widget_light_pressed">#e5e5e5</color>
<color name="map_widget_blue">#536dfe</color>

View file

@ -84,6 +84,7 @@
<dimen name="map_button_inset">2dp</dimen>
<dimen name="map_button_rect_rad">3dp</dimen>
<dimen name="map_button_stroke">1dp</dimen>
<dimen name="map_button_stroke_dark">2dp</dimen>
<dimen name="map_widget_text_size">23sp</dimen>
<dimen name="map_widget_text_size_small">15sp</dimen>

View file

@ -1482,7 +1482,7 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A
<string name="free_version_title">Free version</string>
<string name="poi_context_menu_showdescription">Show POI description</string>
<string name="index_name_north_america">North America</string>
<string name="index_name_netherlands">Netherlands</string>
<string name="index_name_netherlands">Europe - Netherlands</string>
<string name="index_name_us">North America - United States</string>
<string name="index_name_central_america">Central America</string>
<string name="index_name_south_america">South America</string>

View file

@ -137,7 +137,7 @@ public class ContextMenuAdapter {
}
int lstLight = iconListLight.get(pos);
if(lstLight != 0) {
return ctx.getIconsCache().getActionBarIcon(lstLight, light);
return ctx.getIconsCache().getIcon(lstLight, light);
}
return null;
}

View file

@ -55,11 +55,11 @@ public class IconsCache {
}
public Drawable getActionBarIcon(int id) {
public Drawable getIcon(int id) {
return getDrawable(id, 0);
}
public Drawable getActionBarIcon(int id, boolean light) {
public Drawable getIcon(int id, boolean light) {
return getDrawable(id, light ? R.color.icon_color_light : 0);
}

View file

@ -44,7 +44,7 @@ public abstract class ActionBarPreferenceActivity extends PreferenceActivity {
shadowView = null;
}
tb.setClickable(true);
tb.setNavigationIcon(((OsmandApplication)getApplication()).getIconsCache().getActionBarIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha));
tb.setNavigationIcon(((OsmandApplication)getApplication()).getIconsCache().getIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha));
tb.setBackgroundColor(getResources().getColor(getResIdFromAttribute(this, R.attr.pstsTabBackground)));
tb.setTitleTextColor(getResources().getColor(getResIdFromAttribute(this, R.attr.pstsTextColor)));
tb.setNavigationOnClickListener(new View.OnClickListener() {

View file

@ -155,7 +155,7 @@ public class HelpActivity extends OsmandActionBarActivity {
public MenuItem createMenuItem(Menu m, int id, int titleRes, int iconDark, int menuItemType) {
MenuItem menuItem = m.add(0, id, 0, titleRes);
if (iconDark != 0) {
menuItem.setIcon(getMyApplication().getIconsCache().getActionBarIcon(iconDark));
menuItem.setIcon(getMyApplication().getIconsCache().getIcon(iconDark));
}
MenuItemCompat.setShowAsAction(menuItem, menuItemType);
menuItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {

View file

@ -122,7 +122,7 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi
}
MenuItem menuItem = menu.add(0, NAVIGATE_TO, 0, R.string.context_menu_item_directions_to);
MenuItemCompat.setShowAsAction(menuItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
menuItem = menuItem.setIcon(app.getIconsCache().getActionBarIcon(R.drawable.ic_action_gdirections_dark, light));
menuItem = menuItem.setIcon(app.getIconsCache().getIcon(R.drawable.ic_action_gdirections_dark, light));
menuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
@ -135,11 +135,11 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi
if (targets.getPointToNavigate() != null) {
menuItem = menu.add(0, ADD_WAYPOINT, 0, R.string.context_menu_item_intermediate_point);
MenuItemCompat.setShowAsAction(menuItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
menuItem = menuItem.setIcon(app.getIconsCache().getActionBarIcon(R.drawable.ic_action_flage_dark, light));
menuItem = menuItem.setIcon(app.getIconsCache().getIcon(R.drawable.ic_action_flage_dark, light));
} else {
menuItem = menu.add(0, ADD_WAYPOINT, 0, R.string.context_menu_item_destination_point);
MenuItemCompat.setShowAsAction(menuItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
menuItem = menuItem.setIcon(app.getIconsCache().getActionBarIcon(R.drawable.ic_action_flag_dark, light));
menuItem = menuItem.setIcon(app.getIconsCache().getIcon(R.drawable.ic_action_flag_dark, light));
}
menuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
@ -151,7 +151,7 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi
//}
menuItem = menu.add(0, SHOW_ON_MAP, 0, R.string.shared_string_show_on_map);
MenuItemCompat.setShowAsAction(menuItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
menuItem = menuItem.setIcon(app.getIconsCache().getActionBarIcon(R.drawable.ic_action_marker_dark, light));
menuItem = menuItem.setIcon(app.getIconsCache().getIcon(R.drawable.ic_action_marker_dark, light));
menuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
@ -163,7 +163,7 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi
menuItem = menu.add(0, ADD_TO_FAVORITE, 0, R.string.shared_string_add_to_favorites);
MenuItemCompat.setShowAsAction(menuItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
menuItem = menuItem.setIcon(app.getIconsCache().getActionBarIcon(R.drawable.ic_action_fav_dark, light));
menuItem = menuItem.setIcon(app.getIconsCache().getIcon(R.drawable.ic_action_fav_dark, light));
menuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override

View file

@ -18,7 +18,7 @@ public class OsmandActionBarActivity extends ActionBarActivity {
//should be called after set content view
protected void setupHomeButton(){
Drawable back = ((OsmandApplication)getApplication()).getIconsCache().getActionBarIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
Drawable back = ((OsmandApplication)getApplication()).getIconsCache().getIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
back.setColorFilter(getResources().getColor(R.color.color_white), PorterDuff.Mode.MULTIPLY);
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);

View file

@ -48,7 +48,7 @@ public abstract class OsmandListActivity extends
public MenuItem createMenuItem(Menu m, int id, int titleRes, int iconDark, int menuItemType) {
MenuItem menuItem = m.add(0, id, 0, titleRes);
if (iconDark != 0) {
menuItem.setIcon(getMyApplication().getIconsCache().getActionBarIcon(iconDark));
menuItem.setIcon(getMyApplication().getIconsCache().getIcon(iconDark));
}
menuItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override

View file

@ -145,7 +145,7 @@ public class SettingsActivity extends SettingsBaseActivity {
ll.setOrientation(LinearLayout.VERTICAL);
Toolbar tb = new Toolbar(this);
tb.setClickable(true);
Drawable back = ((OsmandApplication)getApplication()).getIconsCache().getActionBarIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
Drawable back = ((OsmandApplication)getApplication()).getIconsCache().getIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
tb.setNavigationIcon(back);
tb.setTitle(R.string.about_settings);
tb.setBackgroundColor(getResources().getColor( getResIdFromAttribute(this, R.attr.pstsTabBackground)));

View file

@ -508,7 +508,7 @@ public abstract class SearchByNameAbstractActivity<T> extends OsmandListActivity
MenuItem menuItem = menu.add(0, NAVIGATE_TO, 0, R.string.context_menu_item_directions_to);
MenuItemCompat.setShowAsAction(menuItem,
MenuItemCompat.SHOW_AS_ACTION_ALWAYS | MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT);
menuItem = menuItem.setIcon(app.getIconsCache().getActionBarIcon(R.drawable.ic_action_gdirections_dark));
menuItem = menuItem.setIcon(app.getIconsCache().getIcon(R.drawable.ic_action_gdirections_dark));
menuItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
@ -521,12 +521,12 @@ public abstract class SearchByNameAbstractActivity<T> extends OsmandListActivity
menuItem = menu.add(0, ADD_WAYPOINT, 0, R.string.context_menu_item_intermediate_point);
MenuItemCompat.setShowAsAction(menuItem,
MenuItemCompat.SHOW_AS_ACTION_ALWAYS | MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT);
menuItem = menuItem.setIcon(app.getIconsCache().getActionBarIcon(R.drawable.ic_action_flage_dark));
menuItem = menuItem.setIcon(app.getIconsCache().getIcon(R.drawable.ic_action_flage_dark));
} else {
menuItem = menu.add(0, ADD_WAYPOINT, 0, R.string.context_menu_item_destination_point);
MenuItemCompat.setShowAsAction(menuItem,
MenuItemCompat.SHOW_AS_ACTION_ALWAYS | MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT);
menuItem = menuItem.setIcon(app.getIconsCache().getActionBarIcon( R.drawable.ic_action_flag_dark));
menuItem = menuItem.setIcon(app.getIconsCache().getIcon( R.drawable.ic_action_flag_dark));
}
menuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
@ -538,7 +538,7 @@ public abstract class SearchByNameAbstractActivity<T> extends OsmandListActivity
menuItem = menu.add(0, SHOW_ON_MAP, 0, R.string.shared_string_show_on_map);
MenuItemCompat.setShowAsAction(menuItem,
MenuItemCompat.SHOW_AS_ACTION_ALWAYS | MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT);
menuItem = menuItem.setIcon(app.getIconsCache().getActionBarIcon(R.drawable.ic_action_marker_dark));
menuItem = menuItem.setIcon(app.getIconsCache().getIcon(R.drawable.ic_action_marker_dark));
menuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
@ -551,7 +551,7 @@ public abstract class SearchByNameAbstractActivity<T> extends OsmandListActivity
menuItem = menu.add(0, ADD_TO_FAVORITE, 0, R.string.shared_string_add_to_favorites);
MenuItemCompat.setShowAsAction(menuItem,
MenuItemCompat.SHOW_AS_ACTION_ALWAYS | MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT);
menuItem = menuItem.setIcon(app.getIconsCache().getActionBarIcon(R.drawable.ic_action_fav_dark));
menuItem = menuItem.setIcon(app.getIconsCache().getIcon(R.drawable.ic_action_fav_dark));
menuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override

View file

@ -132,7 +132,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
});
showFilterItem = menu.add(0, FILTER, 0, R.string.search_poi_filter);
MenuItemCompat.setShowAsAction(showFilterItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
showFilterItem = showFilterItem.setIcon(getMyApplication().getIconsCache().getActionBarIcon(
showFilterItem = showFilterItem.setIcon(getMyApplication().getIconsCache().getIcon(
R.drawable.ic_action_filter_dark));
showFilterItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
@ -155,7 +155,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
showOnMapItem = menu.add(0, SHOW_ON_MAP, 0, R.string.shared_string_show_on_map);
MenuItemCompat.setShowAsAction(showOnMapItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
showOnMapItem = showOnMapItem.setIcon(getMyApplication().getIconsCache().getActionBarIcon(
showOnMapItem = showOnMapItem.setIcon(getMyApplication().getIconsCache().getIcon(
R.drawable.ic_show_on_map));
showOnMapItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override

View file

@ -215,7 +215,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
lst.setVisibility(View.GONE);
ImageView back = (ImageView) dashboardView.findViewById(R.id.toolbar_back);
back.setImageDrawable(
((OsmandApplication)getMyApplication()).getIconsCache().getActionBarIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha));
((OsmandApplication)getMyApplication()).getIconsCache().getIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha));
back.setOnClickListener(new View.OnClickListener() {
@Override
@ -247,7 +247,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
if (getMyApplication().getWaypointHelper().isRouteCalculated()) {
flat.setVisibility(View.VISIBLE);
final boolean flatNow = visibleType == DashboardType.WAYPOINTS_FLAT;
flat.setImageDrawable(iconsCache.getActionBarIcon(flatNow ? R.drawable.ic_tree_list_dark
flat.setImageDrawable(iconsCache.getIcon(flatNow ? R.drawable.ic_tree_list_dark
: R.drawable.ic_flat_list_dark));
flat.setOnClickListener(new View.OnClickListener() {
@ -284,9 +284,9 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
});
lst.setVisibility(View.VISIBLE);
if (visibleType == DashboardType.DASHBOARD) {
lst.setImageDrawable(iconsCache.getActionBarIcon(R.drawable.ic_navigation_drawer));
lst.setImageDrawable(iconsCache.getIcon(R.drawable.ic_navigation_drawer));
} else if (visibleType == DashboardType.LIST_MENU) {
lst.setImageDrawable(iconsCache.getActionBarIcon(R.drawable.ic_dashboard_dark));
lst.setImageDrawable(iconsCache.getIcon(R.drawable.ic_dashboard_dark));
}
lst.setOnClickListener(new View.OnClickListener() {
@Override

View file

@ -231,7 +231,7 @@ public class TourViewActivity extends OsmandActionBarActivity {
final MenuItem.OnMenuItemClickListener listener) {
MenuItem menuItem = m.add(0, id, 0, titleRes);
if (r != 0) {
menuItem.setIcon(getMyApplication().getIconsCache().getActionBarIcon(r));
menuItem.setIcon(getMyApplication().getIconsCache().getIcon(r));
}
MenuItemCompat.setShowAsAction(menuItem, menuItemType);
menuItem.setOnMenuItemClickListener(listener);

View file

@ -174,7 +174,8 @@ public class MapControlsLayer extends OsmandMapLayer {
private void initTopControls() {
View configureMap = mapActivity.findViewById(R.id.map_layers_button);
controls.add(createHudButton((ImageView) configureMap, R.drawable.map_layer_dark)
.setIconColorId(R.drawable.map_layer_dark, R.drawable.map_layer_night));
.setIconsId(R.drawable.map_layer_dark, R.drawable.map_layer_night)
.setBg(R.drawable.btn_inset_circle_trans, R.drawable.btn_inset_circle_night));
configureMap.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -184,7 +185,8 @@ public class MapControlsLayer extends OsmandMapLayer {
});
View compass = mapActivity.findViewById(R.id.map_compass_button);
compassHud = createHudButton((ImageView) compass, R.drawable.map_compass).setIconColorId(0);
compassHud = createHudButton((ImageView) compass, R.drawable.map_compass).setIconColorId(0).
setBg(R.drawable.btn_inset_circle_trans, R.drawable.btn_inset_circle_night);
compassHud.compass = true;
controls.add(compassHud);
compass.setOnClickListener(new View.OnClickListener() {
@ -345,8 +347,11 @@ public class MapControlsLayer extends OsmandMapLayer {
mapActivity.getMapViewTrackingUtilities().backToLocationImpl();
}
});
controls.add(createHudButton(mapActivity.findViewById(R.id.map_app_mode_shadow), 0).setBg(
R.drawable.btn_round_trans, R.drawable.btn_round_transparent));
View backToMenuButton = mapActivity.findViewById(R.id.map_menu_button);
menuControl = createHudButton((ImageView) backToMenuButton, R.drawable.map_dashboard).setBg(
R.drawable.btn_round, R.drawable.btn_round_night);
controls.add(menuControl);
@ -398,7 +403,7 @@ public class MapControlsLayer extends OsmandMapLayer {
final OsmandMapTileView view = mapActivity.getMapView();
View zoomInButton = mapActivity.findViewById(R.id.map_zoom_in_button);
controls.add(createHudButton((ImageView) zoomInButton, R.drawable.map_zoom_in).
setIconColorId(R.drawable.map_zoom_in, R.drawable.map_zoom_in_night).setRoundTransparent());
setIconsId(R.drawable.map_zoom_in, R.drawable.map_zoom_in_night).setRoundTransparent());
zoomInButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -415,7 +420,7 @@ public class MapControlsLayer extends OsmandMapLayer {
zoomInButton.setOnLongClickListener(listener);
View zoomOutButton = mapActivity.findViewById(R.id.map_zoom_out_button);
controls.add(createHudButton((ImageView) zoomOutButton, R.drawable.map_zoom_out).
setIconColorId(R.drawable.map_zoom_out, R.drawable.map_zoom_out_night).setRoundTransparent());
setIconsId(R.drawable.map_zoom_out, R.drawable.map_zoom_out_night).setRoundTransparent());
zoomOutButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -546,7 +551,7 @@ public class MapControlsLayer extends OsmandMapLayer {
zoomText.setVisibility(View.GONE);
appModeIcon.setVisibility(View.VISIBLE);
appModeIcon.setImageDrawable(
app.getIconsCache().getActionBarIcon(
app.getIconsCache().getIcon(
settings.getApplicationMode().getSmallIconDark(), !isNight));
} else {
zoomText.setVisibility(View.VISIBLE);
@ -698,15 +703,18 @@ public class MapControlsLayer extends OsmandMapLayer {
int bgDark;
int bgLight;
int resId;
int resLight = R.color.icon_color_light;
int resDark = 0;
int resLightId;
int resDarkId;
int resClrLight = R.color.icon_color_light;
int resClrDark = 0;
boolean nightMode = false;
boolean f = true;
boolean compass;
public MapHudButton setRoundTransparent() {
setBg(R.drawable.btn_circle_trans);
setBg(R.drawable.btn_circle_trans, R.drawable.btn_circle_night);
return this;
}
@ -754,21 +762,31 @@ public class MapControlsLayer extends OsmandMapLayer {
}
public MapHudButton setIconColorId(int clr) {
if (resLight == clr && resDark == clr) {
if (resClrLight == clr && resClrDark == clr) {
return this;
}
resLight = clr;
resDark = clr;
resClrLight = clr;
resClrDark = clr;
f = true;
return this;
}
public MapHudButton setIconsId(int icnLight, int icnDark) {
if (resLightId == icnLight && resDarkId == icnDark) {
return this;
}
resLightId = icnLight;
resDarkId = icnDark;
f = true;
return this;
}
public MapHudButton setIconColorId(int clrLight, int clrDark) {
if (resLight == clrLight && resDark == clrDark) {
if (resClrLight == clrLight && resClrDark == clrDark) {
return this;
}
resLight = clrLight;
resDark = clrDark;
resClrLight = clrLight;
resClrDark = clrDark;
f = true;
return this;
}
@ -778,21 +796,28 @@ public class MapControlsLayer extends OsmandMapLayer {
return;
}
f = false;
nightMode = night;
nightMode = night;
if (bgDark != 0 && bgLight != 0) {
iv.setBackgroundDrawable(ctx.getResources().getDrawable(night ? bgDark : bgLight));
}
Drawable d = null;
if(resDarkId != 0 && nightMode) {
d = ctx.getIconsCache().getIcon(resDarkId);
} else if(resLightId != 0 && !nightMode) {
d = ctx.getIconsCache().getIcon(resLightId);
} else if(resId != 0){
d = ctx.getIconsCache().getIcon(resId, nightMode ? resClrDark : resClrLight);
}
if (iv instanceof ImageView) {
if (compass) {
((ImageView) iv).setImageDrawable(new CompassDrawable(ctx.getIconsCache().getIcon(resId,
nightMode ? resDark : resLight)));
((ImageView) iv).setImageDrawable(new CompassDrawable(d));
} else {
((ImageView) iv).setImageDrawable(ctx.getIconsCache()
.getIcon(resId, nightMode ? resDark : resLight));
((ImageView) iv).setImageDrawable(d);
}
} else if (iv instanceof TextView) {
((TextView) iv).setCompoundDrawablesWithIntrinsicBounds(
ctx.getIconsCache().getIcon(resId, nightMode ? resDark : resLight), null, null, null);
d, null, null, null);
}
}

View file

@ -216,9 +216,9 @@ public class MapInfoWidgetsFactory {
ImageView all = (ImageView) waypointInfoBar.findViewById(R.id.waypoint_more);
ImageView remove = (ImageView) waypointInfoBar.findViewById(R.id.waypoint_close);
all.setImageDrawable(map.getMyApplication().getIconsCache()
.getActionBarIcon(R.drawable.ic_overflow_menu_white, !nightMode));
.getIcon(R.drawable.ic_overflow_menu_white, !nightMode));
remove.setImageDrawable(map.getMyApplication().getIconsCache()
.getActionBarIcon(R.drawable.ic_action_remove_dark, !nightMode));
.getIcon(R.drawable.ic_action_remove_dark, !nightMode));
}