[android] Added the traffic button in UI, core logic is not bound yet
BIN
android/res/drawable-hdpi/ic_traffic_download_1.png
Normal file
After Width: | Height: | Size: 512 B |
BIN
android/res/drawable-hdpi/ic_traffic_download_2.png
Normal file
After Width: | Height: | Size: 411 B |
BIN
android/res/drawable-hdpi/ic_traffic_download_3.png
Normal file
After Width: | Height: | Size: 426 B |
BIN
android/res/drawable-hdpi/ic_traffic_download_night_1.png
Normal file
After Width: | Height: | Size: 440 B |
BIN
android/res/drawable-hdpi/ic_traffic_download_night_2.png
Normal file
After Width: | Height: | Size: 404 B |
BIN
android/res/drawable-hdpi/ic_traffic_download_night_3.png
Normal file
After Width: | Height: | Size: 438 B |
BIN
android/res/drawable-hdpi/ic_traffic_off.png
Normal file
After Width: | Height: | Size: 351 B |
BIN
android/res/drawable-hdpi/ic_traffic_off_night.png
Normal file
After Width: | Height: | Size: 366 B |
BIN
android/res/drawable-hdpi/ic_traffic_on.png
Normal file
After Width: | Height: | Size: 506 B |
BIN
android/res/drawable-hdpi/ic_traffic_on_night.png
Normal file
After Width: | Height: | Size: 500 B |
BIN
android/res/drawable-hdpi/ic_traffic_outdated.png
Normal file
After Width: | Height: | Size: 473 B |
BIN
android/res/drawable-hdpi/ic_traffic_outdated_night.png
Normal file
After Width: | Height: | Size: 498 B |
BIN
android/res/drawable-mdpi/ic_traffic_download_1.png
Normal file
After Width: | Height: | Size: 395 B |
BIN
android/res/drawable-mdpi/ic_traffic_download_2.png
Normal file
After Width: | Height: | Size: 364 B |
BIN
android/res/drawable-mdpi/ic_traffic_download_3.png
Normal file
After Width: | Height: | Size: 355 B |
BIN
android/res/drawable-mdpi/ic_traffic_download_night_1.png
Normal file
After Width: | Height: | Size: 369 B |
BIN
android/res/drawable-mdpi/ic_traffic_download_night_2.png
Normal file
After Width: | Height: | Size: 372 B |
BIN
android/res/drawable-mdpi/ic_traffic_download_night_3.png
Normal file
After Width: | Height: | Size: 367 B |
BIN
android/res/drawable-mdpi/ic_traffic_off.png
Normal file
After Width: | Height: | Size: 288 B |
BIN
android/res/drawable-mdpi/ic_traffic_off_night.png
Normal file
After Width: | Height: | Size: 298 B |
BIN
android/res/drawable-mdpi/ic_traffic_on.png
Normal file
After Width: | Height: | Size: 415 B |
BIN
android/res/drawable-mdpi/ic_traffic_on_night.png
Normal file
After Width: | Height: | Size: 425 B |
BIN
android/res/drawable-mdpi/ic_traffic_outdated.png
Normal file
After Width: | Height: | Size: 383 B |
BIN
android/res/drawable-mdpi/ic_traffic_outdated_night.png
Normal file
After Width: | Height: | Size: 386 B |
BIN
android/res/drawable-xhdpi/ic_traffic_download_1.png
Normal file
After Width: | Height: | Size: 693 B |
BIN
android/res/drawable-xhdpi/ic_traffic_download_2.png
Normal file
After Width: | Height: | Size: 602 B |
BIN
android/res/drawable-xhdpi/ic_traffic_download_3.png
Normal file
After Width: | Height: | Size: 594 B |
BIN
android/res/drawable-xhdpi/ic_traffic_download_night_1.png
Normal file
After Width: | Height: | Size: 647 B |
BIN
android/res/drawable-xhdpi/ic_traffic_download_night_2.png
Normal file
After Width: | Height: | Size: 649 B |
BIN
android/res/drawable-xhdpi/ic_traffic_download_night_3.png
Normal file
After Width: | Height: | Size: 644 B |
BIN
android/res/drawable-xhdpi/ic_traffic_off.png
Normal file
After Width: | Height: | Size: 480 B |
BIN
android/res/drawable-xhdpi/ic_traffic_off_night.png
Normal file
After Width: | Height: | Size: 511 B |
BIN
android/res/drawable-xhdpi/ic_traffic_on.png
Normal file
After Width: | Height: | Size: 703 B |
BIN
android/res/drawable-xhdpi/ic_traffic_on_night.png
Normal file
After Width: | Height: | Size: 756 B |
BIN
android/res/drawable-xhdpi/ic_traffic_outdated.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
android/res/drawable-xhdpi/ic_traffic_outdated_night.png
Normal file
After Width: | Height: | Size: 699 B |
BIN
android/res/drawable-xxhdpi/ic_traffic_download_1.png
Normal file
After Width: | Height: | Size: 874 B |
BIN
android/res/drawable-xxhdpi/ic_traffic_download_2.png
Normal file
After Width: | Height: | Size: 723 B |
BIN
android/res/drawable-xxhdpi/ic_traffic_download_3.png
Normal file
After Width: | Height: | Size: 735 B |
BIN
android/res/drawable-xxhdpi/ic_traffic_download_night_1.png
Normal file
After Width: | Height: | Size: 765 B |
BIN
android/res/drawable-xxhdpi/ic_traffic_download_night_2.png
Normal file
After Width: | Height: | Size: 762 B |
BIN
android/res/drawable-xxhdpi/ic_traffic_download_night_3.png
Normal file
After Width: | Height: | Size: 768 B |
BIN
android/res/drawable-xxhdpi/ic_traffic_off.png
Normal file
After Width: | Height: | Size: 551 B |
BIN
android/res/drawable-xxhdpi/ic_traffic_off_night.png
Normal file
After Width: | Height: | Size: 596 B |
BIN
android/res/drawable-xxhdpi/ic_traffic_on.png
Normal file
After Width: | Height: | Size: 847 B |
BIN
android/res/drawable-xxhdpi/ic_traffic_on_night.png
Normal file
After Width: | Height: | Size: 888 B |
BIN
android/res/drawable-xxhdpi/ic_traffic_outdated.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
android/res/drawable-xxhdpi/ic_traffic_outdated_night.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
android/res/drawable-xxxhdpi/ic_traffic_download_1.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
android/res/drawable-xxxhdpi/ic_traffic_download_2.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
android/res/drawable-xxxhdpi/ic_traffic_download_3.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
android/res/drawable-xxxhdpi/ic_traffic_download_night_1.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
android/res/drawable-xxxhdpi/ic_traffic_download_night_2.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
android/res/drawable-xxxhdpi/ic_traffic_download_night_3.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
android/res/drawable-xxxhdpi/ic_traffic_off.png
Normal file
After Width: | Height: | Size: 961 B |
BIN
android/res/drawable-xxxhdpi/ic_traffic_off_night.png
Normal file
After Width: | Height: | Size: 1,015 B |
BIN
android/res/drawable-xxxhdpi/ic_traffic_on.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
android/res/drawable-xxxhdpi/ic_traffic_on_night.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
android/res/drawable-xxxhdpi/ic_traffic_outdated.png
Normal file
After Width: | Height: | Size: 3 KiB |
BIN
android/res/drawable-xxxhdpi/ic_traffic_outdated_night.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
11
android/res/drawable/anim_traffic_loading.xml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<animation-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/ic_traffic_download_1"
|
||||
android:duration="@integer/anim_traffic_loading_item"/>
|
||||
|
||||
<item android:drawable="@drawable/ic_traffic_download_2"
|
||||
android:duration="@integer/anim_traffic_loading_item"/>
|
||||
|
||||
<item android:drawable="@drawable/ic_traffic_download_3"
|
||||
android:duration="@integer/anim_traffic_loading_item"/>
|
||||
</animation-list>
|
11
android/res/drawable/anim_traffic_loading_night.xml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<animation-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/ic_traffic_download_night_1"
|
||||
android:duration="@integer/anim_traffic_loading_item"/>
|
||||
|
||||
<item android:drawable="@drawable/ic_traffic_download_night_2"
|
||||
android:duration="@integer/anim_traffic_loading_item"/>
|
||||
|
||||
<item android:drawable="@drawable/ic_traffic_download_night_3"
|
||||
android:duration="@integer/anim_traffic_loading_item"/>
|
||||
</animation-list>
|
|
@ -7,6 +7,14 @@
|
|||
android:padding="@dimen/nav_frame_padding"
|
||||
android:theme="?navButtonsTheme">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/traffic"
|
||||
style="@style/MwmWidget.MapButton.Traffic"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:visibility="invisible"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/nav_zoom_out"
|
||||
style="@style/MwmWidget.MapButton"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?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:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="@dimen/nav_frame_padding"
|
||||
|
@ -12,13 +13,21 @@
|
|||
android:layout_height="0dp"
|
||||
android:layout_centerInParent="true"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/traffic"
|
||||
style="@style/MwmWidget.MapButton.Traffic"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:visibility="invisible"
|
||||
tools:src="@drawable/anim_traffic_loading"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/nav_zoom_out"
|
||||
style="@style/MwmWidget.MapButton"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_below="@id/anchor_center"
|
||||
android:background="?nav_background"
|
||||
android:src="@drawable/ic_zoom_out"/>
|
||||
|
||||
<ImageButton
|
||||
|
@ -27,7 +36,6 @@
|
|||
android:layout_above="@id/anchor_center"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:background="?nav_background"
|
||||
android:src="@drawable/ic_zoom_in"/>
|
||||
|
||||
<ImageButton
|
||||
|
@ -37,7 +45,6 @@
|
|||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginBottom="@dimen/menu_line_height"
|
||||
android:background="?nav_background"
|
||||
android:contentDescription="@string/my_position"
|
||||
android:tint="@null"/>
|
||||
</RelativeLayout>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<integer name="anim_menu">200</integer>
|
||||
<integer name="anim_location_pending_item">50</integer>
|
||||
<integer name="anim_spinner_pending_item">50</integer>
|
||||
<integer name="anim_traffic_loading_item">900</integer>
|
||||
<integer name="anim_slots_swap">@integer/anim_default</integer>
|
||||
<integer name="anim_slots_toggle">@integer/anim_default</integer>
|
||||
</resources>
|
|
@ -24,6 +24,10 @@
|
|||
<item name="android:tint">?iconTint</item>
|
||||
</style>
|
||||
|
||||
<style name="MwmWidget.MapButton.Traffic">
|
||||
<item name="android:tint">@null</item>
|
||||
</style>
|
||||
|
||||
<style name="MwmWidget.Button">
|
||||
<item name="android:layout_width">@dimen/button_width</item>
|
||||
<item name="android:layout_height">@dimen/height_block_base</item>
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
|
||||
<attr name="myPositionButtonAnimation" format="reference"/>
|
||||
<attr name="wheelPendingAnimation" format="reference"/>
|
||||
<attr name="trafficLoadingAnimation" format="reference"/>
|
||||
|
||||
<attr name="navButtonsTheme" format="reference"/>
|
||||
<attr name="downloaderTheme" format="reference"/>
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
|
||||
<item name="myPositionButtonAnimation">@drawable/anim_myposition_pending</item>
|
||||
<item name="wheelPendingAnimation">@drawable/anim_spinner_pending</item>
|
||||
<item name="trafficLoadingAnimation">@drawable/anim_traffic_loading</item>
|
||||
|
||||
<item name="navButtonsTheme">@style/MwmTheme.NavButtons</item>
|
||||
<item name="downloaderTheme">@style/MwmTheme.Downloader</item>
|
||||
|
@ -155,6 +156,7 @@
|
|||
|
||||
<item name="myPositionButtonAnimation">@drawable/anim_myposition_pending_night</item>
|
||||
<item name="wheelPendingAnimation">@drawable/anim_spinner_pending</item>
|
||||
<item name="trafficLoadingAnimation">@drawable/anim_traffic_loading_night</item>
|
||||
|
||||
<item name="navButtonsTheme">@style/MwmTheme.NavButtons.Night</item>
|
||||
<item name="downloaderTheme">@style/MwmTheme.Downloader.Night</item>
|
||||
|
|
|
@ -21,6 +21,7 @@ import android.view.MotionEvent;
|
|||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageButton;
|
||||
|
||||
import com.mapswithme.maps.Framework.MapObjectListener;
|
||||
import com.mapswithme.maps.activity.CustomNavigateUpListener;
|
||||
|
@ -67,6 +68,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.TrafficButton;
|
||||
import com.mapswithme.maps.widget.menu.BaseMenu;
|
||||
import com.mapswithme.maps.widget.menu.MainMenu;
|
||||
import com.mapswithme.maps.widget.menu.MyPositionButton;
|
||||
|
@ -139,6 +141,8 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
private View mNavZoomOut;
|
||||
private MyPositionButton mNavMyPosition;
|
||||
@Nullable
|
||||
private TrafficButton mTraffic;
|
||||
@Nullable
|
||||
private NavigationButtonsAnimationController mNavAnimationController;
|
||||
|
||||
private View mPositionChooser;
|
||||
|
@ -534,6 +538,9 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
mNavZoomOut.setOnClickListener(this);
|
||||
View myPosition = frame.findViewById(R.id.my_position);
|
||||
mNavMyPosition = new MyPositionButton(myPosition);
|
||||
ImageButton traffic = (ImageButton) frame.findViewById(R.id.traffic);
|
||||
mTraffic = new TrafficButton(this, traffic);
|
||||
mTraffic.setLoading(true);
|
||||
mNavAnimationController = new NavigationButtonsAnimationController(mNavZoomIn, mNavZoomOut, myPosition,
|
||||
frame.findViewById(R.id.anchor_center));
|
||||
}
|
||||
|
|
77
android/src/com/mapswithme/maps/widget/TrafficButton.java
Normal file
|
@ -0,0 +1,77 @@
|
|||
package com.mapswithme.maps.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.AnimationDrawable;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.DrawableRes;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.view.View;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import com.mapswithme.maps.R;
|
||||
import com.mapswithme.util.ThemeUtils;
|
||||
import com.mapswithme.util.UiUtils;
|
||||
|
||||
public class TrafficButton
|
||||
{
|
||||
@NonNull
|
||||
private final AnimationDrawable mLoadingAnim;
|
||||
@NonNull
|
||||
private final ImageButton mButton;
|
||||
|
||||
public TrafficButton(@NonNull Context context, @NonNull ImageButton button)
|
||||
{
|
||||
mButton = button;
|
||||
Resources rs = context.getResources();
|
||||
@DrawableRes
|
||||
final int loadingAnimRes = ThemeUtils.getResource(context, R.attr.trafficLoadingAnimation);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
|
||||
mLoadingAnim = (AnimationDrawable) rs.getDrawable(loadingAnimRes, context.getTheme());
|
||||
else
|
||||
mLoadingAnim = (AnimationDrawable) rs.getDrawable(loadingAnimRes);
|
||||
|
||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) button.getLayoutParams();
|
||||
params.setMargins(0, UiUtils.getStatusBarHeight(context), 0, 0);
|
||||
button.setLayoutParams(params);
|
||||
//TODO: set default value(state) here
|
||||
button.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
//TODO: handle the traffic state coming from the core here
|
||||
public void update(int state)
|
||||
{
|
||||
//TODO: soon
|
||||
}
|
||||
|
||||
private void turnOff()
|
||||
{
|
||||
//TODO: soon
|
||||
}
|
||||
|
||||
private void turnOn()
|
||||
{
|
||||
//TODO: soon
|
||||
}
|
||||
|
||||
private void onTrafficOutdated()
|
||||
{
|
||||
//TODO: soon
|
||||
}
|
||||
|
||||
public void setLoading(boolean isLoading)
|
||||
{
|
||||
if (isLoading)
|
||||
{
|
||||
mLoadingAnim.start();
|
||||
mButton.setImageDrawable(mLoadingAnim);
|
||||
}
|
||||
else
|
||||
{
|
||||
mLoadingAnim.stop();
|
||||
mButton.setImageDrawable(null);
|
||||
}
|
||||
mButton.invalidate();
|
||||
}
|
||||
}
|