[3.4.0-map-sdk] code style and add npl catch
This commit is contained in:
@@ -2,6 +2,7 @@ package com.zhidaoauto.map.sdk.inner.byteh;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
@@ -40,7 +41,7 @@ public class PayloadDecoder {
|
||||
|
||||
case "java.lang.Character":
|
||||
case "char":
|
||||
CharSequence charSequence = buffer.readCharSequence(fieldWrapper.getCodecProprety().length(), Charset.forName("UTF-8"));
|
||||
CharSequence charSequence = buffer.readCharSequence(fieldWrapper.getCodecProprety().length(), StandardCharsets.UTF_8);
|
||||
field.set(instance, charSequence);
|
||||
break;
|
||||
case "java.lang.Byte":
|
||||
@@ -74,7 +75,7 @@ public class PayloadDecoder {
|
||||
field.set(instance, readDouble);
|
||||
break;
|
||||
case "java.lang.String":
|
||||
String readString = buffer.readCharSequence(fieldWrapper.getCodecProprety().length(), Charset.forName("UTF-8")).toString();
|
||||
String readString = buffer.readCharSequence(fieldWrapper.getCodecProprety().length(), StandardCharsets.UTF_8).toString();
|
||||
field.set(instance, readString);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.autonavi.nge.map.LonLat;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
@@ -50,7 +51,7 @@ public class PayloadEncoder {
|
||||
case "java.lang.Character":
|
||||
case "kotlin.Character":
|
||||
case "char":
|
||||
buffer.writeCharSequence((CharSequence) value, Charset.forName("UTF-8"));
|
||||
buffer.writeCharSequence((CharSequence) value, StandardCharsets.UTF_8);
|
||||
break;
|
||||
case "java.lang.Byte":
|
||||
case "kotlin.Byte":
|
||||
@@ -84,7 +85,7 @@ public class PayloadEncoder {
|
||||
break;
|
||||
case "java.lang.String":
|
||||
case "kotlin.String":
|
||||
buffer.writeCharSequence((CharSequence) value, Charset.forName("UTF-8"));
|
||||
buffer.writeCharSequence((CharSequence) value, StandardCharsets.UTF_8);
|
||||
break;
|
||||
default:
|
||||
throw new RuntimeException(typeName + "不支持,bug");
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.zhidaoauto.map.sdk.open.tools.MD5Utils
|
||||
import com.zhidaoauto.map.sdk.open.tools.MapTools
|
||||
import io.netty.buffer.Unpooled
|
||||
import java.nio.charset.Charset
|
||||
import java.nio.charset.StandardCharsets
|
||||
import java.util.*
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
@@ -82,11 +83,11 @@ class MarkerNativeInterface(private val mMapController: IMapController): IMarker
|
||||
}
|
||||
|
||||
override fun addMarkerIconCache(id: Int, icon: String) {
|
||||
markerIconResourceCacheMap.put(id,icon)
|
||||
markerIconResourceCacheMap[id] = icon
|
||||
}
|
||||
|
||||
override fun getMarkerIconCache(id:Int):String?{
|
||||
return markerIconResourceCacheMap.get(id)
|
||||
return markerIconResourceCacheMap[id]
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
@@ -103,7 +104,7 @@ class MarkerNativeInterface(private val mMapController: IMapController): IMarker
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
fun clearAllMarkers(): Boolean? {
|
||||
fun clearAllMarkers(): Boolean {
|
||||
if(DEBUG){
|
||||
Log.i(TAG,"markerop--clearAllMarkers:")
|
||||
}
|
||||
@@ -121,9 +122,7 @@ class MarkerNativeInterface(private val mMapController: IMapController): IMarker
|
||||
* @param title
|
||||
*/
|
||||
fun setTitle(id: String?, title: String?) {
|
||||
|
||||
updateMarkerProperty(id!!, "title", title!!)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -133,7 +132,7 @@ class MarkerNativeInterface(private val mMapController: IMapController): IMarker
|
||||
* @return
|
||||
*/
|
||||
fun getTitle(id: String?): String {
|
||||
return getMarkerProperty(id!!, "title")?:""
|
||||
return getMarkerProperty(id!!, "title")
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -153,11 +152,11 @@ class MarkerNativeInterface(private val mMapController: IMapController): IMarker
|
||||
* @return
|
||||
*/
|
||||
fun getSnippet(id: String?): String {
|
||||
return getMarkerProperty(id!!, "snippet")?:""
|
||||
return getMarkerProperty(id!!, "snippet")
|
||||
}
|
||||
|
||||
fun isAnchorDynamicMoving(id: String): Boolean {
|
||||
return mMapController.isAnchorDynamicMoving(id)?:false
|
||||
return mMapController.isAnchorDynamicMoving(id)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -502,7 +501,7 @@ class MarkerNativeInterface(private val mMapController: IMapController): IMarker
|
||||
refreshMap()
|
||||
}
|
||||
|
||||
fun addDynamicAnchorPostion(id: String, points: List<LonLatPoint>,angle:Float, isGps:Boolean,current:Long,duration: Int) {
|
||||
fun addDynamicAnchorPosition(id: String, points: List<LonLatPoint>,angle:Float, isGps:Boolean,current:Long,duration: Int) {
|
||||
val data = MapTools.listToArray(points,!isGps)
|
||||
if(DEBUG){
|
||||
Log.i(TAG,"markerop--addDynamicAnchorPostion:${id},${points},isGps:${isGps},duration:${duration}")
|
||||
@@ -611,7 +610,7 @@ class MarkerNativeInterface(private val mMapController: IMapController): IMarker
|
||||
}
|
||||
|
||||
|
||||
//设置infowindow的偏移量
|
||||
//设置infoWindow的偏移量
|
||||
fun setInfoWindowOffset(id: String, offsetX: Int, offsetY: Int) {
|
||||
if(DEBUG){
|
||||
Log.i(TAG,"markerop--setInfoWindowOffset:${id},${offsetX},${offsetY}")
|
||||
@@ -738,7 +737,7 @@ class MarkerNativeInterface(private val mMapController: IMapController): IMarker
|
||||
mMapController.setAnchorFlash(id, colorType, color, time, angle)
|
||||
}
|
||||
|
||||
val charset = Charset.forName("UTF-8")
|
||||
val charset: Charset = StandardCharsets.UTF_8
|
||||
|
||||
private fun dealMarker(markerPtions: MarkerOptions):ByteArray?{
|
||||
val buffer = Unpooled.buffer()
|
||||
|
||||
@@ -211,7 +211,7 @@
|
||||
// Log.i(TAG, "navop-msg-getTts")
|
||||
// }
|
||||
// val datas = msg.obj as ByteArray
|
||||
// currentTts = String(datas, Charset.forName("utf-8"))
|
||||
// currentTts = String(datas, StandardCharsets.UTF_8)
|
||||
// if (DEBUG) {
|
||||
// Log.i(TAG, "navop-msg-getTts:${currentTts}")
|
||||
// }
|
||||
|
||||
@@ -31,6 +31,7 @@ import com.zhidaoauto.map.sdk.open.view.MapAutoView
|
||||
import io.netty.buffer.Unpooled
|
||||
import java.math.BigDecimal
|
||||
import java.nio.charset.Charset
|
||||
import java.nio.charset.StandardCharsets
|
||||
import kotlin.math.abs
|
||||
import kotlin.math.pow
|
||||
|
||||
@@ -520,13 +521,13 @@ object MapAutoApi {
|
||||
val byteBuffer = Unpooled.buffer()
|
||||
val str = "1111112345678sjkfdhdkb"
|
||||
byteBuffer.writeInt(str.length)
|
||||
byteBuffer.writeCharSequence(str, Charset.forName("utf-8"))
|
||||
byteBuffer.writeCharSequence(str, StandardCharsets.UTF_8)
|
||||
byteBuffer.writeBoolean(true)
|
||||
byteBuffer.writeInt(999)
|
||||
byteBuffer.writeInt(12)
|
||||
val length = byteBuffer.readInt()
|
||||
println("$length")
|
||||
println("${byteBuffer.readCharSequence(length, Charset.forName("utf-8"))}")
|
||||
println("${byteBuffer.readCharSequence(length, StandardCharsets.UTF_8)}")
|
||||
println("${byteBuffer.readBoolean()}")
|
||||
println("${byteBuffer.readInt()}")
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.zhidaoauto.map.sdk.inner.utils.Recorder
|
||||
import io.netty.buffer.Unpooled
|
||||
import java.math.BigDecimal
|
||||
import java.nio.charset.Charset
|
||||
import java.nio.charset.StandardCharsets
|
||||
import kotlin.math.pow
|
||||
|
||||
object NavAutoApi {
|
||||
@@ -167,13 +168,13 @@ object NavAutoApi {
|
||||
val byteBuffer = Unpooled.buffer()
|
||||
val str = "1111112345678sjkfdhdkb"
|
||||
byteBuffer.writeInt(str.length)
|
||||
byteBuffer.writeCharSequence(str, Charset.forName("utf-8"))
|
||||
byteBuffer.writeCharSequence(str, StandardCharsets.UTF_8)
|
||||
byteBuffer.writeBoolean(true)
|
||||
byteBuffer.writeInt(999)
|
||||
byteBuffer.writeInt(12)
|
||||
val length = byteBuffer.readInt()
|
||||
println("$length")
|
||||
println("${byteBuffer.readCharSequence(length, Charset.forName("utf-8"))}")
|
||||
println("${byteBuffer.readCharSequence(length, StandardCharsets.UTF_8)}")
|
||||
println("${byteBuffer.readBoolean()}")
|
||||
println("${byteBuffer.readInt()}")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user