Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2015-04-15 16:52:31 +02:00
commit 13fc8aeea3
27 changed files with 522 additions and 310 deletions

View file

@ -22,7 +22,7 @@ public abstract class AbstractPoiType {
} }
public String getIconKeyName() { public String getIconKeyName() {
return keyName.replace(':', '_'); return getKeyName().replace(':', '_');
} }

View file

@ -105,17 +105,32 @@
android:layout_width="@dimen/map_ruler_width" android:layout_width="@dimen/map_ruler_width"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom" > android:layout_gravity="bottom" >
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginBottom="@dimen/map_ruler_bottom_margin" >
<TextView <TextView
android:id="@+id/map_ruler_text" android:id="@+id/map_ruler_text_shadow"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:layout_marginBottom="@dimen/map_ruler_bottom_margin" android:gravity="center_horizontal"
android:gravity="center_horizontal" android:text="100 m"
android:text="100 m" android:textSize="@dimen/map_widget_text_size_small" />
android:textSize="@dimen/map_widget_text_size_small" />
<TextView
android:id="@+id/map_ruler_text"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="bottom"
android:gravity="center_horizontal"
android:text="100 m"
android:textSize="@dimen/map_widget_text_size_small" />
</FrameLayout>
<ImageView <ImageView
android:id="@+id/map_ruler_image" android:id="@+id/map_ruler_image"
android:layout_width="fill_parent" android:layout_width="fill_parent"

View file

@ -44,20 +44,37 @@
android:background="@drawable/btn_round" android:background="@drawable/btn_round"
android:minHeight="@dimen/map_address_height" > android:minHeight="@dimen/map_address_height" >
<TextView <FrameLayout
android:id="@+id/map_address_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center" >
android:ellipsize="end"
android:maxLines="1" <TextView
android:shadowColor="@color/color_myloc_distance" android:id="@+id/map_address_text_shadow"
android:shadowRadius="10" android:layout_width="wrap_content"
android:text="Long Street Name" android:layout_height="wrap_content"
android:textColor="@color/color_black" android:layout_gravity="center"
android:textSize="@dimen/map_widget_text_size" android:ellipsize="end"
android:textStyle="bold" > android:maxLines="1"
</TextView> android:text="Long Street Name"
android:textColor="@color/color_black"
android:textSize="@dimen/map_widget_text_size" >
</TextView>
<TextView
android:id="@+id/map_address_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:ellipsize="end"
android:maxLines="1"
android:text="Long Street Name"
android:textColor="@color/color_black"
android:textSize="@dimen/map_widget_text_size" >
</TextView>
</FrameLayout>
<LinearLayout <LinearLayout
android:id="@+id/waypoint_info_bar" android:id="@+id/waypoint_info_bar"
@ -85,16 +102,35 @@
android:textSize="15sp" android:textSize="15sp"
android:textStyle="bold" /> android:textStyle="bold" />
<TextView <FrameLayout
android:id="@+id/waypoint_text"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginLeft="4dp" android:layout_marginLeft="4dp"
android:layout_weight="1" android:layout_weight="1" >
android:ellipsize="end"
android:maxLines="2"
android:textSize="18sp" /> <TextView
android:id="@+id/waypoint_text_shadow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:text="Waypoint"
android:textColor="@color/color_black"
android:textSize="@dimen/map_button_text_size" />
<TextView
android:id="@+id/waypoint_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:text="Waypoint"
android:textColor="@color/color_black"
android:textSize="@dimen/map_button_text_size" />
</FrameLayout>
<ImageButton <ImageButton
android:id="@+id/waypoint_more" android:id="@+id/waypoint_more"
@ -112,14 +148,12 @@
</LinearLayout> </LinearLayout>
</FrameLayout> </FrameLayout>
<!-- CENTER --> <!-- CENTER -->
<FrameLayout <FrameLayout
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" > android:layout_height="wrap_content" >
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -138,12 +172,11 @@
<ImageButton <ImageButton
android:id="@+id/map_compass_button" android:id="@+id/map_compass_button"
android:layout_width="@dimen/map_small_button_size" 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:layout_height="@dimen/map_small_button_size"
android:layout_marginLeft="@dimen/map_small_button_margin"
android:background="@drawable/btn_inset_circle_trans" android:background="@drawable/btn_inset_circle_trans"
android:src="@drawable/ic_action_test_light" /> android:src="@drawable/ic_action_test_light" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/map_center_info" android:id="@+id/map_center_info"
@ -159,16 +192,34 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<TextView <FrameLayout
android:id="@+id/map_lanes_dist_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_weight="1" android:layout_weight="1" >
android:maxLines="1"
android:text="1048 km" <TextView
android:textColor="@color/color_black" android:id="@+id/map_lanes_dist_text_shadow"
android:textSize="@dimen/map_widget_text_size_small" /> android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:maxLines="1"
android:text="1048 km"
android:textColor="@color/color_black"
android:textSize="@dimen/map_widget_text_size_small" />
<TextView
android:id="@+id/map_lanes_dist_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:maxLines="1"
android:text="1048 km"
android:textColor="@color/color_black"
android:textSize="@dimen/map_widget_text_size_small" />
</FrameLayout>
<ProgressBar <ProgressBar
android:id="@+id/map_horizontal_progress" android:id="@+id/map_horizontal_progress"

View file

@ -41,6 +41,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
style="?attr/dashboardGeneralButtonStyle" style="?attr/dashboardGeneralButtonStyle"
android:gravity="center"
android:textColor="@color/color_distance" android:textColor="@color/color_distance"
android:text="@string/shared_string_deselect_all"/> android:text="@string/shared_string_deselect_all"/>

View file

@ -53,6 +53,7 @@
android:id="@+id/error_btn" android:id="@+id/error_btn"
style="?attr/dashboardGeneralButtonStyle" style="?attr/dashboardGeneralButtonStyle"
android:layout_width="0dp" android:layout_width="0dp"
android:gravity="center"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/send_report"/> android:text="@string/send_report"/>
@ -65,6 +66,7 @@
android:id="@+id/error_cancel" android:id="@+id/error_cancel"
style="?attr/dashboardGeneralButtonStyle" style="?attr/dashboardGeneralButtonStyle"
android:layout_width="0dp" android:layout_width="0dp"
android:gravity="center"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/shared_string_dismiss"/> android:text="@string/shared_string_dismiss"/>

View file

@ -57,6 +57,7 @@
android:id="@+id/share" android:id="@+id/share"
android:layout_width="@dimen/dashListItemHeight" android:layout_width="@dimen/dashListItemHeight"
android:layout_height="@dimen/dashListItemHeight" android:layout_height="@dimen/dashListItemHeight"
android:gravity="center"
style="?attr/dashboardGeneralButtonStyle"/> style="?attr/dashboardGeneralButtonStyle"/>
<include layout="@layout/check_item_rel"/> <include layout="@layout/check_item_rel"/>

View file

@ -81,6 +81,7 @@
<Button <Button
android:id="@+id/remove_tag" android:id="@+id/remove_tag"
android:gravity="center"
style="?attr/dashboardGeneralButtonStyle" style="?attr/dashboardGeneralButtonStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -61,10 +61,10 @@
<ImageView <ImageView
android:id="@+id/direction" android:id="@+id/direction"
android:layout_width="@dimen/dashFavDirectionSize" android:layout_width="wrap_content"
android:layout_height="@dimen/dashFavDirectionSize" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:src="@drawable/ic_destination_arrow_white"
android:visibility="gone" /> android:layout_gravity="center_vertical"/>
<TextView <TextView
android:id="@+id/distance" android:id="@+id/distance"
@ -88,7 +88,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginLeft="4dp" android:layout_marginLeft="2dp"
android:textColor="?android:textColorSecondary" android:textColor="?android:textColorSecondary"
android:textSize="@dimen/showAllButtonTextSize" /> android:textSize="@dimen/showAllButtonTextSize" />
</LinearLayout> </LinearLayout>

View file

