diff --git a/android/build.gradle b/android/build.gradle
index 3ff26f7a03..0e86b46b2a 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -31,8 +31,8 @@ apply plugin: 'io.fabric'
dependencies {
// android support libs
- compile 'com.android.support:support-v4:22.2.1'
- compile 'com.android.support:appcompat-v7:22.2.1'
+ compile 'com.android.support:support-v4:23.0.0'
+ compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:recyclerview-v7:22.2.1'
compile 'com.android.support:design:22.2.1'
compile 'com.android.support:cardview-v7:22.2.1'
@@ -78,7 +78,7 @@ crashlytics {
android {
// All properties are read from gradle.properties file
- compileSdkVersion propTargetSdkVersion.toInteger()
+ compileSdkVersion propCompileSdkVersion.toInteger()
buildToolsVersion propBuildToolsVersion
defaultConfig {
diff --git a/android/gradle.properties b/android/gradle.properties
index 6b3f97c5b4..78cdd2fc8d 100644
--- a/android/gradle.properties
+++ b/android/gradle.properties
@@ -2,11 +2,13 @@ propMinSdkVersion=15
# TODO use 23 target and build tools version, when ProGuard problem will be fixed
# https://code.google.com/p/android/issues/detail?id=184567
propTargetSdkVersion=22
+propCompileSdkVersion=23
propBuildToolsVersion=22.0.1
propVersionCode=650
propVersionName=6.5.0
propDebugNdkFlags=V=1 NDK_DEBUG=1 DEBUG=1
propReleaseNdkFlags=V=1 NDK_DEBUG=0 PRODUCTION=1
+org.gradle.daemon=true
# list of files for obb-s
propObbFonts ../data/01_dejavusans.ttf \
diff --git a/android/res/color/routing_toolbar_icon_tint.xml b/android/res/color/routing_toolbar_icon_tint.xml
new file mode 100644
index 0000000000..c324c3fdc0
--- /dev/null
+++ b/android/res/color/routing_toolbar_icon_tint.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
diff --git a/android/res/color/routing_toolbar_icon_tint_night.xml b/android/res/color/routing_toolbar_icon_tint_night.xml
new file mode 100644
index 0000000000..883a8200a2
--- /dev/null
+++ b/android/res/color/routing_toolbar_icon_tint_night.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
diff --git a/android/res/drawable-hdpi/ic_bicycle.png b/android/res/drawable-hdpi/ic_bicycle.png
deleted file mode 100644
index 9c9a664cec..0000000000
Binary files a/android/res/drawable-hdpi/ic_bicycle.png and /dev/null differ
diff --git a/android/res/drawable-hdpi/ic_bike.png b/android/res/drawable-hdpi/ic_bike.png
new file mode 100644
index 0000000000..199dac7762
Binary files /dev/null and b/android/res/drawable-hdpi/ic_bike.png differ
diff --git a/android/res/drawable-hdpi/ic_car.png b/android/res/drawable-hdpi/ic_car.png
new file mode 100644
index 0000000000..60787058ee
Binary files /dev/null and b/android/res/drawable-hdpi/ic_car.png differ
diff --git a/android/res/drawable-hdpi/ic_drive.png b/android/res/drawable-hdpi/ic_drive.png
deleted file mode 100644
index bb1fb3a859..0000000000
Binary files a/android/res/drawable-hdpi/ic_drive.png and /dev/null differ
diff --git a/android/res/drawable-hdpi/ic_pedestrian.png b/android/res/drawable-hdpi/ic_pedestrian.png
new file mode 100644
index 0000000000..0331c23e9e
Binary files /dev/null and b/android/res/drawable-hdpi/ic_pedestrian.png differ
diff --git a/android/res/drawable-hdpi/ic_reload.png b/android/res/drawable-hdpi/ic_reload.png
new file mode 100644
index 0000000000..4cb57e73bf
Binary files /dev/null and b/android/res/drawable-hdpi/ic_reload.png differ
diff --git a/android/res/drawable-hdpi/ic_taxi.png b/android/res/drawable-hdpi/ic_taxi.png
index eb68fa1c5e..44a515052f 100644
Binary files a/android/res/drawable-hdpi/ic_taxi.png and b/android/res/drawable-hdpi/ic_taxi.png differ
diff --git a/android/res/drawable-hdpi/ic_walk.png b/android/res/drawable-hdpi/ic_walk.png
deleted file mode 100644
index c10319ae02..0000000000
Binary files a/android/res/drawable-hdpi/ic_walk.png and /dev/null differ
diff --git a/android/res/drawable-mdpi/ic_bicycle.png b/android/res/drawable-mdpi/ic_bicycle.png
deleted file mode 100644
index 349b4d03ba..0000000000
Binary files a/android/res/drawable-mdpi/ic_bicycle.png and /dev/null differ
diff --git a/android/res/drawable-mdpi/ic_bike.png b/android/res/drawable-mdpi/ic_bike.png
new file mode 100644
index 0000000000..e7faee225d
Binary files /dev/null and b/android/res/drawable-mdpi/ic_bike.png differ
diff --git a/android/res/drawable-mdpi/ic_car.png b/android/res/drawable-mdpi/ic_car.png
new file mode 100644
index 0000000000..efa69fc23f
Binary files /dev/null and b/android/res/drawable-mdpi/ic_car.png differ
diff --git a/android/res/drawable-mdpi/ic_drive.png b/android/res/drawable-mdpi/ic_drive.png
deleted file mode 100644
index ebd6c28f7a..0000000000
Binary files a/android/res/drawable-mdpi/ic_drive.png and /dev/null differ
diff --git a/android/res/drawable-mdpi/ic_pedestrian.png b/android/res/drawable-mdpi/ic_pedestrian.png
new file mode 100644
index 0000000000..235f3855ea
Binary files /dev/null and b/android/res/drawable-mdpi/ic_pedestrian.png differ
diff --git a/android/res/drawable-mdpi/ic_reload.png b/android/res/drawable-mdpi/ic_reload.png
new file mode 100644
index 0000000000..5ad9cec954
Binary files /dev/null and b/android/res/drawable-mdpi/ic_reload.png differ
diff --git a/android/res/drawable-mdpi/ic_taxi.png b/android/res/drawable-mdpi/ic_taxi.png
index f655d4503c..5c97904527 100644
Binary files a/android/res/drawable-mdpi/ic_taxi.png and b/android/res/drawable-mdpi/ic_taxi.png differ
diff --git a/android/res/drawable-mdpi/ic_walk.png b/android/res/drawable-mdpi/ic_walk.png
deleted file mode 100644
index 5261e5ad17..0000000000
Binary files a/android/res/drawable-mdpi/ic_walk.png and /dev/null differ
diff --git a/android/res/drawable-v21/routing_toolbar_button.xml b/android/res/drawable-v21/routing_toolbar_button.xml
new file mode 100644
index 0000000000..3d00488b82
--- /dev/null
+++ b/android/res/drawable-v21/routing_toolbar_button.xml
@@ -0,0 +1,15 @@
+
+
+ -
+
+
+
+
+
+
+
+
diff --git a/android/res/drawable-v21/routing_toolbar_button_night.xml b/android/res/drawable-v21/routing_toolbar_button_night.xml
new file mode 100644
index 0000000000..4c5c7fef45
--- /dev/null
+++ b/android/res/drawable-v21/routing_toolbar_button_night.xml
@@ -0,0 +1,15 @@
+
+
+ -
+
+
+
+
+
+
+
+
diff --git a/android/res/drawable-xhdpi/ic_bicycle.png b/android/res/drawable-xhdpi/ic_bicycle.png
deleted file mode 100644
index a1963ac9ad..0000000000
Binary files a/android/res/drawable-xhdpi/ic_bicycle.png and /dev/null differ
diff --git a/android/res/drawable-xhdpi/ic_bike.png b/android/res/drawable-xhdpi/ic_bike.png
new file mode 100644
index 0000000000..e481623316
Binary files /dev/null and b/android/res/drawable-xhdpi/ic_bike.png differ
diff --git a/android/res/drawable-xhdpi/ic_car.png b/android/res/drawable-xhdpi/ic_car.png
new file mode 100644
index 0000000000..94893a0470
Binary files /dev/null and b/android/res/drawable-xhdpi/ic_car.png differ
diff --git a/android/res/drawable-xhdpi/ic_drive.png b/android/res/drawable-xhdpi/ic_drive.png
deleted file mode 100644
index af3612cbea..0000000000
Binary files a/android/res/drawable-xhdpi/ic_drive.png and /dev/null differ
diff --git a/android/res/drawable-xhdpi/ic_pedestrian.png b/android/res/drawable-xhdpi/ic_pedestrian.png
new file mode 100644
index 0000000000..243e0c033d
Binary files /dev/null and b/android/res/drawable-xhdpi/ic_pedestrian.png differ
diff --git a/android/res/drawable-xhdpi/ic_reload.png b/android/res/drawable-xhdpi/ic_reload.png
new file mode 100644
index 0000000000..47b9399b24
Binary files /dev/null and b/android/res/drawable-xhdpi/ic_reload.png differ
diff --git a/android/res/drawable-xhdpi/ic_taxi.png b/android/res/drawable-xhdpi/ic_taxi.png
index 2237526eaf..63a729a06c 100644
Binary files a/android/res/drawable-xhdpi/ic_taxi.png and b/android/res/drawable-xhdpi/ic_taxi.png differ
diff --git a/android/res/drawable-xhdpi/ic_walk.png b/android/res/drawable-xhdpi/ic_walk.png
deleted file mode 100644
index b005dae479..0000000000
Binary files a/android/res/drawable-xhdpi/ic_walk.png and /dev/null differ
diff --git a/android/res/drawable-xxhdpi/ic_bicycle.png b/android/res/drawable-xxhdpi/ic_bicycle.png
deleted file mode 100644
index 2268517319..0000000000
Binary files a/android/res/drawable-xxhdpi/ic_bicycle.png and /dev/null differ
diff --git a/android/res/drawable-xxhdpi/ic_bike.png b/android/res/drawable-xxhdpi/ic_bike.png
new file mode 100644
index 0000000000..05c856b867
Binary files /dev/null and b/android/res/drawable-xxhdpi/ic_bike.png differ
diff --git a/android/res/drawable-xxhdpi/ic_car.png b/android/res/drawable-xxhdpi/ic_car.png
new file mode 100644
index 0000000000..272d6e5784
Binary files /dev/null and b/android/res/drawable-xxhdpi/ic_car.png differ
diff --git a/android/res/drawable-xxhdpi/ic_drive.png b/android/res/drawable-xxhdpi/ic_drive.png
deleted file mode 100644
index d17321fa55..0000000000
Binary files a/android/res/drawable-xxhdpi/ic_drive.png and /dev/null differ
diff --git a/android/res/drawable-xxhdpi/ic_pedestrian.png b/android/res/drawable-xxhdpi/ic_pedestrian.png
new file mode 100644
index 0000000000..27dd7249d3
Binary files /dev/null and b/android/res/drawable-xxhdpi/ic_pedestrian.png differ
diff --git a/android/res/drawable-xxhdpi/ic_reload.png b/android/res/drawable-xxhdpi/ic_reload.png
new file mode 100644
index 0000000000..8dbcc403a5
Binary files /dev/null and b/android/res/drawable-xxhdpi/ic_reload.png differ
diff --git a/android/res/drawable-xxhdpi/ic_taxi.png b/android/res/drawable-xxhdpi/ic_taxi.png
index 1bd80a0aed..88019c1c06 100644
Binary files a/android/res/drawable-xxhdpi/ic_taxi.png and b/android/res/drawable-xxhdpi/ic_taxi.png differ
diff --git a/android/res/drawable-xxhdpi/ic_walk.png b/android/res/drawable-xxhdpi/ic_walk.png
deleted file mode 100644
index 253fe3bfa8..0000000000
Binary files a/android/res/drawable-xxhdpi/ic_walk.png and /dev/null differ
diff --git a/android/res/drawable-xxxhdpi/ic_bicycle.png b/android/res/drawable-xxxhdpi/ic_bicycle.png
deleted file mode 100644
index 1c7333b26f..0000000000
Binary files a/android/res/drawable-xxxhdpi/ic_bicycle.png and /dev/null differ
diff --git a/android/res/drawable-xxxhdpi/ic_bike.png b/android/res/drawable-xxxhdpi/ic_bike.png
new file mode 100644
index 0000000000..0ce046c44c
Binary files /dev/null and b/android/res/drawable-xxxhdpi/ic_bike.png differ
diff --git a/android/res/drawable-xxxhdpi/ic_car.png b/android/res/drawable-xxxhdpi/ic_car.png
new file mode 100644
index 0000000000..ae184e2bb2
Binary files /dev/null and b/android/res/drawable-xxxhdpi/ic_car.png differ
diff --git a/android/res/drawable-xxxhdpi/ic_drive.png b/android/res/drawable-xxxhdpi/ic_drive.png
deleted file mode 100644
index 59a53d9ccb..0000000000
Binary files a/android/res/drawable-xxxhdpi/ic_drive.png and /dev/null differ
diff --git a/android/res/drawable-xxxhdpi/ic_pedestrian.png b/android/res/drawable-xxxhdpi/ic_pedestrian.png
new file mode 100644
index 0000000000..acfbc17c7f
Binary files /dev/null and b/android/res/drawable-xxxhdpi/ic_pedestrian.png differ
diff --git a/android/res/drawable-xxxhdpi/ic_reload.png b/android/res/drawable-xxxhdpi/ic_reload.png
new file mode 100644
index 0000000000..19ed9ad1cd
Binary files /dev/null and b/android/res/drawable-xxxhdpi/ic_reload.png differ
diff --git a/android/res/drawable-xxxhdpi/ic_taxi.png b/android/res/drawable-xxxhdpi/ic_taxi.png
index f9021a89fc..4f8c769b41 100644
Binary files a/android/res/drawable-xxxhdpi/ic_taxi.png and b/android/res/drawable-xxxhdpi/ic_taxi.png differ
diff --git a/android/res/drawable-xxxhdpi/ic_walk.png b/android/res/drawable-xxxhdpi/ic_walk.png
deleted file mode 100644
index 37ef3e1e83..0000000000
Binary files a/android/res/drawable-xxxhdpi/ic_walk.png and /dev/null differ
diff --git a/android/res/drawable/routing_toolbar_button.xml b/android/res/drawable/routing_toolbar_button.xml
new file mode 100644
index 0000000000..fcc598f54c
--- /dev/null
+++ b/android/res/drawable/routing_toolbar_button.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
diff --git a/android/res/drawable/routing_toolbar_button_active.xml b/android/res/drawable/routing_toolbar_button_active.xml
new file mode 100644
index 0000000000..1d422d4e2f
--- /dev/null
+++ b/android/res/drawable/routing_toolbar_button_active.xml
@@ -0,0 +1,7 @@
+
+
+
+
diff --git a/android/res/drawable/routing_toolbar_button_night.xml b/android/res/drawable/routing_toolbar_button_night.xml
new file mode 100644
index 0000000000..9a25142f67
--- /dev/null
+++ b/android/res/drawable/routing_toolbar_button_night.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
diff --git a/android/res/drawable/routing_toolbar_button_normal.xml b/android/res/drawable/routing_toolbar_button_normal.xml
new file mode 100644
index 0000000000..e7300577fc
--- /dev/null
+++ b/android/res/drawable/routing_toolbar_button_normal.xml
@@ -0,0 +1,7 @@
+
+
+
+
diff --git a/android/res/drawable/routing_toolbar_button_normal_night.xml b/android/res/drawable/routing_toolbar_button_normal_night.xml
new file mode 100644
index 0000000000..93cb90ce2c
--- /dev/null
+++ b/android/res/drawable/routing_toolbar_button_normal_night.xml
@@ -0,0 +1,7 @@
+
+
+
+
diff --git a/android/res/layout/routing_plan.xml b/android/res/layout/routing_plan.xml
index c7eb9bf79c..295879dba8 100644
--- a/android/res/layout/routing_plan.xml
+++ b/android/res/layout/routing_plan.xml
@@ -43,37 +43,88 @@
android:scaleType="center"
tools:src="@drawable/ic_down" />
-
+ android:orientation="horizontal">
-
+ tools:button="@drawable/ic_car"
+ tools:buttonTint="?colorAccent" />
-
+ android:layout_marginStart="12dp"
+ android:layout_marginRight="12dp"
+ android:layout_marginEnd="12dp"
+ tools:button="@drawable/ic_bike"
+ tools:buttonTint="?iconTintLight" />
+
+
+
+
+
+
+
+ android:id="@+id/progress_vehicle"
+ style="@style/MwmWidget.ProgressWheel.RoutingPlan"
+ android:layout_marginLeft="@dimen/routing_selector_wheel_margin"
+ android:layout_marginStart="@dimen/routing_selector_wheel_margin"
+ android:layout_marginTop="@dimen/routing_selector_wheel_margin"
+ android:layout_marginBottom="@dimen/routing_selector_wheel_margin"
+ tools:visibility="visible"/>
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
#FFEEEEEE
#FF32363A
- #FF1F9952
- #FF1E2226
+ #1F9952
+ #1E2226
@android:color/white
#FF3C4044
@color/bg_window
@@ -57,8 +57,8 @@
#FFFFFFFF
#FF2D3237
- #FF197E46
- #FF000000
+ #197841
+ #14181C
#1D414651
#FFFFFFFF
@@ -113,8 +113,11 @@
#FFF0F0F0
@color/bg_window_night
#3D000000
- #80FFFFFF
- #FFFFFFFF
+ #FFFFFFFF
+ @color/bg_statusbar
+ @color/bg_statusbar_night
+ #80FFFFFF
+
@color/divider
@color/divider_night
diff --git a/android/res/values/styles.xml b/android/res/values/styles.xml
index 2c734e6c29..8c06b5699d 100644
--- a/android/res/values/styles.xml
+++ b/android/res/values/styles.xml
@@ -47,7 +47,7 @@
- invisible
- ?selectableItemBackgroundBorderless
- @android:color/transparent
- - ?routingButtonPressedHint
+ - ?routingButtonHint
- @android:color/transparent
- @dimen/margin_eighth
diff --git a/android/res/values/themes-attrs.xml b/android/res/values/themes-attrs.xml
index 3d28b09b3a..8f718bdbf8 100644
--- a/android/res/values/themes-attrs.xml
+++ b/android/res/values/themes-attrs.xml
@@ -65,6 +65,7 @@
+
diff --git a/android/res/values/themes-base.xml b/android/res/values/themes-base.xml
index da5be597a4..95f722d747 100644
--- a/android/res/values/themes-base.xml
+++ b/android/res/values/themes-base.xml
@@ -76,6 +76,7 @@
- @drawable/ic_fab_add
- @color/routing_button_tint
+ - ?statusBar
- @color/routing_button_pressed_tint
- @color/bg_placepage_rating
@@ -160,6 +161,7 @@
- @drawable/ic_fab_add_night
- @color/routing_button_tint
+ - ?statusBar
- @color/routing_button_pressed_tint
- @color/bg_placepage_rating_night
diff --git a/android/src/com/mapswithme/maps/routing/RoutingPlanController.java b/android/src/com/mapswithme/maps/routing/RoutingPlanController.java
index 029f3d404a..eeed2a8d43 100644
--- a/android/src/com/mapswithme/maps/routing/RoutingPlanController.java
+++ b/android/src/com/mapswithme/maps/routing/RoutingPlanController.java
@@ -11,6 +11,7 @@ import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
+import android.support.v7.widget.AppCompatRadioButton;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
@@ -19,7 +20,6 @@ import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
-import android.widget.Toast;
import com.mapswithme.maps.Framework;
import com.mapswithme.maps.MwmActivity;
@@ -31,10 +31,10 @@ import com.mapswithme.maps.uber.UberInfo;
import com.mapswithme.maps.uber.UberLinks;
import com.mapswithme.maps.widget.DotPager;
import com.mapswithme.maps.widget.RotateDrawable;
+import com.mapswithme.maps.widget.RoutingToolbarButton;
import com.mapswithme.maps.widget.ToolbarController;
import com.mapswithme.maps.widget.WheelProgressView;
import com.mapswithme.util.ConnectionState;
-import com.mapswithme.util.Graphics;
import com.mapswithme.util.UiUtils;
import com.mapswithme.util.Utils;
import com.mapswithme.util.statistics.AlohaHelper;
@@ -55,6 +55,7 @@ public class RoutingPlanController extends ToolbarController
private final WheelProgressView mProgressPedestrian;
private final WheelProgressView mProgressBicycle;
private final WheelProgressView mProgressTaxi;
+
private final View mAltitudeChartFrame;
private final View mUberFrame;
@@ -75,16 +76,19 @@ public class RoutingPlanController extends ToolbarController
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
{
- buttonView.setButtonDrawable(Graphics.tint(mActivity, iconRes, isChecked ? R.attr.routingButtonPressedHint
- : R.attr.routingButtonHint));
+ RoutingToolbarButton button = (RoutingToolbarButton) buttonView;
+ if (isChecked)
+ button.activate();
+ else
+ button.deactivate();
}
};
- RadioButton rb = (RadioButton) mRouterTypes.findViewById(buttonId);
+ RoutingToolbarButton rb = (RoutingToolbarButton) mRouterTypes.findViewById(buttonId);
+ rb.setButtonDrawable(iconRes);
listener.onCheckedChanged(rb, false);
rb.setOnCheckedChangeListener(listener);
rb.setOnClickListener(clickListener);
-
return rb;
}
@@ -97,7 +101,7 @@ public class RoutingPlanController extends ToolbarController
mSlotFrame = (SlotFrame) root.findViewById(R.id.slots);
mRouterTypes = (RadioGroup) mToolbar.findViewById(R.id.route_type);
- setupRouterButton(R.id.vehicle, R.drawable.ic_drive, new View.OnClickListener()
+ setupRouterButton(R.id.vehicle, R.drawable.ic_car, new View.OnClickListener()
{
@Override
public void onClick(View v)
@@ -108,7 +112,7 @@ public class RoutingPlanController extends ToolbarController
}
});
- setupRouterButton(R.id.pedestrian, R.drawable.ic_walk, new View.OnClickListener()
+ setupRouterButton(R.id.pedestrian, R.drawable.ic_pedestrian, new View.OnClickListener()
{
@Override
public void onClick(View v)
@@ -119,7 +123,7 @@ public class RoutingPlanController extends ToolbarController
}
});
- setupRouterButton(R.id.bicycle, R.drawable.ic_bicycle, new View.OnClickListener()
+ setupRouterButton(R.id.bicycle, R.drawable.ic_bike, new View.OnClickListener()
{
@Override
public void onClick(View v)
@@ -139,8 +143,7 @@ public class RoutingPlanController extends ToolbarController
Statistics.INSTANCE.trackEvent(Statistics.EventName.ROUTING_TAXI_SET);
if (!ConnectionState.isConnected())
{
- //TODO: show uber error about offline mode showUberError(R.id.no_internet_connection);
- Toast.makeText(mActivity, "Заказ такси недоступен в оффлайн-режиме", Toast.LENGTH_LONG).show();
+ ((RoutingToolbarButton) v).error();
return;
}
RoutingController.get().setRouterType(Framework.ROUTER_TYPE_TAXI);
@@ -287,10 +290,18 @@ public class RoutingPlanController extends ToolbarController
progressView = mProgressBicycle;
}
+ RoutingToolbarButton button = (RoutingToolbarButton)mRouterTypes
+ .findViewById(mRouterTypes.getCheckedRadioButtonId());
+ button.progress();
+
updateProgressLabels();
if (!RoutingController.get().isBuilding() || RoutingController.get().isUberRequestHandled())
+ {
+ button.setProgress(false);
+ button.activate();
return;
+ }
UiUtils.show(progressView);
progressView.setPending(progress == 0);
diff --git a/android/src/com/mapswithme/maps/widget/RoutingToolbarButton.java b/android/src/com/mapswithme/maps/widget/RoutingToolbarButton.java
new file mode 100644
index 0000000000..b7c27bd570
--- /dev/null
+++ b/android/src/com/mapswithme/maps/widget/RoutingToolbarButton.java
@@ -0,0 +1,84 @@
+package com.mapswithme.maps.widget;
+
+import android.content.Context;
+import android.os.Build;
+import android.support.annotation.ColorRes;
+import android.support.v7.widget.AppCompatRadioButton;
+import android.util.AttributeSet;
+
+import com.mapswithme.maps.R;
+import com.mapswithme.util.ThemeUtils;
+
+public class RoutingToolbarButton extends AppCompatRadioButton
+{
+ private boolean mProgress;
+
+ public RoutingToolbarButton(Context context, AttributeSet attrs, int defStyleAttr)
+ {
+ super(context, attrs, defStyleAttr);
+ initView();
+ }
+
+ public RoutingToolbarButton(Context context, AttributeSet attrs)
+ {
+ super(context, attrs);
+ initView();
+ }
+
+ public RoutingToolbarButton(Context context)
+ {
+ super(context);
+ initView();
+ }
+
+ private void initView()
+ {
+ setBackgroundResource(ThemeUtils.isNightTheme() ? R.drawable.routing_toolbar_button_night
+ : R.drawable.routing_toolbar_button);
+ setButtonTintList(ThemeUtils.isNightTheme() ? R.color.routing_toolbar_icon_tint_night
+ : R.color.routing_toolbar_icon_tint);
+ }
+
+ public void progress()
+ {
+ if (mProgress)
+ return;
+
+ mProgress = true;
+ setActivated(false);
+ setSelected(true);
+ }
+
+ public void setProgress(boolean progress)
+ {
+ mProgress = progress;
+ }
+
+ public void error()
+ {
+ setActivated(true);
+ }
+
+ public void activate()
+ {
+ if (!mProgress)
+ {
+ setSelected(false);
+ setActivated(true);
+ }
+ }
+
+ public void deactivate()
+ {
+ setActivated(false);
+ mProgress = false;
+ }
+
+ public void setButtonTintList(@ColorRes int color)
+ {
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)
+ setSupportButtonTintList(getResources().getColorStateList(color));
+ else
+ setButtonTintList(getResources().getColorStateList(color));
+ }
+}