Merge pull request #3905 from trashkalmar/new-navigation

[android] refactor: New navigation UI.
This commit is contained in:
Dmitry Yunitsky 2016-08-03 16:43:48 +03:00 committed by GitHub
commit 927891f51b
76 changed files with 1745 additions and 1052 deletions

View file

@ -2,34 +2,50 @@
#include "indexer/search_string_utils.hpp"
#include "platform/measurement_utils.hpp"
#include "platform/settings.hpp"
extern "C"
{
JNIEXPORT jboolean JNICALL
Java_com_mapswithme_util_StringUtils_nativeIsHtml(JNIEnv * env, jclass thiz, jstring text)
JNIEXPORT jboolean JNICALL
Java_com_mapswithme_util_StringUtils_nativeIsHtml(JNIEnv * env, jclass thiz, jstring text)
{
return strings::IsHTML(jni::ToNativeString(env, text));
}
JNIEXPORT jboolean JNICALL
Java_com_mapswithme_util_StringUtils_nativeContainsNormalized(JNIEnv * env, jclass thiz, jstring str, jstring substr)
{
return search::ContainsNormalized(jni::ToNativeString(env, str), jni::ToNativeString(env, substr));
}
JNIEXPORT jobjectArray JNICALL
Java_com_mapswithme_util_StringUtils_nativeFilterContainsNormalized(JNIEnv * env, jclass thiz, jobjectArray src, jstring jSubstr)
{
string substr = jni::ToNativeString(env, jSubstr);
int const length = env->GetArrayLength(src);
vector<string> filtered;
filtered.reserve(length);
for (int i = 0; i < length; i++)
{
return strings::IsHTML(jni::ToNativeString(env, text));
string str = jni::ToNativeString(env, (jstring) env->GetObjectArrayElement(src, i));
if (search::ContainsNormalized(str, substr))
filtered.push_back(str);
}
JNIEXPORT jboolean JNICALL
Java_com_mapswithme_util_StringUtils_nativeContainsNormalized(JNIEnv * env, jclass thiz, jstring str, jstring substr)
{
return search::ContainsNormalized(jni::ToNativeString(env, str), jni::ToNativeString(env, substr));
}
return jni::ToJavaStringArray(env, filtered);
}
JNIEXPORT jobjectArray JNICALL
Java_com_mapswithme_util_StringUtils_nativeFilterContainsNormalized(JNIEnv * env, jclass thiz, jobjectArray src, jstring jSubstr)
{
string substr = jni::ToNativeString(env, jSubstr);
int const length = env->GetArrayLength(src);
vector<string> filtered;
filtered.reserve(length);
for (int i = 0; i < length; i++)
{
string str = jni::ToNativeString(env, (jstring) env->GetObjectArrayElement(src, i));
if (search::ContainsNormalized(str, substr))
filtered.push_back(str);
}
JNIEXPORT jobject JNICALL
Java_com_mapswithme_util_StringUtils_nativeFormatSpeedAndUnits(JNIEnv * env, jclass thiz, jdouble metersPerSecond)
{
static jclass const pairClass = jni::GetGlobalClassRef(env, "android/util/Pair");
static jmethodID const pairCtor = jni::GetConstructorID(env, pairClass, "(Ljava/lang/Object;Ljava/lang/Object;)V");
return jni::ToJavaStringArray(env, filtered);
}
auto units = measurement_utils::Units::Metric;
settings::Get(settings::kMeasurementUnits, units);
return env->NewObject(pairClass, pairCtor,
jni::ToJavaString(env, measurement_utils::FormatSpeed(metersPerSecond, units)),
jni::ToJavaString(env, measurement_utils::FormatSpeedUnits(units)));
}
} // extern "C"

Binary file not shown.

After

Width:  |  Height:  |  Size: 613 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 704 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 388 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 480 B

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/button_pressed">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/button_red"/>
<corners android:radius="2dp"/>
</shape>
</item>
</ripple>

Binary file not shown.

After

Width:  |  Height:  |  Size: 803 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 922 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/bg_menu"/>
<corners android:radius="4dp"/>
</shape>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/bg_menu_night"/>
<corners android:radius="4dp"/>
</shape>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/base_accent"/>
<corners android:radius="4dp"/>
</shape>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/base_accent_night"/>
<corners android:radius="4dp"/>
</shape>

View file

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="@dimen/margin_base_plus"/>
<solid android:color="@color/text_dark_subtitle"/>
</shape>

View file

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

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/button_red_disabled"/>
<corners android:radius="2dp"/>
</shape>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/button_red"/>
<corners android:radius="2dp"/>
</shape>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/button_red_pressed"/>
<corners android:radius="2dp"/>
</shape>

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<item
android:drawable="@drawable/news_marker_active"
android:state_enabled="true"/>
<item
android:drawable="@drawable/news_marker_inactive"/>
</selector>

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<size android:width="7dp"
android:height="7dp"/>
<size android:width="4dp"
android:height="4dp"/>
<solid android:color="@color/news_marker_active"/>
</shape>

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<size android:width="7dp"
android:height="7dp"/>
<size android:width="4dp"
android:height="4dp"/>
<solid android:color="@color/news_marker_active_night"/>
</shape>

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<size android:width="7dp"
android:height="7dp"/>
<size android:width="4dp"
android:height="4dp"/>
<solid android:color="@color/news_marker_inactive"/>
</shape>

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<size android:width="7dp"
android:height="7dp"/>
<size android:width="4dp"
android:height="4dp"/>
<solid android:color="@color/news_marker_inactive_night"/>
</shape>

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<item
android:drawable="@drawable/news_marker_active_night"
android:state_enabled="true"/>
<item
android:drawable="@drawable/news_marker_inactive_night"/>
</selector>

View file

@ -32,19 +32,6 @@
android:visibility="gone"
tools:visibility="visible"/>
<include
layout="@layout/layout_routing_full"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/toolbar"
android:paddingBottom="@dimen/margin_base"
android:visibility="gone"
tools:visibility="visible"/>
<include
layout="@layout/routing_plan"
android:visibility="invisible"/>
<com.mapswithme.maps.widget.FadeView
android:id="@+id/fade_view"
android:layout_width="match_parent"
@ -52,6 +39,19 @@
android:background="@android:color/black"
android:visibility="gone"/>
<include
layout="@layout/layout_nav"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/toolbar"
android:paddingBottom="@dimen/margin_base"
android:visibility="invisible"
tools:visibility="visible"/>
<include
layout="@layout/routing_plan"
android:visibility="invisible"/>
<include
android:id="@+id/menu_frame"
layout="@layout/menu"

View file

@ -0,0 +1,151 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="@dimen/nav_menu_height"
android:orientation="horizontal"
android:paddingLeft="@dimen/nav_numbers_margin"
android:paddingStart="@dimen/nav_numbers_margin"
android:layout_marginRight="@dimen/nav_toggle"
android:layout_marginEnd="@dimen/nav_toggle"
android:background="?clickableBackground"
tools:background="#3000FF00"
tools:ignore="RtlSymmetry">
<!-- Speed -->
<LinearLayout
android:id="@+id/speed_frame"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:minWidth="@dimen/nav_numbers_side_min_width"
android:orientation="horizontal"
android:paddingLeft="@dimen/nav_numbers_margin"
android:paddingRight="@dimen/nav_numbers_margin"
android:paddingTop="@dimen/margin_eighth"
android:gravity="center_horizontal"
tools:background="#20FF0000">
<TextView
android:id="@+id/speed_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="@style/MwmTextAppearance.RoutingNumber"
tools:text="999"/>
<TextView
android:id="@+id/speed_dimen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="@style/MwmTextAppearance.RoutingDimension.Inline"
tools:text="km/h"/>
</LinearLayout>
<Space android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"/>
<!-- Time -->
<FrameLayout
android:id="@+id/time_frame"
android:layout_width="wrap_content"
android:layout_height="@dimen/nav_menu_height"
android:minWidth="@dimen/nav_numbers_center_min_width"
android:paddingTop="@dimen/margin_eighth"
tools:background="#20FF0000">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center_horizontal"
android:gravity="bottom">
<TextView
android:id="@+id/time_hour_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="@style/MwmTextAppearance.RoutingNumber"
tools:text="999"/>
<TextView
android:id="@+id/time_hour_dimen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/margin_quarter"
android:singleLine="true"
android:textAppearance="@style/MwmTextAppearance.RoutingDimension.Inline"
tools:text="h"/>
<TextView
android:id="@+id/time_minute_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="@style/MwmTextAppearance.RoutingNumber"
tools:text="99"/>
<TextView
android:id="@+id/time_minute_dimen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="@style/MwmTextAppearance.RoutingDimension.Inline"
tools:text="m"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:theme="?navigationTheme"
android:layout_marginTop="28dp"
android:layout_gravity="center_horizontal"
android:orientation="horizontal">
<ImageView
android:id="@+id/dot_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/margin_half"
android:layout_marginEnd="@dimen/margin_half"
android:src="?newsMarker"/>
<ImageView
android:id="@+id/dot_estimate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="?newsMarker"/>
</LinearLayout>
</FrameLayout>
<Space android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"/>
<!-- Distance -->
<LinearLayout
android:id="@+id/distance_frame"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:minWidth="@dimen/nav_numbers_side_min_width"
android:orientation="horizontal"
android:paddingLeft="@dimen/nav_numbers_margin"
android:paddingRight="@dimen/nav_numbers_margin"
android:paddingTop="@dimen/margin_eighth"
android:gravity="center_horizontal"
tools:background="#20FF0000">
<TextView
android:id="@+id/distance_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="@style/MwmTextAppearance.RoutingNumber"
tools:text="99999"/>
<TextView
android:id="@+id/distance_dimen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="@style/MwmTextAppearance.RoutingDimension.Inline"
tools:text="km"/>
</LinearLayout>
</LinearLayout>

View file

@ -1,122 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
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:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?panel"
android:clipToPadding="false"
android:elevation="@dimen/appbar_elevation"
android:paddingTop="@dimen/margin_eighth">
<com.mapswithme.maps.widget.FlatProgressView
android:id="@+id/fp__route_progress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:headRadius="2dp"
app:progressColor="@color/routing_progress"
app:headColor="@color/routing_progress"
app:progressThickness="2dp"
app:secondaryProgressColor="@color/divider"
app:secondaryProgressThickness="2dp"/>
<ImageView
android:id="@+id/btn__close"
android:layout_width="@dimen/height_block_base"
android:layout_height="@dimen/height_block_base"
android:layout_centerVertical="true"
android:layout_marginBottom="@dimen/margin_base_plus"
android:layout_marginLeft="@dimen/margin_quarter"
android:layout_marginRight="@dimen/margin_base"
android:layout_marginTop="@dimen/margin_base_plus"
android:background="?attr/selectableItemBackgroundBorderless"
android:scaleType="center"
android:tint="?iconTint"
android:src="@drawable/ic_cancel"/>
<FrameLayout
android:id="@+id/turn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/margin_base"
android:layout_marginLeft="@dimen/margin_double_plus"
android:layout_marginTop="@dimen/margin_base"
android:layout_toRightOf="@id/btn__close">
<com.mapswithme.maps.widget.ArrowView
android:id="@+id/iv__turn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:tint="?colorAccent"
tools:src="@drawable/ic_turn_round"/>
<TextView
android:id="@+id/tv__exit_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textAppearance="@style/MwmTextAppearance.Title"
android:textColor="?colorAccent"
android:visibility="gone"
tools:text="2"
tools:visibility="visible"/>
</FrameLayout>
<TextView
android:id="@+id/tv__turn_distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/margin_base"
android:layout_toRightOf="@id/turn"
android:textAppearance="@style/MwmTextAppearance.RoutingDirection"
tools:text="300 m"/>
<TextView
android:id="@+id/tv__next_street"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@id/tv__turn_distance"
android:layout_alignParentRight="true"
android:layout_below="@id/tv__turn_distance"
android:maxLines="2"
android:textAppearance="@style/MwmTextAppearance.Body2"
android:textSize="@dimen/text_size_title"
tools:text="Oxford str."
tools:visibility="visible"/>
<TextView
android:id="@+id/tv__total_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignTop="@id/tv__turn_distance"
android:layout_marginRight="@dimen/margin_base"
android:gravity="center_vertical"
android:textAppearance="@style/MwmTextAppearance.RoutingNumber"
tools:text="1,5 min"/>
<TextView
android:id="@+id/tv__arrival_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@id/tv__total_time"
android:layout_marginRight="@dimen/margin_base"
android:layout_marginTop="@dimen/margin_eighth"
android:gravity="center_vertical"
android:textAppearance="@style/MwmTextAppearance.RoutingNumber"
tools:text="1:00"/>
<TextView
android:id="@+id/tv__total_distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@id/tv__arrival_time"
android:layout_marginRight="@dimen/margin_base"
android:layout_toLeftOf="@id/tv__arrival_time"
android:gravity="center_vertical"
android:textAppearance="@style/MwmTextAppearance.RoutingNumber"
tools:text="1.4 km"/>
</RelativeLayout>

View file

@ -23,6 +23,13 @@
android:id="@+id/navigation_buttons"
layout="@layout/map_navigation_buttons"/>
<com.mapswithme.maps.widget.FadeView
android:id="@+id/fade_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"
android:visibility="gone"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -42,11 +49,10 @@
tools:visibility="visible"/>
<include
layout="@layout/layout_routing_full"
layout="@layout/layout_nav"
android:layout_width="@dimen/panel_width"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/margin_half"
android:visibility="gone"
android:layout_height="match_parent"
android:visibility="invisible"
tools:visibility="visible"/>
<com.mapswithme.maps.widget.placepage.PlacePageView
@ -60,13 +66,6 @@
placePage:floating="true"/>
</LinearLayout>
<com.mapswithme.maps.widget.FadeView
android:id="@+id/fade_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"
android:visibility="gone"/>
<include
android:id="@+id/menu_frame"
layout="@layout/menu"

