[android] Added the traffic button in the navigation menu
BIN
android/res/drawable-hdpi/ic_setting_traffic_off.png
Normal file
After Width: | Height: | Size: 994 B |
BIN
android/res/drawable-hdpi/ic_setting_traffic_on.png
Normal file
After Width: | Height: | Size: 812 B |
BIN
android/res/drawable-mdpi/ic_setting_traffic_off.png
Normal file
After Width: | Height: | Size: 530 B |
BIN
android/res/drawable-mdpi/ic_setting_traffic_on.png
Normal file
After Width: | Height: | Size: 467 B |
BIN
android/res/drawable-xhdpi/ic_setting_traffic_off.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
android/res/drawable-xhdpi/ic_setting_traffic_on.png
Normal file
After Width: | Height: | Size: 1,018 B |
BIN
android/res/drawable-xxhdpi/ic_setting_traffic_off.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
android/res/drawable-xxhdpi/ic_setting_traffic_on.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
android/res/drawable-xxxhdpi/ic_setting_traffic_off.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
android/res/drawable-xxxhdpi/ic_setting_traffic_on.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
|
@ -42,47 +42,58 @@
|
|||
app:secondaryProgressColor="@color/bg_routing_progress"
|
||||
app:secondaryProgressThickness="@dimen/nav_progress"/>
|
||||
|
||||
<FrameLayout
|
||||
<LinearLayout
|
||||
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"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
tools:background="#300000FF">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/tts_volume"
|
||||
android:layout_weight="0.2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/nav_icon_size"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_voice_on"
|
||||
android:background="?selectableItemBackgroundBorderless"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/traffic"
|
||||
android:layout_weight="0.2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/nav_icon_size"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_setting_traffic_on"
|
||||
android:background="?selectableItemBackgroundBorderless"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/settings"
|
||||
android:layout_width="@dimen/nav_icon_size"
|
||||
android:layout_weight="0.2"
|
||||
android:layout_width="0dp"
|
||||
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|end"
|
||||
android:src="@drawable/ic_voice_on"
|
||||
android:background="?selectableItemBackgroundBorderless"/>
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
android:id="@+id/stop"
|
||||
android:layout_weight="0.4"
|
||||
android:layout_width="0dp"
|
||||
android:minWidth="@dimen/start_button_width"
|
||||
android:layout_height="@dimen/nav_button_height"
|
||||
android:background="?redButtonBackground"
|
||||
android:text="@string/current_location_unknown_stop_button"
|
||||
android:fontFamily="@string/robotoMedium"
|
||||
android:textAppearance="@style/MwmTextAppearance.Button.Red"
|
||||
tools:ignore="UnusedAttribute"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
|
|
@ -81,7 +81,7 @@ public class NavigationController
|
|||
}
|
||||
});
|
||||
mNavMenu = createNavMenu();
|
||||
mNavMenu.refreshTts();
|
||||
mNavMenu.refresh();
|
||||
|
||||
// Top frame
|
||||
View topFrame = mFrame.findViewById(R.id.nav_top_frame);
|
||||
|
@ -154,6 +154,10 @@ public class NavigationController
|
|||
Statistics.INSTANCE.trackEvent(Statistics.EventName.ROUTING_CLOSE);
|
||||
AlohaHelper.logClick(AlohaHelper.ROUTING_CLOSE);
|
||||
break;
|
||||
case TRAFFIC:
|
||||
mNavMenu.refreshTraffic();
|
||||
//TODO: Add statistics reporting (in separate task)
|
||||
break;
|
||||
case TOGGLE:
|
||||
mNavMenu.toggle(true);
|
||||
parent.refreshFade();
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.mapswithme.maps.widget.menu;
|
||||
|
||||
import android.animation.ValueAnimator;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
@ -16,14 +17,18 @@ import com.mapswithme.util.UiUtils;
|
|||
public class NavMenu extends BaseMenu
|
||||
{
|
||||
private final RotateDrawable mToggleImage;
|
||||
@NonNull
|
||||
private final ImageView mTts;
|
||||
@NonNull
|
||||
private final ImageView mTraffic;
|
||||
|
||||
public enum Item implements BaseMenu.Item
|
||||
{
|
||||
TOGGLE(R.id.toggle),
|
||||
TTS_VOLUME(R.id.tts_volume),
|
||||
STOP(R.id.stop),
|
||||
SETTINGS(R.id.settings);
|
||||
SETTINGS(R.id.settings),
|
||||
TRAFFIC(R.id.traffic);
|
||||
|
||||
private final int mViewId;
|
||||
|
||||
|
@ -56,13 +61,20 @@ public class NavMenu extends BaseMenu
|
|||
mapItem(Item.SETTINGS, mFrame);
|
||||
|
||||
mTts = (ImageView) mapItem(Item.TTS_VOLUME, mFrame);
|
||||
mTraffic = (ImageView) mapItem(Item.TRAFFIC, mFrame);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume(@Nullable Runnable procAfterMeasurement)
|
||||
{
|
||||
super.onResume(procAfterMeasurement);
|
||||
refresh();
|
||||
}
|
||||
|
||||
public void refresh()
|
||||
{
|
||||
refreshTts();
|
||||
refreshTraffic();
|
||||
}
|
||||
|
||||
public void refreshTts()
|
||||
|
@ -72,6 +84,14 @@ public class NavMenu extends BaseMenu
|
|||
: Graphics.tint(mFrame.getContext(), R.drawable.ic_voice_off));
|
||||
}
|
||||
|
||||
public void refreshTraffic()
|
||||
{
|
||||
//TODO: Read the real value of this setting (in separate task)
|
||||
mTraffic.setImageDrawable(true ? Graphics.tint(mFrame.getContext(), R.drawable.ic_setting_traffic_on,
|
||||
R.attr.colorAccent)
|
||||
: Graphics.tint(mFrame.getContext(), R.drawable.ic_setting_traffic_off));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setToggleState(boolean open, boolean animate)
|
||||
{
|
||||
|
@ -111,7 +131,9 @@ public class NavMenu extends BaseMenu
|
|||
{
|
||||
super.show(show);
|
||||
measureContent(null);
|
||||
|
||||
UiUtils.showIf(show && Framework.nativeGetRouter() != Framework.ROUTER_TYPE_PEDESTRIAN, mTts);
|
||||
@Framework.RouterType
|
||||
int routerType = Framework.nativeGetRouter();
|
||||
UiUtils.showIf(show && routerType != Framework.ROUTER_TYPE_PEDESTRIAN, mTts);
|
||||
UiUtils.showIf(show && routerType == Framework.ROUTER_TYPE_VEHICLE, mTraffic);
|
||||
}
|
||||
}
|
||||
|
|