@ -11,27 +11,30 @@
<FrameLayout <FrameLayout
android:id="@+id/map_alarm_warning" android:id="@+id/map_alarm_warning"
android:layout_width="@dimen/map_alarm_size"
android:layout_height="@dimen/map_alarm_size"
android:layout_gravity="bottom|left" android:layout_gravity="bottom|left"
android:layout_marginBottom="@dimen/map_alarm_bottom_margin" android:layout_marginBottom="@dimen/map_alarm_bottom_margin"
android:layout_marginLeft="@dimen/map_button_shadow_margin" android:layout_marginLeft="@dimen/map_button_shadow_margin" >
android:layout_width="@dimen/map_alarm_size"
android:layout_height="@dimen/map_alarm_size">
<ImageView <ImageView
android:id="@+id/map_alarm_warning_icon" android:id="@+id/map_alarm_warning_icon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:src="@drawable/warnings_limit" /> android:src="@drawable/warnings_limit" />
<TextView <TextView
android:id="@+id/map_alarm_warning_text" android:id="@+id/map_alarm_warning_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:textStyle="bold" android:text="60"
android:textColor="@color/color_black" android:textColor="@color/color_black"
android:textSize="@dimen/map_alarm_text_size" android:textSize="@dimen/map_alarm_text_size"
android:text="60"/> android:textStyle="bold" />
</FrameLayout> </FrameLayout>
<FrameLayout <FrameLayout
android:id="@+id/map_app_mode_shadow" android:id="@+id/map_app_mode_shadow"
android:layout_width="@dimen/map_button_shadow_width" android:layout_width="@dimen/map_button_shadow_width"
@ -60,18 +63,17 @@
<LinearLayout <LinearLayout
android:id="@+id/map_transparency_layout" android:id="@+id/map_transparency_layout"
android:layout_height="wrap_content"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center" android:layout_gravity="bottom|center"
android:layout_marginBottom="@dimen/map_button_size" android:layout_marginBottom="@dimen/map_button_size"
android:orientation="horizontal" > android:orientation="horizontal" >
<SeekBar <SeekBar
android:id="@+id/map_transparency_seekbar" android:id="@+id/map_transparency_seekbar"
android:layout_width="@dimen/map_trans_seek_size"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="@dimen/map_trans_seek_size" android:layout_gravity="center" />
android:layout_gravity="center"
/>
<ImageButton <ImageButton
android:id="@+id/map_transparency_hide" android:id="@+id/map_transparency_hide"
@ -103,30 +105,46 @@
android:layout_marginLeft="@dimen/map_button_spacing" android:layout_marginLeft="@dimen/map_button_spacing"
android:background="@drawable/btn_round" android:background="@drawable/btn_round"
android:src="@drawable/ic_action_test_light" /> android:src="@drawable/ic_action_test_light" />
<FrameLayout <FrameLayout
android:id="@+id/map_ruler_layout" android:id="@+id/map_ruler_layout"
android:layout_width="@dimen/map_ruler_width" android:layout_width="@dimen/map_ruler_width"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:layout_marginLeft="@dimen/map_button_margin"> android:layout_marginLeft="@dimen/map_button_margin" >
<TextView
android:id="@+id/map_ruler_text" <FrameLayout
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:layout_marginBottom="@dimen/map_ruler_bottom_margin" android:layout_marginBottom="@dimen/map_ruler_bottom_margin" >
android:text="100 m"
android:gravity="center_horizontal"
android:layout_gravity="bottom" <TextView
android:textSize="@dimen/map_widget_text_size_small" android:id="@+id/map_ruler_text_shadow"
/> android:layout_width="fill_parent"
<ImageView android:layout_height="fill_parent"
android:layout_gravity="bottom"
android:gravity="center_horizontal"
android:text="100 m"
android:textSize="@dimen/map_widget_text_size_small" />
<TextView
android:id="@+id/map_ruler_text"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="bottom"
android:gravity="center_horizontal"
android:text="100 m"
android:textSize="@dimen/map_widget_text_size_small" />
</FrameLayout>
<ImageView
android:id="@+id/map_ruler_image" android:id="@+id/map_ruler_image"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:background="@drawable/ruler" android:background="@drawable/ruler" />
/>
</FrameLayout> </FrameLayout>
</LinearLayout> </LinearLayout>

View file

@ -2,7 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical" >
<!-- TOP ROW --> <!-- TOP ROW -->
@ -14,21 +14,37 @@
android:minHeight="@dimen/map_address_height" > android:minHeight="@dimen/map_address_height" >
<!-- android:layout_weight="1" to show properly next turn --> <!-- android:layout_weight="1" to show properly next turn -->
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" >
<TextView
android:id="@+id/map_address_text_shadow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:ellipsize="end"
android:maxLines="1"
android:text="Long Street Name"
android:textColor="@color/color_black"
android:textSize="@dimen/map_widget_text_size" >
</TextView>
<TextView
android:id="@+id/map_address_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:ellipsize="end"
android:maxLines="1"
android:text="Long Street Name"
android:textColor="@color/color_black"
android:textSize="@dimen/map_widget_text_size" >
</TextView>
</FrameLayout>
<TextView
android:id="@+id/map_address_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:ellipsize="end"
android:maxLines="1"
android:shadowColor="@color/color_myloc_distance"
android:shadowRadius="10"
android:text="Long Street Name"
android:textColor="@color/color_black"
android:textSize="@dimen/map_widget_text_size"
android:textStyle="bold" >
</TextView>
<LinearLayout <LinearLayout
android:id="@+id/waypoint_info_bar" android:id="@+id/waypoint_info_bar"
@ -56,23 +72,41 @@
android:textSize="15sp" android:textSize="15sp"
android:textStyle="bold" /> android:textStyle="bold" />
<TextView <FrameLayout
android:id="@+id/waypoint_text" android:layout_width="0dp"
android:layout_width="0dp" android:layout_height="wrap_content"
android:layout_height="wrap_content" android:layout_gravity="center_vertical"
android:layout_gravity="center_vertical" android:layout_marginLeft="4dp"
android:layout_marginLeft="4dp" android:layout_weight="1" >
android:layout_weight="1"
android:ellipsize="end" <TextView
android:maxLines="2" android:id="@+id/waypoint_text_shadow"
android:textSize="18sp" /> android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:text="Waypoint"
android:textColor="@color/color_black"
android:textSize="@dimen/map_button_text_size" />
<TextView
android:id="@+id/waypoint_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:text="Waypoint"
android:textColor="@color/color_black"
android:textSize="@dimen/map_button_text_size" />
</FrameLayout>
<ImageButton <ImageButton
android:id="@+id/waypoint_more" android:id="@+id/waypoint_more"
android:layout_width="@dimen/map_address_height" android:layout_width="@dimen/map_address_height"
android:layout_height="@dimen/map_address_height" android:layout_height="@dimen/map_address_height"
android:background="@drawable/btn_circle_transparent" android:background="@drawable/btn_circle_transparent"
android:src="@drawable/ic_overflow_menu_white" /> android:src="@drawable/ic_action_test_light" />
<ImageButton <ImageButton
android:id="@+id/waypoint_close" android:id="@+id/waypoint_close"
@ -111,7 +145,9 @@
android:orientation="vertical" > android:orientation="vertical" >
<include layout="@layout/map_hud_widget" /> <include layout="@layout/map_hud_widget" />
<include layout="@layout/map_hud_widget" /> <include layout="@layout/map_hud_widget" />
<include layout="@layout/map_hud_widget" /> <include layout="@layout/map_hud_widget" />
</LinearLayout> </LinearLayout>
@ -147,7 +183,7 @@
android:layout_weight="0.6" > android:layout_weight="0.6" >
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<!-- RIGHT widgets colon --> <!-- RIGHT widgets colon -->
<LinearLayout <LinearLayout
@ -184,6 +220,7 @@
android:orientation="vertical" > android:orientation="vertical" >
<include layout="@layout/map_hud_widget" /> <include layout="@layout/map_hud_widget" />
<include layout="@layout/map_hud_widget" /> <include layout="@layout/map_hud_widget" />
</LinearLayout> </LinearLayout>
@ -197,7 +234,7 @@
</LinearLayout> </LinearLayout>
</FrameLayout> </FrameLayout>
</LinearLayout> </LinearLayout>
<!-- CENTER --> <!-- CENTER -->
<LinearLayout <LinearLayout
android:id="@+id/map_center_info" android:id="@+id/map_center_info"
@ -206,24 +243,41 @@
android:layout_gravity="top|center" android:layout_gravity="top|center"
android:layout_marginTop="@dimen/map_button_margin" android:layout_marginTop="@dimen/map_button_margin"
android:background="@drawable/btn_round" android:background="@drawable/btn_round"
android:visibility="gone" android:orientation="vertical"
android:orientation="vertical" > android:visibility="gone" >
<ImageView <ImageView
android:id="@+id/map_lanes" android:id="@+id/map_lanes"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<TextView <FrameLayout
android:id="@+id/map_lanes_dist_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_weight="1" android:layout_weight="1" >
android:maxLines="1"
android:text="1048 km" <TextView
android:textColor="@color/color_black" android:id="@+id/map_lanes_dist_text_shadow"
android:textSize="@dimen/map_widget_text_size_small" /> android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:maxLines="1"
android:text="1048 km"
android:textColor="@color/color_black"
android:textSize="@dimen/map_widget_text_size_small" />
<TextView
android:id="@+id/map_lanes_dist_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:maxLines="1"
android:text="1048 km"
android:textColor="@color/color_black"
android:textSize="@dimen/map_widget_text_size_small" />
</FrameLayout>
<ProgressBar <ProgressBar
android:id="@+id/map_horizontal_progress" android:id="@+id/map_horizontal_progress"