View file

@ -1,82 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
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:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?panel"
android:clipToPadding="false"
android:elevation="@dimen/appbar_elevation">
<LinearLayout
android:id="@+id/time_distance"
android:layout_width="match_parent"
android:layout_height="@dimen/height_item_oneline"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="@dimen/margin_quarter">
<ImageView
android:id="@+id/btn__close"
android:layout_width="@dimen/height_block_base"
android:layout_height="@dimen/height_block_base"
android:layout_centerVertical="true"
android:layout_marginRight="@dimen/margin_base"
android:layout_weight="0"
android:background="?attr/selectableItemBackgroundBorderless"
android:scaleType="center"
android:tint="?iconTint"
android:src="@drawable/ic_cancel"/>
<TextView
android:id="@+id/tv__total_distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/margin_base"
android:layout_weight="1"
android:gravity="center"
android:textAppearance="@style/MwmTextAppearance.RoutingNumber"
tools:text="1.4 km"/>
<TextView
android:id="@+id/tv__total_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/margin_base"
android:layout_weight="1"
android:gravity="center"
android:textAppearance="@style/MwmTextAppearance.RoutingNumber"
tools:text="1,5 min"/>
<TextView
android:id="@+id/tv__arrival_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:textAppearance="@style/MwmTextAppearance.RoutingNumber"
tools:text="1:00"/>
</LinearLayout>
<com.mapswithme.maps.widget.FlatProgressView
android:id="@+id/fp__route_progress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/time_distance"
app:headRadius="2dp"
app:progressColor="@color/routing_progress"
app:headColor="@color/routing_progress"
app:progressThickness="2dp"
app:secondaryProgressColor="@color/divider"
app:secondaryProgressThickness="2dp"/>
<include
android:id="@+id/turns"
layout="@layout/layout_turn_and_street"
android:layout_width="@dimen/panel_width"
android:layout_height="wrap_content"
android:layout_below="@id/fp__route_progress"
android:layout_centerHorizontal="true"/>
</RelativeLayout>

View file

@ -30,18 +30,6 @@
android:visibility="gone"
tools:visibility="visible"/>
<include
layout="@layout/layout_routing_full"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/toolbar"
android:paddingBottom="@dimen/margin_base"
android:visibility="gone"/>
<include
layout="@layout/routing_plan"
android:visibility="invisible"/>
<com.mapswithme.maps.widget.FadeView
android:id="@+id/fade_view"
android:layout_width="match_parent"
@ -49,6 +37,18 @@
android:background="@android:color/black"
android:visibility="gone"/>
<include
layout="@layout/layout_nav"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/toolbar"
android:paddingBottom="@dimen/margin_base"
android:visibility="invisible"/>
<include
layout="@layout/routing_plan"
android:visibility="invisible"/>
<include
android:id="@+id/menu_frame"
layout="@layout/menu"

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/navigation_frame"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/layout_nav_top"/>
<include layout="@layout/layout_nav_bottom"/>
</FrameLayout>

View file

@ -0,0 +1,87 @@
<?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:tools="http://schemas.android.com/tools"
android:id="@+id/nav_bottom_frame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="bottom"
android:clickable="true"
android:visibility="invisible"
android:background="?menuBackgroundOpen"
tools:visibility="visible">
<FrameLayout
android:id="@+id/line_frame"
android:layout_width="match_parent"
android:layout_height="@dimen/nav_menu_height">
<include layout="@layout/layout_nav_bottom_numbers"/>
<ImageView
android:id="@+id/toggle"
android:layout_width="@dimen/nav_menu_height"
android:layout_height="@dimen/nav_menu_height"
android:layout_gravity="end|center_vertical"
android:background="?clickableBackground"
android:scaleType="center"
android:tint="?iconTint"
tools:src="@drawable/ic_menu_close"/>
</FrameLayout>
<com.mapswithme.maps.widget.FlatProgressView
android:id="@+id/navigation_progress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:headRadius="@dimen/nav_progress_head"
app:progressColor="?colorAccent"
app:headColor="?colorAccent"
app:progressThickness="@dimen/nav_progress"
app:secondaryProgressColor="@color/bg_routing_progress"
app:secondaryProgressThickness="@dimen/nav_progress"/>
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="@dimen/nav_menu_content_height"
android:clipChildren="false"
android:clipToPadding="false"
android:paddingLeft="@dimen/nav_bottom_gap"
android:paddingStart="@dimen/nav_bottom_gap"
android:paddingRight="@dimen/nav_bottom_gap"
android:paddingEnd="@dimen/nav_bottom_gap"
tools:background="#300000FF">
<ImageView
android:id="@+id/settings"
android:layout_width="@dimen/nav_icon_size"
android:layout_height="@dimen/nav_icon_size"
android:layout_marginRight="@dimen/nav_bottom_gap"
android:layout_marginEnd="@dimen/nav_bottom_gap"
android:layout_gravity="center_vertical"
android:scaleType="center"
android:src="@drawable/ic_menu_settings"
android:background="?selectableItemBackgroundBorderless"
android:tint="?iconTint"/>
<Button
android:id="@+id/stop"
android:layout_width="@dimen/nav_button_width"
android:layout_height="@dimen/nav_button_height"
android:layout_gravity="center"
android:background="?redButtonBackground"
android:text="@string/current_location_unknown_stop_button"
android:fontFamily="@string/robotoMedium"
android:textAppearance="@style/MwmTextAppearance.Button.Red"
tools:ignore="UnusedAttribute"/>
<ImageView
android:id="@+id/tts_volume"
android:layout_width="@dimen/nav_icon_size"
android:layout_height="@dimen/nav_icon_size"
android:scaleType="center"
android:layout_gravity="center_vertical|right"
android:src="@drawable/ic_voice_on"
android:background="?selectableItemBackgroundBorderless"/>
</FrameLayout>
</LinearLayout>

View file

@ -0,0 +1,155 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="@dimen/nav_menu_height"
android:orientation="horizontal"
android:paddingLeft="@dimen/nav_numbers_margin"
android:paddingStart="@dimen/nav_numbers_margin"
android:layout_marginRight="@dimen/nav_toggle"
android:layout_marginEnd="@dimen/nav_toggle"
android:background="?clickableBackground"
tools:background="#3000FF00"
tools:ignore="RtlSymmetry">
<!-- Speed -->
<LinearLayout
android:id="@+id/speed_frame"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:minWidth="@dimen/nav_numbers_side_min_width"
android:orientation="vertical"
android:paddingLeft="@dimen/nav_numbers_margin"
android:paddingRight="@dimen/nav_numbers_margin"
android:paddingTop="@dimen/margin_eighth"
android:gravity="center_horizontal"
tools:background="#20FF0000">
<TextView
android:id="@+id/speed_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/neg_margin_quarter"
android:singleLine="true"
android:includeFontPadding="false"
android:textAppearance="@style/MwmTextAppearance.RoutingNumber"
tools:text="999"/>
<TextView
android:id="@+id/speed_dimen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="@style/MwmTextAppearance.RoutingDimension"
tools:text="km/h"/>
</LinearLayout>
<Space android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"/>
<!-- Time -->
<FrameLayout
android:id="@+id/time_frame"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:minWidth="@dimen/nav_numbers_center_min_width"
android:paddingTop="@dimen/margin_eighth"
tools:background="#20FF0000">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center_horizontal">
<TextView
android:id="@+id/time_hour_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="@style/MwmTextAppearance.RoutingNumber"
tools:text="999"/>
<TextView
android:id="@+id/time_hour_dimen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/margin_quarter"
android:layout_marginEnd="@dimen/margin_quarter"
android:singleLine="true"
android:textAppearance="@style/MwmTextAppearance.RoutingDimension.Inline"
tools:text="h"/>
<TextView
android:id="@+id/time_minute_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="@style/MwmTextAppearance.RoutingNumber"
tools:text="99"/>
<TextView
android:id="@+id/time_minute_dimen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="@style/MwmTextAppearance.RoutingDimension.Inline"
tools:text="m"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:theme="?navigationTheme"
android:layout_gravity="center_horizontal"
android:layout_marginTop="30dp">
<ImageView
android:id="@+id/dot_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/margin_half"
android:layout_marginEnd="@dimen/margin_half"
android:src="?newsMarker"/>
<ImageView
android:id="@+id/dot_estimate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="?newsMarker"/>
</LinearLayout>
</FrameLayout>
<Space android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"/>
<!-- Distance -->
<LinearLayout
android:id="@+id/distance_frame"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:minWidth="@dimen/nav_numbers_side_min_width"
android:orientation="vertical"
android:paddingLeft="@dimen/nav_numbers_margin"
android:paddingRight="@dimen/nav_numbers_margin"
android:paddingTop="@dimen/margin_eighth"
android:gravity="center_horizontal"
tools:background="#20FF0000">
<TextView
android:id="@+id/distance_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/neg_margin_quarter"
android:singleLine="true"
android:includeFontPadding="false"
android:textAppearance="@style/MwmTextAppearance.RoutingNumber"
tools:text="99999"/>
<TextView
android:id="@+id/distance_dimen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="@style/MwmTextAppearance.RoutingDimension"
tools:text="km"/>
</LinearLayout>
</LinearLayout>

View file

@ -0,0 +1,95 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/nav_top_frame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:background="#20FF0000">
<FrameLayout
android:id="@+id/street_frame"
android:layout_width="match_parent"
android:layout_height="@dimen/nav_street_height"
android:elevation="@dimen/nav_elevation"
android:background="?cardBackground">
<TextView
android:id="@+id/street"
style="@style/MwmWidget.TextView.NavStreet"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/nav_street_left"
android:layout_marginStart="@dimen/nav_street_left"
android:maxLines="2"
android:layout_gravity="center_vertical"
android:gravity="center"
tools:text="Sample street name.\nLong looooooooong!!!!"/>
</FrameLayout>
<include
layout="@layout/shadow_top"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/street_frame"/>
<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">
<com.mapswithme.maps.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"
android: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_alignLeft="@id/nav_next_turn_frame"
android:layout_alignRight="@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"
tools:src="@drawable/ic_close"/>
</FrameLayout>
</RelativeLayout>

View file

@ -1,47 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/navigation_frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<include
layout="@layout/layout_turn_instructions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/margin_half"
android:layout_marginBottom="@dimen/margin_half"/>
<LinearLayout
android:id="@+id/next_turn_frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="@drawable/bg_next_turn"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingBottom="@dimen/margin_quarter"
android:paddingLeft="@dimen/margin_base"
android:paddingRight="@dimen/margin_base"
android:paddingTop="@dimen/margin_quarter"
android:visibility="gone"
tools:visibility="visible">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:padding="@dimen/margin_quarter"
android:text="@string/next_turn_then"
android:textColor="@android:color/white"
android:textSize="@dimen/text_size_toolbar"/>
<ImageView
android:id="@+id/iv__next_turn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:contentDescription="@string/next_turn_then"
tools:src="@drawable/ic_then_round"/>
</LinearLayout>
</LinearLayout>

View file

@ -1,55 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:id="@+id/turns"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="@dimen/panel_width"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:padding="@dimen/routing_turns_padding">
<FrameLayout
android:id="@+id/turn"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<com.mapswithme.maps.widget.ArrowView
android:id="@+id/iv__turn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:tint="?colorAccent"
tools:src="@drawable/ic_turn_round"/>
<TextView
android:id="@+id/tv__exit_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textAppearance="@style/MwmTextAppearance.Title"
android:textColor="?colorAccent"
android:visibility="gone"
tools:text="2"
tools:visibility="visible"/>
</FrameLayout>
<TextView
android:id="@+id/tv__turn_distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/margin_base"
android:layout_toRightOf="@+id/turn"
android:textAppearance="@style/MwmTextAppearance.RoutingDirection"
tools:text="300 m"/>
<TextView
android:id="@+id/tv__next_street"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@id/tv__turn_distance"
android:layout_below="@id/tv__turn_distance"
android:maxLines="2"
android:textAppearance="@style/MwmTextAppearance.Body2"
android:textSize="@dimen/text_size_title"
tools:text="Oxford str."
tools:visibility="visible"/>
</RelativeLayout>

View file

@ -1,74 +0,0 @@
<?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:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="?panel"
android:elevation="@dimen/appbar_elevation">
<LinearLayout
android:id="@+id/time_distance"
android:layout_width="match_parent"
android:layout_height="@dimen/routing_info_height"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="@dimen/margin_quarter">
<ImageView
android:id="@+id/btn__close"
android:layout_width="@dimen/height_block_base"
android:layout_height="@dimen/height_block_base"
android:layout_weight="0"
android:background="?selectableItemBackgroundBorderless"
android:tint="?iconTint"
android:scaleType="center"
android:src="@drawable/ic_cancel"/>
<TextView
android:id="@+id/tv__total_distance"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:textAppearance="@style/MwmTextAppearance.RoutingNumber"
tools:text="100.4 km"/>
<TextView
android:id="@+id/tv__total_time"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:textAppearance="@style/MwmTextAppearance.RoutingNumber"
tools:text="10h 40min"/>
<TextView
android:id="@+id/tv__arrival_time"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:textAppearance="@style/MwmTextAppearance.RoutingNumber"
android:textSize="@dimen/text_size_routing_number"
tools:text="23:59"/>
</LinearLayout>
<com.mapswithme.maps.widget.FlatProgressView
android:id="@+id/fp__route_progress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:headRadius="2dp"
app:progressColor="@color/routing_progress"
app:headColor="@color/routing_progress"
app:progressThickness="2dp"
app:secondaryProgressColor="@color/divider"
app:secondaryProgressThickness="2dp"/>
<include
android:id="@+id/turns"
layout="@layout/layout_turn_and_street"
android:layout_width="@dimen/panel_width"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"/>
</LinearLayout>

View file

