Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@
import androidx.annotation.NonNull;

public enum Command {
CREATE_FRAGMENT(1, "createFragment"),
MOVE_CAMERA(2, "moveCamera"),
SET_MY_LOCATION_ENABLED(3, "setMyLocationEnabled"),
SET_TRIP_PROGRESS_BAR_ENABLED(4, "setTripProgressBarEnabled"),
SET_NAVIGATION_UI_ENABLED(5, "setNavigationUIEnabled"),
SET_FOLLOWING_PERSPECTIVE(6, "setFollowingPerspective"),
SET_NIGHT_MODE(7, "setNightMode"),
DELETE_FRAGMENT(8, "deleteFragment"),
SET_SPEEDOMETER_ENABLED(9, "setSpeedometerEnabled"),
SET_SPEED_LIMIT_ICON_ENABLED(10, "setSpeedLimitIconEnabled"),
SET_ZOOM_LEVEL(11, "setZoomLevel"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,10 @@ public static int getMapTypeFromJsValue(int jsValue) {
}

public static CustomTypes.FragmentType getFragmentTypeFromJsValue(int jsValue) {
switch (jsValue) {
case 0:
default:
return CustomTypes.FragmentType.MAP;
case 1:
return CustomTypes.FragmentType.NAVIGATION;
}
return switch (jsValue) {
case 0 -> CustomTypes.FragmentType.MAP;
case 1 -> CustomTypes.FragmentType.NAVIGATION;
default -> throw new IllegalStateException("Unexpected FragmentType value: " + jsValue);
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public void initializeNavigator(
}

private void onNavigationReady() {
mNavViewManager.applyStylingOptions();
mNavViewManager.onNavigationReady();

sendCommandToReactNative("onNavigationReady", null);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ public void applyStylingOptions() {

public void setStylingOptions(StylingOptions stylingOptions) {
mStylingOptions = stylingOptions;
applyStylingOptions();
}

public void setNightModeOption(int jsValue) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/**
* Copyright 2023 Google LLC
*
* <p>Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of the License at
*
* <p>http://www.apache.org/licenses/LICENSE-2.0
*
* <p>Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.react.navsdk;

import android.content.Context;
import android.widget.FrameLayout;
import androidx.annotation.Nullable;
import com.google.android.libraries.navigation.StylingOptions;

public class NavViewLayout extends FrameLayout {
private CustomTypes.FragmentType fragmentType;
private StylingOptions stylingOptions;
private boolean isFragmentCreated = false;

public NavViewLayout(Context context) {
super(context);
}

public void setFragmentType(CustomTypes.FragmentType type) {
this.fragmentType = type;
}

@Nullable
public CustomTypes.FragmentType getFragmentType() {
return this.fragmentType;
}

public void setStylingOptions(@Nullable StylingOptions options) {
this.stylingOptions = options;
}

@Nullable
public StylingOptions getStylingOptions() {
return this.stylingOptions;
}

public boolean isFragmentCreated() {
return this.isFragmentCreated;
}

public void setFragmentCreated(boolean created) {
this.isFragmentCreated = created;
}
}
Loading
Loading