[6.7.0][Opt]行程总览页右下角小图标加阴影
This commit is contained in:
@@ -9,7 +9,10 @@ import android.os.Bundle
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.animation.AccelerateDecelerateInterpolator
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.view.marginStart
|
||||
import androidx.core.view.marginTop
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng
|
||||
import com.mogo.eagle.core.function.api.order.IOrderListener
|
||||
import com.mogo.eagle.core.function.call.order.CallerOrderListenerManager
|
||||
@@ -31,6 +34,14 @@ class MapContainerLayout @JvmOverloads constructor(
|
||||
@Volatile
|
||||
private var isScaled = false
|
||||
private var isPlayingAnim = false
|
||||
private var mapMinWidth = 0
|
||||
private var mapMinHeight = 0
|
||||
private var mapMaxWidth = 0
|
||||
private var mapMaxHeight = 0
|
||||
private var maxMarginStart = 0
|
||||
private var maxMarginTop = 0
|
||||
|
||||
private var valueAnimator: ValueAnimator? = null
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_map_container, this, true)
|
||||
@@ -69,15 +80,37 @@ class MapContainerLayout @JvmOverloads constructor(
|
||||
overMapView.onDestroy()
|
||||
}
|
||||
|
||||
override fun onWindowFocusChanged(hasWindowFocus: Boolean) {
|
||||
super.onWindowFocusChanged(hasWindowFocus)
|
||||
if (hasWindowFocus) {
|
||||
if (mapMaxWidth == 0 && maxMarginStart == 0) {
|
||||
calculate()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun calculate() {
|
||||
mapMaxWidth = width
|
||||
mapMaxHeight = height
|
||||
mapMinWidth = overMapView.width
|
||||
mapMinHeight = overMapView.height
|
||||
maxMarginStart = overMapView.marginStart
|
||||
maxMarginTop = overMapView.marginTop
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
MogoMapListenerHandler.mogoMapListenerHandler.registerHostMapListener("${TAG}${this.hashCode()}",this)
|
||||
MogoMapListenerHandler.mogoMapListenerHandler.registerHostMapListener(
|
||||
"${TAG}${this.hashCode()}",
|
||||
this
|
||||
)
|
||||
CallerOrderListenerManager.addListener("${TAG}${this.hashCode()}", this)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
MogoMapListenerHandler.mogoMapListenerHandler.unregisterHostMapListener("${TAG}${this.hashCode()}")
|
||||
valueAnimator?.removeAllListeners()
|
||||
}
|
||||
|
||||
private fun initView() {
|
||||
@@ -103,38 +136,45 @@ class MapContainerLayout @JvmOverloads constructor(
|
||||
|
||||
private fun scaleMapWithAnim() {
|
||||
if (isPlayingAnim) return
|
||||
if (mapMaxWidth == 0 && maxMarginStart == 0 && !isScaled) {
|
||||
calculate()
|
||||
}
|
||||
if (!isScaled) {
|
||||
val valueAnimator = ValueAnimator.ofInt(270, 1560)
|
||||
valueAnimator = ValueAnimator.ofInt(mapMinWidth, mapMaxWidth)
|
||||
val evaluator = IntEvaluator()
|
||||
valueAnimator.addUpdateListener {
|
||||
overMapView.layoutParams = (overMapView.layoutParams as LayoutParams).also { layoutParams ->
|
||||
layoutParams.width = it.animatedValue as Int
|
||||
layoutParams.height = evaluator.evaluate(it.animatedFraction, 270, 1534)
|
||||
layoutParams.leftMargin = evaluator.evaluate(it.animatedFraction, 1230, 0)
|
||||
layoutParams.topMargin = evaluator.evaluate(it.animatedFraction, 1204, 0)
|
||||
}
|
||||
valueAnimator?.addUpdateListener {
|
||||
overMapView.layoutParams =
|
||||
(overMapView.layoutParams as LayoutParams).also { layoutParams ->
|
||||
layoutParams.width = it.animatedValue as Int
|
||||
layoutParams.height = evaluator.evaluate(it.animatedFraction, mapMinHeight, mapMaxHeight)
|
||||
layoutParams.leftMargin = evaluator.evaluate(it.animatedFraction, maxMarginStart, 0)
|
||||
layoutParams.topMargin = evaluator.evaluate(it.animatedFraction, maxMarginTop, 0)
|
||||
}
|
||||
}
|
||||
valueAnimator.addListener(listenerAdapter)
|
||||
valueAnimator.duration = 350
|
||||
valueAnimator.start()
|
||||
valueAnimator?.interpolator = AccelerateDecelerateInterpolator()
|
||||
valueAnimator?.addListener(listenerAdapter)
|
||||
valueAnimator?.duration = 400
|
||||
valueAnimator?.start()
|
||||
} else {
|
||||
val valueAnimator = ValueAnimator.ofInt(1560, 270)
|
||||
valueAnimator = ValueAnimator.ofInt(mapMaxWidth, mapMinWidth)
|
||||
val evaluator = IntEvaluator()
|
||||
valueAnimator.addUpdateListener {
|
||||
overMapView.layoutParams = (overMapView.layoutParams as LayoutParams).also { layoutParams ->
|
||||
layoutParams.width = it.animatedValue as Int
|
||||
layoutParams.height = evaluator.evaluate(it.animatedFraction, 1534, 270)
|
||||
layoutParams.leftMargin = evaluator.evaluate(it.animatedFraction, 0, 1230)
|
||||
layoutParams.topMargin = evaluator.evaluate(it.animatedFraction, 0, 1204)
|
||||
}
|
||||
valueAnimator?.addUpdateListener {
|
||||
overMapView.layoutParams =
|
||||
(overMapView.layoutParams as LayoutParams).also { layoutParams ->
|
||||
layoutParams.width = it.animatedValue as Int
|
||||
layoutParams.height = evaluator.evaluate(it.animatedFraction, mapMaxHeight, mapMinHeight)
|
||||
layoutParams.leftMargin = evaluator.evaluate(it.animatedFraction, 0, maxMarginStart)
|
||||
layoutParams.topMargin = evaluator.evaluate(it.animatedFraction, 0, maxMarginTop)
|
||||
}
|
||||
}
|
||||
valueAnimator.addListener(listenerAdapter)
|
||||
valueAnimator.duration = 350
|
||||
valueAnimator.start()
|
||||
valueAnimator?.interpolator = AccelerateDecelerateInterpolator()
|
||||
valueAnimator?.addListener(listenerAdapter)
|
||||
valueAnimator?.duration = 400
|
||||
valueAnimator?.start()
|
||||
}
|
||||
}
|
||||
|
||||
private val listenerAdapter = object : AnimatorListenerAdapter() {
|
||||
private val listenerAdapter = object : AnimatorListenerAdapter() {
|
||||
override fun onAnimationStart(animation: Animator) {
|
||||
super.onAnimationStart(animation)
|
||||
isPlayingAnim = true
|
||||
@@ -150,7 +190,8 @@ class MapContainerLayout @JvmOverloads constructor(
|
||||
if (isScaled) {
|
||||
visualAngleToggle?.takeIf { it.visibility == View.VISIBLE }?.visibility = View.GONE
|
||||
} else {
|
||||
visualAngleToggle?.takeIf { it.visibility != View.VISIBLE }?.visibility = View.VISIBLE
|
||||
visualAngleToggle?.takeIf { it.visibility != View.VISIBLE }?.visibility =
|
||||
View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,7 +204,8 @@ class MapContainerLayout @JvmOverloads constructor(
|
||||
if (isScaled) {
|
||||
visualAngleToggle?.takeIf { it.visibility == View.VISIBLE }?.visibility = View.GONE
|
||||
} else {
|
||||
visualAngleToggle?.takeIf { it.visibility != View.VISIBLE }?.visibility = View.VISIBLE
|
||||
visualAngleToggle?.takeIf { it.visibility != View.VISIBLE }?.visibility =
|
||||
View.VISIBLE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 106 KiB After Width: | Height: | Size: 95 KiB |
@@ -89,10 +89,11 @@
|
||||
|
||||
<View
|
||||
android:id="@+id/shadowView"
|
||||
android:layout_width="270dp"
|
||||
android:layout_height="270dp"
|
||||
android:layout_marginEnd="60dp"
|
||||
android:layout_marginBottom="60dp"
|
||||
android:layout_width="310dp"
|
||||
android:layout_height="310dp"
|
||||
android:layout_marginEnd="40dp"
|
||||
android:layout_marginBottom="40dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -447,6 +447,8 @@ class TravelRealityView @JvmOverloads constructor(
|
||||
)
|
||||
// 设置自定义样式
|
||||
mAMap?.setCustomMapStyle(customMapStyleOptions1)
|
||||
mAMap?.uiSettings?.isZoomControlsEnabled = false
|
||||
mAMap?.uiSettings?.setLogoBottomMargin(-150)
|
||||
}
|
||||
mAMap?.setAMapGestureListener(gestListener)
|
||||
}
|
||||
@@ -468,7 +470,7 @@ class TravelRealityView @JvmOverloads constructor(
|
||||
//设置希望展示的地图缩放级别
|
||||
val loc = CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02()
|
||||
if (loc.latitude.toInt() == 0 || loc.longitude.toInt() == 0) {
|
||||
moveMapCamera(CameraUpdateFactory.zoomTo(14f))
|
||||
moveMapCamera(CameraUpdateFactory.zoomTo(17f))
|
||||
} else {
|
||||
moveMapCamera(CameraUpdateFactory.newLatLngZoom(
|
||||
coordinateConverterWgsToGcj(
|
||||
@@ -540,7 +542,7 @@ class TravelRealityView @JvmOverloads constructor(
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
if (isSmallMap) {
|
||||
this.outlineProvider = TextureVideoViewOutlineProvider(
|
||||
AutoSizeUtils.dp2px(context, 32f)
|
||||
AutoSizeUtils.dp2px(context, 38f)
|
||||
.toFloat()
|
||||
)
|
||||
this.clipToOutline = true
|
||||
|
||||
Reference in New Issue
Block a user