View file

@ -11,22 +11,24 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" > android:layout_height="wrap_content" >
<TextView android:id="@+id/widget_top_icon_text" <TextView
android:id="@+id/widget_top_icon_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginTop="2dp"
android:textColor="@color/color_black" android:textColor="@color/color_black"
android:textSize="@dimen/map_widget_text_size" android:textSize="@dimen/map_widget_text_size"
android:visibility="gone" android:visibility="gone" />
/>
<ImageView <ImageView
android:id="@+id/widget_top_icon" android:id="@+id/widget_top_icon"
android:layout_width="@dimen/map_widget_image" android:layout_width="@dimen/map_widget_image"
android:layout_height="@dimen/map_widget_image" android:layout_height="@dimen/map_widget_image"
android:layout_marginTop="2dp"
android:layout_gravity="center" android:layout_gravity="center"
android:src="@drawable/ic_action_test_light" android:src="@drawable/ic_action_test_light"
android:visibility="gone" android:visibility="gone" />
/>
</FrameLayout> </FrameLayout>
<LinearLayout <LinearLayout
@ -43,36 +45,63 @@
android:gravity="center" android:gravity="center"
android:src="@drawable/ic_action_test_light" /> android:src="@drawable/ic_action_test_light" />
<TextView <FrameLayout
android:id="@+id/widget_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:layout_marginBottom="@dimen/map_widget_text_bottom_margin" android:layout_marginBottom="@dimen/map_widget_text_bottom_margin"
android:layout_marginLeft="5dp" android:layout_marginLeft="5dp"
android:layout_weight="1" android:layout_weight="1" >
android:maxLines="1"
android:minWidth="10dp"
android:shadowColor="@color/color_myloc_distance"
android:shadowRadius="10"
android:text="1048"
android:textColor="@color/color_black"
android:textSize="@dimen/map_widget_text_size" />
<TextView <TextView
android:id="@+id/widget_text_small" android:id="@+id/widget_text_shadow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:maxLines="1"
android:minWidth="10dp"
android:text="1048"
android:textColor="@color/color_white"
android:textSize="@dimen/map_widget_text_size" />
<TextView
android:id="@+id/widget_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:maxLines="1"
android:minWidth="10dp"
android:text="1048"
android:textColor="@color/color_black"
android:textSize="@dimen/map_widget_text_size" />
</FrameLayout>
<FrameLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:layout_marginBottom="@dimen/map_widget_text_bottom_margin" android:layout_marginBottom="@dimen/map_widget_text_small_bottom_margin"
android:layout_marginLeft="4dp" android:layout_marginLeft="4dp"
android:layout_marginRight="4dp" android:layout_marginRight="4dp" >
android:maxLines="1"
android:shadowColor="@color/color_myloc_distance" <TextView
android:shadowRadius="10" android:id="@+id/widget_text_small_shadow"
android:text="km" android:layout_width="wrap_content"
android:textColor="@color/color_black" android:layout_height="wrap_content"
android:textSize="@dimen/map_widget_text_size_small" /> android:maxLines="1"
android:text="km"
android:textColor="@color/color_white"
android:textSize="@dimen/map_widget_text_size_small" />
<TextView
android:id="@+id/widget_text_small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:text="km"
android:textColor="@color/color_black"
android:textSize="@dimen/map_widget_text_size_small" />
</FrameLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>

View file

@ -69,6 +69,7 @@
android:id="@+id/type_name_icon" android:id="@+id/type_name_icon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:src="@drawable/ic_small_group" /> android:src="@drawable/ic_small_group" />

View file

@ -90,6 +90,7 @@
<dimen name="map_button_text_size">18sp</dimen> <dimen name="map_button_text_size">18sp</dimen>
<dimen name="map_alarm_text_size">25sp</dimen> <dimen name="map_alarm_text_size">25sp</dimen>
<dimen name="map_widget_text_bottom_margin">1sp</dimen> <dimen name="map_widget_text_bottom_margin">1sp</dimen>
<dimen name="map_widget_text_small_bottom_margin">3sp</dimen>
<dimen name="map_widget_icon_margin">4dp</dimen> <dimen name="map_widget_icon_margin">4dp</dimen>
<dimen name="dash_margin">2dp</dimen> <dimen name="dash_margin">2dp</dimen>

View file

