[android] Added routing top plate

This commit is contained in:
Dmitry Donskoy 2019-04-02 16:00:51 +03:00 committed by Aleksandr Zatsepin
parent c1c2841d40
commit fe68567dcb
10 changed files with 117 additions and 17 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 288 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 528 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 779 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -150,8 +150,42 @@
</android.support.v7.widget.Toolbar>
</FrameLayout>
<FrameLayout
android:background="@color/light_green"
android:foreground="@drawable/shadow_top"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/driving_options_btn"
android:background="?attr/selectableItemBackgroundBorderless"
android:visibility="visible"
android:layout_width="match_parent"
android:minHeight="@dimen/height_block_base"
android:layout_height="wrap_content">
<TextView
android:id="@+id/driving_options_btn_title"
android:layout_centerInParent="true"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="?android:attr/textColorPrimaryInverse"
android:text="asdasdasdasdas"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/margin_half_plus_eight"
android:layout_marginEnd="@dimen/margin_half_plus_eight"/>
<ImageView
android:id="@+id/driving_options_btn_img"
android:src="@drawable/ic_error_white"
android:layout_centerVertical="true"
android:layout_width="@dimen/margin_base_plus"
android:layout_height="@dimen/margin_base_plus"
android:layout_toLeftOf="@id/driving_options_btn_title"
android:layout_toStartOf="@id/driving_options_btn_title"/>
</RelativeLayout>
</FrameLayout>
<FrameLayout
style="@style/MwmWidget.FrameLayout.Elevation"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
</LinearLayout>

View file

@ -17,6 +17,7 @@
<color name="dark_red">#F51E30</color>
<color name="base_yellow">#FFFFC30A</color>
<color name="base_green">#FF558B2F</color>
<color name="light_green">#2D8953</color>
<color name="black_primary">#DE000000</color> <!-- 87% black -->
<color name="black_secondary">#8A000000</color> <!-- 54% black -->

View file

@ -25,6 +25,7 @@ import android.view.View;
import android.view.View.OnClickListener;
import android.view.WindowManager;
import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.Toast;
import com.mapswithme.maps.Framework.MapObjectListener;
@ -243,6 +244,10 @@ public class MwmActivity extends BaseMwmFragmentActivity
@NonNull
private PlacePageController mPlacePageController;
@SuppressWarnings("NullableProblems")
@NonNull
private View mDrivingOptionsBtn;
public interface LeftAnimationTrackListener
{
void onTrackStarted(boolean collapsed);
@ -535,6 +540,15 @@ public class MwmActivity extends BaseMwmFragmentActivity
initOnmapDownloader();
initPositionChooser();
initFilterViews();
initDrivingOptionsViews();
}
private void initDrivingOptionsViews()
{
mDrivingOptionsBtn = findViewById(R.id.driving_options_btn);
mDrivingOptionsBtn.setOnClickListener(v -> {
});
}
private void initTips()
@ -2037,6 +2051,26 @@ public class MwmActivity extends BaseMwmFragmentActivity
mNavigationController.resetSearchWheel();
}
@Override
public void onRouteWarningReceived()
{
showDrivingOptionPlate();
}
private void showDrivingOptionPlate()
{
UiUtils.show(mDrivingOptionsBtn);
View image = findViewById(R.id.driving_options_btn_img);
UiUtils.showIf(true, image);
TextView title = mDrivingOptionsBtn.findViewById(R.id.driving_options_btn_title);
// title.setText(true ? );
}
private void hideDrivingOptionsPlate()
{
UiUtils.hide(mDrivingOptionsBtn);
}
@Override
public boolean isSubwayEnabled()
{

View file

@ -78,6 +78,7 @@ public class RoutingController implements TaxiManager.TaxiListener
void onAddedStop();
void onRemovedStop();
void onBuiltRoute();
void onRouteWarningReceived();
boolean isSubwayEnabled();
/**
@ -128,22 +129,33 @@ public class RoutingController implements TaxiManager.TaxiListener
mContainsCachedResult = true;
if (mLastResultCode == ResultCodesHelper.NO_ERROR
|| mLastResultCode == ResultCodesHelper.HAS_WARNINGS
|| ResultCodesHelper.isMoreMapsNeeded(mLastResultCode))
{
mCachedRoutingInfo = Framework.nativeGetRouteFollowingInfo();
if (mLastRouterType == Framework.ROUTER_TYPE_TRANSIT)
mCachedTransitRouteInfo = Framework.nativeGetTransitRouteInfo();
setBuildState(BuildState.BUILT);
mLastBuildProgress = 100;
if (mContainer != null)
mContainer.onBuiltRoute();
}
onBuiltRoute();
else if (mLastResultCode == ResultCodesHelper.HAS_WARNINGS)
onWarningReceived();
processRoutingEvent();
}
};
private void onWarningReceived()
{
onBuiltRoute();
if (mContainer != null)
mContainer.onRouteWarningReceived();
}
private void onBuiltRoute()
{
mCachedRoutingInfo = Framework.nativeGetRouteFollowingInfo();
if (mLastRouterType == Framework.ROUTER_TYPE_TRANSIT)
mCachedTransitRouteInfo = Framework.nativeGetTransitRouteInfo();
setBuildState(BuildState.BUILT);
mLastBuildProgress = 100;
if (mContainer != null)
mContainer.onBuiltRoute();
}
@SuppressWarnings("FieldCanBeLocal")
private final Framework.RoutingProgressListener mRoutingProgressListener = new Framework.RoutingProgressListener()
{
@ -197,15 +209,24 @@ public class RoutingController implements TaxiManager.TaxiListener
return;
}
if (!ResultCodesHelper.isMoreMapsNeeded(mLastResultCode))
if (ResultCodesHelper.isMoreMapsNeeded(mLastResultCode))
{
setBuildState(BuildState.ERROR);
mLastBuildProgress = 0;
updateProgress();
RoutingErrorDialogFragment fragment = RoutingErrorDialogFragment.create(mLastResultCode, mLastMissingMaps);
fragment.show(mContainer.getActivity().getSupportFragmentManager(), RoutingErrorDialogFragment.class.getSimpleName());
return;
}
RoutingErrorDialogFragment fragment = RoutingErrorDialogFragment.create(mLastResultCode, mLastMissingMaps);
fragment.show(mContainer.getActivity().getSupportFragmentManager(), RoutingErrorDialogFragment.class.getSimpleName());
setBuildState(BuildState.ERROR);
mLastBuildProgress = 0;
updateProgress();
if (RoutingOptions.hasAnyOptions())
showUnableCalcRouteDialog();
}
private void showUnableCalcRouteDialog()
{
}
private void setState(State newState)

View file

@ -24,4 +24,14 @@ public class RoutingOptions
private static native void nativeAddOption(int option);
private static native void nativeRemoveOption(int option);
private static native boolean nativeHasOption(int option);
static boolean hasAnyOptions()
{
for (RoadType each : RoadType.values())
{
if (hasOption(each))
return true;
}
return false;
}
}