This commit is contained in:
wangcongtao
2020-01-10 20:05:23 +08:00
parent 834a82f902
commit 8b4000ad4a
11 changed files with 104 additions and 21 deletions

View File

@@ -26,6 +26,8 @@ import com.mogo.service.fragmentmanager.FragmentDescriptor;
import java.util.ArrayList;
import java.util.List;
import javax.net.ssl.SSLHandshakeException;
/**
* 搜索页面
* <p>
@@ -82,6 +84,9 @@ public class SearchFragment extends BaseSearchFragment implements SearchView, Vi
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
SearchServiceHolder.INSTANCE.init(getActivity().getApplicationContext());
SearchServiceHolder.INSTANCE.getMarkerManger().removeMarkers();
SearchServiceHolder.INSTANCE.getMapUIController().showMyLocation( false );
moveMapToCenter();
}
@Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
@@ -395,4 +400,11 @@ public class SearchFragment extends BaseSearchFragment implements SearchView, Vi
push(CategorySearchFragment.Companion.newInstance(text),
MogoModulePaths.PATH_FRAGMENT_SEARCH_CATEGORY);
}
@Override
public void onDestroyView() {
super.onDestroyView();
SearchServiceHolder.INSTANCE.getMapUIController().showMyLocation( true );
moveMapToRight();
}
}

View File

@@ -5,6 +5,7 @@ import android.os.Bundle
import android.view.View
import androidx.fragment.app.Fragment
import com.alibaba.android.arouter.facade.annotation.Route
import com.amap.api.col.n3.it
import com.mogo.map.MogoLatLng
import com.mogo.map.listener.IMogoMapListener
import com.mogo.map.location.IMogoLocationListener
@@ -55,9 +56,17 @@ class SettingAddressFragment : BaseFragment(), IMogoGeoSearchListener {
super.onMapChanged(latLng, zoom, tilt, bearing)
var mogoRegeocodeQuery = MogoRegeocodeQuery()
mogoRegeocodeQuery.point = latLng
SearchServiceHolder.getGeoSearcher()
.getFromLocationAsyn(mogoRegeocodeQuery)
SearchServiceHolder.getGeoSearcher().getFromLocationAsyn(mogoRegeocodeQuery)
addMarker?.apply {
SearchServiceHolder.getMapUIController().startJumpAnimation(this,
150f,{input ->
if (input <= 0.5) {
(0.5f - 2.0 * (0.5 - input) * (0.5 - input)).toFloat()
} else {
(0.5f - Math.sqrt(((input - 0.5f) * (1.5f - input)).toDouble())).toFloat()
}
}, 600)
}
}
}
@@ -109,35 +118,34 @@ class SettingAddressFragment : BaseFragment(), IMogoGeoSearchListener {
et_navi_search.isEnabled = false
et_navi_search.setText(getString(string.drag_map_to_choose))
var location = SearchServiceHolder.getMapUIController()
.windowCenterLocation
.windowCenterLocation
if (addMarker == null) {
var decodeResource = BitmapFactory.decodeResource(resources, R.mipmap.icon_choose_position)
var decodeResource = BitmapFactory.decodeResource(resources, R.mipmap.icon_choose_position2)
val options = MogoMarkerOptions()
.icon(decodeResource)
.latitude(location?.lat ?: 0.0)
.owner(TAG)
.anchor(0.5f, 0.5f)
.longitude(location?.lng ?: 0.0)
.icon(decodeResource)
.latitude(location?.lat ?: 0.0)
.owner(TAG)
.anchor(0.5f, 1f)
.longitude(location?.lng ?: 0.0)
addMarker = SearchServiceHolder.getMarkerManger()
.addMarker(MogoModulePaths.PATH_FRAGMENT_SETTING_HOME, options)
.addMarker(MogoModulePaths.PATH_FRAGMENT_SETTING_HOME, options)
var locationPointInScreen = SearchServiceHolder.getMapUIController()
.getLocationPointInScreen(location)
.getLocationPointInScreen(location)
addMarker?.setPositionByPixels(locationPointInScreen)
}
}
override fun onDestroyView() {
super.onDestroyView()
setMarkerStatus(true)
SearchServiceHolder.getMapUIController()
.showMyLocation(true)
// SearchServiceHolder.getMapUIController()
// .showMyLocation(true)
SearchServiceHolder.listenerCenter.unregisterMogoMapListener(
MogoModulePaths.PATH_FRAGMENT_SETTING_HOME
)
addMarker?.destroy()
moveMapToRight()
// moveMapToRight()
}
companion object {