Always show next turn option #7196
2 changed files with 128 additions and 10 deletions
125
android/app/src/main/res/layout-land/layout_nav_top.xml
Normal file
125
android/app/src/main/res/layout-land/layout_nav_top.xml
Normal file
|
@ -0,0 +1,125 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/nav_top_frame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:background="#20FF0000"
|
||||
tools:showIn="@layout/layout_nav">
|
||||
<FrameLayout
|
||||
android:id="@+id/street_frame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:elevation="@dimen/nav_elevation"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:clickable="true"
|
||||
android:background="?cardBackground">
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:ignore="UselessParent">
|
||||
<TextView
|
||||
android:id="@+id/street"
|
||||
style="@style/MwmWidget.TextView.NavStreet"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/nav_street_left"
|
||||
android:maxLines="2"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:gravity="center"
|
||||
tools:text="Sample street name.\nLong looooooooong!!!!"/>
|
||||
</RelativeLayout>
|
||||
</FrameLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/nav_next_turn_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@id/street_frame"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:layout_marginTop="-40dp"
|
||||
![]() This file was just copied from
I don't remember the exact reason I changed them, I think it was based on some of the requests to make landscape look different to portrait mode. Personally I think changes to landscape might fit better in a different PR (and would be better off being done by someone who understands the android layout xml better), but that was what was requested so I figured out how to make it look different Edit: Better diff format This file was just copied from https://github.com/organicmaps/organicmaps/blob/656686cbb4f768d0c28313e7921aa555992a68eb/android/app/src/main/res/layout/layout_nav_top.xml, there are only three lines that are different, and they're in the first FrameLayout section:
```
~ $ diff -u layout_nav_top.xml layout_land_nav_top.xml
--- layout_nav_top.xml 2024-05-20 11:26:45.962049801 -0700
+++ layout_land_nav_top.xml 2024-05-20 11:27:18.522029199 -0700
@@ -18,16 +18,16 @@
android:background="?cardBackground">
<RelativeLayout
android:layout_width="match_parent"
- android:layout_height="@dimen/nav_street_height"
+ android:layout_height="wrap_content"
tools:ignore="UselessParent">
<TextView
android:id="@+id/street"
style="@style/MwmWidget.TextView.NavStreet"
android:layout_width="match_parent"
- android:layout_height="match_parent"
+ android:layout_height="wrap_content"
android:layout_marginStart="@dimen/nav_street_left"
android:maxLines="2"
- android:layout_gravity="center_vertical"
+ android:layout_gravity="center_horizontal"
android:gravity="center"
tools:text="Sample street name.\nLong looooooooong!!!!"/>
</RelativeLayout>
```
I don't remember the exact reason I changed them, I think it was based on some of the requests to make landscape look different to portrait mode. Personally I think changes to landscape might fit better in a different PR (and would be better off being done by someone who understands the android layout xml better), but that was what was requested so I figured out how to make it look different
Edit: Better diff format
|
||||
android:clickable="true"
|
||||
android:elevation="@dimen/nav_elevation">
|
||||
<LinearLayout
|
||||
android:id="@+id/nav_next_turn_frame"
|
||||
android:layout_width="@dimen/nav_next_turn_frame"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/margin_half"
|
||||
android:orientation="vertical"
|
||||
android:background="?navNextTurnFrame"
|
||||
android:elevation="@dimen/nav_elevation">
|
||||
<FrameLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/nav_next_turn_top"
|
||||
android:layout_marginBottom="@dimen/nav_next_turn_space"
|
||||
android:layout_gravity="center_horizontal">
|
||||
<app.organicmaps.widget.ArrowView
|
||||
android:id="@+id/turn"
|
||||
android:theme="?navigationTheme"
|
||||
android:layout_width="@dimen/nav_next_turn_sign"
|
||||
android:layout_height="@dimen/nav_next_turn_sign"
|
||||
app:tint="?iconTint"
|
||||
tools:background="#400000FF"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/circle_exit"
|
||||
style="@style/MwmWidget.TextView.NavNextTurn.Exit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
tools:text="9"/>
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/distance"
|
||||
style="@style/MwmWidget.TextView.NavNextTurn"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/nav_next_turn_bottom"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:gravity="center_horizontal"
|
||||
tools:text="9999 ft"/>
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/nav_next_next_turn_frame"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/nav_next_next_turn_frame"
|
||||
android:layout_marginBottom="@dimen/margin_base"
|
||||
android:layout_below="@id/nav_next_turn_frame"
|
||||
android:layout_alignStart="@id/nav_next_turn_frame"
|
||||
android:layout_alignEnd="@id/nav_next_turn_frame"
|
||||
android:background="?navNextNextTurnFrame"
|
||||
android:elevation="@dimen/nav_elevation"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
<ImageView
|
||||
android:id="@id/turn"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
app:tint="?iconTint"
|
||||
tools:src="@drawable/ic_then_left_sharp"/>
|
||||
</FrameLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/lanes_frame"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="@dimen/margin_half"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintHeight_percent="@fraction/nav_lane_height"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toEndOf="@+id/nav_next_turn_container"
|
||||
app:layout_constraintTop_toBottomOf="@+id/street_frame"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<include layout="@layout/nav_lanes" />
|
||||
</FrameLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -425,26 +425,19 @@ void RoutingSession::GetRouteFollowingInfo(FollowingInfo & info) const
|
|||
|
||||
info.m_completionPercent = GetCompletionPercent();
|
||||
|
||||
double const timeToNearestTurnSec = m_route->GetCurrentTimeToNearestTurnSec();
|
||||
|
||||
// Lane information and next street name.
|
||||
if (distanceToTurnMeters < kShowLanesMinDistInMeters || timeToNearestTurnSec < 60.0)
|
||||
info.m_displayedStreetName = info.m_targetName;
|
||||
info.m_lanes.clear();
|
||||
if (distanceToTurnMeters < kShowLanesMinDistInMeters || m_route->GetCurrentTimeToNearestTurnSec() < 60.0)
|
||||
{
|
||||
![]() No need to modify variable twice. No need to modify variable twice.
|
||||
info.m_displayedStreetName = info.m_targetName;
|
||||
// There are two nested loops below. Outer one is for lanes and inner one (ctor of
|
||||
// SingleLaneInfo) is
|
||||
// for each lane's directions. The size of turn.m_lanes is relatively small. Less than 10 in
|
||||
// most cases.
|
||||
info.m_lanes.clear();
|
||||
info.m_lanes.reserve(turn.m_lanes.size());
|
||||
for (size_t j = 0; j < turn.m_lanes.size(); ++j)
|
||||
info.m_lanes.emplace_back(turn.m_lanes[j]);
|
||||
}
|
||||
else
|
||||
{
|
||||
info.m_displayedStreetName = "";
|
||||
info.m_lanes.clear();
|
||||
}
|
||||
|
||||
// Pedestrian info.
|
||||
info.m_pedestrianTurn = (distanceToTurnMeters < kShowPedestrianTurnInMeters)
|
||||
|
|
Reference in a new issue
Should it be hard-coded or made relative in some other way? How was this value determined? Will it work with a very large font set in system settings?