@ -149,7 +149,8 @@ public class MapActivity extends AccessibleActivity {
// getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); // getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main); setContentView(R.layout.main);
mapView = new OsmandMapTileView(this); mapView = new OsmandMapTileView(this, getWindow().getDecorView().getWidth(),
getWindow().getDecorView().getHeight());
mapActions = new MapActivityActions(this); mapActions = new MapActivityActions(this);
mapLayers = new MapActivityLayers(this); mapLayers = new MapActivityLayers(this);
if (mapViewTrackingUtilities == null) { if (mapViewTrackingUtilities == null) {

View file

@ -128,20 +128,26 @@ public abstract class DashLocationFragment extends DashBaseFragment {
Location.distanceBetween(toLat, toLon, fromLoc.getLatitude(), fromLoc.getLongitude(), mes); Location.distanceBetween(toLat, toLon, fromLoc.getLatitude(), fromLoc.getLongitude(), mes);
} }
if (arrow != null) { if (arrow != null) {
if (!(arrow.getDrawable() instanceof DirectionDrawable)) { boolean newImage = false;
DirectionDrawable dd = new DirectionDrawable(ctx, 10, 10);
arrow.setImageDrawable(dd);
}
if (arrowResId == 0) { if (arrowResId == 0) {
arrowResId = R.drawable.ic_destination_arrow_white; arrowResId = R.drawable.ic_destination_arrow_white;
} }
DirectionDrawable dd = (DirectionDrawable) arrow.getDrawable(); DirectionDrawable dd;
if(!(arrow.getDrawable() instanceof DirectionDrawable)) {
newImage = true;
dd = new DirectionDrawable(ctx, arrow.getWidth(), arrow.getHeight());
} else {
dd = (DirectionDrawable) arrow.getDrawable();
}
dd.setImage(arrowResId, useCenter ? R.color.color_distance : R.color.color_myloc_distance); dd.setImage(arrowResId, useCenter ? R.color.color_distance : R.color.color_myloc_distance);
if (fromLoc == null || h == null) { if (fromLoc == null || h == null) {
dd.setAngle(0); dd.setAngle(0);
} else { } else {
dd.setAngle(mes[1] - h + 180 + screenOrientation); dd.setAngle(mes[1] - h + 180 + screenOrientation);
} }
if (newImage) {
arrow.setImageDrawable(dd);
}
arrow.invalidate(); arrow.invalidate();
} }
if (txt != null) { if (txt != null) {

View file

@ -3,9 +3,7 @@ package net.osmand.plus.dialogs;
import java.text.Collator; import java.text.Collator;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.Iterator;
import java.util.List; import java.util.List;
import net.osmand.AndroidUtils; import net.osmand.AndroidUtils;
@ -14,30 +12,28 @@ import net.osmand.data.FavouritePoint;
import net.osmand.data.PointDescription; import net.osmand.data.PointDescription;
import net.osmand.plus.FavouritesDbHelper; import net.osmand.plus.FavouritesDbHelper;
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup; import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.FavoritesListFragment.FavouritesAdapter;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.FavoriteImageDrawable;
import net.osmand.util.MapUtils; import net.osmand.util.MapUtils;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.AlertDialog.Builder; import android.app.AlertDialog.Builder;
import android.app.Dialog; import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.DialogInterface.OnDismissListener;
import android.content.res.Resources; import android.content.res.Resources;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.util.TypedValue;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView; import android.widget.AutoCompleteTextView;
import android.widget.CheckBox;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageView; import android.widget.ListView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
public class FavoriteDialogs { public class FavoriteDialogs {
@ -46,87 +42,19 @@ public class FavoriteDialogs {
public static Dialog createReplaceFavouriteDialog(final Activity activity, final Bundle args) { public static Dialog createReplaceFavouriteDialog(final Activity activity, final Bundle args) {
final FavouritesDbHelper helper = ((OsmandApplication) activity.getApplication()).getFavorites(); final FavouritesDbHelper helper = ((OsmandApplication) activity.getApplication()).getFavorites();
final List<FavouritePoint> points = new ArrayList<FavouritePoint>(helper.getFavouritePoints()); final List<FavouritePoint> points = new ArrayList<FavouritePoint>(helper.getFavouritePoints());
final Collator ci = java.text.Collator.getInstance(); final FavouritesAdapter favouritesAdapter = new FavouritesAdapter(activity,
final boolean distance = args.containsKey("DISTANCE"); ((OsmandApplication) activity.getApplication()).getFavorites().getFavouritePoints());
Collections.sort(points, new Comparator<FavouritePoint>() { final Dialog[] dlgHolder = new Dialog[1];
OnItemClickListener click = new AdapterView.OnItemClickListener() {
@Override @Override
public int compare(FavouritePoint o1, FavouritePoint o2) { public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (distance && activity instanceof MapActivity) { FavouritePoint fp = favouritesAdapter.getItem(position);
float f1 = (float) MapUtils.getDistance(((MapActivity) activity).getMapLocation(), o1.getLatitude(), if(dlgHolder != null && dlgHolder.length > 0 && dlgHolder[0] != null) {
o1.getLongitude()); dlgHolder[0].dismiss();
float f2 = (float) MapUtils.getDistance(((MapActivity) activity).getMapLocation(), o2.getLatitude(),
o2.getLongitude());
return Float.compare(f1, f2);
} }
return ci.compare(o1.getCategory() + " " + o1.getName(), o2.getCategory() + " " + o2.getName());
}
});
final String[] names = new String[points.size()];
if(points.size() == 0){
AccessibleToast.makeText(activity, activity.getString(R.string.fav_points_not_exist), Toast.LENGTH_SHORT).show();
return null;
}
Builder b = new AlertDialog.Builder(activity);
final FavouritePoint[] favs = new FavouritePoint[points.size()];
Iterator<FavouritePoint> it = points.iterator();
int i=0;
while (it.hasNext()) {
FavouritePoint fp = it.next();
// filter gpx points
favs[i] = fp;
if(fp.getCategory().trim().length() ==0){
names[i] = fp.getName();
} else {
names[i] = fp.getCategory() + ": " + fp.getName();
}
if(activity instanceof MapActivity) {
names[i] += " " + OsmAndFormatter.getFormattedDistance(
(float) MapUtils.getDistance(((MapActivity) activity).getMapLocation(), fp.getLatitude(),
fp.getLongitude()), ((MapActivity) activity).getMyApplication());
}
i++;
}
final int layout;
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
layout = R.layout.list_menu_item;
} else {
layout = R.layout.list_menu_item_native;
}
final ArrayAdapter<String> listAdapter = new ArrayAdapter<String>(activity, layout, R.id.title,
names) {
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
// User super class to create the View
View v = convertView;
if (v == null) {
v = activity.getLayoutInflater().inflate(layout, null);
int vl = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 32, activity.getResources()
.getDisplayMetrics());
final LinearLayout.LayoutParams ll = new LinearLayout.LayoutParams(vl, vl);
ll.setMargins(vl / 4, vl / 4, vl / 4, vl / 4);
v.findViewById(R.id.icon).setLayoutParams(ll);
}
ImageView icon = (ImageView) v.findViewById(R.id.icon);
FavouritePoint fp = points.get(position);
icon.setImageDrawable(FavoriteImageDrawable.getOrCreate(activity, fp.getColor()));
icon.setVisibility(View.VISIBLE);
TextView tv = (TextView) v.findViewById(R.id.title);
tv.setText(names[position]);
tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16);
final CheckBox ch = ((CheckBox) v.findViewById(R.id.check_item));
ch.setVisibility(View.INVISIBLE);
return v;
}
};
b.setAdapter(listAdapter, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
FavouritePoint fv = favs[which];
FavouritePoint point = (FavouritePoint) args.getSerializable(KEY_FAVORITE); FavouritePoint point = (FavouritePoint) args.getSerializable(KEY_FAVORITE);
if (helper.editFavourite(fv, point.getLatitude(), point.getLongitude())) { if (helper.editFavourite(fp, point.getLatitude(), point.getLongitude())) {
AccessibleToast.makeText(activity, activity.getString(R.string.fav_points_edited), AccessibleToast.makeText(activity, activity.getString(R.string.fav_points_edited),
Toast.LENGTH_SHORT).show(); Toast.LENGTH_SHORT).show();
} }
@ -134,24 +62,16 @@ public class FavoriteDialogs {
((MapActivity) activity).getMapView().refreshMap(); ((MapActivity) activity).getMapView().refreshMap();
} }
} }
}); };
if (activity instanceof MapActivity) { if (activity instanceof MapActivity) {
b.setPositiveButton(distance ? R.string.sort_by_name : R.string.sort_by_distance, favouritesAdapter.updateLocation(((MapActivity) activity).getMapLocation());
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (distance) {
args.remove("DISTANCE");
} else {
args.putBoolean("DISTANCE", true);
}
createReplaceFavouriteDialog(activity, args).show();
}
});
} }
AlertDialog al = b.create(); final String[] names = new String[points.size()];
return al; if(points.size() == 0){
AccessibleToast.makeText(activity, activity.getString(R.string.fav_points_not_exist), Toast.LENGTH_SHORT).show();
return null;
}
return showFavoritesDialog(activity, favouritesAdapter, click, null, dlgHolder, true);
} }
public static void prepareAddFavouriteDialog(Activity activity, Dialog dialog, Bundle args, double lat, double lon, PointDescription desc) { public static void prepareAddFavouriteDialog(Activity activity, Dialog dialog, Bundle args, double lat, double lon, PointDescription desc) {
@ -242,4 +162,49 @@ public class FavoriteDialogs {
return builder.create(); return builder.create();
} }
public static final AlertDialog showFavoritesDialog(
final Context uiContext,
final FavouritesAdapter favouritesAdapter, final OnItemClickListener click,
final OnDismissListener dismissListener, final Dialog[] dialogHolder, final boolean sortByDist) {
ListView listView = new ListView(uiContext);
Builder bld = new AlertDialog.Builder(uiContext);
final Collator inst = Collator.getInstance();
favouritesAdapter.sort(new Comparator<FavouritePoint>() {
@Override
public int compare(FavouritePoint lhs, FavouritePoint rhs) {
if (sortByDist) {
if (favouritesAdapter.getLocation() == null) {
return 0;
}
double ld = MapUtils.getDistance(favouritesAdapter.getLocation(), lhs.getLatitude(),
lhs.getLongitude());
double rd = MapUtils.getDistance(favouritesAdapter.getLocation(), rhs.getLatitude(),
rhs.getLongitude());
return Double.compare(ld, rd);
}
return inst.compare(lhs.getName(), rhs.getName());
}
});
listView.setAdapter(favouritesAdapter);
listView.setOnItemClickListener(click);
bld.setPositiveButton(sortByDist ? R.string.sort_by_name :
R.string.sort_by_distance, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
showFavoritesDialog(uiContext, favouritesAdapter, click, dismissListener, dialogHolder, !sortByDist);
}
});
bld.setNegativeButton(R.string.shared_string_cancel, null);
bld.setView(listView);
AlertDialog dlg = bld.show();
if(dialogHolder != null) {
dialogHolder[0] = dlg;
}
dlg.setOnDismissListener(dismissListener);
return dlg;
}
} }

View file

@ -60,6 +60,7 @@ public class WaypointDialogHelper {
WaypointHelper wh = app.getWaypointHelper(); WaypointHelper wh = app.getWaypointHelper();
final LocationPoint point = ps.getPoint(); final LocationPoint point = ps.getPoint();
TextView text = (TextView) localView.findViewById(R.id.waypoint_text); TextView text = (TextView) localView.findViewById(R.id.waypoint_text);
TextView textShadow = (TextView) localView.findViewById(R.id.waypoint_text_shadow);
localView.setOnClickListener(new View.OnClickListener() { localView.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
@ -86,7 +87,12 @@ public class WaypointDialogHelper {
} else { } else {
textDist.setText(""); textDist.setText("");
} }
text.setText(PointDescription.getSimpleName(point, app)); String descr = PointDescription.getSimpleName(point, app);
if(textShadow != null) {
textShadow.setText(descr);
}
text.setText(descr);
// ((Spannable) text.getText()).setSpan( // ((Spannable) text.getText()).setSpan(
// new ForegroundColorSpan(ctx.getResources().getColor(R.color.color_distance)), 0, distance.length() - 1, // new ForegroundColorSpan(ctx.getResources().getColor(R.color.color_distance)), 0, distance.length() - 1,
// 0); // 0);

View file

@ -74,9 +74,11 @@ public class OsmEditsLayer extends OsmandMapLayer implements ContextMenuLayer.IC
DataTileManager<OsmPoint> points = plugin.getLocalOsmEdits(); DataTileManager<OsmPoint> points = plugin.getLocalOsmEdits();
final QuadRect latlon = tileBox.getLatLonBounds(); final QuadRect latlon = tileBox.getLatLonBounds();
List<OsmPoint> objects = points.getObjects(latlon. top, latlon.left, latlon.bottom, latlon.right); List<OsmPoint> objects = points.getObjects(latlon. top, latlon.left, latlon.bottom, latlon.right);
for (OsmPoint o : objects) { for (OsmPoint o : objects) {
int x = (int) tileBox.getPixXFromLatLon(o.getLatitude(), o.getLongitude()); int locationX = tileBox.getPixXFromLonNoRot(o.getLongitude());
int y = (int) tileBox.getPixYFromLatLon(o.getLatitude(), o.getLongitude()); int locationY = tileBox.getPixYFromLatNoRot(o.getLatitude());
canvas.rotate(-view.getRotate(), locationX, locationY);
Bitmap b; Bitmap b;
if (o.getGroup() == OsmPoint.Group.POI) { if (o.getGroup() == OsmPoint.Group.POI) {
b = poi; b = poi;
@ -84,9 +86,9 @@ public class OsmEditsLayer extends OsmandMapLayer implements ContextMenuLayer.IC
b = bug; b = bug;
} else { } else {
b = poi; b = poi;
} }
canvas.drawBitmap(b, x - b.getWidth() / 2, y - b.getHeight(), paintIcon); canvas.drawBitmap(b, locationX - b.getWidth() / 2, locationY - b.getHeight(), paintIcon);
canvas.rotate(view.getRotate(), locationX, locationY);
} }
} }
} }

View file

