Implement new colored location icon on map
This commit is contained in:
parent
8f52d72524
commit
f09c1f8d74
12 changed files with 234 additions and 88 deletions
6
OsmAnd/res/drawable/bg_select_icon_button.xml
Normal file
6
OsmAnd/res/drawable/bg_select_icon_button.xml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape android:shape="rectangle"
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<solid android:color="@color/stroked_buttons_and_links_outline_dark" />
|
||||||
|
<corners android:radius="2dp" />
|
||||||
|
</shape>
|
9
OsmAnd/res/drawable/bg_select_icon_button_outline.xml
Normal file
9
OsmAnd/res/drawable/bg_select_icon_button_outline.xml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape android:shape="rectangle"
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<corners android:radius="2dp" />
|
||||||
|
<stroke
|
||||||
|
android:radius="5dp"
|
||||||
|
android:width="2dp"
|
||||||
|
android:color="@color/A400red" />
|
||||||
|
</shape>
|
18
OsmAnd/res/drawable/map_bicycle_location_xml.xml
Normal file
18
OsmAnd/res/drawable/map_bicycle_location_xml.xml
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:id="@+id/bottom" >
|
||||||
|
<bitmap
|
||||||
|
android:src="@drawable/map_bicycle_location_bottom"
|
||||||
|
android:gravity="bottom|center" />
|
||||||
|
</item>
|
||||||
|
<item android:id="@+id/center" >
|
||||||
|
<bitmap
|
||||||
|
android:src="@drawable/map_bicycle_location_center"
|
||||||
|
android:gravity="bottom|center" />
|
||||||
|
</item>
|
||||||
|
<item android:id="@+id/top" >
|
||||||
|
<bitmap
|
||||||
|
android:src="@drawable/map_bicycle_location_top"
|
||||||
|
android:gravity="bottom|center" />
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
18
OsmAnd/res/drawable/map_car_location_xml.xml
Normal file
18
OsmAnd/res/drawable/map_car_location_xml.xml
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:id="@+id/bottom" >
|
||||||
|
<bitmap
|
||||||
|
android:src="@drawable/map_car_location_bottom"
|
||||||
|
android:gravity="bottom|center" />
|
||||||
|
</item>
|
||||||
|
<item android:id="@+id/center" >
|
||||||
|
<bitmap
|
||||||
|
android:src="@drawable/map_car_location_center"
|
||||||
|
android:gravity="bottom|center" />
|
||||||
|
</item>
|
||||||
|
<item android:id="@+id/top" >
|
||||||
|
<bitmap
|
||||||
|
android:src="@drawable/map_car_location_top"
|
||||||
|
android:gravity="bottom|center" />
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
18
OsmAnd/res/drawable/map_default_location_xml.xml
Normal file
18
OsmAnd/res/drawable/map_default_location_xml.xml
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:id="@+id/bottom" >
|
||||||
|
<bitmap
|
||||||
|
android:src="@drawable/map_default_location_bottom"
|
||||||
|
android:gravity="bottom|center" />
|
||||||
|
</item>
|
||||||
|
<item android:id="@+id/center" >
|
||||||
|
<bitmap
|
||||||
|
android:src="@drawable/map_default_location_center"
|
||||||
|
android:gravity="bottom|center" />
|
||||||
|
</item>
|
||||||
|
<item android:id="@+id/top" >
|
||||||
|
<bitmap
|
||||||
|
android:src="@drawable/map_default_location_top"
|
||||||
|
android:gravity="bottom|center" />
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
|
@ -3,7 +3,7 @@
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="6dp">
|
android:padding="7dp">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/outlineCircle"
|
android:id="@+id/outlineCircle"
|
||||||
|
|
|
@ -8,5 +8,5 @@
|
||||||
android:id="@+id/color_items"
|
android:id="@+id/color_items"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="10dp" />
|
android:layout_margin="4dp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
21
OsmAnd/res/layout/preference_select_icon_button.xml
Normal file
21
OsmAnd/res/layout/preference_select_icon_button.xml
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="6dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/outlineRect"
|
||||||
|
android:layout_width="164dp"
|
||||||
|
android:layout_height="128dp"
|
||||||
|
app:srcCompat="@drawable/bg_select_icon_button_outline" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/backgroundRect"
|
||||||
|
android:layout_width="156dp"
|
||||||
|
android:layout_height="120dp"
|
||||||
|
android:layout_margin="4dp"
|
||||||
|
android:background="@drawable/bg_select_icon_button" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
|
@ -49,15 +49,15 @@
|
||||||
android:layout="@layout/simple_divider_item"
|
android:layout="@layout/simple_divider_item"
|
||||||
android:selectable="false" />
|
android:selectable="false" />
|
||||||
|
|
||||||
<!--PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="select_map_icon"
|
android:key="select_map_icon"
|
||||||
android:layout="@layout/preference_category_with_descr"
|
android:layout="@layout/preference_category_with_descr"
|
||||||
|
android:summary="@string/select_map_icon_descr"
|
||||||
android:title="@string/select_map_icon" />
|
android:title="@string/select_map_icon" />
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="map_icon_items"
|
android:key="map_icon_items"
|
||||||
android:layout="@layout/preference_with_descr"
|
android:layout="@layout/preference_color_select"
|
||||||
android:title="@string/select_map_icon"
|
|
||||||
android:selectable="false"/>
|
android:selectable="false"/>
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
|
@ -67,12 +67,13 @@
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="select_nav_icon"
|
android:key="select_nav_icon"
|
||||||
android:layout="@layout/preference_category_with_descr"
|
android:layout="@layout/preference_category_with_descr"
|
||||||
|
android:summary="@string/select_nav_icon_descr"
|
||||||
android:title="@string/select_navigation_icon" />
|
android:title="@string/select_navigation_icon" />
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="nav_icon_items"
|
android:key="nav_icon_items"
|
||||||
android:layout="@layout/preference_with_descr"
|
android:layout="@layout/preference_color_select"
|
||||||
android:title="@string/select_navigation_icon"
|
android:title="@string/select_navigation_icon"
|
||||||
android:selectable="false"/-->
|
android:selectable="false"/>
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
|
@ -79,13 +79,13 @@ public class ApplicationMode {
|
||||||
private int arrivalDistance = 90;
|
private int arrivalDistance = 90;
|
||||||
private int offRouteDistance = 350;
|
private int offRouteDistance = 350;
|
||||||
private int bearingIconDay = R.drawable.map_pedestrian_bearing;
|
private int bearingIconDay = R.drawable.map_pedestrian_bearing;
|
||||||
private int bearingIconNight = R.drawable.map_pedestrian_bearing_night;
|
// private int bearingIconNight = R.drawable.map_pedestrian_bearing_night;
|
||||||
private int headingIconDay = R.drawable.map_pedestrian_location_view_angle;
|
private int headingIconDay = R.drawable.map_pedestrian_location_view_angle;
|
||||||
private int headingIconNight = R.drawable.map_pedestrian_location_view_angle_night;
|
// private int headingIconNight = R.drawable.map_pedestrian_location_view_angle_night;
|
||||||
private int locationIconDay = R.drawable.map_pedestrian_location;
|
private int locationIcon = R.drawable.map_default_location_xml;
|
||||||
private int locationIconNight = R.drawable.map_pedestrian_location_night;
|
// private int locationIconNight = R.drawable.map_pedestrian_location_night;
|
||||||
private int locationIconDayLost = R.drawable.map_pedestrian_location_lost;
|
// private int locationIconDayLost = R.drawable.map_pedestrian_location_lost;
|
||||||
private int locationIconNightLost = R.drawable.map_pedestrian_location_lost_night;
|
// private int locationIconNightLost = R.drawable.map_pedestrian_location_lost_night;
|
||||||
|
|
||||||
private ApplicationMode(int key, String stringKey) {
|
private ApplicationMode(int key, String stringKey) {
|
||||||
this.keyName = key;
|
this.keyName = key;
|
||||||
|
@ -207,13 +207,13 @@ public class ApplicationMode {
|
||||||
m.arrivalDistance = m.parentAppMode.arrivalDistance;
|
m.arrivalDistance = m.parentAppMode.arrivalDistance;
|
||||||
m.offRouteDistance = m.parentAppMode.offRouteDistance;
|
m.offRouteDistance = m.parentAppMode.offRouteDistance;
|
||||||
m.bearingIconDay = m.parentAppMode.bearingIconDay;
|
m.bearingIconDay = m.parentAppMode.bearingIconDay;
|
||||||
m.bearingIconNight = m.parentAppMode.bearingIconNight;
|
// m.bearingIconNight = m.parentAppMode.bearingIconNight;
|
||||||
m.headingIconDay = m.parentAppMode.headingIconDay;
|
m.headingIconDay = m.parentAppMode.headingIconDay;
|
||||||
m.headingIconNight = m.parentAppMode.headingIconNight;
|
// m.headingIconNight = m.parentAppMode.headingIconNight;
|
||||||
m.locationIconDay = m.parentAppMode.locationIconDay;
|
m.locationIcon = m.parentAppMode.locationIcon;
|
||||||
m.locationIconNight = m.parentAppMode.locationIconNight;
|
// m.locationIconNight = m.parentAppMode.locationIconNight;
|
||||||
m.locationIconDayLost = m.parentAppMode.locationIconDayLost;
|
// m.locationIconDayLost = m.parentAppMode.locationIconDayLost;
|
||||||
m.locationIconNightLost = m.parentAppMode.locationIconNightLost;
|
// m.locationIconNightLost = m.parentAppMode.locationIconNightLost;
|
||||||
values.add(applicationMode);
|
values.add(applicationMode);
|
||||||
if (applicationMode.getOrder() == 0 && !values.isEmpty()) {
|
if (applicationMode.getOrder() == 0 && !values.isEmpty()) {
|
||||||
applicationMode.setOrder(values.size());
|
applicationMode.setOrder(values.size());
|
||||||
|
@ -264,47 +264,47 @@ public class ApplicationMode {
|
||||||
|
|
||||||
public ApplicationModeBuilder carLocation() {
|
public ApplicationModeBuilder carLocation() {
|
||||||
applicationMode.bearingIconDay = R.drawable.map_car_bearing;
|
applicationMode.bearingIconDay = R.drawable.map_car_bearing;
|
||||||
applicationMode.bearingIconNight = R.drawable.map_car_bearing_night;
|
// applicationMode.bearingIconNight = R.drawable.map_car_bearing_night;
|
||||||
applicationMode.headingIconDay = R.drawable.map_car_location_view_angle;
|
applicationMode.headingIconDay = R.drawable.map_car_location_view_angle;
|
||||||
applicationMode.headingIconNight = R.drawable.map_car_location_view_angle_night;
|
// applicationMode.headingIconNight = R.drawable.map_car_location_view_angle_night;
|
||||||
applicationMode.locationIconDay = R.drawable.map_car_location;
|
applicationMode.locationIcon = R.drawable.map_car_location_xml;
|
||||||
applicationMode.locationIconNight = R.drawable.map_car_location_night;
|
// applicationMode.locationIconNight = R.drawable.map_car_location_night;
|
||||||
applicationMode.locationIconDayLost = R.drawable.map_car_location_lost;
|
// applicationMode.locationIconDayLost = R.drawable.map_car_location_lost;
|
||||||
applicationMode.locationIconNightLost = R.drawable.map_car_location_lost_night;
|
// applicationMode.locationIconNightLost = R.drawable.map_car_location_lost_night;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApplicationModeBuilder bicycleLocation() {
|
public ApplicationModeBuilder bicycleLocation() {
|
||||||
applicationMode.bearingIconDay = R.drawable.map_bicycle_bearing;
|
applicationMode.bearingIconDay = R.drawable.map_bicycle_bearing;
|
||||||
applicationMode.bearingIconNight = R.drawable.map_bicycle_bearing_night;
|
// applicationMode.bearingIconNight = R.drawable.map_bicycle_bearing_night;
|
||||||
applicationMode.headingIconDay = R.drawable.map_bicycle_location_view_angle;
|
applicationMode.headingIconDay = R.drawable.map_bicycle_location_view_angle;
|
||||||
applicationMode.headingIconNight = R.drawable.map_bicycle_location_view_angle_night;
|
// applicationMode.headingIconNight = R.drawable.map_bicycle_location_view_angle_night;
|
||||||
applicationMode.locationIconDay = R.drawable.map_bicycle_location;
|
applicationMode.locationIcon = R.drawable.map_bicycle_location_xml;
|
||||||
applicationMode.locationIconNight = R.drawable.map_bicycle_location_night;
|
// applicationMode.locationIconNight = R.drawable.map_bicycle_location_night;
|
||||||
applicationMode.locationIconDayLost = R.drawable.map_bicycle_location_lost;
|
// applicationMode.locationIconDayLost = R.drawable.map_bicycle_location_lost;
|
||||||
applicationMode.locationIconNightLost = R.drawable.map_bicycle_location_lost_night;
|
// applicationMode.locationIconNightLost = R.drawable.map_bicycle_location_lost_night;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApplicationModeBuilder defLocation() {
|
public ApplicationModeBuilder defLocation() {
|
||||||
applicationMode.bearingIconDay = R.drawable.map_pedestrian_bearing;
|
applicationMode.bearingIconDay = R.drawable.map_pedestrian_bearing;
|
||||||
applicationMode.bearingIconNight = R.drawable.map_pedestrian_bearing_night;
|
// applicationMode.bearingIconNight = R.drawable.map_pedestrian_bearing_night;
|
||||||
applicationMode.headingIconDay = R.drawable.map_default_location_view_angle;
|
applicationMode.headingIconDay = R.drawable.map_default_location_view_angle;
|
||||||
applicationMode.headingIconNight = R.drawable.map_default_location_view_angle_night;
|
// applicationMode.headingIconNight = R.drawable.map_default_location_view_angle_night;
|
||||||
applicationMode.locationIconDay = R.drawable.map_pedestrian_location;
|
applicationMode.locationIcon = R.drawable.map_default_location_xml;
|
||||||
applicationMode.locationIconNight = R.drawable.map_pedestrian_location_night;
|
// applicationMode.locationIconNight = R.drawable.map_pedestrian_location_night;
|
||||||
applicationMode.locationIconDayLost = R.drawable.map_pedestrian_location_lost;
|
// applicationMode.locationIconDayLost = R.drawable.map_pedestrian_location_lost;
|
||||||
applicationMode.locationIconNightLost = R.drawable.map_pedestrian_location_lost_night;
|
// applicationMode.locationIconNightLost = R.drawable.map_pedestrian_location_lost_night;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApplicationModeBuilder nauticalLocation() {
|
public ApplicationModeBuilder nauticalLocation() {
|
||||||
applicationMode.bearingIconDay = R.drawable.map_nautical_bearing;
|
applicationMode.bearingIconDay = R.drawable.map_nautical_bearing;
|
||||||
applicationMode.bearingIconNight = R.drawable.map_nautical_bearing_night;
|
// applicationMode.bearingIconNight = R.drawable.map_nautical_bearing_night;
|
||||||
applicationMode.headingIconDay = R.drawable.map_nautical_location_view_angle;
|
applicationMode.headingIconDay = R.drawable.map_nautical_location_view_angle;
|
||||||
applicationMode.headingIconNight = R.drawable.map_nautical_location_view_angle_night;
|
// applicationMode.headingIconNight = R.drawable.map_nautical_location_view_angle_night;
|
||||||
applicationMode.locationIconDay = R.drawable.map_nautical_location;
|
applicationMode.locationIcon = R.drawable.map_nautical_location;
|
||||||
applicationMode.locationIconNight = R.drawable.map_nautical_location_night;
|
// applicationMode.locationIconNight = R.drawable.map_nautical_location_night;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -512,33 +512,33 @@ public class ApplicationMode {
|
||||||
return bearingIconDay;
|
return bearingIconDay;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getResourceBearingNight() {
|
// public int getResourceBearingNight() {
|
||||||
return bearingIconNight;
|
// return bearingIconNight;
|
||||||
}
|
// }
|
||||||
|
|
||||||
public int getResourceHeadingDay() {
|
public int getResourceHeadingDay() {
|
||||||
return headingIconDay;
|
return headingIconDay;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getResourceHeadingNight() {
|
// public int getResourceHeadingNight() {
|
||||||
return headingIconNight;
|
// return headingIconNight;
|
||||||
}
|
// }
|
||||||
|
|
||||||
public int getResourceLocationDay() {
|
public int getResourceLocationDay() {
|
||||||
return locationIconDay;
|
return locationIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getResourceLocationNight() {
|
// public int getResourceLocationNight() {
|
||||||
return locationIconNight;
|
// return locationIconNight;
|
||||||
}
|
// }
|
||||||
|
|
||||||
public int getResourceLocationDayLost() {
|
// public int getResourceLocationDayLost() {
|
||||||
return locationIconDayLost;
|
// return locationIconDayLost;
|
||||||
}
|
// }
|
||||||
|
|
||||||
public int getResourceLocationNightLost() {
|
// public int getResourceLocationNightLost() {
|
||||||
return locationIconNightLost;
|
// return locationIconNightLost;
|
||||||
}
|
// }
|
||||||
|
|
||||||
public String getStringKey() {
|
public String getStringKey() {
|
||||||
return stringKey;
|
return stringKey;
|
||||||
|
|
|
@ -60,8 +60,10 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
|
||||||
private static final String SELECT_ICON = "select_icon";
|
private static final String SELECT_ICON = "select_icon";
|
||||||
private static final String COLOR_ITEMS = "color_items";
|
private static final String COLOR_ITEMS = "color_items";
|
||||||
private static final String ICON_ITEMS = "icon_items";
|
private static final String ICON_ITEMS = "icon_items";
|
||||||
// private static final String SELECT_MAP_ICON = "select_map_icon";
|
private static final String SELECT_MAP_ICON = "select_map_icon";
|
||||||
// private static final String SELECT_NAV_ICON = "select_nav_icon";
|
private static final String MAP_ICON_ITEMS = "map_icon_items";
|
||||||
|
private static final String SELECT_NAV_ICON = "select_nav_icon";
|
||||||
|
private static final String NAV_ICON_ITEMS = "nav_icon_items";
|
||||||
|
|
||||||
public static final String PROFILE_NAME_KEY = "profile_name_key";
|
public static final String PROFILE_NAME_KEY = "profile_name_key";
|
||||||
public static final String PROFILE_STRINGKEY_KEY = "profile_stringkey_key";
|
public static final String PROFILE_STRINGKEY_KEY = "profile_stringkey_key";
|
||||||
|
@ -76,6 +78,8 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
|
||||||
private EditText profileName;
|
private EditText profileName;
|
||||||
private FlowLayout colorItems;
|
private FlowLayout colorItems;
|
||||||
private FlowLayout iconItems;
|
private FlowLayout iconItems;
|
||||||
|
private FlowLayout mapIconItems;
|
||||||
|
private FlowLayout navIconItems;
|
||||||
private OsmandTextFieldBoxes profileNameOtfb;
|
private OsmandTextFieldBoxes profileNameOtfb;
|
||||||
private View saveButton;
|
private View saveButton;
|
||||||
|
|
||||||
|
@ -166,8 +170,8 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
|
||||||
protected void setupPreferences() {
|
protected void setupPreferences() {
|
||||||
findPreference(SELECT_COLOR).setIconSpaceReserved(false);
|
findPreference(SELECT_COLOR).setIconSpaceReserved(false);
|
||||||
findPreference(SELECT_ICON).setIconSpaceReserved(false);
|
findPreference(SELECT_ICON).setIconSpaceReserved(false);
|
||||||
// findPreference(SELECT_MAP_ICON).setIconSpaceReserved(false);
|
findPreference(SELECT_MAP_ICON).setIconSpaceReserved(false);
|
||||||
// findPreference(SELECT_NAV_ICON).setIconSpaceReserved(false);
|
findPreference(SELECT_NAV_ICON).setIconSpaceReserved(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("InlinedApi")
|
@SuppressLint("InlinedApi")
|
||||||
|
@ -370,6 +374,40 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
|
||||||
outlineCircle.setVisibility(View.GONE);
|
outlineCircle.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
setIconNewColor(changedProfile.iconRes);
|
setIconNewColor(changedProfile.iconRes);
|
||||||
|
} else if (MAP_ICON_ITEMS.equals(preference.getKey())) {
|
||||||
|
mapIconItems = (FlowLayout) holder.findViewById(R.id.color_items);
|
||||||
|
mapIconItems.removeAllViews();
|
||||||
|
ArrayList<Integer> icons = ApplicationMode.ProfileIcons.getIcons();
|
||||||
|
for(int iconRes:icons) {
|
||||||
|
FrameLayout iconItemView = (FrameLayout) UiUtilities.getInflater(getContext(), isNightMode())
|
||||||
|
.inflate(R.layout.preference_select_icon_button, mapIconItems, false);
|
||||||
|
mapIconItems.addView(iconItemView, new FlowLayout.LayoutParams(0, 0));
|
||||||
|
ImageView coloredRect = mapIconItems.findViewById(R.id.backgroundRect);
|
||||||
|
AndroidUtils.setBackground(coloredRect,
|
||||||
|
UiUtilities.tintDrawable(ContextCompat.getDrawable(app, R.drawable.bg_select_icon_button),
|
||||||
|
UiUtilities.getColorWithAlpha(ContextCompat.getColor(app, R.color.icon_color_default_light), 0.1f)));
|
||||||
|
coloredRect.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
// if (iconRes != changedProfile.iconRes) {
|
||||||
|
// updateIconSelector(iconRes);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ImageView outlineCircle = mapIconItems.findViewById(R.id.outlineRect);
|
||||||
|
GradientDrawable circleContourDrawable = (GradientDrawable) ContextCompat.getDrawable(app, R.drawable.bg_select_icon_button_outline);
|
||||||
|
int changedProfileColor = ContextCompat.getColor(app, changedProfile.color.getColor(
|
||||||
|
app.getDaynightHelper().isNightModeForMapControls()));
|
||||||
|
if (circleContourDrawable != null) {
|
||||||
|
circleContourDrawable.setStroke(AndroidUtils.dpToPx(app, 2), changedProfileColor);
|
||||||
|
}
|
||||||
|
outlineCircle.setImageDrawable(circleContourDrawable);
|
||||||
|
outlineCircle.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (NAV_ICON_ITEMS.equals(preference.getKey())) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,12 @@ import android.graphics.Canvas;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.graphics.Paint.Style;
|
import android.graphics.Paint.Style;
|
||||||
import android.graphics.PointF;
|
import android.graphics.PointF;
|
||||||
|
import android.graphics.PorterDuff;
|
||||||
|
import android.graphics.PorterDuffColorFilter;
|
||||||
import android.graphics.RectF;
|
import android.graphics.RectF;
|
||||||
|
import android.graphics.drawable.BitmapDrawable;
|
||||||
|
import android.graphics.drawable.LayerDrawable;
|
||||||
|
import android.support.v4.content.ContextCompat;
|
||||||
|
|
||||||
import net.osmand.Location;
|
import net.osmand.Location;
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
|
@ -23,6 +28,9 @@ import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static android.graphics.Paint.ANTI_ALIAS_FLAG;
|
||||||
|
import static android.graphics.Paint.FILTER_BITMAP_FLAG;
|
||||||
|
|
||||||
public class PointLocationLayer extends OsmandMapLayer implements ContextMenuLayer.IContextMenuProvider {
|
public class PointLocationLayer extends OsmandMapLayer implements ContextMenuLayer.IContextMenuProvider {
|
||||||
private static final Log LOG = PlatformUtil.getLog(PointLocationLayer.class);
|
private static final Log LOG = PlatformUtil.getLog(PointLocationLayer.class);
|
||||||
|
|
||||||
|
@ -30,15 +38,19 @@ public class PointLocationLayer extends OsmandMapLayer implements ContextMenuLay
|
||||||
protected final static int RADIUS = 7;
|
protected final static int RADIUS = 7;
|
||||||
|
|
||||||
private Paint locationPaint;
|
private Paint locationPaint;
|
||||||
|
private Paint headingPaint;
|
||||||
private Paint area;
|
private Paint area;
|
||||||
private Paint aroundArea;
|
private Paint aroundArea;
|
||||||
|
|
||||||
private OsmandMapTileView view;
|
private OsmandMapTileView view;
|
||||||
|
|
||||||
private ApplicationMode appMode;
|
private ApplicationMode appMode;
|
||||||
|
private int color;
|
||||||
private Bitmap bearingIcon;
|
private Bitmap bearingIcon;
|
||||||
private Bitmap headingIcon;
|
private Bitmap headingIcon;
|
||||||
private Bitmap locationIcon;
|
private Bitmap locationIconCenter;
|
||||||
|
private Bitmap locationIconTop;
|
||||||
|
private Bitmap locationIconBottom;
|
||||||
private OsmAndLocationProvider locationProvider;
|
private OsmAndLocationProvider locationProvider;
|
||||||
private MapViewTrackingUtilities mapViewTrackingUtilities;
|
private MapViewTrackingUtilities mapViewTrackingUtilities;
|
||||||
private boolean nm;
|
private boolean nm;
|
||||||
|
@ -53,6 +65,9 @@ public class PointLocationLayer extends OsmandMapLayer implements ContextMenuLay
|
||||||
locationPaint.setAntiAlias(true);
|
locationPaint.setAntiAlias(true);
|
||||||
locationPaint.setFilterBitmap(true);
|
locationPaint.setFilterBitmap(true);
|
||||||
|
|
||||||
|
headingPaint = new Paint(ANTI_ALIAS_FLAG | FILTER_BITMAP_FLAG);
|
||||||
|
|
||||||
|
|
||||||
area = new Paint();
|
area = new Paint();
|
||||||
area.setColor(view.getResources().getColor(R.color.pos_area));
|
area.setColor(view.getResources().getColor(R.color.pos_area));
|
||||||
|
|
||||||
|
@ -119,7 +134,7 @@ public class PointLocationLayer extends OsmandMapLayer implements ContextMenuLay
|
||||||
canvas.save();
|
canvas.save();
|
||||||
canvas.rotate(heading - 180, locationX, locationY);
|
canvas.rotate(heading - 180, locationX, locationY);
|
||||||
canvas.drawBitmap(headingIcon, locationX - headingIcon.getWidth() / 2,
|
canvas.drawBitmap(headingIcon, locationX - headingIcon.getWidth() / 2,
|
||||||
locationY - headingIcon.getHeight() / 2, locationPaint);
|
locationY - headingIcon.getHeight() / 2, headingPaint);
|
||||||
canvas.restore();
|
canvas.restore();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -131,8 +146,18 @@ public class PointLocationLayer extends OsmandMapLayer implements ContextMenuLay
|
||||||
canvas.drawBitmap(bearingIcon, locationX - bearingIcon.getWidth() / 2,
|
canvas.drawBitmap(bearingIcon, locationX - bearingIcon.getWidth() / 2,
|
||||||
locationY - bearingIcon.getHeight() / 2, locationPaint);
|
locationY - bearingIcon.getHeight() / 2, locationPaint);
|
||||||
} else {
|
} else {
|
||||||
canvas.drawBitmap(locationIcon, locationX - locationIcon.getWidth() / 2,
|
if (locationIconTop != null) {
|
||||||
locationY - locationIcon.getHeight() / 2, locationPaint);
|
canvas.drawBitmap(locationIconTop, locationX - locationIconCenter.getWidth() / 2,
|
||||||
|
locationY - locationIconCenter.getHeight() / 2, headingPaint);
|
||||||
|
}
|
||||||
|
if (locationIconCenter != null) {
|
||||||
|
canvas.drawBitmap(locationIconCenter, locationX - locationIconCenter.getWidth() / 2,
|
||||||
|
locationY - locationIconCenter.getHeight() / 2, locationPaint);
|
||||||
|
}
|
||||||
|
if (locationIconBottom != null) {
|
||||||
|
canvas.drawBitmap(locationIconBottom, locationX - locationIconCenter.getWidth() / 2,
|
||||||
|
locationY - locationIconCenter.getHeight() / 2, headingPaint);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -147,32 +172,24 @@ public class PointLocationLayer extends OsmandMapLayer implements ContextMenuLay
|
||||||
public void destroyLayer() {
|
public void destroyLayer() {
|
||||||
|
|
||||||
}
|
}
|
||||||
public void updateIcons(ApplicationMode appMode, boolean nighMode, boolean locationOutdated) {
|
private void updateIcons(ApplicationMode appMode, boolean nighMode, boolean locationOutdated) {
|
||||||
if (appMode != this.appMode || this.nm != nighMode || this.locationOutdated != locationOutdated) {
|
if (appMode != this.appMode || this.nm != nighMode || this.locationOutdated != locationOutdated ||
|
||||||
|
color != appMode.getIconColorInfo().getColor(nighMode)) {
|
||||||
this.appMode = appMode;
|
this.appMode = appMode;
|
||||||
|
this.color = appMode.getIconColorInfo().getColor(nighMode);
|
||||||
this.nm = nighMode;
|
this.nm = nighMode;
|
||||||
this.locationOutdated = locationOutdated;
|
this.locationOutdated = locationOutdated;
|
||||||
final int resourceBearingDay = appMode.getResourceBearingDay();
|
bearingIcon = BitmapFactory.decodeResource(view.getResources(), appMode.getResourceBearingDay());
|
||||||
final int resourceBearingNight = appMode.getResourceBearingNight();
|
headingIcon = BitmapFactory.decodeResource(view.getResources(), appMode.getResourceHeadingDay());
|
||||||
final int resourceBearing = nighMode ? resourceBearingNight : resourceBearingDay;
|
final int resourceLocation = appMode.getResourceLocationDay();
|
||||||
bearingIcon = BitmapFactory.decodeResource(view.getResources(), resourceBearing);
|
locationPaint.setColorFilter(new PorterDuffColorFilter(ContextCompat.getColor(view.getContext(), color),
|
||||||
|
PorterDuff.Mode.SRC_IN));
|
||||||
final int resourceHeadingDay = appMode.getResourceHeadingDay();
|
LayerDrawable layerDrawable = (LayerDrawable) ContextCompat.getDrawable(view.getContext(), resourceLocation);
|
||||||
final int resourceHeadingNight = appMode.getResourceHeadingNight();
|
if (layerDrawable != null) {
|
||||||
final int resourceHeading = nighMode ? resourceHeadingNight : resourceHeadingDay;
|
locationIconTop = ((BitmapDrawable) layerDrawable.getDrawable(0)).getBitmap();
|
||||||
headingIcon = BitmapFactory.decodeResource(view.getResources(), resourceHeading);
|
locationIconCenter = ((BitmapDrawable) layerDrawable.getDrawable(1)).getBitmap();
|
||||||
|
locationIconBottom = ((BitmapDrawable) layerDrawable.getDrawable(2)).getBitmap();
|
||||||
final int resourceLocationDay;
|
}
|
||||||
final int resourceLocationNight;
|
|
||||||
if (locationOutdated) {
|
|
||||||
resourceLocationDay = appMode.getResourceLocationDayLost();
|
|
||||||
resourceLocationNight = appMode.getResourceLocationNightLost();
|
|
||||||
} else {
|
|
||||||
resourceLocationDay = appMode.getResourceLocationDay();
|
|
||||||
resourceLocationNight = appMode.getResourceLocationNight();
|
|
||||||
}
|
|
||||||
final int resourceLocation = nighMode ? resourceLocationNight : resourceLocationDay;
|
|
||||||
locationIcon = BitmapFactory.decodeResource(view.getResources(), resourceLocation);
|
|
||||||
area.setColor(view.getResources().getColor(!nm ? R.color.pos_area : R.color.pos_area_night));
|
area.setColor(view.getResources().getColor(!nm ? R.color.pos_area : R.color.pos_area_night));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue