This commit is contained in:
xmd5a 2015-04-14 22:46:41 +03:00
commit 68b371f80f
98 changed files with 398 additions and 242 deletions

View file

@ -21,6 +21,11 @@ public abstract class AbstractPoiType {
return keyName;
}
public String getIconKeyName() {
return keyName.replace(':', '_');
}
public String getTranslation() {
return registry.getTranslation(this);
}

View file

@ -101,8 +101,8 @@ public class BinaryRoutePlanner {
if(TRACE_ROUTING){
printRoad(">", segment, !forwardSearch);
}
if(segment.getParentRoute() != null)
System.out.println(segment.getRoad().getId() + " - " + segment.getParentRoute().getRoad().getId());
// if(segment.getParentRoute() != null)
// System.out.println(segment.getRoad().getId() + " - " + segment.getParentRoute().getRoad().getId());
if(segment instanceof FinalRouteSegment) {
if(RoutingContext.SHOW_GC_SIZE){
log.warn("Estimated overhead " + (ctx.memoryOverhead / (1<<20))+ " mb");

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/btn_inset_circle_p" android:state_pressed="true"/>
<item android:drawable="@drawable/btn_inset_circle_trans_n"></item>
</selector>

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<bitmap android:src="@drawable/map_bt_round_2_shadow" android:gravity="center" />
</item>
<item>
<inset
android:insetBottom="@dimen/map_button_inset"
android:insetLeft="@dimen/map_button_inset"
android:insetRight="@dimen/map_button_inset"
android:insetTop="@dimen/map_button_inset" >
<shape android:shape="oval" >
<solid android:color="@color/map_widget_light_trans" />
</shape>
</inset>
</item>
</layer-list>

View file

@ -112,11 +112,38 @@
</LinearLayout>
</FrameLayout>
<!-- CENTER -->
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<!-- CENTER -->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|left"
android:layout_marginLeft="@dimen/map_button_margin"
android:layout_marginTop="@dimen/map_button_margin"
android:orientation="horizontal" >
<ImageButton
android:id="@+id/map_layers_button"
android:layout_width="@dimen/map_small_button_size"
android:layout_height="@dimen/map_small_button_size"
android:background="@drawable/btn_inset_circle_trans"
android:src="@drawable/ic_action_test_light" />
<ImageButton
android:id="@+id/map_compass_button"
android:layout_width="@dimen/map_small_button_size"
android:layout_marginLeft="@dimen/map_small_button_margin"
android:layout_height="@dimen/map_small_button_size"
android:background="@drawable/btn_inset_circle_trans"
android:src="@drawable/ic_action_test_light" />
</LinearLayout>
<LinearLayout
android:id="@+id/map_center_info"
@ -154,29 +181,6 @@
android:progress="60"
android:visibility="gone" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|left"
android:layout_marginLeft="@dimen/map_button_margin"
android:layout_marginTop="@dimen/map_button_margin"
android:orientation="horizontal" >
<ImageButton
android:id="@+id/map_layers_button"
android:layout_width="@dimen/map_button_size"
android:layout_height="@dimen/map_button_size"
android:background="@drawable/btn_inset_circle"
android:src="@drawable/ic_action_test_light" />
<ImageButton
android:id="@+id/map_compass_button"
android:layout_width="@dimen/map_button_size"
android:layout_height="@dimen/map_button_size"
android:background="@drawable/btn_inset_circle"
android:src="@drawable/ic_action_test_light" />
</LinearLayout>
</FrameLayout>
</LinearLayout>
@ -207,10 +211,10 @@
<ImageButton
android:id="@+id/map_collapse_button"
android:layout_width="@dimen/map_button_size"
android:layout_height="@dimen/map_button_size"
android:layout_width="@dimen/map_small_button_size"
android:layout_height="@dimen/map_small_button_size"
android:layout_gravity="top|center_horizontal"
android:background="@drawable/btn_inset_circle"
android:background="@drawable/btn_inset_circle_trans"
android:src="@drawable/ic_action_test_light" />
</LinearLayout>
</FrameLayout>

View file

@ -5,6 +5,10 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="?attr/card_bg"
android:layout_marginTop="@dimen/dash_margin"
android:layout_marginBottom="@dimen/dash_margin"
android:layout_marginLeft="@dimen/dash_margin_h"
android:layout_marginRight="@dimen/dash_margin_h"
android:orientation="vertical" >
<LinearLayout

View file

@ -5,6 +5,10 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/card_bg"
android:layout_marginTop="@dimen/dash_margin"
android:layout_marginBottom="@dimen/dash_margin"
android:layout_marginLeft="@dimen/dash_margin_h"
android:layout_marginRight="@dimen/dash_margin_h"
android:orientation="vertical">
<LinearLayout

View file

@ -5,6 +5,10 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/card_bg"
android:layout_marginLeft="@dimen/dash_margin_h"
android:layout_marginRight="@dimen/dash_margin_h"
android:layout_marginTop="@dimen/dash_margin"
android:layout_marginBottom="@dimen/dash_margin"
android:orientation="vertical">
<LinearLayout

View file

@ -4,6 +4,10 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/card_bg"
android:layout_marginTop="@dimen/dash_margin"
android:layout_marginBottom="@dimen/dash_margin"
android:layout_marginLeft="@dimen/dash_margin_h"
android:layout_marginRight="@dimen/dash_margin_h"
android:orientation="vertical" >
<LinearLayout

View file

@ -4,6 +4,10 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/card_bg"
android:layout_marginTop="@dimen/dash_margin"
android:layout_marginBottom="@dimen/dash_margin"
android:layout_marginLeft="@dimen/dash_margin_h"
android:layout_marginRight="@dimen/dash_margin_h"
android:orientation="vertical">
<LinearLayout

View file

@ -5,6 +5,10 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/card_bg"
android:layout_marginTop="@dimen/dash_margin"
android:layout_marginBottom="@dimen/dash_margin"
android:layout_marginLeft="@dimen/dash_margin_h"
android:layout_marginRight="@dimen/dash_margin_h"
android:orientation="vertical" >
<LinearLayout
@ -19,6 +23,7 @@
<net.osmand.plus.widgets.ButtonEx
android:id="@+id/recents"
android:layout_width="wrap_content"
style="?attr/dashboardGeneralButtonStyle"
android:text="@string/shared_string_history"
osmand:textAllCapsCompat="true"

View file

@ -5,6 +5,10 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/card_bg"
android:layout_marginTop="@dimen/dash_margin"
android:layout_marginBottom="@dimen/dash_margin"
android:layout_marginLeft="@dimen/dash_margin_h"
android:layout_marginRight="@dimen/dash_margin_h"
android:orientation="vertical">
<LinearLayout

View file

@ -125,16 +125,17 @@
<ImageButton
android:id="@+id/map_layers_button"
android:layout_width="@dimen/map_button_size"
android:layout_height="@dimen/map_button_size"
android:background="@drawable/btn_inset_circle"
android:layout_width="@dimen/map_small_button_size"
android:layout_height="@dimen/map_small_button_size"
android:background="@drawable/btn_inset_circle_trans"
android:src="@drawable/ic_action_test_light" />
<ImageButton
android:id="@+id/map_compass_button"
android:layout_width="@dimen/map_button_size"
android:layout_height="@dimen/map_button_size"
android:background="@drawable/btn_inset_circle"
android:layout_width="@dimen/map_small_button_size"
android:layout_height="@dimen/map_small_button_size"
android:layout_marginLeft="@dimen/map_small_button_margin"
android:background="@drawable/btn_inset_circle_trans"
android:src="@drawable/ic_action_test_light" />
</LinearLayout>
</LinearLayout>
@ -146,45 +147,7 @@
android:layout_weight="0.6" >
</LinearLayout>
</LinearLayout>
<!-- CENTER -->
<LinearLayout
android:id="@+id/map_center_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|center"
android:layout_marginTop="@dimen/map_button_margin"
android:background="@drawable/btn_round"
android:visibility="gone"
android:orientation="vertical" >
<ImageView
android:id="@+id/map_lanes"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/map_lanes_dist_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:maxLines="1"
android:text="1048 km"
android:textColor="@color/color_black"
android:textSize="@dimen/map_widget_text_size_small" />
<ProgressBar
android:id="@+id/map_horizontal_progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="@dimen/map_routing_progress_width"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/map_button_margin"
android:layout_marginRight="@dimen/map_button_margin"
android:max="100"
android:progress="60"
android:visibility="gone" />
</LinearLayout>
<!-- RIGHT widgets colon -->
<LinearLayout
@ -226,14 +189,53 @@
<ImageButton
android:id="@+id/map_collapse_button"
android:layout_width="@dimen/map_button_size"
android:layout_height="@dimen/map_button_size"
android:layout_width="@dimen/map_small_button_size"
android:layout_height="@dimen/map_small_button_size"
android:layout_gravity="top|center_horizontal"
android:background="@drawable/btn_inset_circle"
android:background="@drawable/btn_inset_circle_trans"
android:src="@drawable/ic_action_test_light" />
</LinearLayout>
</FrameLayout>
</LinearLayout>
<!-- CENTER -->
<LinearLayout
android:id="@+id/map_center_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|center"
android:layout_marginTop="@dimen/map_button_margin"
android:background="@drawable/btn_round"
android:visibility="gone"
android:orientation="vertical" >
<ImageView
android:id="@+id/map_lanes"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/map_lanes_dist_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:maxLines="1"
android:text="1048 km"
android:textColor="@color/color_black"
android:textSize="@dimen/map_widget_text_size_small" />
<ProgressBar
android:id="@+id/map_horizontal_progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="@dimen/map_routing_progress_width"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/map_button_margin"
android:layout_marginRight="@dimen/map_button_margin"
android:max="100"
android:progress="60"
android:visibility="gone" />
</LinearLayout>
</FrameLayout>
</LinearLayout>

View file

@ -39,6 +39,7 @@
android:layout_width="@dimen/map_widget_icon"
android:layout_height="@dimen/map_widget_icon"
android:layout_gravity="left|center_vertical"
android:layout_marginLeft="@dimen/map_widget_icon_margin"
android:gravity="center"
android:src="@drawable/ic_action_test_light" />
@ -48,7 +49,7 @@
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginBottom="@dimen/map_widget_text_bottom_margin"
android:layout_marginLeft="4dp"
android:layout_marginLeft="5dp"
android:layout_weight="1"
android:maxLines="1"
android:minWidth="10dp"

View file

@ -785,7 +785,7 @@
<string name="poi_residential">Boligområde</string>
<string name="poi_recreation_ground">Rekreativtområde</string>
<string name="poi_village_green">Forte</string>
<string name="poi_village_green">Grønning</string>
<string name="poi_junction">Vejkryds</string>
</resources>

View file

@ -9,29 +9,34 @@
<dimen name="map_route_buttons_height_land">72dp</dimen>
<dimen name="map_address_height">60dp</dimen>
<dimen name="map_button_size">75dp</dimen>
<dimen name="map_button_size">78dp</dimen>
<dimen name="map_small_button_size">66dp</dimen>
<dimen name="map_small_button_margin">9dp</dimen>
<dimen name="map_ruler_width">180dp</dimen>
<dimen name="map_ruler_bottom_margin">14dp</dimen>
<dimen name="map_button_shadow_width">80dp</dimen>
<dimen name="map_ruler_bottom_margin">17dp</dimen>
<dimen name="map_button_shadow_height">112dp</dimen>
<dimen name="map_button_shadow_margin">6dp</dimen>
<dimen name="map_button_shadow_width">84dp</dimen>
<dimen name="map_alarm_size">116dp</dimen>
<dimen name="map_alarm_text_size">35sp</dimen>
<dimen name="map_alarm_bottom_margin">140dp</dimen>
<dimen name="map_alarm_bottom_margin_land">78dp</dimen>
<dimen name="map_button_shadow_height">112dp</dimen>
<dimen name="map_alarm_bottom_margin_land">81dp</dimen>
<dimen name="map_widget_icon">32dp</dimen>
<dimen name="map_widget_height">48dp</dimen>
<dimen name="map_widget_image">120dp</dimen>
<dimen name="map_button_spacing">20dp</dimen>
<dimen name="map_button_spacing_land">12dp</dimen>
<dimen name="map_button_margin">6dp</dimen>
<dimen name="map_button_spacing">17dp</dimen>
<dimen name="map_button_spacing_land">9dp</dimen>
<dimen name="map_button_margin">9dp</dimen>
<dimen name="map_routing_progress_width">150dp</dimen>
<dimen name="map_button_shadow_margin">3dp</dimen>
<dimen name="map_button_inset_shadow">5dp</dimen>
<dimen name="map_button_inset">10dp</dimen>
<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">1px</dimen>
<dimen name="map_button_stroke">1dp</dimen>
<dimen name="map_widget_icon_margin">6dp</dimen>
</resources>

View file

@ -26,11 +26,11 @@
<color name="list_item_background_dark_pressed">#be39464d</color>
<color name="map_widget_icon_color">#ff8f00</color>
<color name="map_widget_stroke">#333333</color>
<color name="map_widget_stroke">#4C000000</color>
<color name="map_widget_light">#ffffff</color>
<color name="map_widget_dark">#bb3f3f3f</color>
<color name="map_widget_dark_pressed">#ddcccccc</color>
<color name="map_widget_light_trans">#40ffffff</color>
<color name="map_widget_light_trans">#80ffffff</color>
<color name="map_widget_light_pressed">#e5e5e5</color>
<color name="map_widget_blue">#536dfe</color>
<color name="map_widget_blue_pressed">#485dd9</color>

View file

@ -57,36 +57,43 @@
<dimen name="map_route_buttons_height_land">48dp</dimen>
<dimen name="map_address_height">40dp</dimen>
<dimen name="map_button_size">50dp</dimen>
<dimen name="map_button_size">52dp</dimen>
<dimen name="map_small_button_size">44dp</dimen>
<dimen name="map_small_button_margin">5dp</dimen>
<dimen name="map_ruler_width">120dp</dimen>
<dimen name="map_ruler_bottom_margin">7dp</dimen>
<dimen name="map_button_shadow_width">54dp</dimen>
<dimen name="map_ruler_bottom_margin">9dp</dimen>
<dimen name="map_alarm_size">78dp</dimen>
<dimen name="map_alarm_bottom_margin">87dp</dimen>
<dimen name="map_alarm_bottom_margin_land">55dp</dimen>
<dimen name="map_alarm_bottom_margin_land">57dp</dimen>
<dimen name="map_button_shadow_height">85dp</dimen>
<dimen name="map_button_shadow_width">56dp</dimen>
<dimen name="map_button_shadow_margin">4dp</dimen>
<dimen name="map_widget_icon">24dp</dimen>
<dimen name="map_widget_height">32dp</dimen>
<dimen name="map_widget_image">80dp</dimen>
<dimen name="map_button_spacing">13dp</dimen>
<dimen name="map_button_spacing_land">8dp</dimen>
<dimen name="map_button_margin">4dp</dimen>
<dimen name="map_button_spacing">11dp</dimen>
<dimen name="map_button_spacing_land">6dp</dimen>
<dimen name="map_button_margin">6dp</dimen>
<dimen name="map_routing_progress_width">100dp</dimen>
<dimen name="map_button_shadow_margin">2dp</dimen>
<dimen name="map_button_inset_shadow">1dp</dimen>
<dimen name="map_button_inset">4dp</dimen>
<dimen name="map_button_inset_shadow">2dp</dimen>
<dimen name="map_button_inset">2dp</dimen>
<dimen name="map_button_rect_rad">3dp</dimen>
<dimen name="map_button_stroke">1px</dimen>
<dimen name="map_button_stroke">1dp</dimen>
<dimen name="map_widget_text_size">23sp</dimen>
<dimen name="map_widget_text_size_small">15sp</dimen>
<dimen name="map_button_text_size">18sp</dimen>
<dimen name="map_alarm_text_size">25sp</dimen>
<dimen name="map_widget_text_bottom_margin">0sp</dimen>
<dimen name="map_widget_text_bottom_margin">1sp</dimen>
<dimen name="map_widget_icon_margin">4dp</dimen>
<dimen name="dash_margin">2dp</dimen>
<dimen name="dash_margin_h">6dp</dimen>
<!-- TextSizes -->
<dimen name="default_list_text_size_small">17sp</dimen>

View file

@ -38,6 +38,7 @@
<style name="DashboardGeneralButton">
<item name="android:layout_width">wrap_content</item>
<item name="android:gravity">center_vertical|right</item>
<item name="android:layout_height">@dimen/showAllButtonHeight</item>
<item name="android:layout_gravity">center_vertical</item>
<item name="android:textSize">@dimen/showAllButtonTextSize</item>

View file

@ -251,7 +251,7 @@ public class AppInitializer implements IProgress {
@Override
public String getTranslation(AbstractPoiType type) {
try {
Field f = R.string.class.getField("poi_" + type.getKeyName());
Field f = R.string.class.getField("poi_" + type.getIconKeyName());
if (f != null) {
Integer in = (Integer) f.get(null);
return app.getString(in);

View file

@ -4,25 +4,6 @@
package net.osmand.plus.activities;
import java.text.Collator;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import net.osmand.data.LatLon;
import net.osmand.osm.PoiCategory;
import net.osmand.osm.PoiType;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.activities.search.SearchActivity;
import net.osmand.plus.activities.search.SearchPOIActivity;
import net.osmand.plus.poi.PoiFiltersHelper;
import net.osmand.plus.poi.PoiLegacyFilter;
import net.osmand.util.Algorithms;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.DialogInterface;
@ -42,6 +23,26 @@ import android.widget.ListView;
import android.widget.ScrollView;
import android.widget.TextView;
import net.osmand.data.LatLon;
import net.osmand.osm.PoiCategory;
import net.osmand.osm.PoiType;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.activities.search.SearchActivity;
import net.osmand.plus.activities.search.SearchPOIActivity;
import net.osmand.plus.poi.PoiFiltersHelper;
import net.osmand.plus.poi.PoiLegacyFilter;
import net.osmand.util.Algorithms;
import java.text.Collator;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
/**
*
*/
@ -63,9 +64,20 @@ public class EditPOIFilterActivity extends OsmandListActivity {
filter = helper.getFilterById(filterId);
super.onCreate(icicle);
setContentView(R.layout.editing_poi_filter);
setContentView(R.layout.update_index);
((TextView)findViewById(R.id.header)).setText(R.string.shared_string_select_all);
final CheckBox selectAll = (CheckBox) findViewById(R.id.select_all);
selectAll.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (selectAll.isChecked()) {
selectAll();
} else {
deselectAll();
}
}
});
getSupportActionBar().setTitle(R.string.filterpoi_activity);
// getSupportActionBar().setIcon(R.drawable.tab_search_poi_icon);
if (filter != null) {
getSupportActionBar().setSubtitle(filter.getName());
@ -204,11 +216,7 @@ public class EditPOIFilterActivity extends OsmandListActivity {
builder.setPositiveButton(EditPOIFilterActivity.this.getText(R.string.shared_string_select_all), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
filter.selectSubTypesToAccept(poiCategory, null);
helper.editPoiFilter(filter);
ListView lv = EditPOIFilterActivity.this.getListView();
AmenityAdapter la = (AmenityAdapter) EditPOIFilterActivity.this.getListAdapter();
la.notifyDataSetInvalidated();
ListView lv = selectAllFromCategory(poiCategory);
lv.setSelectionFromTop(index, top);
}
});
@ -223,8 +231,33 @@ public class EditPOIFilterActivity extends OsmandListActivity {
builder.show();
}
public ListView selectAllFromCategory(PoiCategory poiCategory) {
filter.selectSubTypesToAccept(poiCategory, null);
helper.editPoiFilter(filter);
ListView lv = this.getListView();
AmenityAdapter la = this.getListAdapter();
la.notifyDataSetInvalidated();
return lv;
}
private void selectAll() {
AmenityAdapter adapter = getListAdapter();
int count = adapter.getCount();
for (int i = 0; i < count; i++) {
selectAllFromCategory(adapter.getItem(i));
}
}
private void deselectAll(){
AmenityAdapter adapter = getListAdapter();
int count = adapter.getCount();
for (int i =0; i< count; i++) {
filter.setTypeToAccept(adapter.getItem(i), false);
}
adapter.notifyDataSetChanged();
}
@Override
public AmenityAdapter getListAdapter() {
return (AmenityAdapter) super.getListAdapter();

View file

@ -142,15 +142,6 @@ public class MainMenuActivity extends BaseDownloadActivity implements OsmAndLoca
}
}
private void addErrorFragment() {
android.support.v4.app.FragmentManager manager = getSupportFragmentManager();
android.support.v4.app.FragmentTransaction fragmentTransaction = manager.beginTransaction();
if (manager.findFragmentByTag(DashErrorFragment.TAG) == null) {
DashErrorFragment errorFragment = new DashErrorFragment();
fragmentTransaction.add(R.id.content, errorFragment, DashErrorFragment.TAG).commit();
}
}
private void startMapActivity() {
final Intent mapIndent = new Intent(this, getMyApplication().getAppCustomization().getMapActivity());

View file

@ -250,29 +250,25 @@ public class MapActivityLayers {
return GpxUiHelper.selectGPXFile(files, activity, true, true, callbackWithObject);
}
}
public AlertDialog selectPOIFilterLayer(final OsmandMapTileView mapView, final PoiLegacyFilter[] selected){
OsmandApplication app = (OsmandApplication) getApplication();
final PoiFiltersHelper poiFilters = app.getPoiFilters();
final ContextMenuAdapter adapter = new ContextMenuAdapter(activity);
adapter.item(R.string.shared_string_search).iconColor(R.drawable.ic_action_search_dark).reg();
final List<PoiLegacyFilter> list = new ArrayList<PoiLegacyFilter>();
for (PoiLegacyFilter f : poiFilters.getTopDefinedPoiFilters()) {
addFilterToList(adapter, list, f);
}
list.add(poiFilters.getCustomPOIFilter());
adapter.item(R.string.shared_string_search).iconColor(R.drawable.ic_action_search_dark).reg();
Builder builder = new AlertDialog.Builder(activity);
ListAdapter listAdapter = adapter.createListAdapter(activity, app.getSettings().isLightContent());
builder.setAdapter(listAdapter, new DialogInterface.OnClickListener(){
@Override
public void onClick(DialogInterface dialog, int which) {
PoiLegacyFilter pf = list.get(which);
PoiLegacyFilter pf = list.get(which - 1);
String filterId = pf.getFilterId();
if(filterId.equals(PoiLegacyFilter.CUSTOM_FILTER_ID)){
Intent search = new Intent(activity, SearchActivity.class);

View file

@ -76,6 +76,7 @@ import android.widget.Filter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
@ -479,7 +480,12 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
}
if (handled) {
this.location = location;
amenityAdapter.notifyDataSetChanged();
amenityAdapter.notifyDataSetInvalidated();
ListView lv = getListView();
final int index = lv.getFirstVisiblePosition();
View v = lv.getChildAt(0);
final int top = (v == null) ? 0 : v.getTop();
lv.setSelectionFromTop(index, top);
updateButtonState();
}
@ -631,7 +637,9 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
Toast.LENGTH_LONG).show();
}
amenityAdapter.setNewModel(result);
showOnMapItem.setEnabled(amenityAdapter.getCount() > 0);
if(showOnMapItem != null) {
showOnMapItem.setEnabled(amenityAdapter.getCount() > 0);
}
} else {
amenityAdapter.setNewModel(result);
}
@ -767,8 +775,8 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
direction.setImageDrawable(draw);
PoiType st = amenity.getType().getPoiTypeByKeyName(amenity.getSubType());
if (st != null) {
if (RenderingIcons.containsBigIcon(st.getKeyName())) {
icon.setImageResource(RenderingIcons.getBigIconResourceId(st.getKeyName()));
if (RenderingIcons.containsBigIcon(st.getIconKeyName())) {
icon.setImageResource(RenderingIcons.getBigIconResourceId(st.getIconKeyName()));
} else if (RenderingIcons.containsBigIcon(st.getOsmTag() + "_" + st.getOsmValue())) {
icon.setImageResource(RenderingIcons.getBigIconResourceId(st.getOsmTag() + "_" + st.getOsmValue()));
} else {

View file

@ -255,8 +255,8 @@ public class SearchPoiFilterFragment extends ListFragment implements SearchActiv
name = model.getName();
} else {
AbstractPoiType st = (AbstractPoiType) item;
if (RenderingIcons.containsBigIcon(st.getKeyName())) {
icon.setImageDrawable(RenderingIcons.getBigIcon(getActivity(), st.getKeyName()));
if (RenderingIcons.containsBigIcon(st.getIconKeyName())) {
icon.setImageDrawable(RenderingIcons.getBigIcon(getActivity(), st.getIconKeyName()));
} else if (st instanceof PoiType
&& RenderingIcons.containsBigIcon(((PoiType) st).getOsmTag() + "_"
+ ((PoiType) st).getOsmValue())) {

View file

@ -520,7 +520,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
recordControl = new TextInfoWidget(activity);
recordControl.setImageDrawable(activity.getResources().getDrawable(R.drawable.monitoring_rec_inactive));
setRecordListener(recordControl, activity);
mapInfoLayer.registerSideWidget(recordControl, R.drawable.ic_action_micro_dark, R.drawable.widget_icon_av_inactive,
mapInfoLayer.registerSideWidget(recordControl, R.drawable.ic_action_micro_dark,
R.string.map_widget_av_notes, "audionotes", false, 22);
mapInfoLayer.recreateControls();
}
@ -539,13 +539,17 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
}
private void updateWidgetIcon(final TextInfoWidget recordPlaceControl) {
recordPlaceControl.setImageDrawable(activity.getResources().getDrawable(R.drawable.widget_icon_av_inactive));
recordPlaceControl.setIcons(R.drawable.widget_icon_av_inactive_day,
R.drawable.widget_icon_av_inactive_night);
if (AV_DEFAULT_ACTION.get() == AV_DEFAULT_ACTION_VIDEO) {
recordPlaceControl.setImageDrawable(R.drawable.widget_icon_video);
recordPlaceControl.setIcons(R.drawable.widget_icon_video,
R.drawable.widget_icon_video);
} else if (AV_DEFAULT_ACTION.get() == AV_DEFAULT_ACTION_TAKEPICTURE) {
recordPlaceControl.setImageDrawable(R.drawable.widget_icon_photo);
recordPlaceControl.setIcons(R.drawable.widget_icon_video,
R.drawable.widget_icon_video);
} else if (AV_DEFAULT_ACTION.get() == AV_DEFAULT_ACTION_AUDIO) {
recordPlaceControl.setImageDrawable(R.drawable.widget_icon_audio);
recordPlaceControl.setIcons(R.drawable.widget_icon_audio,
R.drawable.widget_icon_audio);
}
}

View file

@ -4,24 +4,18 @@ import java.util.ArrayList;
import java.util.List;
import net.osmand.data.PointDescription;
import net.osmand.plus.OsmAndAppCustomization;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.dashboard.DashBaseFragment;
import net.osmand.plus.helpers.FontCache;
import net.osmand.plus.myplaces.FavoritesActivity;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
@ -86,6 +80,8 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
View view = inflater.inflate(R.layout.note, null, false);
getNoteView(recording, view, getMyApplication());
((ImageView) view.findViewById(R.id.play)).setImageDrawable(getMyApplication().getIconsCache()
.getContentIcon(R.drawable.ic_play_dark));
view.findViewById(R.id.play).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

View file

@ -65,7 +65,7 @@ public class OsmandDevelopmentPlugin extends OsmandPlugin {
return true;
}
};
mapInfoLayer.registerSideWidget(fps, R.drawable.widget_no_icon, R.drawable.widget_no_icon,
mapInfoLayer.registerSideWidget(fps, R.drawable.widget_no_icon,
R.string.map_widget_fps_info, "fps", false, 30);
mapInfoLayer.recreateControls();
}
@ -78,7 +78,6 @@ public class OsmandDevelopmentPlugin extends OsmandPlugin {
@Override
public int getLogoResourceId() {
// TODO
return R.drawable.ic_plugin_developer;
}

View file

@ -388,7 +388,8 @@ public class ConfigureMapMenu {
ctx.getString(R.string.lang_es), ctx.getString(R.string.lang_fi), ctx.getString(R.string.lang_fr),
ctx.getString(R.string.lang_he), ctx.getString(R.string.lang_hi), ctx.getString(R.string.lang_hr),
ctx.getString(R.string.lang_hu), ctx.getString(R.string.lang_it), ctx.getString(R.string.lang_ja),
ctx.getString(R.string.lang_ko), ctx.getString(R.string.lang_lv), ctx.getString(R.string.lang_nl),
ctx.getString(R.string.lang_ko), ctx.getString(R.string.lang_lt),
ctx.getString(R.string.lang_lv), ctx.getString(R.string.lang_nl),
ctx.getString(R.string.lang_pl), ctx.getString(R.string.lang_ro), ctx.getString(R.string.lang_ru),
ctx.getString(R.string.lang_sk), ctx.getString(R.string.lang_sl), ctx.getString(R.string.lang_sv),
ctx.getString(R.string.lang_sw), ctx.getString(R.string.lang_zh) };

View file

@ -118,7 +118,7 @@ public class DistanceCalculatorPlugin extends OsmandPlugin {
if (mapInfoLayer != null ) {
distanceControl = createDistanceControl(activity);
mapInfoLayer.registerSideWidget(distanceControl,
R.drawable.ic_action_ruler_dark, R.drawable.widget_distance, R.string.map_widget_distancemeasurement, "distance.measurement", false, 21);
R.drawable.ic_action_ruler_dark, R.string.map_widget_distancemeasurement, "distance.measurement", false, 21);
mapInfoLayer.recreateControls();
updateText();
}
@ -390,7 +390,7 @@ public class DistanceCalculatorPlugin extends OsmandPlugin {
showDialog(activity);
}
});
distanceControl.setImageDrawable(R.drawable.widget_distance);
distanceControl.setIcons(R.drawable.widget_distance_day, R.drawable.widget_distance_night);
return distanceControl;
}

View file

@ -666,9 +666,9 @@ public class WaypointHelper {
Amenity amenity = ((AmenityLocationPoint) point).a;
PoiType st = amenity.getType().getPoiTypeByKeyName(amenity.getSubType());
if (st != null) {
if (RenderingIcons.containsBigIcon(st.getKeyName())) {
if (RenderingIcons.containsBigIcon(st.getIconKeyName())) {
return uiCtx.getResources().getDrawable(
RenderingIcons.getBigIconResourceId(st.getKeyName()));
RenderingIcons.getBigIconResourceId(st.getIconKeyName()));
} else if (RenderingIcons.containsBigIcon(st.getOsmTag() + "_" + st.getOsmValue())) {
return uiCtx.getResources().getDrawable(
RenderingIcons.getBigIconResourceId(st.getOsmTag() + "_" + st.getOsmValue()));

View file

@ -98,7 +98,7 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
monitoringControl = createMonitoringControl(activity);
layer.registerSideWidget(monitoringControl,
R.drawable.ic_action_play_dark, R.drawable.monitoring_rec_big, R.string.map_widget_monitoring, "monitoring", false, 18);
R.drawable.ic_action_play_dark, R.string.map_widget_monitoring, "monitoring", false, 18);
layer.recreateControls();
}
@ -140,21 +140,19 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
* creates (if it wasn't created previously) the control to be added on a MapInfoLayer that shows a monitoring state (recorded/stopped)
*/
private TextInfoWidget createMonitoringControl(final MapActivity map) {
final Drawable monitoringBig = map.getResources().getDrawable(R.drawable.monitoring_rec_big);
final Drawable monitoringSmall = map.getResources().getDrawable(R.drawable.monitoring_rec_small);
final Drawable monitoringInactive = map.getResources().getDrawable(R.drawable.monitoring_rec_inactive);
monitoringControl = new TextInfoWidget(map) {
long lastUpdateTime;
@Override
public boolean updateInfo(DrawSettings drawSettings) {
if(isSaving){
setText(map.getString(R.string.shared_string_save), "");
setImageDrawable(monitoringBig);
setIcons(R.drawable.widget_monitoring_rec_big_day, R.drawable.widget_monitoring_rec_big_night);
return true;
}
String txt = map.getString(R.string.monitoring_control_start);
String subtxt = null;
Drawable d = monitoringInactive;
int dn = R.drawable.widget_monitoring_rec_inactive_night;
int d = R.drawable.widget_monitoring_rec_inactive_day;
long last = lastUpdateTime;
final boolean globalRecord = settings.SAVE_GLOBAL_TRACK_TO_GPX.get();
final boolean isRecording = app.getSavingTrackHelper().getIsRecording();
@ -175,27 +173,39 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
if(globalRecord) {
//indicates global recording (+background recording)
d = monitoringBig;
dn = R.drawable.widget_monitoring_rec_big_night;
d = R.drawable.widget_monitoring_rec_big_day;
} else if (isRecording) {
//indicates (profile-based, configured in settings) recording (looks like is only active during nav in follow mode)
d = monitoringSmall;
dn = R.drawable.widget_monitoring_rec_small_night;
d = R.drawable.widget_monitoring_rec_small_day;
} else {
d = monitoringInactive;
dn = R.drawable.widget_monitoring_rec_inactive_night;
d = R.drawable.widget_monitoring_rec_inactive_day;
}
setText(txt, subtxt);
setImageDrawable(d);
setIcons(d, dn);
if ((last != lastUpdateTime) && (globalRecord || isRecording)) {
lastUpdateTime = last;
//blink implementation with 2 indicator states (global logging + profile/navigation logging)
setImageDrawable(monitoringInactive);
if (globalRecord) {
setIcons(R.drawable.widget_monitoring_rec_small_day,
R.drawable.widget_monitoring_rec_small_night);
} else {
setIcons(R.drawable.widget_monitoring_rec_small_day,
R.drawable.widget_monitoring_rec_small_night);
}
map.getMyApplication().runInUIThread(new Runnable() {
@Override
public void run() {
if (globalRecord) {
setImageDrawable(monitoringBig);
setIcons(R.drawable.widget_monitoring_rec_big_day,
R.drawable.widget_monitoring_rec_big_night);
} else {
setImageDrawable(monitoringSmall);
setIcons(R.drawable.widget_monitoring_rec_small_day,
R.drawable.widget_monitoring_rec_small_night);
}
}
}, 500);

View file

@ -435,6 +435,19 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
private OsMoGroup group;
private Menu menu;
private MenuItem createActionModeMenuItem(final ActionMode actionMode, Menu m, int id, int titleRes, int icon, int menuItemType){
final MenuItem menuItem = createMenuItem(m, id, titleRes, icon,
menuItemType);
menuItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
onActionItemClicked(actionMode, menuItem);
return true;
}
});
return menuItem;
}
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
selectedObject = o;
@ -449,34 +462,37 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
group = (OsMoGroup) (o instanceof OsMoGroup ? o : null);
MenuItem mi = null;
if (device != null) {
mi = createMenuItem(menu, ON_OFF_ACTION_ID, R.string.shared_string_ok, 0, 0,
mi = createActionModeMenuItem(actionMode, menu, ON_OFF_ACTION_ID, R.string.shared_string_ok, 0,
MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
mode.setTitle(device.getVisibleName());
}
if (device != null && device.getLastLocation() != null) {
createMenuItem(menu, SHOW_ON_MAP_ID, R.string.shared_string_show_on_map, R.drawable.ic_action_marker_dark,
createActionModeMenuItem(actionMode, menu, SHOW_ON_MAP_ID, R.string.shared_string_show_on_map, R.drawable.ic_action_marker_dark,
MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
}
createMenuItem(menu, SHARE_ID, R.string.shared_string_share, R.drawable.ic_action_gshare_dark,
createActionModeMenuItem(actionMode, menu, SHARE_ID, R.string.shared_string_share, R.drawable.ic_action_gshare_dark,
// there is a bug in Android 4.2 layout
device != null && device.getLastLocation() != null ? MenuItemCompat.SHOW_AS_ACTION_NEVER : MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
///
if (device != null) {
createMenuItem(menu, SETTINGS_DEV_ID, R.string.shared_string_settings, R.drawable.ic_action_settings_enabled_dark,
createActionModeMenuItem(actionMode, menu, SETTINGS_DEV_ID, R.string.shared_string_settings, R.drawable.ic_action_settings_enabled_dark,
// there is a bug in Android 4.2 layout
device.getLastLocation() != null ? MenuItemCompat.SHOW_AS_ACTION_NEVER : MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
}
if (device != null && device.getLastLocation() != null) {
MenuItem menuItem = createMenuItem(menu, TRACK_DEV_ID, R.string.osmo_set_moving_target, R.drawable.ic_action_flage_dark,
MenuItem menuItem = createActionModeMenuItem(actionMode, menu, TRACK_DEV_ID, R.string.osmo_set_moving_target, R.drawable.ic_action_flage_dark,
// there is a bug in Android 4.2 layout
device.getLastLocation() != null ? MenuItemCompat.SHOW_AS_ACTION_NEVER : MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
menuItem.setTitleCondensed(getString(R.string.osmo_follow));
}
if (group != null) {
createMenuItem(menu, GROUP_INFO, R.string.osmo_group_info, R.drawable.ic_action_gabout_dark,
mode.setTitle(group.getVisibleName(OsMoGroupsActivity.this));
createActionModeMenuItem(actionMode, menu, GROUP_INFO, R.string.osmo_group_info, R.drawable.ic_action_gabout_dark,
MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
}
if ((group != null && !group.isMainGroup()) || (device != null && device.getGroup().isMainGroup())) {
createMenuItem(menu, DELETE_ACTION_ID, R.string.shared_string_delete,
createActionModeMenuItem(actionMode, menu, DELETE_ACTION_ID, R.string.shared_string_delete,
R.drawable.ic_action_delete_dark,
MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
}
@ -981,7 +997,8 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
public void onClick(DialogInterface dialog, int which) {
final String nameUser = name.getText().toString();
final String id = tracker.getText().toString();
final String nick = nickname.getText().toString();
String nick = nickname.getText().toString().isEmpty() ? "user" : nickname.getText().toString();
if(id.length() == 0) {
app.showToastMessage(R.string.osmo_specify_tracker_id);
connectToDevice();

View file

@ -172,7 +172,7 @@ public class OsMoPlugin extends OsmandPlugin implements OsMoReactor {
MapInfoLayer layer = activity.getMapLayers().getMapInfoLayer();
osmoControl = createOsMoControl(activity);
layer.registerSideWidget(osmoControl,
R.drawable.ic_osmo_dark, R.drawable.mon_osmo_signal_inactive, R.string.osmo_control, "osmo_control", false, 18);
R.drawable.ic_osmo_dark, R.string.osmo_control, "osmo_control", false, 18);
layer.recreateControls();
if(olayer != null) {

View file

@ -191,7 +191,7 @@ public class ParkingPositionPlugin extends OsmandPlugin {
if (mapInfoLayer != null) {
parkingPlaceControl = createParkingPlaceInfoControl(activity);
mapInfoLayer.registerSideWidget(parkingPlaceControl,
R.drawable.ic_action_parking_dark, R.drawable.widget_parking, R.string.map_widget_parking, "parking", false, 8);
R.drawable.ic_action_parking_dark, R.string.map_widget_parking, "parking", false, 8);
mapInfoLayer.recreateControls();
}
}
@ -495,7 +495,7 @@ public class ParkingPositionPlugin extends OsmandPlugin {
}
});
parkingPlaceControl.setText(null, null);
parkingPlaceControl.setImageDrawable(R.drawable.widget_parking);
parkingPlaceControl.setIcons(R.drawable.widget_parking_day, R.drawable.widget_parking_night);
return parkingPlaceControl;
}

View file

@ -31,7 +31,6 @@ import net.osmand.util.MapUtils;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Paint;
import android.os.AsyncTask;
import android.text.format.DateFormat;
import android.view.Gravity;
@ -201,7 +200,7 @@ public class RoutePointsPlugin extends OsmandPlugin {
if (mapInfoLayer != null) {
routeStepsControl = createRouteStepsInfoControl(activity);
mapInfoLayer.registerSideWidget(routeStepsControl,
R.drawable.ic_action_signpost_dark, R.drawable.widget_signpost, R.string.map_widget_route_points, "route_steps", false, 8);
R.drawable.ic_action_signpost_dark, R.string.map_widget_route_points, "route_steps", false, 8);
mapInfoLayer.recreateControls();
}
}

View file

@ -82,9 +82,9 @@ public class MapInfoLayer extends OsmandMapLayer {
recreateControls();
}
public void registerSideWidget(TextInfoWidget widget, int drawableMenu, int drawableMap,
public void registerSideWidget(TextInfoWidget widget, int drawableMenu,
int messageId, String key, boolean left, int priorityOrder) {
MapWidgetRegInfo reg = mapInfoControls.registerSideWidgetInternal(widget, drawableMenu, drawableMap, messageId, key, left, priorityOrder);
MapWidgetRegInfo reg = mapInfoControls.registerSideWidgetInternal(widget, drawableMenu, messageId, key, left, priorityOrder);
updateReg(calculateTextState(), reg);
}
@ -105,29 +105,29 @@ public class MapInfoLayer extends OsmandMapLayer {
// register left stack
NextTurnInfoWidget bigInfoControl = ric.createNextInfoControl(map, app, false);
registerSideWidget(bigInfoControl, R.drawable.ic_action_next_turn, R.drawable.widget_next_turn, R.string.map_widget_next_turn,"next_turn", true, 5);
registerSideWidget(bigInfoControl, R.drawable.ic_action_next_turn, R.string.map_widget_next_turn,"next_turn", true, 5);
NextTurnInfoWidget smallInfoControl = ric.createNextInfoControl(map, app, true);
registerSideWidget(smallInfoControl, R.drawable.ic_action_next_turn, R.drawable.widget_next_turn, R.string.map_widget_next_turn_small, "next_turn_small", true,
registerSideWidget(smallInfoControl, R.drawable.ic_action_next_turn, R.string.map_widget_next_turn_small, "next_turn_small", true,
10);
NextTurnInfoWidget nextNextInfoControl = ric.createNextNextInfoControl(map, app, true);
registerSideWidget(nextNextInfoControl, R.drawable.ic_action_next_turn, R.drawable.widget_next_turn, R.string.map_widget_next_next_turn, "next_next_turn",true, 15);
registerSideWidget(nextNextInfoControl, R.drawable.ic_action_next_turn, R.string.map_widget_next_next_turn, "next_next_turn",true, 15);
// right stack
TextInfoWidget intermediateDist = ric.createIntermediateDistanceControl(map);
registerSideWidget(intermediateDist, R.drawable.ic_action_intermediate, R.drawable.widget_intermediate, R.string.map_widget_intermediate_distance, "intermediate_distance", false, 3);
registerSideWidget(intermediateDist, R.drawable.ic_action_intermediate, R.string.map_widget_intermediate_distance, "intermediate_distance", false, 3);
TextInfoWidget dist = ric.createDistanceControl(map);
registerSideWidget(dist, R.drawable.ic_action_target, R.drawable.widget_target, R.string.map_widget_distance, "distance", false, 5);
registerSideWidget(dist, R.drawable.ic_action_target, R.string.map_widget_distance, "distance", false, 5);
TextInfoWidget time = ric.createTimeControl(map);
registerSideWidget(time, R.drawable.ic_action_time, R.drawable.widget_time, R.string.map_widget_time, "time", false, 10);
registerSideWidget(time, R.drawable.ic_action_time, R.string.map_widget_time, "time", false, 10);
TextInfoWidget speed = ric.createSpeedControl(map);
registerSideWidget(speed, R.drawable.ic_action_speed, R.drawable.widget_speed, R.string.map_widget_speed, "speed", false, 15);
registerSideWidget(speed, R.drawable.ic_action_speed, R.string.map_widget_speed, "speed", false, 15);
TextInfoWidget gpsInfo = mic.createGPSInfoControl(map);
registerSideWidget(gpsInfo, R.drawable.ic_action_gps_info, R.drawable.widget_gps_info, R.string.map_widget_gps_info, "gps_info", false, 17);
registerSideWidget(gpsInfo, R.drawable.ic_action_gps_info, R.string.map_widget_gps_info, "gps_info", false, 17);
TextInfoWidget maxspeed = ric.createMaxSpeedControl(map);
registerSideWidget(maxspeed, R.drawable.ic_action_max_speed, R.drawable.widget_max_speed, R.string.map_widget_max_speed, "max_speed", false, 18);
registerSideWidget(maxspeed, R.drawable.ic_action_max_speed, R.string.map_widget_max_speed, "max_speed", false, 18);
TextInfoWidget alt = mic.createAltitudeControl(map);
registerSideWidget(alt, R.drawable.ic_action_altitude, R.drawable.widget_altitude, R.string.map_widget_altitude, "altitude", false, 20);
registerSideWidget(alt, R.drawable.ic_action_altitude, R.string.map_widget_altitude, "altitude", false, 20);
TextInfoWidget plainTime = ric.createPlainTimeControl(map);
registerSideWidget(plainTime, R.drawable.ic_action_time_to_distance, R.drawable.widget_time_to_distance, R.string.map_widget_plain_time, "plain_time", false, 25);
registerSideWidget(plainTime, R.drawable.ic_action_time, R.string.map_widget_plain_time, "plain_time", false, 25);
}
@ -155,6 +155,7 @@ public class MapInfoLayer extends OsmandMapLayer {
private static class TextState {
boolean textBold ;
boolean night;
int textColor ;
int textShadowColor ;
int boxTop;
@ -202,6 +203,7 @@ public class MapInfoLayer extends OsmandMapLayer {
if(v != null) {
v.setBackgroundResource(reg.left ? ts.leftRes : ts.rightRes);
reg.widget.updateTextColor(ts.textColor, ts.textShadowColor, ts.textBold, ts.textShadowRadius);
reg.widget.updateIconMode(ts.night);
}
}
@ -211,6 +213,7 @@ public class MapInfoLayer extends OsmandMapLayer {
boolean following = routeLayer.getHelper().isFollowingMode();
TextState ts = new TextState();
ts.textBold = following;
ts.night = nightMode;
ts.textColor = nightMode ? view.getResources().getColor(R.color.widgettext_night) : Color.BLACK;
// Night shadowColor always use widgettext_shadow_night, same as widget background color for non-transparent
// night skin (from box_night_free_simple.9.png)

View file

@ -208,8 +208,8 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
String id = null;
PoiType st = o.getType().getPoiTypeByKeyName(o.getSubType());
if (st != null) {
if (RenderingIcons.containsIcon(st.getKeyName())) {
id = st.getKeyName();
if (RenderingIcons.containsIcon(st.getIconKeyName())) {
id = st.getIconKeyName();
} else if (RenderingIcons.containsIcon(st.getOsmTag() + "_" + st.getOsmValue())) {
id = st.getOsmTag() + "_" + st.getOsmValue();
}

View file

@ -105,19 +105,20 @@ public class PointLocationLayer extends OsmandMapLayer {
if (isLocationVisible(box, lastKnownLocation)) {
checkAppMode(view.getSettings().getApplicationMode());
boolean isBearing = lastKnownLocation.hasBearing();
if (!isBearing) {
canvas.drawBitmap(locationIcon, locationX - locationIcon.getWidth() / 2, locationY - locationIcon.getHeight() / 2,
locationPaint);
}
Float heading = locationProvider.getHeading();
if (heading != null && mapViewTrackingUtilities.isShowViewAngle()) {
canvas.drawArc(getHeadingRect(locationX, locationY), heading - HEADING_ANGLE / 2 - 90, HEADING_ANGLE, true, headingPaint);
canvas.drawArc(getHeadingRect(locationX, locationY), heading - HEADING_ANGLE / 2 - 90, HEADING_ANGLE,
true, headingPaint);
}
if (isBearing) {
float bearing = lastKnownLocation.getBearing();
canvas.rotate(bearing - 90, locationX, locationY);
canvas.drawBitmap(bearingIcon, locationX - bearingIcon.getWidth() / 2, locationY - bearingIcon.getHeight() / 2,
locationPaint);
canvas.drawBitmap(bearingIcon, locationX - bearingIcon.getWidth() / 2,
locationY - bearingIcon.getHeight() / 2, locationPaint);
} else {
canvas.drawBitmap(locationIcon, locationX - locationIcon.getWidth() / 2,
locationY - locationIcon.getHeight() / 2, locationPaint);
}
}

View file

@ -70,7 +70,7 @@ public class MapInfoWidgetsFactory {
}
};
altitudeControl.setText(null, null);
altitudeControl.setImageDrawable(R.drawable.widget_altitude);
altitudeControl.setIcons(R.drawable.widget_altitude_day, R.drawable.widget_altitude_night);
return altitudeControl;
}
@ -93,7 +93,7 @@ public class MapInfoWidgetsFactory {
return false;
}
};
gpsInfoControl.setImageDrawable(R.drawable.widget_gps_info);
gpsInfoControl.setIcons(R.drawable.widget_gps_info_day, R.drawable.widget_gps_info_night);
gpsInfoControl.setText(null, null);
gpsInfoControl.setOnClickListener(new View.OnClickListener() {
@Override

View file

@ -89,9 +89,9 @@ public class MapWidgetRegistry {
}
}
}
public MapWidgetRegInfo registerSideWidgetInternal(TextInfoWidget widget, int drawableMenu, int drawableMap,
public MapWidgetRegInfo registerSideWidgetInternal(TextInfoWidget widget, int drawableMenu,
int messageId, String key, boolean left, int priorityOrder) {
MapWidgetRegInfo ii = new MapWidgetRegInfo(key, widget, drawableMenu, drawableMap,
MapWidgetRegInfo ii = new MapWidgetRegInfo(key, widget, drawableMenu,
messageId, priorityOrder, left);
for (ApplicationMode ms : ApplicationMode.values(settings)) {
boolean collapse = ms.isWidgetCollapsible(key);
@ -309,7 +309,6 @@ public class MapWidgetRegistry {
public static class MapWidgetRegInfo implements Comparable<MapWidgetRegInfo> {
public final TextInfoWidget widget;
public final int drawableMenu;
public final int drawableMap;
public final int messageId;
public final String key;
public final boolean left;
@ -319,12 +318,10 @@ public class MapWidgetRegistry {
private Runnable stateChangeListener = null;
public MapWidgetRegInfo(String key, TextInfoWidget widget, int drawableMenu,
int drawableMap, int messageId, int priorityOrder,
boolean left) {
int messageId, int priorityOrder, boolean left) {
this.key = key;
this.widget = widget;
this.drawableMenu = drawableMenu;
this.drawableMap = drawableMap;
this.messageId = messageId;
this.priorityOrder = priorityOrder;
this.left = left;

View file

@ -196,8 +196,10 @@ public class RouteInfoWidgetsFactory {
public TextInfoWidget createTimeControl(final MapActivity map){
final RoutingHelper routingHelper = map.getRoutingHelper();
final int time = R.drawable.widget_time;
final int timeToGo = R.drawable.widget_time_to_distance;
final int time = R.drawable.widget_time_day;
final int timeN = R.drawable.widget_time_night;
final int timeToGo = R.drawable.widget_time_to_distance_day;
final int timeToGoN = R.drawable.widget_time_to_distance_night;
final OsmandApplication ctx = map.getMyApplication();
final OsmandPreference<Boolean> showArrival = ctx.getSettings().SHOW_ARRIVAL_TIME_OTHERWISE_EXPECTED_TIME;
final TextInfoWidget leftTimeControl = new TextInfoWidget(map) {
@ -248,13 +250,15 @@ public class RouteInfoWidgetsFactory {
@Override
public void onClick(View v) {
showArrival.set(!showArrival.get());
leftTimeControl.setImageDrawable(showArrival.get()? time : timeToGo);
leftTimeControl.setIcons(showArrival.get() ? time : timeToGo,
showArrival.get() ? timeN : timeToGoN);
map.getMapView().refreshMap();
}
});
leftTimeControl.setText(null, null);
leftTimeControl.setImageDrawable(showArrival.get()? time : timeToGo);
leftTimeControl.setIcons(showArrival.get() ? time : timeToGo,
showArrival.get() ? timeN : timeToGoN);
return leftTimeControl;
}
@ -280,7 +284,7 @@ public class RouteInfoWidgetsFactory {
};
};
plainTimeControl.setText(null, null);
plainTimeControl.setImageDrawable(R.drawable.widget_time_to_distance);
plainTimeControl.setIcons(R.drawable.widget_time_day, R.drawable.widget_time_night);
return plainTimeControl;
}
@ -323,7 +327,7 @@ public class RouteInfoWidgetsFactory {
return false;
}
};
speedControl.setImageDrawable(R.drawable.widget_max_speed);
speedControl.setIcons(R.drawable.widget_max_speed_day, R.drawable.widget_max_speed_night);
speedControl.setText(null, null);
return speedControl;
}
@ -367,7 +371,7 @@ public class RouteInfoWidgetsFactory {
return false;
}
};
speedControl.setImageDrawable(R.drawable.widget_speed);
speedControl.setIcons(R.drawable.widget_speed_day, R.drawable.widget_speed_night);
speedControl.setText(null, null);
return speedControl;
}
@ -378,10 +382,10 @@ public class RouteInfoWidgetsFactory {
private float[] calculations = new float[1];
private int cachedMeters;
public DistanceToPointInfoControl(MapActivity ma, int res) {
public DistanceToPointInfoControl(MapActivity ma, int res, int resNight) {
super(ma);
this.view = ma.getMapView();
setImageDrawable(res);
setIcons(res, resNight);
setText(null, null);
setOnClickListener(new View.OnClickListener() {
@ -437,7 +441,8 @@ public class RouteInfoWidgetsFactory {
}
public TextInfoWidget createDistanceControl(final MapActivity map) {
DistanceToPointInfoControl distanceControl = new DistanceToPointInfoControl(map,R.drawable.widget_target) {
DistanceToPointInfoControl distanceControl = new DistanceToPointInfoControl(map,R.drawable.widget_target_day,
R.drawable.widget_target_night) {
@Override
public LatLon getPointToNavigate() {
TargetPoint p = map.getPointToNavigate();
@ -457,7 +462,8 @@ public class RouteInfoWidgetsFactory {
public TextInfoWidget createIntermediateDistanceControl(final MapActivity map) {
final TargetPointsHelper targets = map.getMyApplication().getTargetPointsHelper();
DistanceToPointInfoControl distanceControl = new DistanceToPointInfoControl(map, R.drawable.widget_intermediate) {
DistanceToPointInfoControl distanceControl = new DistanceToPointInfoControl(map, R.drawable.widget_intermediate_day,
R.drawable.widget_intermediate_night) {
@Override
protected void click(OsmandMapTileView view) {

View file

@ -23,6 +23,9 @@ public class TextInfoWidget {
private boolean explicitlyVisible;
private OsmandApplication app;
private int dayIcon;
private int nightIcon;
private boolean isNight;
public TextInfoWidget(Activity activity) {
@ -72,6 +75,12 @@ public class TextInfoWidget {
topImageView.invalidate();
}
public void setIcons(int widgetDayIcon, int widgetNightIcon) {
dayIcon = widgetDayIcon;
nightIcon = widgetNightIcon;
setImageDrawable(!isNight ? dayIcon : nightIcon);
}
@ -154,6 +163,13 @@ public class TextInfoWidget {
public boolean isExplicitlyVisible() {
return explicitlyVisible;
}
public void updateIconMode(boolean night) {
isNight = night;
if(dayIcon != 0) {
setImageDrawable(!night? dayIcon : nightIcon);
}
}
public void updateTextColor(int textColor, int textShadowColor, boolean bold, int rad) {
updateTextColor(smallTextView, textColor, textShadowColor, bold, rad);
@ -168,5 +184,7 @@ public class TextInfoWidget {
}
}