Add landscape layout

This commit is contained in:
Alexander Sytnyk 2017-11-10 13:26:04 +02:00
parent 050f9a190e
commit e71622b2e2
4 changed files with 439 additions and 19 deletions

View file

@ -0,0 +1,413 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/ctx_menu_info_view_bg"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dashboard_map_toolbar"
android:background="?attr/actionModeBackground">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="@dimen/dashboard_map_toolbar"
android:minHeight="@dimen/dashboard_map_toolbar"
app:contentInsetLeft="54dp"
app:contentInsetStart="54dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<net.osmand.plus.widgets.TextViewEx
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:ellipsize="end"
android:gravity="center_vertical"
android:maxLines="1"
android:text="@string/shared_string_settings"
android:textColor="@color/color_white"
android:textSize="@dimen/dialog_header_text_size"
osmand:typeface="@string/font_roboto_medium"/>
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/app_mode_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding"
android:drawablePadding="6dp"
android:ellipsize="end"
android:gravity="center_vertical"
android:maxLines="1"
android:textAllCaps="true"
android:textColor="@color/color_white"
android:textSize="@dimen/default_desc_text_size"
tools:drawableRight="@drawable/ic_action_car_dark"
tools:text="car"/>
</LinearLayout>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:layout_width="@dimen/action_bar_image_width_land"
android:layout_height="match_parent"
android:background="?attr/actionModeBackground"
android:paddingTop="@dimen/action_bar_image_top_margin_land">
<ImageView
android:id="@+id/action_bar_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="@dimen/bottom_sheet_content_margin_small"
android:layout_marginRight="@dimen/bottom_sheet_content_margin_small"
tools:src="@drawable/img_help_markers_direction_device_night"/>
</FrameLayout>
<com.github.ksoichiro.android.observablescrollview.ObservableScrollView
android:id="@+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/content_padding"
android:background="?attr/bg_card"
android:orientation="vertical"
android:paddingLeft="@dimen/content_padding"
android:paddingStart="@dimen/content_padding">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_title_height"
android:layout_marginEnd="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/active_markers"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
<TextView
android:id="@+id/active_markers_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?attr/contextMenuButtonColor"
android:textSize="@dimen/default_list_text_size"
tools:drawableRight="@drawable/ic_action_arrow_drop_down"
tools:text="Two"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding"
android:paddingBottom="@dimen/content_padding_small"
android:paddingTop="@dimen/content_padding_small"
android:text="@string/active_markers_descr"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/content_padding"
android:background="?attr/bg_card"
android:orientation="vertical"
android:paddingBottom="4dp">
<LinearLayout
android:id="@+id/distance_indication_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_title_height"
android:background="?attr/selectableItemBackground"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/show_direction"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
<android.support.v7.widget.SwitchCompat
android:id="@+id/distance_indication_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:layout_marginLeft="@dimen/bottom_sheet_content_margin_small"
android:layout_marginStart="@dimen/bottom_sheet_content_margin_small"
android:background="@null"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginStart="@dimen/content_padding"
android:background="?attr/dashboard_divider"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding"
android:paddingBottom="@dimen/content_padding_small"
android:paddingTop="@dimen/content_padding_small"
android:text="@string/distance_indication_descr"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"/>
<LinearLayout
android:id="@+id/top_bar_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_list_item_height"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:paddingEnd="@dimen/content_padding_small"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding_small"
android:paddingStart="@dimen/content_padding">
<ImageView
android:id="@+id/top_bar_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:background="@drawable/ic_action_device_top"
tools:src="@drawable/ic_action_device_topbar"/>
<net.osmand.plus.widgets.TextViewEx
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/shared_string_topbar"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_regular"/>
<RadioButton
android:id="@+id/top_bar_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:clickable="false"
android:focusable="false"/>
</LinearLayout>
<LinearLayout
android:id="@+id/widget_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_list_item_height"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:paddingEnd="@dimen/content_padding_small"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding_small"
android:paddingStart="@dimen/content_padding">
<ImageView
android:id="@+id/widget_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:background="@drawable/ic_action_device_top"
tools:src="@drawable/ic_action_device_widget"/>
<net.osmand.plus.widgets.TextViewEx
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/shared_string_widgets"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_regular"/>
<RadioButton
android:id="@+id/widget_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:clickable="false"
android:focusable="false"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/content_padding"
android:background="?attr/bg_card"
android:orientation="vertical">
<LinearLayout
android:id="@+id/show_arrows_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_title_height"
android:background="?attr/selectableItemBackground"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/show_arrows_on_the_map"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
<android.support.v7.widget.SwitchCompat
android:id="@+id/show_arrows_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:layout_marginLeft="@dimen/bottom_sheet_content_margin_small"
android:layout_marginStart="@dimen/bottom_sheet_content_margin_small"
android:background="@null"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginStart="@dimen/content_padding"
android:background="?attr/dashboard_divider"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding"
android:paddingBottom="@dimen/content_padding_small"
android:paddingTop="@dimen/content_padding_small"
android:text="@string/show_arrows_descr"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/content_padding"
android:layout_marginTop="@dimen/content_padding"
android:background="?attr/bg_card"
android:orientation="vertical">
<LinearLayout
android:id="@+id/show_guide_line_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_title_height"
android:background="?attr/selectableItemBackground"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/show_guide_line"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
<android.support.v7.widget.SwitchCompat
android:id="@+id/show_guide_line_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:layout_marginLeft="@dimen/bottom_sheet_content_margin_small"
android:layout_marginStart="@dimen/bottom_sheet_content_margin_small"
android:background="@null"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginStart="@dimen/content_padding"
android:background="?attr/dashboard_divider"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding"
android:paddingBottom="@dimen/content_padding_small"
android:paddingTop="@dimen/content_padding_small"
android:text="@string/show_guide_line_descr"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"/>
</LinearLayout>
</LinearLayout>
</com.github.ksoichiro.android.observablescrollview.ObservableScrollView>
</LinearLayout>
</LinearLayout>

