Add landscape

This commit is contained in:
Victor Shcherb 2015-03-15 23:50:53 +01:00
parent a16e420943
commit 7596f1ffcf
6 changed files with 499 additions and 3 deletions

View file

@ -0,0 +1,273 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:orientation="horizontal" >
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<!-- ALARM -->
<FrameLayout
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_marginBottom="@dimen/map_alarm_bottom_margin_land"
android:layout_marginLeft="@dimen/map_button_shadow_margin" >
<ImageView
android:id="@+id/map_alarm_warning_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/warnings_limit" />
<TextView
android:id="@+id/map_alarm_warning_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="60"
android:textColor="@color/color_black"
android:textSize="@dimen/map_alarm_text_size"
android:textStyle="bold" />
</FrameLayout>
<!-- SHADOW -->
<FrameLayout
android:id="@+id/map_app_mode_shadow"
android:layout_width="@dimen/map_button_shadow_width"
android:layout_height="@dimen/map_button_shadow_height"
android:layout_gravity="bottom|left"
android:layout_marginBottom="@dimen/map_button_shadow_margin"
android:layout_marginLeft="@dimen/map_button_shadow_margin"
android:background="@drawable/btn_round_trans" >
<ImageView
android:id="@+id/map_app_mode_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|center"
android:layout_marginTop="3dp"
android:src="@drawable/ic_action_remove_light" />
<TextView
android:id="@+id/map_app_mode_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|center"
android:layout_marginTop="3dp"
android:textSize="@dimen/map_button_text_size" />
</FrameLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|left"
android:layout_marginBottom="@dimen/map_button_margin"
android:layout_marginRight="@dimen/map_button_spacing_land"
android:layout_marginLeft="@dimen/map_button_margin"
android:orientation="horizontal" >
<ImageButton
android:id="@+id/map_menu_button"
android:layout_width="@dimen/map_button_size"
android:layout_height="@dimen/map_button_size"
android:background="@drawable/btn_round"
android:src="@drawable/ic_action_remove_light" />
<ImageButton
android:id="@+id/map_route_info_button"
android:layout_width="@dimen/map_button_size"
android:layout_height="@dimen/map_button_size"
android:layout_gravity="bottom"
android:layout_marginLeft="@dimen/map_button_spacing_land"
android:background="@drawable/btn_round"
android:src="@drawable/ic_action_remove_light" />
</LinearLayout>
</FrameLayout>
<!-- RULER -->
<FrameLayout
android:id="@+id/map_ruler_layout"
android:layout_width="@dimen/map_ruler_width"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:visibility="gone" >
<TextView
android:id="@+id/map_ruler_text"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="bottom"
android:layout_marginBottom="@dimen/map_ruler_bottom_margin"
android:gravity="center_horizontal"
android:text="100 m"
android:textSize="@dimen/map_widget_text_size_small" />
<ImageView
android:id="@+id/map_ruler_image"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@drawable/ruler" />
</FrameLayout>
<FrameLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginBottom="@dimen/map_button_margin"
android:layout_weight="1" >
<!-- TRANSPARENCY -->
<LinearLayout
android:id="@+id/map_transparency_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center"
android:layout_marginBottom="@dimen/map_button_size"
android:orientation="horizontal" >
<SeekBar
android:id="@+id/map_transparency_seekbar"
android:layout_width="@dimen/map_trans_seek_size"
android:layout_height="wrap_content"
android:layout_gravity="center" />
<ImageButton
android:id="@+id/map_transparency_hide"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/btn_circle_transparent"
android:src="@drawable/headliner_close" />
</LinearLayout>
<!-- PREPARATION SCREEN -->
<LinearLayout
android:id="@+id/map_route_preparation_layout"
android:layout_width="match_parent"
android:layout_height="@dimen/map_route_buttons_height_land"
android:layout_gravity="bottom" >
<ImageButton
android:id="@+id/map_cancel_route_button"
android:layout_width="@dimen/map_route_buttons_width"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:background="@drawable/btn_flat"
android:src="@drawable/ic_action_remove_light" />
<ImageButton
android:id="@+id/map_waypoints_route_button"
android:layout_width="@dimen/map_route_buttons_width"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:background="@drawable/btn_flat"
android:src="@drawable/ic_action_remove_light" />
<ImageButton
android:id="@+id/map_options_route_button"
android:layout_width="@dimen/map_route_buttons_width"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:background="@drawable/btn_flat"
android:src="@drawable/ic_action_remove_light" />
<TextView
android:id="@+id/map_go_route_button"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:background="@drawable/btn_flat"
android:drawableLeft="@drawable/ic_action_remove_light"
android:drawablePadding="4dp"
android:gravity="center_vertical"
android:paddingLeft="12dp"
android:textSize="20sp"
android:textStyle="bold" />
</LinearLayout>
<!-- CONTEXT MENU -->
<LinearLayout
android:id="@+id/map_context_menu_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@drawable/btn_flat"
android:visibility="gone" >
<TextView
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:ellipsize="end"
android:gravity="center" >
</TextView>
<ImageButton
android:layout_width="@dimen/map_address_height"
android:layout_height="@dimen/map_address_height"
android:layout_gravity="center_vertical"
android:background="@drawable/btn_circle_transparent"
android:src="@drawable/ic_action_remove_light" />
<ImageButton
android:layout_width="@dimen/map_address_height"
android:layout_height="@dimen/map_address_height"
android:layout_gravity="center_vertical"
android:background="@drawable/btn_circle_transparent"
android:src="@drawable/ic_action_remove_light" />
</LinearLayout>
</FrameLayout>
<!-- RIGHT BUTTONS -->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginBottom="@dimen/map_button_margin"
android:layout_marginLeft="@dimen/map_button_spacing_land"
android:layout_marginRight="@dimen/map_button_margin" >
<ImageButton
android:id="@+id/map_my_location_button"
android:layout_width="@dimen/map_button_size"
android:layout_height="@dimen/map_button_size"
android:layout_gravity="bottom"
android:background="@drawable/btn_circle"
android:src="@drawable/ic_action_remove_light" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginLeft="@dimen/map_button_spacing_land"
android:orientation="vertical" >
<ImageButton
android:id="@+id/map_zoom_in_button"
android:layout_width="@dimen/map_button_size"
android:layout_height="@dimen/map_button_size"
android:background="@drawable/btn_circle"
android:src="@drawable/ic_action_remove_light" />
<ImageButton
android:id="@+id/map_zoom_out_button"
android:layout_width="@dimen/map_button_size"
android:layout_height="@dimen/map_button_size"
android:layout_marginTop="@dimen/map_button_spacing_land"
android:background="@drawable/btn_circle"
android:src="@drawable/ic_action_remove_light" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