@ -1,26 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="right"
android:paddingLeft="@dimen/margin_navigation_buttons"
android:paddingRight="0dp"
android:paddingBottom="@dimen/margin_navigation_buttons">
<android.support.v4.widget.Space
android:id="@+id/space_bottom"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"/>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/nav_frame_padding"
android:layout_marginBottom="@dimen/nav_menu_height">
<ImageButton
android:id="@+id/nav_zoom_out"
style="@style/MwmWidget.MapButton"
android:layout_marginBottom="@dimen/nav_zoom_bottom"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
tools:src="@drawable/zoom_out"/>
<ImageButton android:id="@+id/map_button_plus"
style="@style/MwmWidget.MapButton"
android:layout_marginRight="@dimen/margin_quarter"
tools:src="@drawable/zoom_in"/>
<ImageButton android:id="@+id/map_button_minus"
style="@style/MwmWidget.MapButton"
android:layout_marginRight="@dimen/margin_quarter"
tools:src="@drawable/zoom_out"/>
</LinearLayout>
<ImageButton
android:id="@+id/nav_zoom_in"
style="@style/MwmWidget.MapButton"
android:layout_marginBottom="@dimen/nav_frame_padding"
android:layout_above="@id/nav_zoom_out"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
tools:src="@drawable/zoom_in"/>
</RelativeLayout>

View file

@ -35,34 +35,19 @@
<ImageView
android:id="@+id/toggle"
style="@style/MwmTheme.Menu.Line.Button"
android:tint="@null"
android:layout_width="@dimen/menu_line_button_width_edge"
android:layout_height="@dimen/menu_line_height"
android:layout_gravity="right"
android:paddingLeft="@dimen/margin_half_plus"
android:paddingRight="@dimen/margin_half"
android:src="@drawable/ic_menu_open"
android:background="@drawable/menu_button_right"
style="@style/MwmTheme.Menu.Line.Button.Toggle"
tools:layout_marginTop="60dp"/>
<include
android:id="@+id/buttons_frame"
layout="@layout/menu_buttons_line"/>
<include
android:id="@+id/navigation_frame"
layout="@layout/menu_navigation_line"
tools:layout_width="match_parent"
tools:layout_height="@dimen/menu_line_height"
tools:layout_marginTop="60dp"/>
<include
android:id="@+id/routing_plan_frame"
layout="@layout/menu_route_plan_line"
tools:layout_width="match_parent"
tools:layout_height="@dimen/menu_line_height"
tools:layout_marginTop="120dp"/>
tools:layout_marginTop="60dp"/>
</FrameLayout>
</LinearLayout>

View file

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="@dimen/menu_line_height"
android:orientation="horizontal">
<!-- Gap for MyPosition button -->
<View
android:layout_width="@dimen/menu_line_button_width_edge"
android:layout_height="match_parent"
tools:background="#4000F000"/>
<TextView
android:id="@+id/current_place"
style="@style/MwmTheme.Menu.Line.CurrentLocationText"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
tools:background="#200000FF"
tools:text="Some street name. Long long long long name here! Loooooong!!!111"/>
<!-- Gap for menu open/close button -->
<View
android:layout_width="@dimen/menu_line_button_width_edge"
android:layout_height="match_parent"
tools:background="#4000F000"/>
</LinearLayout>

View file

@ -28,7 +28,7 @@
android:id="@+id/toggle"
android:layout_width="?attr/actionBarSize"
android:layout_height="?attr/actionBarSize"
android:layout_gravity="right|center_horizontal"
android:layout_gravity="end|center_horizontal"
android:background="?attr/selectableItemBackgroundBorderless"
android:scaleType="center"
tools:src="@drawable/ic_down"/>

View file

@ -1,10 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="zoom_plus_top_margin">-10dp</dimen>
<dimen name="drawer_top_padding">12dp</dimen>
<dimen name="tabs_height">48dp</dimen>
<dimen name="menu_line_button_inset_edge">-12dp</dimen>
<dimen name="menu_line_button_width_edge">72dp</dimen>
<dimen name="menu_line_button_width">88dp</dimen>
<!-- Nav menu -->
<dimen name="nav_menu_height">36dp</dimen>
<dimen name="nav_menu_content_height">48dp</dimen>
<dimen name="nav_zoom_bottom">80dp</dimen>
<dimen name="nav_toggle_margin">16dp</dimen>
<dimen name="nav_numbers_margin">16dp</dimen>
<dimen name="nav_bottom_gap">24dp</dimen>
</resources>

View file

@ -1,8 +1,6 @@
<resources>
<dimen name="dialog_max_height">560dp</dimen>
<dimen name="routing_pp_height">63dp</dimen>
<!-- direction fragment -->
<dimen name="margin_direction_small">12dp</dimen>
<dimen name="margin_direction_big">80dp</dimen>

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Nav menu -->
<dimen name="nav_menu_height">40dp</dimen>
<dimen name="nav_menu_content_height">64dp</dimen>
<dimen name="nav_progress">8dp</dimen>
<dimen name="nav_numbers_margin">32dp</dimen>
</resources>

View file

@ -1,3 +1,19 @@
<resources>
<dimen name="dialog_max_height">600dp</dimen>
<dimen name="nav_menu_height">40dp</dimen>
<dimen name="nav_menu_content_height">64dp</dimen>
<dimen name="nav_street_height">56dp</dimen>
<dimen name="nav_street_left">152dp</dimen>
<dimen name="nav_next_turn_frame">132dp</dimen>
<dimen name="nav_next_turn_top">12dp</dimen>
<dimen name="nav_next_turn_bottom">9dp</dimen>
<dimen name="nav_next_turn_space">9dp</dimen>
<dimen name="nav_next_turn_sign">96dp</dimen>
<dimen name="nav_next_next_turn_frame">48dp</dimen>
<dimen name="nav_frame_padding">@dimen/margin_base</dimen>
<dimen name="nav_zoom_bottom">250dp</dimen>
<dimen name="nav_toggle_margin">16dp</dimen>
<dimen name="nav_numbers_margin">16dp</dimen>
</resources>

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="text_size_nav_street">26sp</dimen>
<dimen name="text_size_nav_next_turn">32sp</dimen>
<dimen name="text_size_nav_circle_exit">16sp</dimen>
<dimen name="text_size_nav_number">36sp</dimen>
<dimen name="text_size_nav_dimension">30sp</dimen>
</resources>

View file

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="margin_navigation_buttons">@dimen/margin_half</dimen>
</resources>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Text colors -->
<color name="text_dark">#DE000000</color>
<color name="text_dark_subtitle">#8A000000</color>
<color name="text_dark_hint">#61000000</color>
<color name="text_light">#FFFFFFFF</color>
<color name="text_light_subtitle">#B3FFFFFF</color>
<color name="text_light_hint">#4CFFFFFF</color>
<color name="text_dark">@color/black_primary</color>
<color name="text_dark_subtitle">@color/black_secondary</color>
<color name="text_dark_hint">@color/black_lightest</color>
<color name="text_light">@color/white_primary</color>
<color name="text_light_subtitle">@color/white_secondary</color>
<color name="text_light_hint">@color/white_lightest</color>
<color name="base_accent">#FF1E96F0</color>
<color name="base_accent_night">#FFFFE68C</color>
@ -17,6 +17,13 @@
<color name="base_yellow">#FFFFC30A</color>
<color name="base_green">#FF558B2F</color>
<color name="black_primary">#DE000000</color> <!-- 87% black -->
<color name="black_secondary">#8A000000</color> <!-- 54% black -->
<color name="black_lightest">#61000000</color> <!-- 38% black -->
<color name="white_primary">#FFFFFFFF</color> <!-- 100% white -->
<color name="white_secondary">#B3FFFFFF</color> <!-- 70% white -->
<color name="white_lightest">#4CFFFFFF</color> <!-- 50% white -->
<color name="icon_tint">#FF757575</color>
<color name="icon_tint_night">#FFC4C6C7</color>
@ -41,10 +48,10 @@
<color name="bg_dialog_translucent">#BB000000</color>
<color name="bg_text_translucent">#99FFFFFF</color>
<color name="bg_menu">#CCFFFFFF</color>
<color name="bg_menu_night">#CC2D3237</color>
<color name="bg_menu_open">#FFFFFFFF</color>
<color name="bg_menu_open_night">#FF2D3237</color>
<color name="bg_menu_closed">#CCFFFFFF</color>
<color name="bg_menu_closed_night">#CC2D3237</color>
<color name="bg_statusbar">#FF197E46</color>
<color name="bg_statusbar_night">#FF000000</color>
@ -79,10 +86,17 @@
<color name="button_accent_text_disabled">#42000000</color>
<color name="button_accent_text_disabled_night">#4CFFFFFF</color>
<color name="button_red">@color/button_red_normal</color>
<color name="button_red_normal">@color/base_red</color>
<color name="button_red_pressed">#FFC22219</color>
<color name="button_red_disabled">#FFB9332B</color>
<color name="button_red_text">#FFFFFFFF</color>
<color name="button_red_text_disabled">#FF606060</color>
<color name="downloader_gray">#FF999999</color>
<!-- Routing-->
<color name="routing_progress">#FF757575</color>
<color name="bg_routing_progress">#1F000000</color>
<color name="routing_slot_background">#FFFFFFFF</color>
<color name="routing_slot_background_night">@color/bg_panel_night</color>
<color name="routing_slot_background_pressed">#FFF0F0F0</color>

View file

@ -25,8 +25,6 @@
<dimen name="neg_margin_base">-16dp</dimen>
<dimen name="neg_margin_double">-32dp</dimen>
<dimen name="margin_navigation_buttons">@dimen/margin_quarter</dimen>
<!-- base sizes -->
<dimen name="height_block_base">48dp</dimen>
<dimen name="height_item_oneline">56dp</dimen>
@ -57,9 +55,6 @@
<dimen name="margin_direction_around_center">40dp</dimen>
<dimen name="direction_frame_min_height">36dp</dimen>
<dimen name="zoom_buttons_top_required_space">266dp</dimen>
<dimen name="zoom_buttons_bottom_max_space">228dp</dimen>
<!-- map widgets -->
<dimen name="margin_compass_left">32dp</dimen>
<dimen name="margin_compass_bottom">80dp</dimen>
@ -87,6 +82,34 @@
<dimen name="menu_line_button_inset_edge">-16dp</dimen>
<dimen name="menu_list_item_height">48dp</dimen>
<!-- Nav menu -->
<dimen name="nav_elevation">6dp</dimen>
<dimen name="nav_street_height">44dp</dimen>
<dimen name="nav_street_left">104dp</dimen>
<dimen name="nav_next_turn_frame">88dp</dimen>
<dimen name="nav_next_turn_top">8dp</dimen>
<dimen name="nav_next_turn_bottom">6dp</dimen>
<dimen name="nav_next_turn_space">6dp</dimen>
<dimen name="nav_next_turn_sign">64dp</dimen>
<dimen name="nav_next_next_turn_frame">32dp</dimen>
<dimen name="nav_menu_height">48dp</dimen>
<dimen name="nav_menu_content_height">64dp</dimen>
<dimen name="nav_numbers_margin">8dp</dimen>
<dimen name="nav_numbers_side_min_width">90dp</dimen>
<dimen name="nav_numbers_center_min_width">130dp</dimen>
<dimen name="nav_progress">4dp</dimen>
<dimen name="nav_progress_head">2dp</dimen>
<dimen name="nav_toggle">40dp</dimen>
<dimen name="nav_toggle_margin">8dp</dimen>
<dimen name="nav_button_width">200dp</dimen>
<dimen name="nav_button_height">36dp</dimen>
<dimen name="nav_icon_size">48dp</dimen>
<dimen name="nav_bottom_gap">12dp</dimen>
<dimen name="nav_frame_padding">@dimen/margin_half</dimen>
<dimen name="nav_button">28dp</dimen>
<dimen name="nav_zoom_bottom">160dp</dimen>
<dimen name="panel_elevation">12dp</dimen>
<dimen name="appbar_elevation">4dp</dimen>
<dimen name="placepage_elevation">4dp</dimen>

View file

@ -31,10 +31,16 @@
<!-- -->
<dimen name="text_size_routing_number">20sp</dimen>
<dimen name="text_size_routing_dimension">14sp</dimen>
<dimen name="text_size_routing_number">24sp</dimen>
<dimen name="text_size_routing_dimension">12sp</dimen>
<dimen name="text_size_routing_dimension_inline">20sp</dimen>
<dimen name="text_size_routing_plan_detail">18sp</dimen>
<dimen name="text_size_routing_plan_detail_arrival">14sp</dimen>
<dimen name="text_size_time_picker">56sp</dimen>
<dimen name="text_size_nav_street">17sp</dimen>
<dimen name="text_size_nav_next_turn">24sp</dimen>
<dimen name="text_size_nav_circle_exit">12sp</dimen>
<dimen name="text_size_nav_number">24sp</dimen>
<dimen name="text_size_nav_dimension">20sp</dimen>
</resources>

View file

@ -12,11 +12,15 @@
<item name="android:tint">?iconTint</item>
</style>
<style name="MwmTheme.Menu.Line.CurrentLocationText">
<item name="android:gravity">center</item>
<item name="android:maxLines">2</item>
<item name="android:ellipsize">end</item>
<item name="android:textAppearance">@style/MwmTextAppearance.Body1</item>
<style name="MwmTheme.Menu.Line.Button.Toggle">
<item name="android:layout_width">@dimen/menu_line_button_width_edge</item>
<item name="android:layout_height">@dimen/menu_line_height</item>
<item name="android:layout_gravity">right</item>
<item name="android:paddingLeft">@dimen/margin_half_plus</item>
<item name="android:paddingRight">@dimen/margin_half</item>
<item name="android:src">@drawable/ic_menu_close</item>
<item name="android:background">@drawable/menu_button_right</item>
<item name="android:tint">@null</item>
</style>
<style name="MwmTheme.Menu.Content.ListItem"

View file

@ -72,6 +72,10 @@
<item name="android:textAllCaps">true</item>
</style>
<style name="MwmTextAppearance.Button.Red">
<item name="android:textColor">@color/button_red_text</item>
</style>
<style name="MwmTextAppearance.Toolbar">
<item name="android:textSize">@dimen/text_size_toolbar</item>
<item name="android:textColor">@color/text_light</item>
@ -98,15 +102,21 @@
<style name="MwmTextAppearance.RoutingNumber">
<item name="android:textSize">@dimen/text_size_routing_number</item>
<item name="android:textColor">?android:textColorSecondary</item>
<item name="android:textColor">?android:textColorPrimary</item>
<item name="android:textStyle">bold</item>
</style>
<style name="MwmTextAppearance.RoutingDirection">
<item name="android:textSize">@dimen/text_size_display_2</item>
<item name="android:textColor">?colorAccent</item>
<style name="MwmTextAppearance.RoutingDimension">
<item name="android:textSize">@dimen/text_size_routing_dimension</item>
<item name="android:textColor">?android:textColorSecondary</item>
<item name="android:textStyle">bold</item>
</style>
<style name="MwmTextAppearance.RoutingDimension.Inline"
parent="MwmTextAppearance.RoutingNumber">
<item name="android:textSize">@dimen/text_size_routing_dimension_inline</item>
</style>
<style name="MwmTextAppearance.RoutingDetail">
<item name="android:textSize">@dimen/text_size_routing_plan_detail</item>
<item name="android:fontFamily" tools:ignore="NewApi">@string/robotoMedium</item>
@ -117,6 +127,23 @@
<item name="android:textColor">?secondary</item>
</style>
<style name="MwmTextAppearance.NavStreet">
<item name="android:textSize">@dimen/text_size_nav_street</item>
<item name="android:fontFamily" tools:ignore="NewApi">@string/robotoMedium</item>
<item name="android:textColor">?android:textColorPrimary</item>
</style>
<style name="MwmTextAppearance.NavNextTurn">
<item name="android:textSize">@dimen/text_size_nav_next_turn</item>
<item name="android:fontFamily" tools:ignore="NewApi">@string/robotoMedium</item>
<item name="android:textStyle">bold</item>
<item name="android:textColor">?android:textColorPrimaryInverse</item>
</style>
<style name="MwmTextAppearance.NavNextTurn.Exit">
<item name="android:textSize">@dimen/text_size_nav_circle_exit</item>
</style>
<style name="MwmTextAppearance.PlacePage"
parent="MwmTextAppearance.Body1"/>

View file

@ -149,6 +149,18 @@
<item name="android:layout_centerVertical">true</item>
</style>
<style name="MwmWidget.TextView.NavStreet">
<item name="android:textAppearance">@style/MwmTextAppearance.NavStreet</item>
</style>
<style name="MwmWidget.TextView.NavNextTurn">
<item name="android:textAppearance">@style/MwmTextAppearance.NavNextTurn</item>
</style>
<style name="MwmWidget.TextView.NavNextTurn.Exit">
<item name="android:textAppearance">@style/MwmTextAppearance.NavNextTurn.Exit</item>
</style>
<style name="MwmWidget.FrameLayout.Elevation">
<item name="android:foreground">@drawable/shadow_top</item>
</style>

View file

@ -28,6 +28,8 @@
<attr name="routingSlot" format="reference"/>
<attr name="routingSlotPressed" format="reference"/>
<attr name="routingSlotMarker" format="reference"/>
<attr name="navNextTurnFrame" format="reference"/>
<attr name="navNextNextTurnFrame" format="reference"/>
<attr name="buttonBackground" format="reference"/>
<attr name="buttonTextColor" format="color"/>
@ -37,19 +39,33 @@
<attr name="accentButtonTextColor" format="color"/>
<attr name="accentButtonTextColorDisabled" format="color"/>
<attr name="redButtonBackground" format="reference"/>
<attr name="redButtonTextColor" format="color"/>
<attr name="redButtonTextColorDisabled" format="color"/>
<attr name="circleAccent" format="reference"/>
<attr name="menuBackgroundClosed" format="color"/>
<attr name="menuBackground" format="color"/>
<attr name="menuBackgroundOpen" format="color"/>
<attr name="myPositionButtonAnimation" format="reference"/>
<attr name="wheelPendingAnimation" format="reference"/>
<attr name="navButtonsTheme" format="reference"/>
<attr name="downloaderTheme" format="reference"/>
<attr name="navigationTheme" format="reference"/>
<attr name="fabAdd" format="reference"/>
</declare-styleable>
<declare-styleable name="ThemeAttrs.NavButtons">
<attr name="nav_zoom_in" format="reference"/>
<attr name="nav_zoom_out" format="reference"/>
<attr name="nav_search_closed" format="reference"/>
<attr name="nav_search_open" format="reference"/>
<attr name="nav_bookmark" format="reference"/>
</declare-styleable>
<declare-styleable name="ThemeAttrs.Downloader">
<attr name="status_done" format="reference"/>
<attr name="status_downloadable" format="reference"/>
@ -58,4 +74,8 @@
<attr name="status_folder" format="reference"/>
<attr name="status_folder_done" format="reference"/>
</declare-styleable>
<declare-styleable name="ThemeAttrs.Navigation">
<attr name="newsMarker" format="reference"/>
</declare-styleable>
</resources>

View file

@ -44,6 +44,8 @@
<item name="routingSlot">@drawable/routing_slot_background</item>
<item name="routingSlotPressed">@drawable/routing_slot_background_pressed</item>
<item name="routingSlotMarker">@drawable/routing_slot_marker</item>
<item name="navNextTurnFrame">@drawable/bg_nav_next_turn</item>
<item name="navNextNextTurnFrame">@drawable/bg_nav_next_next_turn</item>
<item name="buttonBackground">@drawable/button</item>
<item name="buttonTextColor">@color/button_text</item>
@ -53,15 +55,21 @@
<item name="accentButtonTextColor">@color/button_accent_text</item>
<item name="accentButtonTextColorDisabled">@color/button_accent_text_disabled</item>
<item name="redButtonBackground">@drawable/button_red</item>
<item name="redButtonTextColor">@color/button_red_text</item>
<item name="redButtonTextColorDisabled">@color/button_red_text_disabled</item>
<item name="circleAccent">@drawable/circle_accent</item>
<item name="menuBackgroundClosed">@color/bg_menu_closed</item>
<item name="menuBackground">@color/bg_menu</item>
<item name="menuBackgroundOpen">@color/bg_menu_open</item>
<item name="myPositionButtonAnimation">@drawable/anim_myposition_pending</item>
<item name="wheelPendingAnimation">@drawable/anim_spinner_pending</item>
<item name="navButtonsTheme">@style/MwmTheme.NavButtons</item>
<item name="downloaderTheme">@style/MwmTheme.Downloader</item>
<item name="navigationTheme">@style/MwmTheme.Navigation</item>
<item name="fabAdd">@drawable/ic_fab_add</item>
</style>
@ -110,6 +118,8 @@
<item name="routingSlot">@drawable/routing_slot_background_night</item>
<item name="routingSlotPressed">@drawable/routing_slot_background_pressed_night</item>
<item name="routingSlotMarker">@drawable/routing_slot_marker_night</item>
<item name="navNextTurnFrame">@drawable/bg_nav_next_turn_night</item>
<item name="navNextNextTurnFrame">@drawable/bg_nav_next_next_turn_night</item>
<item name="buttonBackground">@drawable/button_night</item>
<item name="buttonTextColor">@color/button_text_night</item>
@ -119,15 +129,21 @@
<item name="accentButtonTextColor">@color/button_accent_text_night</item>
<item name="accentButtonTextColorDisabled">@color/button_accent_text_disabled_night</item>
<item name="redButtonBackground">@drawable/button_red</item>
<item name="redButtonTextColor">@color/button_red_text</item>
<item name="redButtonTextColorDisabled">@color/button_red_text_disabled</item>
<item name="circleAccent">@drawable/circle_accent_night</item>
<item name="menuBackgroundClosed">@color/bg_menu_closed_night</item>
<item name="menuBackground">@color/bg_menu_night</item>
<item name="menuBackgroundOpen">@color/bg_menu_open_night</item>
<item name="myPositionButtonAnimation">@drawable/anim_myposition_pending_night</item>
<item name="wheelPendingAnimation">@drawable/anim_spinner_pending_night</item>
<item name="navButtonsTheme">@style/MwmTheme.NavButtons.Night</item>
<item name="downloaderTheme">@style/MwmTheme.Downloader.Night</item>
<item name="navigationTheme">@style/MwmTheme.Navigation.Night</item>
<item name="fabAdd">@drawable/ic_fab_add_night</item>
</style>

View file

@ -132,4 +132,37 @@
<item name="status_folder">@drawable/ic_downloader_folder_night</item>
<item name="status_folder_done">@drawable/ic_downloader_folder_done_night</item>
</style>
<style name="MwmTheme.NavButtons">
<item name="nav_zoom_in">@drawable/zoom_in</item>
<item name="nav_zoom_out">@drawable/zoom_out</item>
<item name="nav_search_closed">@drawable/zoom_in</item>
<item name="nav_search_open">@drawable/zoom_out</item>
<item name="nav_bookmark">@drawable/zoom_in</item>
<item name="iconTint">@android:color/white</item>
</style>
<style name="MwmTheme.NavButtons.Night">
<item name="nav_zoom_in">@drawable/ic_zoom_in_night</item>
<item name="nav_zoom_out">@drawable/zoom_out_night</item>
<item name="nav_search_closed">@drawable/zoom_in_night</item>
<item name="nav_search_open">@drawable/zoom_out_night</item>
<item name="nav_bookmark">@drawable/zoom_in_night</item>
<item name="iconTint">@android:color/darker_gray</item>
</style>
<style name="MwmTheme.Button" parent="Base.Widget.AppCompat.Button">
<item name="colorButtonNormal">?colorAccent</item>
</style>
<style name="MwmTheme.Navigation">
<item name="iconTint">@color/white_primary</item>
<item name="newsMarker">@drawable/news_marker</item>
</style>
<style name="MwmTheme.Navigation.Night">
<item name="iconTint">@color/black_primary</item>
<item name="newsMarker">@drawable/news_marker_night</item>
</style>
</resources>

View file

@ -1,12 +1,13 @@
package com.mapswithme.maps;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.location.Location;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.AttrRes;
import android.support.annotation.IdRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.DialogFragment;
@ -18,13 +19,8 @@ import android.support.v7.widget.Toolbar;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import java.io.Serializable;
import java.util.Stack;
import com.mapswithme.maps.Framework.MapObjectListener;
import com.mapswithme.maps.activity.CustomNavigateUpListener;
@ -66,6 +62,7 @@ import com.mapswithme.maps.settings.StoragePathManager;
import com.mapswithme.maps.settings.UnitLocale;
import com.mapswithme.maps.sound.TtsPlayer;
import com.mapswithme.maps.widget.FadeView;
import com.mapswithme.maps.widget.menu.BaseMenu;
import com.mapswithme.maps.widget.menu.MainMenu;
import com.mapswithme.maps.widget.placepage.BasePlacePageAnimationController;
import com.mapswithme.maps.widget.placepage.PlacePageView;
@ -86,6 +83,9 @@ import com.mapswithme.util.statistics.Statistics;
import ru.mail.android.mytarget.nativeads.NativeAppwallAd;
import ru.mail.android.mytarget.nativeads.banners.NativeAppwallBanner;
import java.io.Serializable;
import java.util.Stack;
public class MwmActivity extends BaseMwmFragmentActivity
implements MapObjectListener,
View.OnTouchListener,
@ -124,14 +124,15 @@ public class MwmActivity extends BaseMwmFragmentActivity
private NavigationController mNavigationController;
private MainMenu mMainMenu;
private PanelAnimator mPanelAnimator;
private OnmapDownloader mOnmapDownloader;
private MytargetHelper mMytargetHelper;
private FadeView mFadeView;
private ImageButton mBtnZoomIn;
private ImageButton mBtnZoomOut;
private View mNavZoomIn;
private View mNavZoomOut;
private View mPositionChooser;
@ -345,7 +346,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
}
mNavigationController = new NavigationController(this);
initMenu();
initMainMenu();
initOnmapDownloader();
initPositionChooser();
}
@ -373,7 +374,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
if (Framework.nativeIsDownloadedMapAtScreenCenter())
startActivity(new Intent(MwmActivity.this, FeatureCategoryActivity.class));
else
UiUtils.showAlertDialog(getActivity(), R.string.message_invalid_feature_position);
UiUtils.showAlertDialog(MwmActivity.this, R.string.message_invalid_feature_position);
}
});
UiUtils.hide(mPositionChooser);
@ -405,7 +406,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
@Override
public boolean onTouch()
{
return mMainMenu.close(true);
return getCurrentMenu().close(true);
}
});
@ -421,17 +422,20 @@ public class MwmActivity extends BaseMwmFragmentActivity
mMapFrame.setOnTouchListener(this);
}
private View initNavigationButton(View frame, @IdRes int id, @AttrRes int iconAttr)
{
ImageButton res = (ImageButton) frame.findViewById(id);
res.setImageResource(ThemeUtils.getResource(this, R.attr.navButtonsTheme, iconAttr));
res.setOnClickListener(this);
return res;
}
private void initNavigationButtons()
{
View frame = findViewById(R.id.navigation_buttons);
mBtnZoomIn = (ImageButton) frame.findViewById(R.id.map_button_plus);
mBtnZoomIn.setImageResource(ThemeUtils.isNightTheme() ? R.drawable.zoom_in_night
: R.drawable.zoom_in);
mBtnZoomIn.setOnClickListener(this);
mBtnZoomOut = (ImageButton) frame.findViewById(R.id.map_button_minus);
mBtnZoomOut.setOnClickListener(this);
mBtnZoomOut.setImageResource(ThemeUtils.isNightTheme() ? R.drawable.zoom_out_night
: R.drawable.zoom_out);
mNavZoomIn = initNavigationButton(frame, R.id.nav_zoom_in, R.attr.nav_zoom_in);
mNavZoomOut = initNavigationButton(frame, R.id.nav_zoom_out, R.attr.nav_zoom_out);
}
private boolean closePlacePage()
@ -452,7 +456,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
if (removeCurrentFragment(true))
{
InputUtils.hideKeyboard(mFadeView);
mFadeView.fadeOut(false);
mFadeView.fadeOut();
return true;
}
@ -464,7 +468,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
Statistics.INSTANCE.trackEvent(statEvent);
AlohaHelper.logClick(alohaStatEvent);
mFadeView.fadeOut(false);
mFadeView.fadeOut();
mMainMenu.close(true, procAfterClose);
}
@ -496,24 +500,22 @@ public class MwmActivity extends BaseMwmFragmentActivity
private void toggleMenu()
{
if (mMainMenu.isOpen())
mFadeView.fadeOut(false);
else
mFadeView.fadeIn();
mMainMenu.toggle(true);
getCurrentMenu().toggle(true);
refreshFade();
}
private void initMenu()
public void refreshFade()
{
mMainMenu = new MainMenu(this, (ViewGroup) findViewById(R.id.menu_frame), new MainMenu.Container()
{
@Override
public Activity getActivity()
{
return MwmActivity.this;
}
if (getCurrentMenu().isOpen())
mFadeView.fadeIn();
else
mFadeView.fadeOut();
}
private void initMainMenu()
{
mMainMenu = new MainMenu(findViewById(R.id.menu_frame), new BaseMenu.ItemClickListener<MainMenu.Item>()
{
@Override
public void onItemClick(MainMenu.Item item)
{
@ -609,7 +611,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
@Override
public void run()
{
startActivity(new Intent(getActivity(), SettingsActivity.class));
startActivity(new Intent(MwmActivity.this, SettingsActivity.class));
}
});
break;
@ -747,6 +749,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
}
});
mOnmapDownloader.onResume();
mNavigationController.getNavMenu().onResume(null);
}
@Override
@ -794,28 +797,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
private void adjustZoomButtons()
{
final boolean show = showZoomButtons();
UiUtils.showIf(show, mBtnZoomIn, mBtnZoomOut);
if (!show)
return;
mMapFrame.post(new Runnable()
{
@Override
public void run()
{
int height = mMapFrame.getMeasuredHeight();
int top = UiUtils.dimen(R.dimen.zoom_buttons_top_required_space);
int bottom = UiUtils.dimen(R.dimen.zoom_buttons_bottom_max_space);
int space = (top + bottom < height ? bottom : height - top);
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mBtnZoomOut.getLayoutParams();
lp.bottomMargin = space;
mBtnZoomOut.setLayoutParams(lp);
}
});
UiUtils.showIf(showZoomButtons(), mNavZoomIn, mNavZoomOut);
}
private static boolean showZoomButtons()
@ -890,9 +872,9 @@ public class MwmActivity extends BaseMwmFragmentActivity
@Override
public void onBackPressed()
{
if (mMainMenu.close(true))
if (getCurrentMenu().close(true))
{
mFadeView.fadeOut(false);
mFadeView.fadeOut();
return;
}
@ -990,7 +972,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
mPlacePage.setState(State.PREVIEW);
if (UiUtils.isVisible(mFadeView))
mFadeView.fadeOut(false);
mFadeView.fadeOut();
}
@Override
@ -1010,21 +992,33 @@ public class MwmActivity extends BaseMwmFragmentActivity
}
}
private BaseMenu getCurrentMenu()
{
return (RoutingController.get().isNavigating() ? mNavigationController.getNavMenu() : mMainMenu);
}
private void setFullscreen(boolean isFullscreen)
{
if (RoutingController.get().isNavigating()
|| RoutingController.get().isBuilding()
|| RoutingController.get().isPlanning())
return;
mIsFullscreen = isFullscreen;
final BaseMenu menu = getCurrentMenu();
if (isFullscreen)
{
if (mMainMenu.isAnimating())
if (menu.isAnimating())
return;
mIsFullscreenAnimating = true;
Animations.disappearSliding(mMainMenu.getFrame(), Animations.BOTTOM, new Runnable()
Animations.disappearSliding(menu.getFrame(), Animations.BOTTOM, new Runnable()
{
@Override
public void run()
{
final int menuHeight = mMainMenu.getFrame().getHeight();
final int menuHeight = menu.getFrame().getHeight();
adjustCompass(0, menuHeight);
adjustRuler(0, menuHeight);
@ -1033,13 +1027,13 @@ public class MwmActivity extends BaseMwmFragmentActivity
});
if (showZoomButtons())
{
Animations.disappearSliding(mBtnZoomOut, Animations.RIGHT, null);
Animations.disappearSliding(mBtnZoomIn, Animations.RIGHT, null);
Animations.disappearSliding(mNavZoomOut, Animations.RIGHT, null);
Animations.disappearSliding(mNavZoomIn, Animations.RIGHT, null);
}
}
else
{
Animations.appearSliding(mMainMenu.getFrame(), Animations.BOTTOM, new Runnable()
Animations.appearSliding(menu.getFrame(), Animations.BOTTOM, new Runnable()
{
@Override
public void run()
@ -1050,8 +1044,8 @@ public class MwmActivity extends BaseMwmFragmentActivity
});
if (showZoomButtons())
{
Animations.appearSliding(mBtnZoomOut, Animations.RIGHT, null);
Animations.appearSliding(mBtnZoomIn, Animations.RIGHT, null);
Animations.appearSliding(mNavZoomOut, Animations.RIGHT, null);
Animations.appearSliding(mNavZoomIn, Animations.RIGHT, null);
}
}
}
@ -1068,16 +1062,15 @@ public class MwmActivity extends BaseMwmFragmentActivity
public void run()
{
if (mMainMenu.close(true))
mFadeView.fadeOut(false);
mFadeView.fadeOut();
}
}, MainMenu.ANIMATION_DURATION * 2);
}, BaseMenu.ANIMATION_DURATION * 2);
}
else
{
Framework.nativeDeactivatePopup();
mPlacePage.saveBookmarkTitle();
mPlacePage.setMapObject(null, false);
mMainMenu.show(true);
}
}
@ -1095,12 +1088,12 @@ public class MwmActivity extends BaseMwmFragmentActivity
{
switch (v.getId())
{
case R.id.map_button_plus:
case R.id.nav_zoom_in:
Statistics.INSTANCE.trackEvent(Statistics.EventName.ZOOM_IN);
AlohaHelper.logClick(AlohaHelper.ZOOM_IN);
MapFragment.nativeScalePlus();
break;
case R.id.map_button_minus:
case R.id.nav_zoom_out:
Statistics.INSTANCE.trackEvent(Statistics.EventName.ZOOM_OUT);
AlohaHelper.logClick(AlohaHelper.ZOOM_OUT);
MapFragment.nativeScaleMinus();
@ -1232,6 +1225,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
{
if (RoutingController.get().isNavigating())
{
mNavigationController.show(true);
mMainMenu.setState(MainMenu.State.NAVIGATION, false);
return;
}
@ -1345,7 +1339,6 @@ public class MwmActivity extends BaseMwmFragmentActivity
RoutingInfo info = Framework.nativeGetRouteFollowingInfo();
mNavigationController.update(info);
mMainMenu.updateRoutingInfo(info);
TtsPlayer.INSTANCE.playTurnNotifications();
}

View file

@ -1,86 +1,166 @@
package com.mapswithme.maps.routing;
import android.app.Activity;
import android.content.Intent;
import android.location.Location;
import android.os.Build;
import android.text.TextUtils;
import android.util.Pair;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.mapswithme.maps.Framework;
import com.mapswithme.maps.MwmActivity;
import com.mapswithme.maps.R;
import com.mapswithme.maps.bookmarks.data.DistanceAndAzimut;
import com.mapswithme.maps.location.LocationHelper;
import com.mapswithme.maps.settings.SettingsActivity;
import com.mapswithme.maps.sound.TtsPlayer;
import com.mapswithme.maps.widget.FlatProgressView;
import com.mapswithme.util.Animations;
import com.mapswithme.maps.widget.menu.NavMenu;
import com.mapswithme.util.StringUtils;
import com.mapswithme.util.UiUtils;
import com.mapswithme.util.Utils;
import com.mapswithme.util.statistics.AlohaHelper;
import com.mapswithme.util.statistics.Statistics;
import java.text.DateFormat;
import java.util.Calendar;
import java.util.concurrent.TimeUnit;
public class NavigationController
{
private final View mFrame;
private final View mBottomFrame;
private final NavMenu mNavMenu;
private final TextView mDistanceTotal;
private final TextView mTimeTotal;
private final ImageView mTurnDirection;
private final TextView mExitNumber;
private final View mNextTurnFrame;
private final ImageView mNextTurnImage;
private final TextView mNextTurnDistance;
private final TextView mCircleExit;
private final TextView mDistanceTurn;
private final FlatProgressView mRouteProgress;
private final View mNextNextTurnFrame;
private final ImageView mNextNextTurnImage;
private final View mStreetFrame;
private final TextView mNextStreet;
private final TextView mTimeArrival;
private final TextView mSpeedValue;
private final TextView mSpeedUnits;
private final TextView mTimeHourValue;
private final TextView mTimeHourUnits;
private final TextView mTimeMinuteValue;
private final TextView mTimeMinuteUnits;
private final ImageView mDotTimeLeft;
private final ImageView mDotTimeArrival;
private final TextView mDistanceValue;
private final TextView mDistanceUnits;
private final FlatProgressView mRouteProgress;
private boolean mShowTimeLeft = true;
private double mNorth;
public NavigationController(Activity activity)
{
mFrame = activity.findViewById(R.id.navigation_frame);
mDistanceTotal = (TextView) mFrame.findViewById(R.id.tv__total_distance);
mTimeTotal = (TextView) mFrame.findViewById(R.id.tv__total_time);
mTimeArrival = (TextView) mFrame.findViewById(R.id.tv__arrival_time);
mTurnDirection = (ImageView) mFrame.findViewById(R.id.iv__turn);
mExitNumber = (TextView) mFrame.findViewById(R.id.tv__exit_num);
mDistanceTurn = (TextView) mFrame.findViewById(R.id.tv__turn_distance);
mRouteProgress = (FlatProgressView) mFrame.findViewById(R.id.fp__route_progress);
mNextStreet = (TextView) mFrame.findViewById(R.id.tv__next_street);
mFrame.findViewById(R.id.btn__close).setOnClickListener(new View.OnClickListener()
mBottomFrame = mFrame.findViewById(R.id.nav_bottom_frame);
mBottomFrame.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
AlohaHelper.logClick(AlohaHelper.ROUTING_CLOSE);
Statistics.INSTANCE.trackEvent(Statistics.EventName.ROUTING_CLOSE);
RoutingController.get().cancel();
switchTimeFormat();
}
});
mNavMenu = createNavMenu();
mNavMenu.refreshTts();
mNextTurnFrame = mFrame.findViewById(R.id.next_turn_frame);
mNextTurnImage = (ImageView) mNextTurnFrame.findViewById(R.id.iv__next_turn);
// Top frame
View topFrame = mFrame.findViewById(R.id.nav_top_frame);
View turnFrame = topFrame.findViewById(R.id.nav_next_turn_frame);
mNextTurnImage = (ImageView) turnFrame.findViewById(R.id.turn);
mNextTurnDistance = (TextView) turnFrame.findViewById(R.id.distance);
mCircleExit = (TextView) turnFrame.findViewById(R.id.circle_exit);
mNextNextTurnFrame = topFrame.findViewById(R.id.nav_next_next_turn_frame);
mNextNextTurnImage = (ImageView) mNextNextTurnFrame.findViewById(R.id.turn);
mStreetFrame = topFrame.findViewById(R.id.street_frame);
mNextStreet = (TextView) mStreetFrame.findViewById(R.id.street);
View shadow = topFrame.findViewById(R.id.shadow_top);
UiUtils.showIf(Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP, shadow);
// Bottom frame
mSpeedValue = (TextView) mBottomFrame.findViewById(R.id.speed_value);
mSpeedUnits = (TextView) mBottomFrame.findViewById(R.id.speed_dimen);
mTimeHourValue = (TextView) mBottomFrame.findViewById(R.id.time_hour_value);
mTimeHourUnits = (TextView) mBottomFrame.findViewById(R.id.time_hour_dimen);
mTimeMinuteValue = (TextView) mBottomFrame.findViewById(R.id.time_minute_value);
mTimeMinuteUnits = (TextView) mBottomFrame.findViewById(R.id.time_minute_dimen);
mDotTimeArrival = (ImageView) mBottomFrame.findViewById(R.id.dot_estimate);
mDotTimeLeft = (ImageView) mBottomFrame.findViewById(R.id.dot_left);
mDistanceValue = (TextView) mBottomFrame.findViewById(R.id.distance_value);
mDistanceUnits = (TextView) mBottomFrame.findViewById(R.id.distance_dimen);
mRouteProgress = (FlatProgressView) mBottomFrame.findViewById(R.id.navigation_progress);
}
private NavMenu createNavMenu()
{
return new NavMenu(mBottomFrame, new NavMenu.ItemClickListener<NavMenu.Item>()
{
@Override
public void onItemClick(NavMenu.Item item)
{
final MwmActivity parent = ((MwmActivity) mFrame.getContext());
switch (item)
{
case STOP:
RoutingController.get().cancel();
Statistics.INSTANCE.trackEvent(Statistics.EventName.ROUTING_CLOSE);
AlohaHelper.logClick(AlohaHelper.ROUTING_CLOSE);
parent.refreshFade();
break;
case SETTINGS:
parent.closeMenu(Statistics.EventName.ROUTING_SETTINGS, AlohaHelper.MENU_SETTINGS, new Runnable()
{
@Override
public void run()
{
parent.startActivity(new Intent(parent, SettingsActivity.class));
}
});
break;
case TTS_VOLUME:
TtsPlayer.setEnabled(!TtsPlayer.isEnabled());
mNavMenu.refreshTts();
Statistics.INSTANCE.trackEvent(Statistics.EventName.ROUTING_CLOSE);
AlohaHelper.logClick(AlohaHelper.ROUTING_CLOSE);
break;
case TOGGLE:
mNavMenu.toggle(true);
parent.refreshFade();
}
}
});
}
private void updateVehicle(RoutingInfo info)
{
mDistanceTurn.setText(Utils.formatUnitsText(R.dimen.text_size_display_1, R.dimen.text_size_toolbar,
info.distToTurn, info.turnUnits));
info.vehicleTurnDirection.setTurnDrawable(mTurnDirection);
mNextTurnDistance.setText(Utils.formatUnitsText(mFrame.getContext(),
R.dimen.text_size_nav_number,
R.dimen.text_size_nav_dimension,
info.distToTurn,
info.turnUnits));
info.vehicleTurnDirection.setTurnDrawable(mNextTurnImage);
if (RoutingInfo.VehicleTurnDirection.isRoundAbout(info.vehicleTurnDirection))
UiUtils.setTextAndShow(mExitNumber, String.valueOf(info.exitNum));
UiUtils.setTextAndShow(mCircleExit, String.valueOf(info.exitNum));
else
UiUtils.hide(mExitNumber);
UiUtils.hide(mCircleExit);
UiUtils.showIf(info.vehicleNextTurnDirection.containsNextTurn(), mNextNextTurnFrame);
if (info.vehicleNextTurnDirection.containsNextTurn())
{
Animations.appearSliding(mNextTurnFrame, Animations.TOP, null);
info.vehicleNextTurnDirection.setNextTurnDrawable(mNextTurnImage);
}
else
Animations.disappearSliding(mNextTurnFrame, Animations.BOTTOM, null);
info.vehicleNextTurnDirection.setNextTurnDrawable(mNextNextTurnImage);
}
private void updatePedestrian(RoutingInfo info)
@ -91,10 +171,13 @@ public class NavigationController
location.getLatitude(), location.getLongitude(),
mNorth);
String[] splitDistance = da.getDistance().split(" ");
mDistanceTurn.setText(Utils.formatUnitsText(R.dimen.text_size_display_1, R.dimen.text_size_toolbar,
splitDistance[0], splitDistance[1]));
mNextTurnDistance.setText(Utils.formatUnitsText(mFrame.getContext(),
R.dimen.text_size_nav_number,
R.dimen.text_size_nav_dimension,
splitDistance[0],
splitDistance[1]));
if (info.pedestrianTurnDirection != null)
RoutingInfo.PedestrianTurnDirection.setTurnDrawable(mTurnDirection, da);
RoutingInfo.PedestrianTurnDirection.setTurnDrawable(mNextTurnImage, da);
}
public void updateNorth(double north)
@ -116,18 +199,75 @@ public class NavigationController
else
updateVehicle(info);
mTimeTotal.setText(RoutingController.formatRoutingTime(info.totalTimeInSeconds, R.dimen.text_size_routing_dimension));
mDistanceTotal.setText(Utils.formatUnitsText(R.dimen.text_size_routing_number, R.dimen.text_size_routing_dimension,
info.distToTarget, info.targetUnits));
mTimeArrival.setText(RoutingController.formatArrivalTime(info.totalTimeInSeconds));
UiUtils.setTextAndHideIfEmpty(mNextStreet, info.nextStreet);
boolean hasStreet = !TextUtils.isEmpty(info.nextStreet);
UiUtils.showIf(hasStreet, mStreetFrame);
if (!TextUtils.isEmpty(info.nextStreet))
mNextStreet.setText(info.nextStreet);
final Location last = LocationHelper.INSTANCE.getLastKnownLocation();
if (last != null)
{
Pair<String, String> speedAndUnits = StringUtils.nativeFormatSpeedAndUnits(last.getSpeed());
mSpeedValue.setText(speedAndUnits.first);
mSpeedUnits.setText(speedAndUnits.second);
}
updateTime(info.totalTimeInSeconds);
mDistanceValue.setText(info.distToTarget);
mDistanceUnits.setText(info.targetUnits);
mRouteProgress.setProgress((int) info.completionPercent);
}
private void updateTime(int seconds)
{
if (mShowTimeLeft)
updateTimeLeft(seconds);
else
updateTimeEstimate(seconds);
mDotTimeLeft.setEnabled(mShowTimeLeft);
mDotTimeArrival.setEnabled(!mShowTimeLeft);
}
private void updateTimeLeft(int seconds)
{
final long hours = TimeUnit.SECONDS.toHours(seconds);
final long minutes = TimeUnit.SECONDS.toMinutes(seconds) % 60;
UiUtils.setTextAndShow(mTimeMinuteValue, String.valueOf(minutes));
// TODO set localized text
UiUtils.setTextAndShow(mTimeMinuteUnits, "min");
if (hours == 0)
{
UiUtils.hide(mTimeHourUnits, mTimeHourValue);
return;
}
UiUtils.setTextAndShow(mTimeHourValue,String.valueOf(hours));
// TODO set localized text
UiUtils.setTextAndShow(mTimeHourUnits, "h");
}
private void updateTimeEstimate(int seconds)
{
final Calendar currentTime = Calendar.getInstance();
currentTime.add(Calendar.SECOND, seconds);
UiUtils.setTextAndShow(mTimeMinuteValue, DateFormat.getTimeInstance(DateFormat.SHORT)
.format(currentTime.getTime()));
UiUtils.hide(mTimeHourUnits, mTimeHourValue, mTimeMinuteUnits);
}
private void switchTimeFormat()
{
mShowTimeLeft = !mShowTimeLeft;
updateTime(Framework.nativeGetRouteFollowingInfo().totalTimeInSeconds);
}
public void show(boolean show)
{
UiUtils.showIf(show, mFrame);
if (!show)
UiUtils.hide(mNextTurnFrame);
mNavMenu.show(show);
}
public NavMenu getNavMenu()
{
return mNavMenu;
}
}

