From b81c55f2a1666a103c9e2b5f5f05dad59ac81ce5 Mon Sep 17 00:00:00 2001 From: Denis Date: Fri, 6 Feb 2015 16:37:15 +0200 Subject: [PATCH] CHanged icons of expandable list and fixed add gpx dialog --- OsmAnd/res/layout/add_gpx_point_dialog.xml | 14 ++++++++++++++ .../plus/activities/AvailableGPXFragment.java | 2 +- .../plus/activities/FavoritesTreeFragment.java | 2 +- .../osmand/plus/activities/MapActivityActions.java | 9 +++------ .../OsmandBaseExpandableListAdapter.java | 8 ++++---- .../plus/activities/SelectedGPXFragment.java | 2 +- .../osmand/plus/download/DownloadIndexAdapter.java | 2 +- .../net/osmand/plus/osmo/OsMoGroupsActivity.java | 6 +++--- 8 files changed, 28 insertions(+), 17 deletions(-) create mode 100644 OsmAnd/res/layout/add_gpx_point_dialog.xml diff --git a/OsmAnd/res/layout/add_gpx_point_dialog.xml b/OsmAnd/res/layout/add_gpx_point_dialog.xml new file mode 100644 index 0000000000..7663cfa0fc --- /dev/null +++ b/OsmAnd/res/layout/add_gpx_point_dialog.xml @@ -0,0 +1,14 @@ + + + + + \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/activities/AvailableGPXFragment.java b/OsmAnd/src/net/osmand/plus/activities/AvailableGPXFragment.java index 33d404d76d..1beafdead4 100644 --- a/OsmAnd/src/net/osmand/plus/activities/AvailableGPXFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/AvailableGPXFragment.java @@ -783,7 +783,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment { v = inflater.inflate(net.osmand.plus.R.layout.expandable_list_item_category, parent, false); } StringBuilder t = new StringBuilder(group); - adjustIndicator(groupPosition, isExpanded, v); + adjustIndicator(groupPosition, isExpanded, v, getMyApplication().getSettings().isLightContent()); TextView nameView = ((TextView) v.findViewById(R.id.category_name)); List list = data.get(group); int size = 0; diff --git a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java index 28502edeea..511944fa47 100644 --- a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java @@ -708,7 +708,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment { R.layout.expandable_list_item_category_btn, parent, false); fixBackgroundRepeat(row); } - adjustIndicator(groupPosition, isExpanded, row); + adjustIndicator(groupPosition, isExpanded, row, getMyApplication().getSettings().isLightContent()); TextView label = (TextView) row.findViewById(R.id.category_name); final FavoriteGroup model = getGroup(groupPosition); label.setText(model.name.length() == 0? getString(R.string.favourites_activity) : model.name); diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java index e27a04a252..f5d55dee58 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java @@ -131,12 +131,9 @@ public class MapActivityActions implements DialogProvider { private Dialog createAddWaypointDialog(final Bundle args) { Builder builder = new AlertDialog.Builder(mapActivity); builder.setTitle(R.string.add_waypoint_dialog_title); - FrameLayout parent = new FrameLayout(mapActivity); - final EditText editText = new EditText(mapActivity); - editText.setId(android.R.id.edit); - parent.setPadding(15, 0, 15, 0); - parent.addView(editText); - builder.setView(parent); + View view = mapActivity.getLayoutInflater().inflate(R.layout.add_gpx_point_dialog, null); + final EditText editText = (EditText) view.findViewById(android.R.id.edit); + builder.setView(view); builder.setNegativeButton(R.string.default_buttons_cancel, null); builder.setPositiveButton(R.string.default_buttons_add, new DialogInterface.OnClickListener() { @Override diff --git a/OsmAnd/src/net/osmand/plus/activities/OsmandBaseExpandableListAdapter.java b/OsmAnd/src/net/osmand/plus/activities/OsmandBaseExpandableListAdapter.java index f07869b109..86a77a8efd 100644 --- a/OsmAnd/src/net/osmand/plus/activities/OsmandBaseExpandableListAdapter.java +++ b/OsmAnd/src/net/osmand/plus/activities/OsmandBaseExpandableListAdapter.java @@ -7,16 +7,16 @@ import android.widget.ImageView; public abstract class OsmandBaseExpandableListAdapter extends BaseExpandableListAdapter { - protected void adjustIndicator(int groupPosition, boolean isExpanded, View row) { + protected void adjustIndicator(int groupPosition, boolean isExpanded, View row, boolean light) { ImageView indicator = (ImageView) row.findViewById(R.id.explist_indicator); if (!isExpanded) { if (getChildrenCount(groupPosition) == 0) { - indicator.setImageResource(R.drawable.expandable_category_empty); + indicator.setImageResource(light ? R.drawable.expandable_category_empty_light : R.drawable.expandable_category_empty_dark); } else { - indicator.setImageResource(R.drawable.expandable_category_unpushed); + indicator.setImageResource(light ? R.drawable.expandable_category_unpushed_light : R.drawable.expandable_category_unpushed_dark); } } else { - indicator.setImageResource(R.drawable.expandable_category_pushed); + indicator.setImageResource(light ? R.drawable.expandable_category_pushed_light : R.drawable.expandable_category_pushed_dark); } } diff --git a/OsmAnd/src/net/osmand/plus/activities/SelectedGPXFragment.java b/OsmAnd/src/net/osmand/plus/activities/SelectedGPXFragment.java index 7c3cef8928..99736c982e 100644 --- a/OsmAnd/src/net/osmand/plus/activities/SelectedGPXFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/SelectedGPXFragment.java @@ -522,7 +522,7 @@ public class SelectedGPXFragment extends OsmandExpandableListFragment { if(isArgumentTrue(ARG_TO_EXPAND_TRACK_INFO)) { row.findViewById(R.id.explist_indicator).setVisibility(View.GONE); } else { - adjustIndicator(groupPosition, isExpanded, row); + adjustIndicator(groupPosition, isExpanded, row, app.getSettings().isLightContent()); } TextView label = (TextView) row.findViewById(R.id.category_name); final GpxDisplayGroup model = getGroup(groupPosition); diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadIndexAdapter.java b/OsmAnd/src/net/osmand/plus/download/DownloadIndexAdapter.java index 936ab46a8b..1bd65d4fb0 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadIndexAdapter.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadIndexAdapter.java @@ -221,7 +221,7 @@ public class DownloadIndexAdapter extends OsmandBaseExpandableListAdapter implem TextView item = (TextView) row.findViewById(R.id.category_name); item.setText(group.name); item.setLinkTextColor(Color.YELLOW); - adjustIndicator(groupPosition, isExpanded, v); + adjustIndicator(groupPosition, isExpanded, v, app.getSettings().isLightContent()); return row; } diff --git a/OsmAnd/src/net/osmand/plus/osmo/OsMoGroupsActivity.java b/OsmAnd/src/net/osmand/plus/osmo/OsMoGroupsActivity.java index 681b8e78f0..4b0ada2871 100644 --- a/OsmAnd/src/net/osmand/plus/osmo/OsMoGroupsActivity.java +++ b/OsmAnd/src/net/osmand/plus/osmo/OsMoGroupsActivity.java @@ -1142,8 +1142,8 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements row = inflater.inflate(R.layout.osmo_group_item, parent, false); //fixBackgroundRepeat(row); } - - adjustIndicator(groupPosition, isExpanded, row); + boolean light = getMyApplication().getSettings().isLightContent(); + adjustIndicator(groupPosition, isExpanded, row, light); TextView label = (TextView) row.findViewById(R.id.category_name); final OsMoGroup model = getGroup(groupPosition); if(selectedObject == model) { @@ -1161,7 +1161,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements if(model.isMainGroup()) { v.setVisibility(View.GONE); } else { - if (getMyApplication().getSettings().isLightContent()){ + if (light){ v.setImageResource(R.drawable.ic_action_settings_enabled_light); } else { v.setImageResource(R.drawable.ic_action_settings_enabled_dark);