View file

@ -0,0 +1,218 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="1" >
<!-- LEFT widgets colon -->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|left"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/map_left_widgets_panel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|left"
android:orientation="vertical" >
<include
android:layout_width="wrap_content"
android:layout_height="wrap_content"
layout="@layout/map_hud_widget" />
<include layout="@layout/map_hud_widget" />
<include layout="@layout/map_hud_widget" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical" >
<FrameLayout
android:id="@+id/map_top_bar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/btn_round"
android:minHeight="@dimen/map_address_height" >
<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
android:id="@+id/waypoint_info_bar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<ImageView
android:id="@+id/waypoint_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/map_button_margin"
android:layout_marginRight="@dimen/map_button_margin"
android:src="@drawable/ic_action_remove_light" />
<TextView
android:id="@+id/waypoint_dist"
android:layout_width="60dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="4dp"
android:maxLines="2"
android:textColor="@color/wpt_distance_color"
android:textSize="15sp"
android:textStyle="bold" />
<TextView
android:id="@+id/waypoint_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="4dp"
android:layout_weight="1"
android:ellipsize="end"
android:maxLines="2"
android:textSize="18sp" />
<ImageButton
android:id="@+id/waypoint_more"
android:layout_width="@dimen/map_address_height"
android:layout_height="@dimen/map_address_height"
android:background="@drawable/btn_circle_transparent"
android:src="@drawable/ic_overflow_menu_white" />
<ImageButton
android:id="@+id/waypoint_close"
android:layout_width="@dimen/map_address_height"
android:layout_height="@dimen/map_address_height"
android:background="@drawable/btn_circle_transparent"
android:src="@drawable/ic_action_remove_light" />
</LinearLayout>
</FrameLayout>
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<!-- 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: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>
<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_remove_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_remove_light" />
</LinearLayout>
</FrameLayout>
</LinearLayout>
<!-- RIGHT widgets colon -->
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|right" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|right"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/map_right_widgets_panel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|right"
android:orientation="vertical" >
<include layout="@layout/map_hud_widget" />
<include layout="@layout/map_hud_widget" />
</LinearLayout>
<ImageButton
android:id="@+id/map_collapse_button"
android:layout_width="@dimen/map_button_size"
android:layout_height="@dimen/map_button_size"
android:layout_gravity="top|center_horizontal"
android:background="@drawable/btn_inset_circle"
android:src="@drawable/ic_action_remove_light" />
</LinearLayout>
</FrameLayout>
</LinearLayout>

