From 6ef9a76f2732a9ec6e62f703cf400609582259bb Mon Sep 17 00:00:00 2001 From: Bars107 Date: Thu, 12 Feb 2015 17:32:21 +0200 Subject: [PATCH] Updated styles for android 2.3.3 --- OsmAnd/res/layout/main.xml | 1 + OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java | 2 +- OsmAnd/src/net/osmand/plus/OsmandApplication.java | 13 ------------- OsmAnd/src/net/osmand/plus/OsmandSettings.java | 13 +++---------- .../osmand/plus/activities/MapActivityActions.java | 14 ++------------ .../osmand/plus/activities/MapActivityLayers.java | 2 +- .../osmand/plus/helpers/AvoidSpecificRoads.java | 4 ++-- .../src/net/osmand/plus/helpers/GpxUiHelper.java | 2 +- 8 files changed, 11 insertions(+), 40 deletions(-) diff --git a/OsmAnd/res/layout/main.xml b/OsmAnd/res/layout/main.xml index 341d033692..d931d6f352 100644 --- a/OsmAnd/res/layout/main.xml +++ b/OsmAnd/res/layout/main.xml @@ -46,6 +46,7 @@ android:layout_height="match_parent" android:layout_gravity="start" android:choiceMode="singleChoice" + android:background="?attr/expandable_list_background" android:divider="@drawable/divider" android:dividerHeight="1dp" /> diff --git a/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java b/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java index 8aae8f7c80..1d76fc8a91 100644 --- a/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java +++ b/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java @@ -137,7 +137,7 @@ public class ContextMenuAdapter { if (holoLight) { return ctx.getResources().getColor(R.color.color_white); } else { - return ctx.getResources().getColor(R.color.dark_drawer_bg_color); + return ctx.getResources().getColor(R.color.list_background_dark); } } diff --git a/OsmAnd/src/net/osmand/plus/OsmandApplication.java b/OsmAnd/src/net/osmand/plus/OsmandApplication.java index ea7a0d108a..cb8b3445cc 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandApplication.java +++ b/OsmAnd/src/net/osmand/plus/OsmandApplication.java @@ -804,19 +804,6 @@ public class OsmandApplication extends Application { } setLanguage(c); c.setTheme(t); - if (osmandSettings.OSMAND_THEME.get() == OsmandSettings.OSMAND_LIGHT_DARK_ACTIONBAR_THEME - && Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) { - ActionBar ab = null; - if (c instanceof ActionBarActivity) { - ab = ((ActionBarActivity) c).getSupportActionBar(); - } - - if (ab != null) { - BitmapDrawable bg = (BitmapDrawable) getResources().getDrawable(R.drawable.bg_striped); - bg.setTileModeXY(TileMode.REPEAT, TileMode.REPEAT); - ab.setBackgroundDrawable(bg); - } - } } public IBRouterService getBRouterService() { diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index f6c7a60d34..de3f1fbf0f 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -1756,7 +1756,7 @@ public class OsmandSettings { public static final int OSMAND_DARK_THEME = 0; public static final int OSMAND_LIGHT_THEME = 1; - public static final int OSMAND_LIGHT_DARK_ACTIONBAR_THEME = 2; + public final CommonPreference SEARCH_TAB = new IntPreference("SEARCH_TAB", 0).makeGlobal().cache(); @@ -1771,18 +1771,11 @@ public class OsmandSettings { return OSMAND_THEME.get() == OSMAND_LIGHT_THEME; } - public boolean isLightContentMenu(){ - return OSMAND_THEME.get() != OSMAND_DARK_THEME || Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB; - } - + public boolean isLightContent(){ - if(Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB){ - return false; - } return OSMAND_THEME.get() != OSMAND_DARK_THEME ; } - - + public final CommonPreference FLUORESCENT_OVERLAYS = new BooleanPreference("fluorescent_overlays", false).makeGlobal().cache(); diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java index f5d55dee58..e7ee08de89 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java @@ -317,7 +317,7 @@ public class MapActivityActions implements DialogProvider { final Builder builder = new AlertDialog.Builder(mapActivity); final ArrayAdapter listAdapter = - adapter.createListAdapter(mapActivity, getMyApplication().getSettings().isLightContentMenu()); + adapter.createListAdapter(mapActivity, getMyApplication().getSettings().isLightContent()); builder.setAdapter(listAdapter, new DialogInterface.OnClickListener() { @Override @@ -641,12 +641,8 @@ public class MapActivityActions implements DialogProvider { public void prepareOptionsMenu(final ContextMenuAdapter cm) { refreshDrawer = false; final ArrayAdapter listAdapter = - cm.createListAdapter(mapActivity, getMyApplication().getSettings().isLightContentMenu()); + cm.createListAdapter(mapActivity, getMyApplication().getSettings().isLightContent()); mDrawerList.setAdapter(listAdapter); - mDrawerList.setDivider(mapActivity.getResources().getDrawable(R.drawable.drawer_divider)); - final int colorHint = cm.getBackgroundColor(mapActivity, getMyApplication().getSettings().isLightContentMenu()); - mDrawerList.setBackgroundColor(colorHint); - mDrawerList.setCacheColorHint(colorHint); mDrawerList.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override @@ -945,12 +941,6 @@ public class MapActivityActions implements DialogProvider { ArrayAdapter listAdapter = waypointDialogHelper.getWaypointsDrawerAdapter(mapActivity, running, flat); mDrawerList.setAdapter(listAdapter); refreshDrawer = false; - mDrawerList.setDivider(mapActivity.getResources().getDrawable(R.drawable.drawer_divider)); - final int color = getMyApplication().getSettings().isLightContentMenu() ? mapActivity - .getResources().getColor(R.color.color_white) : mapActivity.getResources().getColor( - R.color.dark_drawer_bg_color); - mDrawerList.setBackgroundColor(color); - mDrawerList.setCacheColorHint(color); mDrawerList.setOnItemClickListener(waypointDialogHelper.getDrawerItemClickListener(mapActivity, running, listAdapter, null)); } diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityLayers.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityLayers.java index c02c80989c..9c37127838 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityLayers.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityLayers.java @@ -292,7 +292,7 @@ public class MapActivityLayers { it.reg(); } Builder builder = new AlertDialog.Builder(activity); - ListAdapter listAdapter =adapter.createListAdapter(activity, app.getSettings().isLightContentMenu()); + ListAdapter listAdapter =adapter.createListAdapter(activity, app.getSettings().isLightContent()); builder.setAdapter(listAdapter, new DialogInterface.OnClickListener(){ @Override diff --git a/OsmAnd/src/net/osmand/plus/helpers/AvoidSpecificRoads.java b/OsmAnd/src/net/osmand/plus/helpers/AvoidSpecificRoads.java index 43de4ab72f..f50cb40a15 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/AvoidSpecificRoads.java +++ b/OsmAnd/src/net/osmand/plus/helpers/AvoidSpecificRoads.java @@ -62,7 +62,7 @@ public class AvoidSpecificRoads { } final RouteDataObject obj = getItem(position); v.findViewById(R.id.all_points).setVisibility(View.GONE); - ((ImageView) v.findViewById(R.id.waypoint_icon)).setImageResource(app.getSettings().isLightContentMenu() ? + ((ImageView) v.findViewById(R.id.waypoint_icon)).setImageResource(app.getSettings().isLightContent() ? R.drawable.ic_action_road_works_light : R.drawable.ic_action_road_works_dark); double dist = MapUtils.getDistance(mapLocation, MapUtils.get31LatitudeY(obj.getPoint31YTile(0)), MapUtils.get31LongitudeX(obj.getPoint31XTile(0))); @@ -71,7 +71,7 @@ public class AvoidSpecificRoads { ((TextView) v.findViewById(R.id.waypoint_text)).setText(getText(obj)); ImageButton remove = (ImageButton) v.findViewById(R.id.info_close); remove.setVisibility(View.VISIBLE); - remove.setImageResource(app.getSettings().isLightContentMenu() ? + remove.setImageResource(app.getSettings().isLightContent() ? R.drawable.ic_action_gremove_light : R.drawable.ic_action_gremove_dark); remove.setOnClickListener(new View.OnClickListener() { diff --git a/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java b/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java index e4840c4e1f..becab0ced1 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java @@ -232,7 +232,7 @@ public class GpxUiHelper { final File dir = app.getAppPath(IndexConstants.GPX_INDEX_DIR); Builder b = new AlertDialog.Builder(activity); // final int padding = (int) (12 * activity.getResources().getDisplayMetrics().density + 0.5f); - final boolean light = app.getSettings().isLightContentMenu(); + final boolean light = app.getSettings().isLightContent(); final int layout; if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { layout = R.layout.list_menu_item;