forked from organicmaps/organicmaps
[android] Filled navigation menu with data.
This commit is contained in:
parent
1857e8bdee
commit
e66fe5b62d
15 changed files with 225 additions and 72 deletions
|
@ -6,8 +6,11 @@
|
|||
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"
|
||||
tools:background="#3000FF00">
|
||||
android:layout_marginEnd="@dimen/nav_toggle"
|
||||
tools:background="#3000FF00"
|
||||
tools:ignore="RtlSymmetry">
|
||||
<!-- Speed -->
|
||||
<LinearLayout
|
||||
android:id="@+id/speed_frame"
|
||||
|
@ -19,7 +22,6 @@
|
|||
android:paddingRight="@dimen/nav_numbers_margin"
|
||||
android:paddingTop="@dimen/margin_eighth"
|
||||
android:gravity="center_horizontal"
|
||||
android:background="?clickableBackground"
|
||||
tools:background="#20FF0000">
|
||||
<TextView
|
||||
android:id="@+id/speed_value"
|
||||
|
@ -51,7 +53,6 @@
|
|||
android:orientation="vertical"
|
||||
android:paddingTop="@dimen/margin_eighth"
|
||||
android:gravity="center_horizontal"
|
||||
android:background="?clickableBackground"
|
||||
tools:background="#20FF0000">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -100,7 +101,8 @@
|
|||
android:id="@+id/dot_estimate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginRight="@dimen/margin_half"
|
||||
android:layout_marginEnd="@dimen/margin_half"
|
||||
tools:src="@drawable/news_marker_active"/>
|
||||
|
||||
<ImageView
|
||||
|
@ -126,7 +128,6 @@
|
|||
android:paddingRight="@dimen/nav_numbers_margin"
|
||||
android:paddingTop="@dimen/margin_eighth"
|
||||
android:gravity="center_horizontal"
|
||||
android:background="?clickableBackground"
|
||||
tools:background="#20FF0000">
|
||||
<TextView
|
||||
android:id="@+id/distance_value"
|
||||
|
|
|
@ -1,35 +1,38 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/nav_bottom_frame"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_gravity="bottom"
|
||||
android:clickable="true"
|
||||
android:visibility="invisible"
|
||||
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="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="right|center_vertical"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:background="?clickableBackground"
|
||||
android:scaleType="center"
|
||||
android:tint="?iconTint"
|
||||
tools:src="@drawable/ic_menu_close"/>
|
||||
android:clickable="true"
|
||||
android:src="@drawable/ic_menu_close"/>
|
||||
</FrameLayout>
|
||||
|
||||
<com.mapswithme.maps.widget.FlatProgressView
|
||||
android:id="@+id/progress"
|
||||
android:id="@+id/navigation_progress"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:headRadius="@dimen/nav_progress"
|
||||
|
@ -43,8 +46,44 @@
|
|||
android:id="@+id/content_frame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="64dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:padding="@dimen/margin_half_plus"
|
||||
tools:background="#300000FF">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/settings"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginEnd="@dimen/margin_half_plus"
|
||||
android:layout_marginRight="@dimen/margin_half_plus"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_menu_settings"
|
||||
android:background="?selectableItemBackgroundBorderless"
|
||||
android:tint="?iconTint"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/stop"
|
||||
android:theme="@style/MwmTheme.Button.Red"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_marginRight="@dimen/margin_half_plus"
|
||||
android:layout_marginEnd="@dimen/margin_half_plus"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/button_default"
|
||||
android:text="@string/current_location_unknown_stop_button"
|
||||
android:fontFamily="@string/robotoMedium"
|
||||
android:textAllCaps="true"
|
||||
android:textAppearance="@style/MwmTextAppearance.Body1.Light"
|
||||
tools:ignore="UnusedAttribute"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/tts_volume"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_voice_on"
|
||||
android:background="?selectableItemBackgroundBorderless"
|
||||
android:tint="?iconTint"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
|
@ -6,8 +6,11 @@
|
|||
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"
|
||||
tools:background="#3000FF00">
|
||||
android:layout_marginEnd="@dimen/nav_toggle"
|
||||
tools:background="#3000FF00"
|
||||
tools:ignore="RtlSymmetry">
|
||||
<!-- Speed -->
|
||||
<LinearLayout
|
||||
android:id="@+id/speed_frame"
|
||||
|
@ -71,6 +74,7 @@
|
|||
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"/>
|
||||
|
@ -101,7 +105,8 @@
|
|||
android:id="@+id/dot_estimate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginRight="@dimen/margin_half"
|
||||
android:layout_marginEnd="@dimen/margin_half"
|
||||
tools:src="@drawable/news_marker_active"/>
|
||||
|
||||
<ImageView
|
||||
|
|
|
@ -46,8 +46,10 @@
|
|||
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
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
|
||||
<attr name="navButtonsTheme" format="reference"/>
|
||||
<attr name="downloaderTheme" format="reference"/>
|
||||
<attr name="navigationTheme" format="reference"/>
|
||||
|
||||
<attr name="fabAdd" format="reference"/>
|
||||
</declare-styleable>
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
|
||||
<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>
|
||||
|
@ -134,6 +135,7 @@
|
|||
|
||||
<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>
|
||||
|
|
|
@ -139,6 +139,7 @@
|
|||
<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">
|
||||
|
@ -147,5 +148,24 @@
|
|||
<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.Button.Red">
|
||||
<item name="colorButtonNormal">@color/base_red</item>
|
||||
</style>
|
||||
|
||||
<style name="MwmTheme.Navigation">
|
||||
<item name="iconTint">@android:color/white</item>
|
||||
</style>
|
||||
|
||||
<!-- TODO get proper color -->
|
||||
<style name="MwmTheme.Navigation.Night">
|
||||
<item name="iconTint">@android:color/darker_gray</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
|
@ -22,6 +22,9 @@ import android.view.View.OnClickListener;
|
|||
import android.view.WindowManager;
|
||||
import android.widget.ImageButton;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Stack;
|
||||
|
||||
import com.mapswithme.maps.Framework.MapObjectListener;
|
||||
import com.mapswithme.maps.activity.CustomNavigateUpListener;
|
||||
import com.mapswithme.maps.ads.LikesManager;
|
||||
|
@ -83,9 +86,6 @@ 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,
|
||||
|
@ -745,6 +745,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
}
|
||||
});
|
||||
mOnmapDownloader.onResume();
|
||||
mNavigationController.getNavMenu().onResume(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -994,6 +995,11 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
|
||||
private void setFullscreen(boolean isFullscreen)
|
||||
{
|
||||
if (RoutingController.get().isNavigating()
|
||||
|| RoutingController.get().isBuilding()
|
||||
|| RoutingController.get().isPlanning())
|
||||
return;
|
||||
|
||||
mIsFullscreen = isFullscreen;
|
||||
final BaseMenu menu = getCurrentMenu();
|
||||
|
||||
|
@ -1061,7 +1067,6 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
Framework.nativeDeactivatePopup();
|
||||
mPlacePage.saveBookmarkTitle();
|
||||
mPlacePage.setMapObject(null, false);
|
||||
mMainMenu.show(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,25 +1,37 @@
|
|||
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 java.util.concurrent.TimeUnit;
|
||||
|
||||
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.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;
|
||||
|
||||
public class NavigationController
|
||||
{
|
||||
private final View mFrame;
|
||||
private final View mTopFrame;
|
||||
private final View mBottomFrame;
|
||||
private final NavMenu mNavMenu;
|
||||
|
||||
private final ImageView mNextTurnImage;
|
||||
|
@ -32,12 +44,15 @@ public class NavigationController
|
|||
private final View mStreetFrame;
|
||||
private final TextView mNextStreet;
|
||||
|
||||
// private final TextView mDistanceTotal;
|
||||
// private final TextView mTimeTotal;
|
||||
// private final ImageView mTurnDirection;
|
||||
//
|
||||
// private final FlatProgressView mRouteProgress;
|
||||
// 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 TextView mDistanceValue;
|
||||
private final TextView mDistanceUnits;
|
||||
private final FlatProgressView mRouteProgress;
|
||||
|
||||
private double mNorth;
|
||||
|
||||
|
@ -45,7 +60,9 @@ public class NavigationController
|
|||
{
|
||||
mFrame = activity.findViewById(R.id.navigation_frame);
|
||||
mTopFrame = mFrame.findViewById(R.id.nav_top_frame);
|
||||
mBottomFrame = mFrame.findViewById(R.id.nav_bottom_frame);
|
||||
mNavMenu = createNavMenu();
|
||||
mNavMenu.refreshTts();
|
||||
|
||||
// Top frame
|
||||
View turnFrame = mTopFrame.findViewById(R.id.nav_next_turn_frame);
|
||||
|
@ -61,32 +78,50 @@ public class NavigationController
|
|||
View shadow = mTopFrame.findViewById(R.id.shadow_top);
|
||||
UiUtils.showIf(Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP, shadow);
|
||||
|
||||
// TODO (trashkalmar): Bottom 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);
|
||||
//
|
||||
// mRouteProgress = (FlatProgressView) mFrame.findViewById(R.id.fp__route_progress);
|
||||
//
|
||||
// mFrame.findViewById(R.id.btn__close).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();
|
||||
// }
|
||||
// });
|
||||
// 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);
|
||||
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(mFrame.findViewById(R.id.nav_bottom_frame), new NavMenu.ItemClickListener<NavMenu.Item>() {
|
||||
private NavMenu createNavMenu()
|
||||
{
|
||||
return new NavMenu(mBottomFrame, new NavMenu.ItemClickListener<NavMenu.Item>()
|
||||
{
|
||||
@Override
|
||||
public void onItemClick(NavMenu.Item item)
|
||||
{
|
||||
|
||||
switch (item)
|
||||
{
|
||||
case STOP:
|
||||
RoutingController.get().cancel();
|
||||
Statistics.INSTANCE.trackEvent(Statistics.EventName.ROUTING_CLOSE);
|
||||
AlohaHelper.logClick(AlohaHelper.ROUTING_CLOSE);
|
||||
break;
|
||||
case SETTINGS:
|
||||
final MwmActivity parent = ((MwmActivity) mFrame.getContext());
|
||||
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;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -150,22 +185,40 @@ public class NavigationController
|
|||
if (!TextUtils.isEmpty(info.nextStreet))
|
||||
mNextStreet.setText(info.nextStreet);
|
||||
|
||||
/*
|
||||
mTimeTotal.setText(RoutingController.formatRoutingTime(mFrame.getContext(),
|
||||
info.totalTimeInSeconds,
|
||||
R.dimen.text_size_routing_dimension));
|
||||
mDistanceTotal.setText(Utils.formatUnitsText(mFrame.getContext(),
|
||||
R.dimen.text_size_routing_number,
|
||||
R.dimen.text_size_routing_dimension,
|
||||
info.distToTarget,
|
||||
info.targetUnits));
|
||||
mTimeArrival.setText(RoutingController.formatArrivalTime(info.totalTimeInSeconds));
|
||||
mRouteProgress.setProgress((int) info.completionPercent);*/
|
||||
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)
|
||||
{
|
||||
final long hours = TimeUnit.SECONDS.toHours(seconds);
|
||||
final long minutes = TimeUnit.MINUTES.toMinutes(seconds) % 60;
|
||||
mTimeMinuteValue.setText(String.valueOf(minutes));
|
||||
// TODO set localized text
|
||||
mTimeMinuteUnits.setText("m");
|
||||
if (hours == 0)
|
||||
{
|
||||
UiUtils.hide(mTimeHourUnits, mTimeHourValue);
|
||||
return;
|
||||
}
|
||||
mTimeHourValue.setText(String.valueOf(hours));
|
||||
// TODO set localized text
|
||||
mTimeHourUnits.setText("h");
|
||||
}
|
||||
|
||||
public void show(boolean show)
|
||||
{
|
||||
UiUtils.showIf(show, mFrame);
|
||||
mNavMenu.show(show);
|
||||
}
|
||||
|
||||
public NavMenu getNavMenu()
|
||||
|
|
|
@ -14,6 +14,9 @@ import android.view.View;
|
|||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.mapswithme.maps.Framework;
|
||||
import com.mapswithme.maps.MwmApplication;
|
||||
import com.mapswithme.maps.R;
|
||||
|
@ -31,9 +34,6 @@ import com.mapswithme.util.log.Logger;
|
|||
import com.mapswithme.util.statistics.AlohaHelper;
|
||||
import com.mapswithme.util.statistics.Statistics;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@android.support.annotation.UiThread
|
||||
public class RoutingController
|
||||
{
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ 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;
|
||||
|
||||
|
@ -76,12 +77,13 @@ public abstract class BaseMenu
|
|||
: R.attr.menuBackground));
|
||||
}
|
||||
|
||||
void afterLayoutCorrected(Runnable procAfterCorrection)
|
||||
void afterLayoutCorrected(@Nullable Runnable procAfterCorrection)
|
||||
{
|
||||
procAfterCorrection.run();
|
||||
if (procAfterCorrection != null)
|
||||
procAfterCorrection.run();
|
||||
}
|
||||
|
||||
private void correctLayout(final Runnable procAfterCorrection)
|
||||
private void correctLayout(@Nullable final Runnable procAfterCorrection)
|
||||
{
|
||||
if (mLayoutCorrected)
|
||||
return;
|
||||
|
@ -100,13 +102,13 @@ public abstract class BaseMenu
|
|||
});
|
||||
}
|
||||
|
||||
public void onResume(Runnable procAfterCorrection)
|
||||
public void onResume(@Nullable Runnable procAfterCorrection)
|
||||
{
|
||||
correctLayout(procAfterCorrection);
|
||||
updateMarker();
|
||||
}
|
||||
|
||||
BaseMenu(View frame, ItemClickListener<? extends Item> itemClickListener)
|
||||
BaseMenu(@NonNull View frame, @NonNull ItemClickListener<? extends Item> itemClickListener)
|
||||
{
|
||||
mFrame = frame;
|
||||
mItemClickListener = itemClickListener;
|
||||
|
|
|
@ -1,23 +1,26 @@
|
|||
package com.mapswithme.maps.widget.menu;
|
||||
|
||||
import android.animation.ValueAnimator;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.mapswithme.maps.R;
|
||||
import com.mapswithme.maps.sound.TtsPlayer;
|
||||
import com.mapswithme.maps.widget.RotateDrawable;
|
||||
|
||||
public class NavMenu extends BaseMenu
|
||||
{
|
||||
private final ImageView mToggle;
|
||||
private final RotateDrawable mToggleImage = new RotateDrawable(R.drawable.ic_menu_close);
|
||||
private final ImageView mTts;
|
||||
|
||||
public enum Item implements BaseMenu.Item
|
||||
{
|
||||
TOGGLE(R.id.toggle),
|
||||
TTS_VOLUME(R.id.toggle),
|
||||
STOP(R.id.toggle),
|
||||
//OVERVIEW(R.id.toggle), TODO
|
||||
TTS_VOLUME(R.id.tts_volume),
|
||||
STOP(R.id.stop),
|
||||
//OVERVIEW(R.id.), TODO
|
||||
SETTINGS(R.id.settings);
|
||||
|
||||
private final int mViewId;
|
||||
|
@ -39,7 +42,7 @@ public class NavMenu extends BaseMenu
|
|||
super(frame, listener);
|
||||
|
||||
mToggle = (ImageView) mLineFrame.findViewById(R.id.toggle);
|
||||
mToggle.setImageDrawable(mToggleImage);
|
||||
// mToggle.setImageDrawable(mToggleImage);
|
||||
mToggle.setOnClickListener(new View.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
|
@ -49,7 +52,24 @@ public class NavMenu extends BaseMenu
|
|||
}
|
||||
});
|
||||
|
||||
setToggleState(false, false);
|
||||
// setToggleState(false, false);
|
||||
|
||||
mapItem(Item.STOP, mFrame);
|
||||
mapItem(Item.SETTINGS, mFrame);
|
||||
mTts = (ImageView) mapItem(Item.TTS_VOLUME, mFrame);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume(@Nullable Runnable procAfterCorrection)
|
||||
{
|
||||
super.onResume(procAfterCorrection);
|
||||
refreshTts();
|
||||
}
|
||||
|
||||
public void refreshTts()
|
||||
{
|
||||
mTts.setImageResource(TtsPlayer.isEnabled() ? R.drawable.ic_voice_on
|
||||
: R.drawable.ic_voice_off);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -57,7 +77,7 @@ public class NavMenu extends BaseMenu
|
|||
{
|
||||
if (!animate)
|
||||
{
|
||||
mToggleImage.setAngle(open ? -90.0f : 90.0f);
|
||||
// mToggleImage.setAngle(open ? -90.0f : 90.0f);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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";
|
||||
|
|
Loading…
Add table
Reference in a new issue