View file

@ -21,7 +21,6 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:ellipsize="end"
android:gravity="center"
android:maxLines="1"
android:shadowColor="@color/color_myloc_distance"
android:shadowRadius="10"

View file

@ -56,6 +56,8 @@
<dimen name="map_button_text_size">18sp</dimen>
<dimen name="map_route_buttons_width">60dp</dimen>
<dimen name="map_route_buttons_height">54dp</dimen>
<dimen name="map_route_buttons_height_land">48dp</dimen>
<dimen name="map_address_height">40dp</dimen>
<dimen name="map_button_size">48dp</dimen>
<dimen name="map_ruler_width">120dp</dimen>
@ -65,11 +67,13 @@
<dimen name="map_alarm_text_size">25sp</dimen>
<dimen name="map_alarm_bottom_margin">87dp</dimen>
<dimen name="map_alarm_bottom_margin_land">55dp</dimen>
<dimen name="map_button_shadow_height">85dp</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">15dp</dimen>
<dimen name="map_button_spacing_land">10dp</dimen>
<dimen name="map_button_margin">4dp</dimen>
<dimen name="map_routing_progress_width">100dp</dimen>

View file

@ -113,7 +113,7 @@ public class DashboardOnMap {
params.gravity = landscape ? Gravity.BOTTOM | Gravity.RIGHT : Gravity.TOP | Gravity.RIGHT;
actionButton.setLayoutParams(params);
actionButton.setImageDrawable(mapActivity.getResources().getDrawable(R.drawable.ic_action_map));
actionButton.setImageDrawable(mapActivity.getResources().getDrawable(R.drawable.ic_action_get_my_location));
actionButton.setButtonColor(mapActivity.getResources().getColor(R.color.color_myloc_distance));
actionButton.hide();
actionButton.setOnClickListener(new View.OnClickListener() {

View file

@ -12,6 +12,7 @@ import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.dialogs.ConfigureMapMenu;
import net.osmand.plus.helpers.ScreenOrientationHelper;
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory;
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopTextView;
import net.osmand.plus.views.mapwidgets.MapWidgetRegistry;
@ -191,7 +192,8 @@ public class MapInfoLayer extends OsmandMapLayer {
}
private void updateStreetName(TextState ts) {
streetNameView.setBackgroundResource(ts.boxTop);
streetNameView.setBackgroundResource(ScreenOrientationHelper.isOrientationPortrait(map) ? ts.boxTop
: ts.boxFree);
streetNameView.updateTextColor(ts.textColor, ts.textShadowColor, ts.textBold, ts.textShadowRadius);
}