View file

@ -127,6 +127,8 @@
<dimen name="bottom_sheet_image_text_margin_start">15dp</dimen>
<dimen name="bottom_sheet_selected_item_title_height">84dp</dimen>
<dimen name="action_bar_image_width_land">354dp</dimen>
<dimen name="action_bar_image_top_margin_land">102dp</dimen>
<dimen name="action_bar_image_height">330dp</dimen>
<dimen name="action_bar_image_side_margin">105dp</dimen>

View file

@ -190,6 +190,8 @@
<dimen name="bottom_sheet_image_text_margin_start">10dp</dimen>
<dimen name="bottom_sheet_selected_item_title_height">56dp</dimen>
<dimen name="action_bar_image_width_land">236dp</dimen>
<dimen name="action_bar_image_top_margin_land">68dp</dimen>
<dimen name="action_bar_image_height">220dp</dimen>
<dimen name="action_bar_image_side_margin">70dp</dimen>

View file

@ -34,6 +34,7 @@ import net.osmand.plus.OsmandSettings.OsmandPreference;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.BaseOsmAndDialogFragment;
import net.osmand.plus.helpers.AndroidUiHelper;
import java.util.LinkedList;
@ -73,30 +74,32 @@ public class DirectionIndicationDialogFragment extends BaseOsmAndDialogFragment
appModeTv.setText(appMode.getStringResource());
appModeTv.setCompoundDrawablesWithIntrinsicBounds(null, null, getIconsCache().getIcon(appMode.getSmallIconDark()), null);
((ObservableScrollView) mainView.findViewById(R.id.scroll_view)).setScrollViewCallbacks(new ObservableScrollViewCallbacks() {
@Override
public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) {
if (scrollY >= helpImgHeight) {
if (!shadowVisible) {
mainView.findViewById(R.id.app_bar_shadow).setVisibility(View.VISIBLE);
shadowVisible = true;
if (AndroidUiHelper.isOrientationPortrait(getActivity())) {
((ObservableScrollView) mainView.findViewById(R.id.scroll_view)).setScrollViewCallbacks(new ObservableScrollViewCallbacks() {
@Override
public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) {
if (scrollY >= helpImgHeight) {
if (!shadowVisible) {
mainView.findViewById(R.id.app_bar_shadow).setVisibility(View.VISIBLE);
shadowVisible = true;
}
} else if (shadowVisible) {
mainView.findViewById(R.id.app_bar_shadow).setVisibility(View.GONE);
shadowVisible = false;
}
} else if (shadowVisible) {
mainView.findViewById(R.id.app_bar_shadow).setVisibility(View.GONE);
shadowVisible = false;
}
}
@Override
public void onDownMotionEvent() {
@Override
public void onDownMotionEvent() {
}
}
@Override
public void onUpOrCancelMotionEvent(ScrollState scrollState) {
@Override
public void onUpOrCancelMotionEvent(ScrollState scrollState) {
}
});
}
});
}
updateHelpImage();