View file

@ -1,6 +1,7 @@
package com.mapswithme.maps.routing;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.support.annotation.DimenRes;
import android.support.annotation.IntRange;
@ -401,7 +402,7 @@ public class RoutingController
UiUtils.updateAccentButton(mStartButton);
}
public void setStartButton(@Nullable Button button)
void setStartButton(@Nullable Button button)
{
mLogger.d("setStartButton");
mStartButton = button;
@ -487,22 +488,22 @@ public class RoutingController
return (mWaitingPoiPickSlot != NO_SLOT);
}
public BuildState getBuildState()
BuildState getBuildState()
{
return mBuildState;
}
public MapObject getStartPoint()
MapObject getStartPoint()
{
return mStartPoint;
}
public MapObject getEndPoint()
MapObject getEndPoint()
{
return mEndPoint;
}
public RoutingInfo getCachedRoutingInfo()
RoutingInfo getCachedRoutingInfo()
{
return mCachedRoutingInfo;
}
@ -639,7 +640,7 @@ public class RoutingController
return true;
}
public void swapPoints()
void swapPoints()
{
mLogger.d("swapPoints");
@ -654,7 +655,7 @@ public class RoutingController
checkAndBuildRoute();
}
public void setRouterType(@Framework.RouterType int router)
void setRouterType(@Framework.RouterType int router)
{
mLogger.d("setRouterType: " + mLastRouterType + " -> " + router);
@ -668,7 +669,7 @@ public class RoutingController
build();
}
public void searchPoi(int slotId)
void searchPoi(int slotId)
{
mLogger.d("searchPoi: " + slotId);
Statistics.INSTANCE.trackEvent(Statistics.EventName.ROUTING_SEARCH_POINT);
@ -705,16 +706,16 @@ public class RoutingController
mContainer.updatePoints();
}
public static CharSequence formatRoutingTime(int seconds, @DimenRes int unitsSize)
static CharSequence formatRoutingTime(Context context, int seconds, @DimenRes int unitsSize)
{
long minutes = TimeUnit.SECONDS.toMinutes(seconds) % 60;
long hours = TimeUnit.SECONDS.toHours(seconds);
return hours == 0 ? Utils.formatUnitsText(R.dimen.text_size_routing_number, unitsSize,
return hours == 0 ? Utils.formatUnitsText(context, R.dimen.text_size_routing_number, unitsSize,
String.valueOf(minutes), "min")
: TextUtils.concat(Utils.formatUnitsText(R.dimen.text_size_routing_number, unitsSize,
: TextUtils.concat(Utils.formatUnitsText(context, R.dimen.text_size_routing_number, unitsSize,
String.valueOf(hours), "h "),
Utils.formatUnitsText(R.dimen.text_size_routing_number, unitsSize,
Utils.formatUnitsText(context, R.dimen.text_size_routing_number, unitsSize,
String.valueOf(minutes), "min"));
}

View file

@ -89,7 +89,7 @@ public class RoutingInfo
}
}
public enum PedestrianTurnDirection
enum PedestrianTurnDirection
{
NONE,
UPSTAIRS,

View file

@ -193,7 +193,7 @@ public class RoutingPlanController extends ToolbarController
return;
RoutingInfo rinfo = RoutingController.get().getCachedRoutingInfo();
mNumbersTime.setText(RoutingController.formatRoutingTime(rinfo.totalTimeInSeconds, R.dimen.text_size_routing_number));
mNumbersTime.setText(RoutingController.formatRoutingTime(mFrame.getContext(), rinfo.totalTimeInSeconds, R.dimen.text_size_routing_number));
mNumbersDistance.setText(rinfo.distToTarget + " " + rinfo.targetUnits);
if (mNumbersArrival != null)

View file

@ -158,9 +158,9 @@ public enum TtsPlayer
});
}
public boolean isReady()
private static boolean isReady()
{
return (mTts != null && !mUnavailable && !mInitializing);
return (INSTANCE.mTts != null && !INSTANCE.mUnavailable && !INSTANCE.mInitializing);
}
private void speak(String textToSpeak)
@ -202,7 +202,7 @@ public enum TtsPlayer
}
}
public boolean isEnabled()
public static boolean isEnabled()
{
return (isReady() && nativeAreTurnNotificationsEnabled());
}

View file

@ -1,7 +1,6 @@
package com.mapswithme.maps.widget;
import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.support.annotation.NonNull;
import android.util.AttributeSet;
@ -18,12 +17,23 @@ public class FadeView extends FrameLayout
private static final String PROPERTY_ALPHA = "alpha";
private static final int DURATION = MwmApplication.get().getResources().getInteger(R.integer.anim_fade_main);
private final Animator.AnimatorListener mFadeInListener = new UiUtils.SimpleAnimatorListener()
{
@Override
public void onAnimationEnd(Animator animation)
{
UiUtils.show(FadeView.this);
animation.removeListener(this);
}
};
private final Animator.AnimatorListener mFadeOutListener = new UiUtils.SimpleAnimatorListener()
{
@Override
public void onAnimationEnd(Animator animation)
{
UiUtils.hide(FadeView.this);
animation.removeListener(this);
}
};
@ -57,38 +67,31 @@ public class FadeView extends FrameLayout
public void fadeIn()
{
setAlpha(0.0f);
UiUtils.show(this);
ObjectAnimator animation = ObjectAnimator.ofFloat(this, PROPERTY_ALPHA, 0f, FADE_ALPHA_VALUE);
animation.setDuration(DURATION);
animation.start();
animate().alpha(FADE_ALPHA_VALUE)
.setDuration(DURATION)
.setListener(mFadeInListener)
.start();
}
public void fadeOut(boolean notify)
public void fadeOut()
{
if (mListener != null && notify)
{
if (!mListener.onTouch())
return;
}
ObjectAnimator animation = ObjectAnimator.ofFloat(this, PROPERTY_ALPHA, FADE_ALPHA_VALUE, 0f);
animation.addListener(mFadeOutListener);
animation.setDuration(DURATION);
animation.start();
}
public void fadeInInstantly()
{
UiUtils.show(this);
setAlpha(FADE_ALPHA_VALUE);
animate().alpha(0.0f)
.setDuration(DURATION)
.setListener(mFadeOutListener)
.start();
}
@Override
public boolean onTouchEvent(@NonNull MotionEvent event)
{
if (event.getAction() == MotionEvent.ACTION_DOWN)
fadeOut(true);
if (event.getAction() != MotionEvent.ACTION_DOWN)
return true;
if (mListener == null || mListener.onTouch())
fadeOut();
return true;
}

View file

@ -13,9 +13,14 @@ public class RotateDrawable extends Drawable
private float mAngle;
public RotateDrawable(@DrawableRes int resId)
{
this(MwmApplication.get().getResources().getDrawable(resId));
}
public RotateDrawable(Drawable drawable)
{
super();
mBaseDrawable = MwmApplication.get().getResources().getDrawable(resId);
mBaseDrawable = drawable;
}
@Override

View file