@ -95,12 +95,16 @@ public class DirectionDrawable extends Drawable {
protected void onBoundsChange(Rect bounds) { protected void onBoundsChange(Rect bounds) {
super.onBoundsChange(bounds); super.onBoundsChange(bounds);
if (arrowImage != null) { if (arrowImage != null) {
Rect r = getBounds(); Rect r = bounds;
int w = arrowImage.getIntrinsicWidth(); int w = arrowImage.getIntrinsicWidth();
int h = arrowImage.getIntrinsicHeight(); int h = arrowImage.getIntrinsicHeight();
int dx = r.width() - w; int dx = Math.max(0, r.width() - w);
int dy = r.height() - h; int dy = Math.max(0, r.height() - h);
arrowImage.setBounds(r.left + dx / 2, r.top + dy / 2, r.right - dx / 2, r.bottom - dy / 2); if(r.width() == 0 && r.height() == 0) {
arrowImage.setBounds(0, 0, w, h);
} else {
arrowImage.setBounds(r.left + dx / 2, r.top + dy / 2, r.right - dx / 2, r.bottom - dy / 2);
}
} }
} }

View file

@ -173,8 +173,7 @@ public class MapControlsLayer extends OsmandMapLayer {
private void initTopControls() { private void initTopControls() {
View configureMap = mapActivity.findViewById(R.id.map_layers_button); View configureMap = mapActivity.findViewById(R.id.map_layers_button);
controls.add(createHudButton((ImageView) configureMap, R.drawable.map_layer_dark).setIconColorId(0).setBg( controls.add(createHudButton((ImageView) configureMap, R.drawable.map_layer_dark).setIconColorId(0));
R.drawable.btn_inset_circle, R.drawable.btn_inset_circle_night));
configureMap.setOnClickListener(new View.OnClickListener() { configureMap.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -184,8 +183,7 @@ public class MapControlsLayer extends OsmandMapLayer {
}); });
View compass = mapActivity.findViewById(R.id.map_compass_button); View compass = mapActivity.findViewById(R.id.map_compass_button);
compassHud = createHudButton((ImageView) compass, R.drawable.map_compass).setIconColorId(0).setBg( compassHud = createHudButton((ImageView) compass, R.drawable.map_compass).setIconColorId(0);
R.drawable.btn_inset_circle, R.drawable.btn_inset_circle_night);
compassHud.compass = true; compassHud.compass = true;
controls.add(compassHud); controls.add(compassHud);
compass.setOnClickListener(new View.OnClickListener() { compass.setOnClickListener(new View.OnClickListener() {

View file

@ -184,8 +184,8 @@ public class MapInfoLayer extends OsmandMapLayer {
updateReg(ts, reg); updateReg(ts, reg);
} }
updateStreetName(nightMode, ts); updateStreetName(nightMode, ts);
lanesControl.updateTextSize(nightMode, ts.textColor, ts.textShadowColor, ts.textBold, ts.textShadowRadius); lanesControl.updateTextSize(nightMode, ts.textColor, ts.textShadowColor, ts.textBold, ts.textShadowRadius / 2);
rulerControl.updateTextSize(nightMode, ts.textColor, ts.textShadowColor, ts.textShadowRadius); rulerControl.updateTextSize(nightMode, ts.textColor, ts.textShadowColor, (int) (2 * view.getDensity()));
this.expand.setBackgroundResource(ts.expand); this.expand.setBackgroundResource(ts.expand);
rightStack.invalidate(); rightStack.invalidate();
leftStack.invalidate(); leftStack.invalidate();
@ -219,9 +219,11 @@ public class MapInfoLayer extends OsmandMapLayer {
// night skin (from box_night_free_simple.9.png) // night skin (from box_night_free_simple.9.png)
ts.textShadowColor = nightMode ? view.getResources().getColor(R.color.widgettext_shadow_night) : Color.WHITE; ts.textShadowColor = nightMode ? view.getResources().getColor(R.color.widgettext_shadow_night) : Color.WHITE;
if (!transparent && !nightMode) { if (!transparent && !nightMode) {
ts.textShadowColor = Color.TRANSPARENT; // ts.textShadowColor = Color.TRANSPARENT;
ts.textShadowRadius = 0;
} else {
ts.textShadowRadius = (int) (4 * view.getDensity());
} }
ts.textShadowRadius = ts.textShadowColor == 0 ? 0 : 15;
if (transparent) { if (transparent) {
ts.boxTop = R.drawable.btn_flat_transparent; ts.boxTop = R.drawable.btn_flat_transparent;
ts.rightRes = R.drawable.btn_left_round_transparent; ts.rightRes = R.drawable.btn_left_round_transparent;

View file

@ -166,13 +166,13 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
} }
}; };
public OsmandMapTileView(Activity activity) { public OsmandMapTileView(Activity activity, int w, int h) {
this.activity = activity; this.activity = activity;
init(activity); init(activity, w, h);
} }
// ///////////////////////////// INITIALIZING UI PART /////////////////////////////////// // ///////////////////////////// INITIALIZING UI PART ///////////////////////////////////
public void init(Context ctx) { public void init(Context ctx, int w, int h) {
application = (OsmandApplication) ctx.getApplicationContext(); application = (OsmandApplication) ctx.getApplicationContext();
settings = application.getSettings(); settings = application.getSettings();
@ -217,7 +217,7 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
LatLon ll = settings.getLastKnownMapLocation(); LatLon ll = settings.getLastKnownMapLocation();
currentViewport = new RotatedTileBox.RotatedTileBoxBuilder(). currentViewport = new RotatedTileBox.RotatedTileBoxBuilder().
setLocation(ll.getLatitude(), ll.getLongitude()).setZoom(settings.getLastKnownMapZoom()). setLocation(ll.getLatitude(), ll.getLongitude()).setZoom(settings.getLastKnownMapZoom()).
setPixelDimensions(400, 700).build(); setPixelDimensions(w, h).build();
currentViewport.setDensity(dm.density); currentViewport.setDensity(dm.density);
currentViewport.setMapDensity(getSettingsMapDensity()); currentViewport.setMapDensity(getSettingsMapDensity());
} }

View file

@ -1,6 +1,8 @@
package net.osmand.plus.views.controls; package net.osmand.plus.views.controls;
import java.text.Collator;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator;
import java.util.List; import java.util.List;
import net.osmand.data.FavouritePoint; import net.osmand.data.FavouritePoint;
@ -14,22 +16,25 @@ import net.osmand.plus.R;
import net.osmand.plus.TargetPointsHelper; import net.osmand.plus.TargetPointsHelper;
import net.osmand.plus.TargetPointsHelper.TargetPoint; import net.osmand.plus.TargetPointsHelper.TargetPoint;
import net.osmand.plus.activities.FavoritesListFragment.FavouritesAdapter; import net.osmand.plus.activities.FavoritesListFragment.FavouritesAdapter;
import net.osmand.plus.activities.search.SearchActivity;
import net.osmand.plus.activities.search.SearchAddressActivity;
import net.osmand.plus.activities.search.SearchAddressFragment;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.ShowRouteInfoActivity; import net.osmand.plus.activities.ShowRouteInfoActivity;
import net.osmand.plus.activities.search.SearchAddressActivity;
import net.osmand.plus.activities.search.SearchAddressFragment;
import net.osmand.plus.development.OsmandDevelopmentPlugin; import net.osmand.plus.development.OsmandDevelopmentPlugin;
import net.osmand.plus.dialogs.FavoriteDialogs;
import net.osmand.plus.routing.RouteDirectionInfo; import net.osmand.plus.routing.RouteDirectionInfo;
import net.osmand.plus.routing.RoutingHelper; import net.osmand.plus.routing.RoutingHelper;
import net.osmand.plus.routing.RoutingHelper.IRouteInformationListener; import net.osmand.plus.routing.RoutingHelper.IRouteInformationListener;
import net.osmand.plus.views.ContextMenuLayer; import net.osmand.plus.views.ContextMenuLayer;
import net.osmand.plus.views.MapControlsLayer; import net.osmand.plus.views.MapControlsLayer;
import net.osmand.plus.views.OsmandMapTileView; import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.util.MapUtils;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.AlertDialog.Builder; import android.app.AlertDialog.Builder;
import android.app.Dialog; import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.DialogInterface.OnDismissListener; import android.content.DialogInterface.OnDismissListener;
import android.content.Intent; import android.content.Intent;
import android.graphics.PointF; import android.graphics.PointF;
@ -38,6 +43,7 @@ import android.view.View;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.Button; import android.widget.Button;
import android.widget.ImageButton; import android.widget.ImageButton;
@ -52,7 +58,6 @@ public class MapRouteInfoControl implements IRouteInformationListener {
private final RoutingHelper routingHelper; private final RoutingHelper routingHelper;
private OsmandMapTileView mapView; private OsmandMapTileView mapView;
private Dialog dialog; private Dialog dialog;
private AlertDialog favoritesDialog;
private boolean selectFromMapTouch; private boolean selectFromMapTouch;
private boolean selectFromMapForTarget; private boolean selectFromMapForTarget;
@ -229,12 +234,29 @@ public class MapRouteInfoControl implements IRouteInformationListener {
} }
protected void selectFavorite(final View parentView, final boolean target) { protected void selectFavorite(final View parentView, final boolean target) {
Builder bld = new AlertDialog.Builder(mapActivity); final FavouritesAdapter favouritesAdapter = new FavouritesAdapter(mapActivity, mapActivity.getMyApplication()
ListView listView = new ListView(mapActivity); .getFavorites().getFavouritePoints());
final FavouritesAdapter favouritesAdapter = new FavouritesAdapter(mapActivity, mapActivity.getMyApplication().getFavorites().getFavouritePoints()); Dialog[] dlgHolder = new Dialog[1];
OnItemClickListener click = getOnClickListener(target, favouritesAdapter, dlgHolder);
OnDismissListener dismissListener = new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
if (target) {
setupToSpinner(parentView);
} else {
setupFromSpinner(parentView);
}
}
};
favouritesAdapter.updateLocation(mapActivity.getMapLocation()); favouritesAdapter.updateLocation(mapActivity.getMapLocation());
listView.setAdapter(favouritesAdapter); FavoriteDialogs.showFavoritesDialog(mapActivity, favouritesAdapter, click, dismissListener, dlgHolder, true);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { }
private OnItemClickListener getOnClickListener(final boolean target, final FavouritesAdapter favouritesAdapter,
final Dialog[] dlg) {
return new AdapterView.OnItemClickListener() {
@Override @Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
@ -245,25 +267,14 @@ public class MapRouteInfoControl implements IRouteInformationListener {
} else { } else {
getTargets().setStartPoint(point, true, fp.getPointDescription()); getTargets().setStartPoint(point, true, fp.getPointDescription());
} }
favoritesDialog.dismiss(); if(dlg != null && dlg.length > 0 && dlg[0] != null) {
dlg[0].dismiss();
}
//Next 2 lines ensure Dialog is shown in the right correct position after a selection been made //Next 2 lines ensure Dialog is shown in the right correct position after a selection been made
hideDialog(); hideDialog();
showDialog(); showDialog();
} }
}); };
bld.setView(listView);
favoritesDialog = bld.show();
favoritesDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
if(target){
setupToSpinner(parentView);
} else {
setupFromSpinner(parentView);
}
}
});
} }
public static int getDirectionInfo() { public static int getDirectionInfo() {

View file

@ -168,6 +168,7 @@ public class MapInfoWidgetsFactory {
private final MapActivity map; private final MapActivity map;
private View topBar; private View topBar;
private TextView addressText; private TextView addressText;
private TextView addressTextShadow;
private OsmAndLocationProvider locationProvider; private OsmAndLocationProvider locationProvider;
private WaypointHelper waypointHelper; private WaypointHelper waypointHelper;
private OsmandSettings settings; private OsmandSettings settings;
@ -178,6 +179,7 @@ public class MapInfoWidgetsFactory {
public TopTextView(OsmandApplication app, MapActivity map) { public TopTextView(OsmandApplication app, MapActivity map) {
topBar = map.findViewById(R.id.map_top_bar); topBar = map.findViewById(R.id.map_top_bar);
addressText = (TextView) map.findViewById(R.id.map_address_text); addressText = (TextView) map.findViewById(R.id.map_address_text);
addressTextShadow = (TextView) map.findViewById(R.id.map_address_text_shadow);
waypointInfoBar = map.findViewById(R.id.waypoint_info_bar); waypointInfoBar = map.findViewById(R.id.waypoint_info_bar);
this.routingHelper = app.getRoutingHelper(); this.routingHelper = app.getRoutingHelper();
locationProvider = app.getLocationProvider(); locationProvider = app.getLocationProvider();
@ -206,9 +208,11 @@ public class MapInfoWidgetsFactory {
} }
public void updateTextColor(boolean nightMode, int textColor, int textShadowColor, boolean bold, int rad) { public void updateTextColor(boolean nightMode, int textColor, int textShadowColor, boolean bold, int rad) {
updateTextColor(addressText, textColor, textShadowColor, bold, rad); TextInfoWidget.updateTextColor(addressText, addressTextShadow, textColor, textShadowColor, bold, rad);
updateTextColor((TextView) waypointInfoBar.findViewById(R.id.waypoint_text), textColor, textShadowColor, TextInfoWidget.updateTextColor((TextView) waypointInfoBar.findViewById(R.id.waypoint_text),
bold, rad); (TextView) waypointInfoBar.findViewById(R.id.waypoint_text_shadow),
textColor, textShadowColor, bold, rad / 2);
ImageView all = (ImageView) waypointInfoBar.findViewById(R.id.waypoint_more); ImageView all = (ImageView) waypointInfoBar.findViewById(R.id.waypoint_more);
ImageView remove = (ImageView) waypointInfoBar.findViewById(R.id.waypoint_close); ImageView remove = (ImageView) waypointInfoBar.findViewById(R.id.waypoint_close);
all.setImageDrawable(map.getMyApplication().getIconsCache() all.setImageDrawable(map.getMyApplication().getIconsCache()
@ -217,11 +221,7 @@ public class MapInfoWidgetsFactory {
.getActionBarIcon(R.drawable.ic_action_remove_dark, !nightMode)); .getActionBarIcon(R.drawable.ic_action_remove_dark, !nightMode));
} }
private void updateTextColor(TextView tv, int textColor, int textShadowColor, boolean textBold, int rad) {
tv.setTextColor(textColor);
tv.setShadowLayer(rad, 0, 0, textShadowColor);
tv.setTypeface(Typeface.DEFAULT, textBold ? Typeface.BOLD : Typeface.NORMAL);
}
public boolean updateInfo(DrawSettings d) { public boolean updateInfo(DrawSettings d) {
String text = null; String text = null;
@ -266,21 +266,28 @@ public class MapInfoWidgetsFactory {
if(!showNextTurn && updateWaypoint()) { if(!showNextTurn && updateWaypoint()) {
updateVisibility(true); updateVisibility(true);
updateVisibility(addressText, false); updateVisibility(addressText, false);
updateVisibility(addressTextShadow, false);
} else if(text == null) { } else if(text == null) {
updateVisibility(false); updateVisibility(false);
} else { } else {
updateVisibility(true); updateVisibility(true);
updateVisibility(waypointInfoBar, false); updateVisibility(waypointInfoBar, false);
updateVisibility(addressText, true); updateVisibility(addressText, true);
updateVisibility(addressTextShadow, true);
boolean update = turnDrawable.setTurnType(type[0]); boolean update = turnDrawable.setTurnType(type[0]);
int h = addressText.getHeight() / 4 * 3; int h = addressText.getHeight() / 4 * 3;
if (h != turnDrawable.getBounds().bottom) { if (h != turnDrawable.getBounds().bottom) {
turnDrawable.setBounds(0, 0, h, h); turnDrawable.setBounds(0, 0, h, h);
} }
if (update) { if (update) {
if (type[0] != null) { if (type[0] != null) {
addressTextShadow.setCompoundDrawables(turnDrawable, null, null, null);
addressTextShadow.setCompoundDrawablePadding(4);
addressText.setCompoundDrawables(turnDrawable, null, null, null); addressText.setCompoundDrawables(turnDrawable, null, null, null);
addressText.setCompoundDrawablePadding(4);
} else { } else {
addressTextShadow.setCompoundDrawables(null, null, null, null);
addressText.setCompoundDrawables(null, null, null, null); addressText.setCompoundDrawables(null, null, null, null);
} }
} }
@ -290,6 +297,7 @@ public class MapInfoWidgetsFactory {
} else { } else {
topBar.setContentDescription(map.getResources().getString(R.string.map_widget_top_text)); topBar.setContentDescription(map.getResources().getString(R.string.map_widget_top_text));
} }
addressTextShadow.setText(text);
addressText.setText(text); addressText.setText(text);
return true; return true;
} }
@ -307,6 +315,7 @@ public class MapInfoWidgetsFactory {
return false; return false;
} else { } else {
updateVisibility(addressText, false); updateVisibility(addressText, false);
updateVisibility(addressTextShadow, false);
boolean updated = updateVisibility(waypointInfoBar, true); boolean updated = updateVisibility(waypointInfoBar, true);
// pass top bar to make it clickable // pass top bar to make it clickable
WaypointDialogHelper.updatePointInfoView(map.getMyApplication(), map, topBar, WaypointDialogHelper.updatePointInfoView(map.getMyApplication(), map, topBar,

View file

@ -520,6 +520,7 @@ public class RouteInfoWidgetsFactory {
private OsmandSettings settings; private OsmandSettings settings;
private ImageView lanesView; private ImageView lanesView;
private TextView lanesText; private TextView lanesText;
private TextView lanesShadowText;
private OsmandApplication app; private OsmandApplication app;
private int dist; private int dist;
private LanesDrawable lanesDrawable; private LanesDrawable lanesDrawable;
@ -529,6 +530,7 @@ public class RouteInfoWidgetsFactory {
public LanesControl(final MapActivity map, final OsmandMapTileView view) { public LanesControl(final MapActivity map, final OsmandMapTileView view) {
lanesView = (ImageView) map.findViewById(R.id.map_lanes); lanesView = (ImageView) map.findViewById(R.id.map_lanes);
lanesText = (TextView) map.findViewById(R.id.map_lanes_dist_text); lanesText = (TextView) map.findViewById(R.id.map_lanes_dist_text);
lanesShadowText = (TextView) map.findViewById(R.id.map_lanes_dist_text_shadow);
centerInfo = (View) map.findViewById(R.id.map_center_info); centerInfo = (View) map.findViewById(R.id.map_center_info);
progress = (View) map.findViewById(R.id.map_horizontal_progress); progress = (View) map.findViewById(R.id.map_horizontal_progress);
lanesDrawable = new LanesDrawable(map, map.getMapView().getScaleCoefficient()); lanesDrawable = new LanesDrawable(map, map.getMapView().getScaleCoefficient());
@ -541,9 +543,7 @@ public class RouteInfoWidgetsFactory {
} }
public void updateTextSize(boolean isNight, int textColor, int textShadowColor, boolean textBold, int shadowRadius) { public void updateTextSize(boolean isNight, int textColor, int textShadowColor, boolean textBold, int shadowRadius) {
lanesText.setTextColor(textColor); TextInfoWidget.updateTextColor(lanesText, lanesShadowText, textColor, textShadowColor, textBold, shadowRadius);
lanesText.setTypeface(Typeface.DEFAULT, textBold ? Typeface.BOLD : Typeface.NORMAL);
lanesText.setShadowLayer(shadowRadius, 0, 0, textShadowColor);
} }
public boolean updateInfo(DrawSettings drawSettings) { public boolean updateInfo(DrawSettings drawSettings) {
@ -603,13 +603,17 @@ public class RouteInfoWidgetsFactory {
if (distChanged(dist, this.dist)) { if (distChanged(dist, this.dist)) {
this.dist = dist; this.dist = dist;
if(dist == 0) { if(dist == 0) {
lanesShadowText.setText("");
lanesText.setText(""); lanesText.setText("");
} else { } else {
lanesShadowText.setText(OsmAndFormatter.getFormattedDistance(dist, app));
lanesText.setText(OsmAndFormatter.getFormattedDistance(dist, app)); lanesText.setText(OsmAndFormatter.getFormattedDistance(dist, app));
} }
lanesShadowText.invalidate();
lanesText.invalidate(); lanesText.invalidate();
} }
} }
updateVisibility(lanesShadowText, visible);
updateVisibility(lanesText, visible); updateVisibility(lanesText, visible);
updateVisibility(lanesView, visible); updateVisibility(lanesView, visible);
updateVisibility(centerInfo, visible || progress.getVisibility() == View.VISIBLE); updateVisibility(centerInfo, visible || progress.getVisibility() == View.VISIBLE);
@ -715,6 +719,7 @@ public class RouteInfoWidgetsFactory {
private View layout; private View layout;
private ImageView icon; private ImageView icon;
private TextView text; private TextView text;
private TextView textShadow;
private MapActivity ma; private MapActivity ma;
private String cacheRulerText; private String cacheRulerText;
private int maxWidth; private int maxWidth;
@ -728,13 +733,13 @@ public class RouteInfoWidgetsFactory {
layout = ma.findViewById(R.id.map_ruler_layout); layout = ma.findViewById(R.id.map_ruler_layout);
icon = (ImageView) ma.findViewById(R.id.map_ruler_image); icon = (ImageView) ma.findViewById(R.id.map_ruler_image);
text = (TextView) ma.findViewById(R.id.map_ruler_text); text = (TextView) ma.findViewById(R.id.map_ruler_text);
textShadow = (TextView) ma.findViewById(R.id.map_ruler_text_shadow);
maxWidth = ma.getResources().getDimensionPixelSize(R.dimen.map_ruler_width); maxWidth = ma.getResources().getDimensionPixelSize(R.dimen.map_ruler_width);
orientationPortrait = ScreenOrientationHelper.isOrientationPortrait(ma); orientationPortrait = ScreenOrientationHelper.isOrientationPortrait(ma);
} }
public void updateTextSize(boolean isNight, int textColor, int textShadowColor, int shadowRadius) { public void updateTextSize(boolean isNight, int textColor, int textShadowColor, int shadowRadius) {
text.setTextColor(textColor); TextInfoWidget.updateTextColor(text, textShadow, textColor, textShadowColor, false, shadowRadius);
text.setShadowLayer(shadowRadius, 0, 0, textShadowColor);
icon.setBackgroundResource(isNight ? R.drawable.ruler_night : R.drawable.ruler); icon.setBackgroundResource(isNight ? R.drawable.ruler_night : R.drawable.ruler);
} }
@ -758,6 +763,7 @@ public class RouteInfoWidgetsFactory {
int cacheRulerDistPix = (int) (pixDensity * roundedDist); int cacheRulerDistPix = (int) (pixDensity * roundedDist);
cacheRulerText = OsmAndFormatter.getFormattedDistance((float) roundedDist, view.getApplication()); cacheRulerText = OsmAndFormatter.getFormattedDistance((float) roundedDist, view.getApplication());
textShadow.setText(cacheRulerText);
text.setText(cacheRulerText); text.setText(cacheRulerText);
ViewGroup.LayoutParams lp = layout.getLayoutParams(); ViewGroup.LayoutParams lp = layout.getLayoutParams();
lp.width = cacheRulerDistPix; lp.width = cacheRulerDistPix;

View file

@ -4,6 +4,7 @@ import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.views.OsmandMapLayer.DrawSettings; import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
import android.app.Activity; import android.app.Activity;
import android.graphics.Paint.Style;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.view.View; import android.view.View;
@ -17,7 +18,9 @@ public class TextInfoWidget {
private View view; private View view;
private ImageView imageView; private ImageView imageView;
private TextView textView; private TextView textView;
private TextView textViewShadow;
private TextView smallTextView; private TextView smallTextView;
private TextView smallTextViewShadow;
private ImageView topImageView; private ImageView topImageView;
private TextView topTextView; private TextView topTextView;
private boolean explicitlyVisible; private boolean explicitlyVisible;
@ -35,6 +38,8 @@ public class TextInfoWidget {
topTextView = (TextView) view.findViewById(R.id.widget_top_icon_text); topTextView = (TextView) view.findViewById(R.id.widget_top_icon_text);
imageView = (ImageView) view.findViewById(R.id.widget_icon); imageView = (ImageView) view.findViewById(R.id.widget_icon);
textView = (TextView) view.findViewById(R.id.widget_text); textView = (TextView) view.findViewById(R.id.widget_text);
textViewShadow = (TextView) view.findViewById(R.id.widget_text_shadow);
smallTextViewShadow = (TextView) view.findViewById(R.id.widget_text_small_shadow);
smallTextView = (TextView) view.findViewById(R.id.widget_text_small); smallTextView = (TextView) view.findViewById(R.id.widget_text_small);
} }
@ -121,13 +126,17 @@ public class TextInfoWidget {
// } // }
if(text == null) { if(text == null) {
textView.setText(""); textView.setText("");
textViewShadow.setText("");
} else { } else {
textView.setText(text); textView.setText(text);
textViewShadow.setText(text);
} }
if(subtext == null) { if(subtext == null) {
smallTextView.setText(""); smallTextView.setText("");
smallTextViewShadow.setText("");
} else { } else {
smallTextView.setText(subtext); smallTextView.setText(subtext);
smallTextViewShadow.setText(subtext);
} }
} }
@ -172,14 +181,26 @@ public class TextInfoWidget {
} }
public void updateTextColor(int textColor, int textShadowColor, boolean bold, int rad) { public void updateTextColor(int textColor, int textShadowColor, boolean bold, int rad) {
updateTextColor(smallTextView, textColor, textShadowColor, bold, rad); updateTextColor(smallTextView, smallTextViewShadow, textColor, textShadowColor, bold, rad);
updateTextColor(textView, textColor, textShadowColor, bold, rad); updateTextColor(textView, textViewShadow, textColor, textShadowColor, bold, rad);
updateTextColor(topTextView, textColor, textShadowColor, bold, rad); updateTextColor(topTextView, null, textColor, textShadowColor, bold, rad);
} }
private void updateTextColor(TextView tv, int textColor, int textShadowColor, boolean textBold, int rad) { public static void updateTextColor(TextView tv, TextView shadow, int textColor, int textShadowColor, boolean textBold, int rad) {
if(shadow != null) {
if(rad > 0) {
shadow.setVisibility(View.VISIBLE);
shadow.setTypeface(Typeface.DEFAULT, textBold ? Typeface.BOLD : Typeface.NORMAL);
shadow.getPaint().setStrokeWidth(rad);
shadow.getPaint().setStyle(Style.STROKE);
shadow.setTextColor(textShadowColor);
// tv.getPaint().setStyle(Style.FILL);
} else {
// tv.getPaint().setStyle(Style.FILL_AND_STROKE);
shadow.setVisibility(View.GONE);
}
}
tv.setTextColor(textColor); tv.setTextColor(textColor);
tv.setShadowLayer(rad, 0, 0, textShadowColor);
tv.setTypeface(Typeface.DEFAULT, textBold ? Typeface.BOLD : Typeface.NORMAL); tv.setTypeface(Typeface.DEFAULT, textBold ? Typeface.BOLD : Typeface.NORMAL);
} }

View file

@ -1,14 +1,15 @@
package net.osmand.plus.widgets; package net.osmand.plus.widgets;
import android.annotation.SuppressLint;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.content.Context; import android.content.Context;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.os.Build; import android.os.Build;
import android.support.v7.internal.text.AllCapsTransformationMethod; import android.support.v7.internal.text.AllCapsTransformationMethod;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.widget.TextView; import android.widget.TextView;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.helpers.FontCache; import net.osmand.plus.helpers.FontCache;
@ -71,7 +72,7 @@ public class TextViewEx extends TextView {
public static void setAllCapsCompat(TextView target, boolean allCaps) { public static void setAllCapsCompat(TextView target, boolean allCaps) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
target.setAllCaps(allCaps); updateAllCapsNewAPI(target, allCaps);
return; return;
} }
@ -82,6 +83,11 @@ public class TextViewEx extends TextView {
} }
} }
@SuppressLint("NewApi")
private static void updateAllCapsNewAPI(TextView target, boolean allCaps) {
target.setAllCaps(allCaps);
}
public void setAllCapsCompat(boolean allCaps) { public void setAllCapsCompat(boolean allCaps) {
setAllCapsCompat(this, allCaps); setAllCapsCompat(this, allCaps);
} }
@ -99,4 +105,5 @@ public class TextViewEx extends TextView {
} }
setAllCapsCompat(target, true); setAllCapsCompat(target, true);
} }
} }