Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 안드로이드 SDK 31버전에서 현재 위치가 표시되지 않던 버그를 수정하였습니다. #150

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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 @@ -2,6 +2,7 @@

import android.graphics.PointF;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;

Expand All @@ -26,18 +27,21 @@
import java.util.List;

public class RNNaverMapView extends MapView implements OnMapReadyCallback, NaverMap.OnCameraIdleListener, NaverMap.OnMapClickListener, RNNaverMapViewProps {
private static final int LOCATION_PERMISSION_REQUEST_CODE = 100;
private ThemedReactContext themedReactContext;
private FusedLocationSource locationSource;
private NaverMap naverMap;
private NaverMapSdk naverMapSdk;
private ViewAttacherGroup attacherGroup;
private long lastTouch = 0;
private final List<RNNaverMapFeature<?>> features = new ArrayList<>();

public RNNaverMapView(@NonNull ThemedReactContext themedReactContext, ReactApplicationContext appContext, FusedLocationSource locationSource, NaverMapOptions naverMapOptions, Bundle instanceStateBundle) {
public RNNaverMapView(@NonNull ThemedReactContext themedReactContext, ReactApplicationContext appContext, NaverMapOptions naverMapOptions, Bundle instanceStateBundle) {
super(ReactUtil.getNonBuggyContext(themedReactContext, appContext), naverMapOptions);
this.themedReactContext = themedReactContext;
this.locationSource = locationSource;
this.locationSource = new FusedLocationSource(appContext.getCurrentActivity(), LOCATION_PERMISSION_REQUEST_CODE);
super.onCreate(instanceStateBundle);
naverMapSdk = NaverMapSdk.getInstance(appContext);
// super.onStart();
getMapAsync(this);

Expand Down Expand Up @@ -68,6 +72,7 @@ public void onMapReady(@NonNull NaverMap naverMap) {
lastTouch = System.currentTimeMillis();
}
});
naverMapSdk.flushCache(() -> Log.i("NaverMap", "Map Cache Clean"));
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이는 맵이 깜빡거리는 문제를 수정합니다.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. It did NOT

onInitialized();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,15 @@
import com.naver.maps.geometry.LatLngBounds;
import com.naver.maps.map.NaverMap;
import com.naver.maps.map.NaverMapOptions;
import com.naver.maps.map.util.FusedLocationSource;

public class RNNaverMapViewContainer extends FrameLayout implements RNNaverMapViewProps {
private RNNaverMapView mapView;
private Bundle instanceStateBundle = new Bundle();
private boolean isAttachedToWindow = false;

public RNNaverMapViewContainer(@NonNull ThemedReactContext themedReactContext, ReactApplicationContext appContext, FusedLocationSource locationSource, NaverMapOptions naverMapOptions) {
public RNNaverMapViewContainer(@NonNull ThemedReactContext themedReactContext, ReactApplicationContext appContext, NaverMapOptions naverMapOptions) {
super(ReactUtil.getNonBuggyContext(themedReactContext, appContext));
this.mapView = new RNNaverMapView(themedReactContext, appContext, locationSource, naverMapOptions, instanceStateBundle);
this.mapView = new RNNaverMapView(themedReactContext, appContext, naverMapOptions, instanceStateBundle);
addView(mapView);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.graphics.Rect;
import android.view.View;
import android.util.Log;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
Expand All @@ -19,7 +20,6 @@
import com.naver.maps.geometry.LatLngBounds;
import com.naver.maps.map.NaverMap;
import com.naver.maps.map.NaverMapOptions;
import com.naver.maps.map.util.FusedLocationSource;

import java.util.Arrays;
import java.util.Collections;
Expand All @@ -31,14 +31,14 @@

public class RNNaverMapViewManager extends ViewGroupManager<RNNaverMapViewContainer> {
private final ReactApplicationContext appContext;
private final FusedLocationSource locationSource;

private static final int ANIMATE_TO_REGION = 1;
private static final int ANIMATE_TO_COORDINATE = 2;
private static final int ANIMATE_TO_TWO_COORDINATES = 3;
private static final int SET_LOCATION_TRACKING_MODE = 4;
private static final int ANIMATE_TO_COORDINATES = 6;
private static final int SET_LAYER_GROUP_ENABLED = 7;
private static final int LOCATION_PERMISSION_REQUEST_CODE = 100;
private static final List<String> LAYER_GROUPS = Collections.unmodifiableList(Arrays.asList(
NaverMap.LAYER_GROUP_BUILDING,
NaverMap.LAYER_GROUP_TRANSIT,
Expand All @@ -51,7 +51,6 @@ public class RNNaverMapViewManager extends ViewGroupManager<RNNaverMapViewContai
public RNNaverMapViewManager(ReactApplicationContext context) {
super();
this.appContext = context;
locationSource = new FusedLocationSource(context.getCurrentActivity(), 0x1000);
}

@NonNull
Expand All @@ -63,7 +62,7 @@ public String getName() {
@NonNull
@Override
protected RNNaverMapViewContainer createViewInstance(@NonNull ThemedReactContext reactContext) {
return new RNNaverMapViewContainer(reactContext, appContext, locationSource, getNaverMapViewOptions());
return new RNNaverMapViewContainer(reactContext, appContext, getNaverMapViewOptions());
}

@Override
Expand Down