@ -0,0 +1,245 @@
package com.mapswithme.maps.widget.menu;
import android.animation.Animator;
import android.support.annotation.DimenRes;
import android.support.annotation.IdRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.View;
import com.mapswithme.maps.MwmApplication;
import com.mapswithme.maps.R;
import com.mapswithme.util.ThemeUtils;
import com.mapswithme.util.UiUtils;
public abstract class BaseMenu
{
public static final int ANIMATION_DURATION = MwmApplication.get().getResources().getInteger(R.integer.anim_menu);
private boolean mIsOpen;
private boolean mAnimating;
final View mFrame;
final View mLineFrame;
final View mContentFrame;
private final ItemClickListener mItemClickListener;
int mContentHeight;
boolean mLayoutMeasured;
public interface Item
{
@IdRes int getViewId();
}
public interface ItemClickListener<T extends Item>
{
void onItemClick(T item);
}
private class AnimationListener extends UiUtils.SimpleAnimatorListener
{
@Override
public void onAnimationStart(android.animation.Animator animation)
{
mAnimating = true;
}
@Override
public void onAnimationEnd(android.animation.Animator animation)
{
mAnimating = false;
}
}
View mapItem(final Item item, View frame)
{
View res = frame.findViewById(item.getViewId());
if (res != null)
{
res.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
//noinspection unchecked
mItemClickListener.onItemClick(item);
}
});
}
return res;
}
protected void adjustTransparency()
{
mFrame.setBackgroundColor(ThemeUtils.getColor(mFrame.getContext(), isOpen() ? R.attr.menuBackgroundOpen
: R.attr.menuBackground));
}
void afterLayoutMeasured(@Nullable Runnable procAfterCorrection)
{
if (procAfterCorrection != null)
procAfterCorrection.run();
}
void measureContent(@Nullable final Runnable procAfterMeasurement)
{
if (mLayoutMeasured)
return;
UiUtils.measureView(mContentFrame, new UiUtils.OnViewMeasuredListener()
{
@Override
public void onViewMeasured(int width, int height)
{
if (height != 0)
{
mContentHeight = height;
mLayoutMeasured = true;
UiUtils.hide(mContentFrame);
}
afterLayoutMeasured(procAfterMeasurement);
}
});
}
public void onResume(@Nullable Runnable procAfterMeasurement)
{
measureContent(procAfterMeasurement);
updateMarker();
}
BaseMenu(@NonNull View frame, @NonNull ItemClickListener<? extends Item> itemClickListener)
{
mFrame = frame;
mItemClickListener = itemClickListener;
mLineFrame = mFrame.findViewById(R.id.line_frame);
mContentFrame = mFrame.findViewById(R.id.content_frame);
adjustTransparency();
}
public boolean isOpen()
{
return mIsOpen;
}
public boolean isAnimating()
{
return mAnimating;
}
public boolean open(boolean animate)
{
if ((animate && mAnimating) || isOpen())
return false;
mIsOpen = true;
UiUtils.show(mContentFrame);
adjustCollapsedItems();
adjustTransparency();
updateMarker();
setToggleState(mIsOpen, animate);
if (!animate)
return true;
mFrame.setTranslationY(mContentHeight);
mFrame.animate()
.setDuration(ANIMATION_DURATION)
.translationY(0.0f)
.setListener(new AnimationListener())
.start();
return true;
}
public boolean close(boolean animate)
{
return close(animate, null);
}
public boolean close(boolean animate, @Nullable final Runnable onCloseListener)
{
if (mAnimating || !isOpen())
{
if (onCloseListener != null)
onCloseListener.run();
return false;
}
mIsOpen = false;
adjustCollapsedItems();
setToggleState(mIsOpen, animate);
if (!animate)
{
UiUtils.hide(mContentFrame);
adjustTransparency();
updateMarker();
if (onCloseListener != null)
onCloseListener.run();
return true;
}
mFrame.animate()
.setDuration(ANIMATION_DURATION)
.translationY(mContentHeight)
.setListener(new AnimationListener()
{
@Override
public void onAnimationEnd(Animator animation)
{
super.onAnimationEnd(animation);
mFrame.setTranslationY(0.0f);
UiUtils.hide(mContentFrame);
adjustTransparency();
updateMarker();
if (onCloseListener != null)
onCloseListener.run();
}
}).start();
return true;
}
public void toggle(boolean animate)
{
if (mAnimating)
return;
boolean show = !isOpen();
if (show)
open(animate);
else
close(animate);
}
public void show(boolean show)
{
close(false);
UiUtils.showIf(show, mFrame);
}
public View getFrame()
{
return mFrame;
}
protected void adjustCollapsedItems() {}
protected void updateMarker() {}
protected void setToggleState(boolean open, boolean animate) {}
protected abstract @DimenRes int getHeightResId();
}

View file

@ -1,16 +1,8 @@
package com.mapswithme.maps.widget.menu;
import android.animation.Animator;
import android.app.Activity;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.TransitionDrawable;
import android.support.annotation.Nullable;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.util.ArrayList;
@ -18,20 +10,16 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.mapswithme.maps.Framework;
import com.mapswithme.maps.MwmActivity;
import com.mapswithme.maps.MwmApplication;
import com.mapswithme.maps.R;
import com.mapswithme.maps.downloader.MapManager;
import com.mapswithme.maps.downloader.UpdateInfo;
import com.mapswithme.maps.routing.RoutingInfo;
import com.mapswithme.maps.widget.RotateByAlphaDrawable;
import com.mapswithme.maps.widget.TrackedTransitionDrawable;
import com.mapswithme.maps.routing.RoutingController;
import com.mapswithme.util.Graphics;
import com.mapswithme.util.ThemeUtils;
import com.mapswithme.util.UiUtils;
public class MainMenu
public class MainMenu extends BaseMenu
{
public enum State
{
@ -52,39 +40,29 @@ public class MainMenu
}
}
public static final int ANIMATION_DURATION = MwmApplication.get().getResources().getInteger(R.integer.anim_menu);
private static final String TAG_COLLAPSE = MwmApplication.get().getString(R.string.tag_menu_collapse);
private final int mButtonsWidth = UiUtils.dimen(R.dimen.menu_line_button_width);
private final int mPanelWidth = UiUtils.dimen(R.dimen.panel_width);
private final Container mContainer;
private final ViewGroup mFrame;
private final View mButtonsFrame;
private final View mNavigationFrame;
private final View mRoutePlanFrame;
private final View mContentFrame;
private final View mAnimationSpacer;
private final View mAnimationSymmetricalGap;
private final View mNewsMarker;
private final TextView mCurrentPlace;
private final TextView mNewsCounter;
private boolean mCollapsed;
private final List<View> mCollapseViews = new ArrayList<>();
private final MyPositionButton mMyPositionButton;
private final Toggle mToggle;
private final MenuToggle mToggle;
private Button mRouteStartButton;
private int mContentHeight;
// Maps Item into button view placed on mContentFrame
private final Map<Item, View> mItemViews = new HashMap<>();
private boolean mAnimating;
private final MwmActivity.LeftAnimationTrackListener mAnimationTrackListener = new MwmActivity.LeftAnimationTrackListener()
{
private float mSymmetricalGapScale;
@ -135,7 +113,7 @@ public class MainMenu
}
};
public enum Item
public enum Item implements BaseMenu.Item
{
TOGGLE(R.id.toggle),
ADD_PLACE(R.id.add_place),
@ -153,113 +131,25 @@ public class MainMenu
{
mViewId = viewId;
}
}
public interface Container
{
Activity getActivity();
void onItemClick(Item item);
}
private class AnimationListener extends UiUtils.SimpleAnimatorListener
{
@Override
public void onAnimationStart(android.animation.Animator animation)
{
mAnimating = true;
}
@Override
public void onAnimationEnd(android.animation.Animator animation)
public int getViewId()
{
mAnimating = false;
return mViewId;
}
}
private class Toggle
@Override
View mapItem(BaseMenu.Item item, View frame)
{
final ImageView mButton;
final boolean mAlwaysShow;
View res = super.mapItem(item, frame);
if (res != null && TAG_COLLAPSE.equals(res.getTag()))
mCollapseViews.add(res);
final TransitionDrawable mOpenImage;
final TransitionDrawable mCollapseImage;
public Toggle(View frame)
{
mButton = (ImageView) frame.findViewById(R.id.toggle);
mAlwaysShow = (mFrame.findViewById(R.id.disable_toggle) == null);
mapItem(Item.TOGGLE, frame);
int sz = UiUtils.dimen(R.dimen.menu_line_height);
Rect bounds = new Rect(0, 0, sz, sz);
mOpenImage = new TrackedTransitionDrawable(new Drawable[] { new RotateByAlphaDrawable(frame.getContext(), R.drawable.ic_menu_open, R.attr.iconTint, false)
.setInnerBounds(bounds),
new RotateByAlphaDrawable(frame.getContext(), R.drawable.ic_menu_close, R.attr.iconTintLight, true)
.setInnerBounds(bounds)
.setBaseAngle(-90) });
mCollapseImage = new TrackedTransitionDrawable(new Drawable[] { new RotateByAlphaDrawable(frame.getContext(), R.drawable.ic_menu_open, R.attr.iconTint, false)
.setInnerBounds(bounds),
new RotateByAlphaDrawable(frame.getContext(), R.drawable.ic_menu_close, R.attr.iconTintLight, true)
.setInnerBounds(bounds) });
mOpenImage.setCrossFadeEnabled(true);
mCollapseImage.setCrossFadeEnabled(true);
}
public void setState(State state, boolean animate)
{
UiUtils.showIf(mAlwaysShow || state.showToggle(), mButton);
setCollapsed(mCollapsed, animate);
}
private void transitImage(TransitionDrawable image, boolean forward, boolean animate)
{
if (!UiUtils.isVisible(mButton))
animate = false;
mButton.setImageDrawable(image);
if (forward)
image.startTransition(animate ? ANIMATION_DURATION : 0);
else
image.reverseTransition(animate ? ANIMATION_DURATION : 0);
if (!animate)
image.getDrawable(forward ? 1 : 0).setAlpha(0xFF);
}
public void setOpen(boolean open, boolean animate)
{
transitImage(mOpenImage, open, animate);
}
public void setCollapsed(boolean collapse, boolean animate)
{
transitImage(mCollapseImage, collapse, animate);
}
}
private View mapItem(final Item item, View frame)
{
View res = frame.findViewById(item.mViewId);
if (res != null)
{
if (TAG_COLLAPSE.equals(res.getTag()))
mCollapseViews.add(res);
res.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
mContainer.onItemClick(item);
}
});
}
return res;
}
private void mapItem(Item item)
private void mapItem(MainMenu.Item item)
{
mapItem(item, mButtonsFrame);
View view = mapItem(item, mContentFrame);
@ -269,7 +159,8 @@ public class MainMenu
Graphics.tint((TextView)view);
}
private void adjustCollapsedItems()
@Override
protected void adjustCollapsedItems()
{
for (View v : mCollapseViews)
{
@ -280,44 +171,20 @@ public class MainMenu
if (mAnimationSymmetricalGap == null)
return;
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mAnimationSymmetricalGap.getLayoutParams();
ViewGroup.LayoutParams lp = mAnimationSymmetricalGap.getLayoutParams();
lp.width = (mCollapsed ? 0 : mButtonsWidth);
mAnimationSymmetricalGap.setLayoutParams(lp);
}
private void adjustTransparency()
@Override
void afterLayoutMeasured(Runnable procAfterCorrection)
{
mFrame.setBackgroundColor(ThemeUtils.getColor(mFrame.getContext(), isOpen() ? R.attr.menuBackgroundOpen
: R.attr.menuBackgroundClosed));
UiUtils.showIf(!RoutingController.get().isNavigating(), mFrame);
super.afterLayoutMeasured(procAfterCorrection);
}
private boolean isLayoutCorrected()
{
return UiUtils.isVisible(mFrame);
}
private void correctLayout(@Nullable final Runnable procAfterCorrection)
{
if (isLayoutCorrected())
return;
UiUtils.measureView(mContentFrame, new UiUtils.OnViewMeasuredListener()
{
@Override
public void onViewMeasured(int width, int height)
{
mContentHeight = height;
UiUtils.hide(mContentFrame);
UiUtils.show(mFrame);
if (procAfterCorrection != null)
procAfterCorrection.run();
}
});
}
private void updateMarker()
@Override
protected void updateMarker()
{
UpdateInfo info = MapManager.nativeGetUpdateInfo(null);
int count = (info == null ? 0 : info.filesCount);
@ -333,21 +200,10 @@ public class MainMenu
mNewsCounter.setText(String.valueOf(count));
}
public void onResume(@Nullable Runnable procAfterCorrection)
@Override
protected void setToggleState(boolean open, boolean animate)
{
correctLayout(procAfterCorrection);
updateMarker();
}
public void updateRoutingInfo(RoutingInfo info)
{
if (info != null)
updateRoutingInfo(info.currentStreet);
}
private void updateRoutingInfo(String info)
{
mCurrentPlace.setText(info);
mToggle.setOpen(open, animate);
}
private void init()
@ -362,28 +218,22 @@ public class MainMenu
mapItem(Item.SHOWCASE);
adjustCollapsedItems();
adjustTransparency();
setState(State.MENU, false);
}
public MainMenu(MwmActivity activity, ViewGroup frame, Container container)
public MainMenu(View frame, ItemClickListener<Item> itemClickListener)
{
mContainer = container;
mFrame = frame;
super(frame, itemClickListener);
View lineFrame = mFrame.findViewById(R.id.line_frame);
mButtonsFrame = lineFrame.findViewById(R.id.buttons_frame);
mNavigationFrame = lineFrame.findViewById(R.id.navigation_frame);
mRoutePlanFrame = lineFrame.findViewById(R.id.routing_plan_frame);
mContentFrame = mFrame.findViewById(R.id.content_frame);
mButtonsFrame = mLineFrame.findViewById(R.id.buttons_frame);
mRoutePlanFrame = mLineFrame.findViewById(R.id.routing_plan_frame);
mAnimationSpacer = mFrame.findViewById(R.id.animation_spacer);
mAnimationSymmetricalGap = mButtonsFrame.findViewById(R.id.symmetrical_gap);
mCurrentPlace = (TextView) mNavigationFrame.findViewById(R.id.current_place);
mMyPositionButton = new MyPositionButton(lineFrame.findViewById(R.id.my_position));
mToggle = new Toggle(lineFrame);
mMyPositionButton = new MyPositionButton(mLineFrame.findViewById(R.id.my_position));
mToggle = new MenuToggle(mLineFrame, getHeightResId());
mapItem(Item.TOGGLE, mLineFrame);
mNewsMarker = mButtonsFrame.findViewById(R.id.marker);
mNewsCounter = (TextView) mContentFrame.findViewById(R.id.counter);
@ -394,144 +244,45 @@ public class MainMenu
init();
}
@Override
protected int getHeightResId()
{
return R.dimen.menu_line_height;
}
public void setState(State state, boolean animateToggle)
{
mToggle.setState(state, animateToggle);
if (state != State.NAVIGATION)
{
mToggle.show(state.showToggle());
mToggle.setCollapsed(mCollapsed, animateToggle);
boolean expandContent;
boolean isRouting = state == State.NAVIGATION ||
state == State.ROUTE_PREPARE;
if (mRoutePlanFrame == null)
{
UiUtils.showIf(state != State.NAVIGATION, mButtonsFrame);
expandContent = false;
}
else
{
UiUtils.showIf(state == State.MENU, mButtonsFrame);
UiUtils.showIf(state == State.ROUTE_PREPARE, mRoutePlanFrame);
expandContent = isRouting;
boolean expandContent;
boolean isRouting = state == State.ROUTE_PREPARE;
if (mRoutePlanFrame == null)
{
UiUtils.show(mButtonsFrame);
expandContent = false;
} else
{
UiUtils.showIf(state == State.MENU, mButtonsFrame);
UiUtils.showIf(state == State.ROUTE_PREPARE, mRoutePlanFrame);
expandContent = isRouting;
}
UiUtils.showIf(expandContent,
mItemViews.get(Item.SEARCH),
mItemViews.get(Item.BOOKMARKS));
setVisible(Item.ADD_PLACE, !isRouting && !MapManager.nativeIsLegacyMode());
}
UiUtils.showIf(state == State.NAVIGATION, mNavigationFrame);
UiUtils.showIf(expandContent,
mItemViews.get(Item.SEARCH),
mItemViews.get(Item.BOOKMARKS));
setVisible(Item.ADD_PLACE, !isRouting && !MapManager.nativeIsLegacyMode());
if (isLayoutCorrected())
if (mLayoutMeasured)
{
show(state != State.NAVIGATION);
mContentFrame.measure(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
mContentHeight = mContentFrame.getMeasuredHeight();
}
if (state == State.NAVIGATION)
updateRoutingInfo(Framework.nativeGetRouteFollowingInfo());
}
public boolean isOpen()
{
return UiUtils.isVisible(mContentFrame);
}
public boolean open(boolean animate)
{
if ((animate && mAnimating) || isOpen())
return false;
UiUtils.show(mContentFrame);
adjustCollapsedItems();
adjustTransparency();
updateMarker();
mToggle.setOpen(true, animate);
if (!animate)
return true;
mFrame.setTranslationY(mContentHeight);
mFrame.animate()
.setDuration(ANIMATION_DURATION)
.translationY(0.0f)
.setListener(new AnimationListener())
.start();
return true;
}
public boolean close(boolean animate)
{
return close(animate, null);
}
public boolean close(boolean animate, @Nullable final Runnable onCloseListener)
{
if (mAnimating || !isOpen())
{
if (onCloseListener != null)
onCloseListener.run();
return false;
}
adjustCollapsedItems();
if (!animate)
{
UiUtils.hide(mContentFrame);
adjustTransparency();
updateMarker();
mToggle.setOpen(false, false);
if (onCloseListener != null)
onCloseListener.run();
return true;
}
mToggle.setOpen(false, true);
mFrame.animate()
.setDuration(ANIMATION_DURATION)
.translationY(mContentHeight)
.setListener(new AnimationListener()
{
@Override
public void onAnimationEnd(Animator animation)
{
super.onAnimationEnd(animation);
mFrame.setTranslationY(0.0f);
UiUtils.hide(mContentFrame);
adjustTransparency();
updateMarker();
if (onCloseListener != null)
onCloseListener.run();
}
}).start();
return true;
}
public void toggle(boolean animate)
{
if (mAnimating)
return;
boolean show = !isOpen();
if (show)
open(animate);
else
close(animate);
}
public void show(boolean show)
{
close(false);
UiUtils.showIf(show, mFrame);
}
public void setEnabled(Item item, boolean enable)
@ -553,10 +304,6 @@ public class MainMenu
UiUtils.showIf(show, mItemViews.get(item));
}
public View getFrame()
{
return mFrame;
}
public MyPositionButton getMyPositionButton()
{
@ -577,9 +324,4 @@ public class MainMenu
{
return mRouteStartButton;
}
public boolean isAnimating()
{
return mAnimating;
}
}

View file

@ -0,0 +1,82 @@
package com.mapswithme.maps.widget.menu;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.TransitionDrawable;
import android.support.annotation.DimenRes;
import android.support.annotation.DrawableRes;
import android.view.View;
import android.widget.ImageView;
import com.mapswithme.maps.R;
import com.mapswithme.maps.widget.RotateByAlphaDrawable;
import com.mapswithme.maps.widget.TrackedTransitionDrawable;
import com.mapswithme.util.UiUtils;
class MenuToggle
{
private final ImageView mButton;
private final boolean mAlwaysShow;
private final TransitionDrawable mOpenImage;
private final TransitionDrawable mCollapseImage;
MenuToggle(View frame, @DimenRes int heightRes)
{
this(frame, heightRes, R.drawable.ic_menu_open, R.drawable.ic_menu_close);
}
MenuToggle(View frame, @DimenRes int heightRes, @DrawableRes int src, @DrawableRes int dst)
{
mButton = (ImageView) frame.findViewById(R.id.toggle);
mAlwaysShow = (frame.findViewById(R.id.disable_toggle) == null);
int sz = UiUtils.dimen(heightRes);
Rect bounds = new Rect(0, 0, sz, sz);
mOpenImage = new TrackedTransitionDrawable(new Drawable[]{
new RotateByAlphaDrawable(frame.getContext(), src, R.attr.iconTint, false)
.setInnerBounds(bounds),
new RotateByAlphaDrawable(frame.getContext(), dst, R.attr.iconTintLight, true)
.setInnerBounds(bounds)
.setBaseAngle(-90)});
mCollapseImage = new TrackedTransitionDrawable(new Drawable[]{
new RotateByAlphaDrawable(frame.getContext(), src, R.attr.iconTint, false)
.setInnerBounds(bounds),
new RotateByAlphaDrawable(frame.getContext(), dst, R.attr.iconTintLight, true)
.setInnerBounds(bounds)});
mOpenImage.setCrossFadeEnabled(true);
mCollapseImage.setCrossFadeEnabled(true);
}
private void transitImage(TransitionDrawable image, boolean forward, boolean animate)
{
if (!UiUtils.isVisible(mButton))
animate = false;
mButton.setImageDrawable(image);
if (forward)
image.startTransition(animate ? BaseMenu.ANIMATION_DURATION : 0);
else
image.reverseTransition(animate ? BaseMenu.ANIMATION_DURATION : 0);
if (!animate)
image.getDrawable(forward ? 1 : 0).setAlpha(0xFF);
}
void show(boolean show)
{
UiUtils.showIf(mAlwaysShow || show, mButton);
}
void setOpen(boolean open, boolean animate)
{
transitImage(mOpenImage, open, animate);
}
void setCollapsed(boolean collapse, boolean animate)
{
transitImage(mCollapseImage, collapse, animate);
}
}

View file

@ -0,0 +1,114 @@
package com.mapswithme.maps.widget.menu;
import android.animation.ValueAnimator;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import com.mapswithme.maps.R;
import com.mapswithme.maps.sound.TtsPlayer;
import com.mapswithme.maps.widget.RotateDrawable;
import com.mapswithme.util.Graphics;
import com.mapswithme.util.UiUtils;
public class NavMenu extends BaseMenu
{
private final RotateDrawable mToggleImage;
private final ImageView mTts;
public enum Item implements BaseMenu.Item
{
TOGGLE(R.id.toggle),
TTS_VOLUME(R.id.tts_volume),
STOP(R.id.stop),
SETTINGS(R.id.settings);
private final int mViewId;
Item(int viewId)
{
mViewId = viewId;
}
@Override
public int getViewId()
{
return mViewId;
}
}
public NavMenu(View frame, ItemClickListener<Item> listener)
{
super(frame, listener);
mToggleImage = new RotateDrawable(Graphics.tint(mFrame.getContext(), R.drawable.ic_menu_close, R.attr.iconTintLight));
ImageView toggle = (ImageView) mLineFrame.findViewById(R.id.toggle);
toggle.setImageDrawable(mToggleImage);
setToggleState(false, false);
mapItem(Item.TOGGLE, mLineFrame);
Button stop = (Button) mapItem(Item.STOP, mFrame);
UiUtils.updateRedButton(stop);
mapItem(Item.SETTINGS, mFrame);
mTts = (ImageView) mapItem(Item.TTS_VOLUME, mFrame);
}
@Override
public void onResume(@Nullable Runnable procAfterMeasurement)
{
super.onResume(procAfterMeasurement);
refreshTts();
}
public void refreshTts()
{
mTts.setImageDrawable(TtsPlayer.isEnabled() ? Graphics.tint(mFrame.getContext(), R.drawable.ic_voice_on,
R.attr.colorAccent)
: Graphics.tint(mFrame.getContext(), R.drawable.ic_voice_off));
}
@Override
protected void setToggleState(boolean open, boolean animate)
{
final float to = open ? -90.0f : 90.0f;
if (!animate)
{
mToggleImage.setAngle(to);
return;
}
final float from = -to;
ValueAnimator animator = ValueAnimator.ofFloat(from, to);
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener()
{
@Override
public void onAnimationUpdate(ValueAnimator animation)
{
mToggleImage.setAngle((float) animation.getAnimatedValue());
}
});
animator.setDuration(ANIMATION_DURATION);
animator.start();
}
@Override
protected int getHeightResId()
{
return R.dimen.nav_menu_height;
}
@Override
protected void adjustTransparency() {}
@Override
public void show(boolean show)
{
super.show(show);
measureContent(null);
}
}

View file

@ -2,6 +2,7 @@ package com.mapswithme.util;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Pair;
import java.util.Locale;
@ -20,6 +21,8 @@ public class StringUtils
public static native boolean nativeContainsNormalized(String str, String substr);
public static native String[] nativeFilterContainsNormalized(String[] strings, String substr);
public static native Pair<String, String> nativeFormatSpeedAndUnits(double metersPerSecond);
/**
* Removes html tags, generated from edittext content after it's transformed to html.
* In version 4.3.1 we converted descriptions, entered by users, to html automatically. Later html conversion was cancelled, but those converted descriptions should be converted back to

View file

@ -272,7 +272,12 @@ public final class UiUtils
public static int dimen(@DimenRes int id)
{
return MwmApplication.get().getResources().getDimensionPixelSize(id);
return dimen(MwmApplication.get(), id);
}
public static int dimen(Context context, @DimenRes int id)
{
return context.getResources().getDimensionPixelSize(id);
}
public static int toPx(int dp)
@ -289,6 +294,12 @@ public final class UiUtils
: R.attr.buttonTextColorDisabled));
}
public static void updateRedButton(Button button)
{
button.setTextColor(ThemeUtils.getColor(button.getContext(), button.isEnabled() ? R.attr.redButtonTextColor
: R.attr.redButtonTextColorDisabled));
}
public static void updateAccentButton(Button button)
{
button.setTextColor(ThemeUtils.getColor(button.getContext(), button.isEnabled() ? R.attr.accentButtonTextColor

View file

@ -26,6 +26,12 @@ import android.util.Log;
import android.view.Window;
import android.widget.Toast;
import com.mapswithme.maps.BuildConfig;
import com.mapswithme.maps.MwmApplication;
import com.mapswithme.maps.R;
import com.mapswithme.maps.activity.CustomNavigateUpListener;
import com.mapswithme.util.statistics.AlohaHelper;
import java.io.Closeable;
import java.io.File;
import java.io.FileWriter;
@ -35,12 +41,6 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
import com.mapswithme.maps.BuildConfig;
import com.mapswithme.maps.MwmApplication;
import com.mapswithme.maps.R;
import com.mapswithme.maps.activity.CustomNavigateUpListener;
import com.mapswithme.util.statistics.AlohaHelper;
public class Utils
{
private static final String TAG = "Utils";
@ -340,11 +340,11 @@ public class Utils
NavUtils.navigateUpTo(activity, intent);
}
public static SpannableStringBuilder formatUnitsText(@DimenRes int size, @DimenRes int units, String dimension, String unitText)
public static SpannableStringBuilder formatUnitsText(Context context, @DimenRes int size, @DimenRes int units, String dimension, String unitText)
{
final SpannableStringBuilder res = new SpannableStringBuilder(dimension).append(" ").append(unitText);
res.setSpan(new AbsoluteSizeSpan(UiUtils.dimen(size), false), 0, dimension.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
res.setSpan(new AbsoluteSizeSpan(UiUtils.dimen(units), false), dimension.length(), res.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
res.setSpan(new AbsoluteSizeSpan(UiUtils.dimen(context, size), false), 0, dimension.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
res.setSpan(new AbsoluteSizeSpan(UiUtils.dimen(context, units), false), dimension.length(), res.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
return res;
}

View file

@ -78,6 +78,7 @@ public class AlohaHelper
public static final String ROUTING_SWAP_POINTS = "routeSwapPoints";
public static final String ROUTING_TOGGLE = "routeToggle";
public static final String ROUTING_SEARCH_POINT = "routSearchPoint";
public static final String ROUTING_SETTINGS = "routingSettings";
// search
public static final String SEARCH_CANCEL = "searchCancel";
// installation

View file

@ -116,6 +116,8 @@ public enum Statistics
public static final String ROUTING_SWAP_POINTS = "Routing. Swap points";
public static final String ROUTING_TOGGLE = "Routing. Toggle";
public static final String ROUTING_SEARCH_POINT = "Routing. Search point";
public static final String ROUTING_SETTINGS = "Routing. Settings";
public static final String ROUTING_TTS_SWITCH = "Routing. Switch tts";
// editor
public static final String EDITOR_START_CREATE = "Editor_Add_start";
public static final String EDITOR_ADD_CLICK = "Editor_Add_click";