[6.2.4] code clean
This commit is contained in:
@@ -79,7 +79,7 @@ public class BusProvider implements IMogoOCH {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getFunctionName() {
|
||||
return null;
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -66,8 +66,8 @@ public class SlidePanelView extends View {
|
||||
private static int BLOCK_START_Y = AutoSizeUtils.dp2px(AbsMogoApplication.getApp(),15);
|
||||
private static int NORMAL_TEXT_MARGIN_LEFT = AutoSizeUtils.dp2px(AbsMogoApplication.getApp(),40);
|
||||
private static int NORMAL_TEXT_MARGIN_RIGHT = AutoSizeUtils.dp2px(AbsMogoApplication.getApp(),60);
|
||||
private static int SHORT_TEXT_MARGIN_LEFT = AutoSizeUtils.dp2px(AbsMogoApplication.getApp(),60);;
|
||||
private static int SHORT_TEXT_MARGIN_RIGHT = AutoSizeUtils.dp2px(AbsMogoApplication.getApp(),70);;
|
||||
private static int SHORT_TEXT_MARGIN_LEFT = AutoSizeUtils.dp2px(AbsMogoApplication.getApp(),60);
|
||||
private static int SHORT_TEXT_MARGIN_RIGHT = AutoSizeUtils.dp2px(AbsMogoApplication.getApp(),70);
|
||||
|
||||
private int textMarginLeft = NORMAL_TEXT_MARGIN_LEFT;
|
||||
private int textMarginRight = NORMAL_TEXT_MARGIN_RIGHT;
|
||||
@@ -247,10 +247,10 @@ public class SlidePanelView extends View {
|
||||
}
|
||||
|
||||
private void startBlockBackAnim() {
|
||||
ObjectAnimator blockBackanimator = ObjectAnimator.ofInt(this, "blockOffset", blockOffset, 0);
|
||||
blockBackanimator.setInterpolator(new DecelerateInterpolator());
|
||||
blockBackanimator.setDuration(1000L * blockOffset / getWidth());
|
||||
blockBackanimator.start();
|
||||
ObjectAnimator blockBackAnimator = ObjectAnimator.ofInt(this, "blockOffset", blockOffset, 0);
|
||||
blockBackAnimator.setInterpolator(new DecelerateInterpolator());
|
||||
blockBackAnimator.setDuration(1000L * blockOffset / getWidth());
|
||||
blockBackAnimator.start();
|
||||
lastX = 0;
|
||||
}
|
||||
|
||||
@@ -263,7 +263,7 @@ public class SlidePanelView extends View {
|
||||
gradientMatrix.setTranslate(matrixTranslate, 0);
|
||||
textGradient.setLocalMatrix(gradientMatrix);
|
||||
canvas.save();
|
||||
canvas.drawText(blockText, (float) (blockWidth + BLOCK_START_X + textMarginLeft), textOffset, textPaint);
|
||||
canvas.drawText(blockText, (float) (blockWidth + BLOCK_START_X + textMarginLeft), (float) textOffset, textPaint);
|
||||
canvas.restore();
|
||||
// 画滑块
|
||||
canvas.drawBitmap(bmBlock, (float) (BLOCK_START_X + blockOffset), (float) BLOCK_START_Y, blockPaint);
|
||||
|
||||
@@ -57,7 +57,7 @@ public class MogoOCHBusPassenger implements IMogoOCH {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getFunctionName() {
|
||||
return null;
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -79,7 +79,7 @@ public class BusProvider implements IMogoOCH {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getFunctionName() {
|
||||
return null;
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -66,7 +66,7 @@ public class SweeperProvider implements IMogoOCH {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getFunctionName() {
|
||||
return null;
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -66,7 +66,7 @@ public class SweeperProvider implements IMogoOCH {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getFunctionName() {
|
||||
return null;
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -49,6 +49,7 @@ public class SlidePanelView extends View {
|
||||
NORMAL_TEXT_MARGIN_RIGHT = (int) mTypedArray.getDimension(R.styleable.SlidePanelView_NORMAL_TEXT_MARGIN_RIGHT, NORMAL_TEXT_MARGIN_RIGHT);
|
||||
SHORT_TEXT_MARGIN_LEFT = (int) mTypedArray.getDimension(R.styleable.SlidePanelView_SHORT_TEXT_MARGIN_LEFT, SHORT_TEXT_MARGIN_LEFT);
|
||||
SHORT_TEXT_MARGIN_RIGHT = (int) mTypedArray.getDimension(R.styleable.SlidePanelView_SHORT_TEXT_MARGIN_RIGHT, SHORT_TEXT_MARGIN_RIGHT);
|
||||
mTypedArray.recycle();
|
||||
init();
|
||||
}
|
||||
|
||||
@@ -87,7 +88,7 @@ public class SlidePanelView extends View {
|
||||
private ObjectAnimator matrixAnim;
|
||||
|
||||
private String blockText = STRING_SLIDE_TO_RIGHT;
|
||||
private Paint.FontMetrics blockTextMetrics = new Paint.FontMetrics();
|
||||
private final Paint.FontMetrics blockTextMetrics = new Paint.FontMetrics();
|
||||
|
||||
private static final int GRADIENT_OFFSET = 200;
|
||||
|
||||
@@ -239,10 +240,10 @@ public class SlidePanelView extends View {
|
||||
}
|
||||
|
||||
private void startBlockBackAnim() {
|
||||
ObjectAnimator blockBackanimator = ObjectAnimator.ofInt(this, "blockOffset", blockOffset, 0);
|
||||
blockBackanimator.setInterpolator(new DecelerateInterpolator());
|
||||
blockBackanimator.setDuration(1000 * blockOffset / getWidth());
|
||||
blockBackanimator.start();
|
||||
ObjectAnimator blockBackAnimator = ObjectAnimator.ofInt(this, "blockOffset", blockOffset, 0);
|
||||
blockBackAnimator.setInterpolator(new DecelerateInterpolator());
|
||||
blockBackAnimator.setDuration(1000L * blockOffset / getWidth());
|
||||
blockBackAnimator.start();
|
||||
lastX = 0;
|
||||
}
|
||||
|
||||
@@ -255,10 +256,10 @@ public class SlidePanelView extends View {
|
||||
gradientMatrix.setTranslate(matrixTranslate, 0);
|
||||
textGradient.setLocalMatrix(gradientMatrix);
|
||||
canvas.save();
|
||||
canvas.drawText(blockText, blockWidth + BLOCK_START_X + textMarginLeft, textOffset, textPaint);
|
||||
canvas.drawText(blockText, (float) (blockWidth + BLOCK_START_X + textMarginLeft), (float) textOffset, textPaint);
|
||||
canvas.restore();
|
||||
// 画滑块
|
||||
canvas.drawBitmap(bmBlock, BLOCK_START_X + blockOffset, BLOCK_START_Y, blockPaint);
|
||||
canvas.drawBitmap(bmBlock, (float) (BLOCK_START_X + blockOffset), (float) BLOCK_START_Y, blockPaint);
|
||||
}
|
||||
|
||||
public interface OnSlidePanelMoveToEndListener {
|
||||
|
||||
@@ -79,7 +79,7 @@ class TaxiProvider implements IMogoOCH {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getFunctionName() {
|
||||
return null;
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -83,7 +83,6 @@ public class TaxiGrabOrderFragment extends BaseTaxiUIFragment implements View.On
|
||||
}else if (v.getId() == R.id.grab_order_tv){
|
||||
if (!mOrderGrabBt.getText().toString().equals("抢单中...")){
|
||||
getOchTaxiFragment().grabOrder();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -151,7 +150,7 @@ public class TaxiGrabOrderFragment extends BaseTaxiUIFragment implements View.On
|
||||
}
|
||||
mGrabSuccessAnim.start();
|
||||
//开启动画结束的监听
|
||||
long delayMillis = mGrabSuccessAnim.getDuration(0) * mGrabSuccessAnim.getNumberOfFrames();
|
||||
long delayMillis = (long) mGrabSuccessAnim.getDuration(0) * mGrabSuccessAnim.getNumberOfFrames();
|
||||
UiThreadHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -174,7 +173,7 @@ public class TaxiGrabOrderFragment extends BaseTaxiUIFragment implements View.On
|
||||
mGrabFailureAnim = (AnimationDrawable)mGrabResultAnimView.getDrawable();
|
||||
mGrabFailureAnim.start();
|
||||
//开启动画结束的监听
|
||||
long delayMillis = mGrabFailureAnim.getDuration(0) * mGrabFailureAnim.getNumberOfFrames();
|
||||
long delayMillis = (long) mGrabFailureAnim.getDuration(0) * mGrabFailureAnim.getNumberOfFrames();
|
||||
UiThreadHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
@@ -68,12 +68,11 @@ public class TaxiPersonalDialogFragment extends
|
||||
private ViewPager mOperationViewPager;
|
||||
private OrderAdapter mAdapter;
|
||||
private ConstraintLayout mNoDatas;
|
||||
private List<OrderQueryRespBean.Result> orders = new ArrayList<>();
|
||||
private String[] mTabTitles = {"在线时长","订单完成数"};
|
||||
private List<TaxiOperationDatasFragment> fragments = new ArrayList<>();
|
||||
private final List<OrderQueryRespBean.Result> orders = new ArrayList<>();
|
||||
private final String[] mTabTitles = {"在线时长","订单完成数"};
|
||||
private final List<TaxiOperationDatasFragment> fragments = new ArrayList<>();
|
||||
private int mNextPage = 1;//订单列表分页从1开始
|
||||
private int mPerPageSize = 10;
|
||||
private static TaxiFragment mTaxiFragment;
|
||||
private final int mPerPageSize = 10;
|
||||
private static boolean serverHadNoData = false;
|
||||
|
||||
@NonNull
|
||||
@@ -177,7 +176,6 @@ public class TaxiPersonalDialogFragment extends
|
||||
}
|
||||
}
|
||||
mOperationTab.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||
@Override
|
||||
public void onTabSelected(TabLayout.Tab tab) {
|
||||
mOperationViewPager.setCurrentItem(tab.getPosition());
|
||||
@@ -185,7 +183,6 @@ public class TaxiPersonalDialogFragment extends
|
||||
fragments.get(tab.getPosition()).setmType(tab.getPosition());
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||
@Override
|
||||
public void onTabUnselected(TabLayout.Tab tab) {
|
||||
changeOperationTabLayoutTabUI(tab,false);
|
||||
@@ -311,17 +308,14 @@ public class TaxiPersonalDialogFragment extends
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
if (viewType == ORDER_DETAIL_ITEM){
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.taxi_orders_list_item,parent,false);
|
||||
OrderDetailViewHolder viewHolder = new OrderDetailViewHolder(view);
|
||||
return viewHolder;
|
||||
return new OrderDetailViewHolder(view);
|
||||
}else if (viewType == DAY_GROUP_ITEM){
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.taxi_orders_list_day_item,parent,false);
|
||||
DayGroupViewHolder viewHolder = new DayGroupViewHolder(view);
|
||||
return viewHolder;
|
||||
return new DayGroupViewHolder(view);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
OrderQueryRespBean.Result queryRespBean = orders.get(position);
|
||||
@@ -383,8 +377,7 @@ public class TaxiPersonalDialogFragment extends
|
||||
String currentDate = DateTimeUtil.getYMDTime(orders.get(position).createTime);//获取当前订单时间
|
||||
int nextIndex = position + 1;
|
||||
String preDate = DateTimeUtil.getYMDTime(orders.get(nextIndex).createTime);
|
||||
boolean isDifferent = preDate.equals(currentDate);//订单跟后一个订单是否是同一天
|
||||
return isDifferent;//一样有划分线, 不一样没有划分线
|
||||
return preDate.equals(currentDate);//一样有划分线, 不一样没有划分线
|
||||
}
|
||||
}
|
||||
|
||||
@@ -393,7 +386,6 @@ public class TaxiPersonalDialogFragment extends
|
||||
return orders.size();
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||
private void bindOrderDetailData(OrderQueryRespBean.Result queryRespBean, TextView orderTimeTv, TextView startStationTv, TextView endStationTv,
|
||||
Button orderStatusBt, Button orderTypeBt, TextView orderNumTv){
|
||||
Calendar calendar= Calendar.getInstance();
|
||||
@@ -406,7 +398,6 @@ public class TaxiPersonalDialogFragment extends
|
||||
orderNumTv.setText("订单编号:"+String.valueOf(queryRespBean.orderNo));
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||
private String getOrderStatus(int status, Button button){
|
||||
TaxiOrderStatusEnum orderStatus = TaxiOrderStatusEnum.valueOf(status);
|
||||
switch (orderStatus){
|
||||
@@ -422,7 +413,6 @@ public class TaxiPersonalDialogFragment extends
|
||||
}
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||
private String getOrderType(int type, Button button){
|
||||
if (type == TaxiOrderTypeEnum.Reserved.getType()){
|
||||
button.setBackground(context.getDrawable(R.drawable.taxi_order_button_type_reserver_bg));
|
||||
|
||||
@@ -82,7 +82,7 @@ class MogoOCHTaxiPassenger implements IMogoOCH {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getFunctionName() {
|
||||
return null;
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -78,7 +78,7 @@ public class MogoOCHTaxiPassenger implements IMogoOCH {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getFunctionName() {
|
||||
return null;
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -1,284 +0,0 @@
|
||||
package com.mogo.eagle.core.function.smp;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.BitmapFactory;
|
||||
|
||||
import com.amap.api.maps.AMap;
|
||||
import com.amap.api.maps.CameraUpdateFactory;
|
||||
import com.amap.api.maps.TextureMapView;
|
||||
import com.amap.api.maps.model.BitmapDescriptor;
|
||||
import com.amap.api.maps.model.BitmapDescriptorFactory;
|
||||
import com.amap.api.maps.model.CameraPosition;
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.amap.api.maps.model.Marker;
|
||||
import com.amap.api.maps.model.MarkerOptions;
|
||||
import com.amap.api.maps.model.Polyline;
|
||||
import com.autonavi.amap.mapcore.IPoint;
|
||||
import com.mogo.eagle.core.function.map.R;
|
||||
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
/**
|
||||
* 包名: com.amap.api.navi.core
|
||||
* <p>
|
||||
* 创建时间:2018/3/1
|
||||
* 项目名称:AndroidNavigationSDK
|
||||
*
|
||||
* @author guibao.ggb
|
||||
* @email guibao.ggb@alibaba-inc.com
|
||||
* <p>
|
||||
* 类说明:自车位置管理Overlay类
|
||||
*/
|
||||
public class CarOverlay {
|
||||
|
||||
protected static final int CAR_MOVE_ANIMATION_PERIOD = 50;
|
||||
protected int carMoveAnimationFrameNum = 2;
|
||||
protected boolean mIsLock = true;
|
||||
protected IPoint mapAnchorBackup = null;
|
||||
protected double dXOffStep;
|
||||
protected double dYOffStep;
|
||||
protected float dAngleOffStep;
|
||||
protected int currentFrameIndex;
|
||||
protected float angleStart = 0;
|
||||
protected boolean isMoveStarted = false;
|
||||
protected float newAngle = 0;
|
||||
protected BitmapDescriptor carDescriptor = null;
|
||||
protected BitmapDescriptor fourCornersDescriptor = null;
|
||||
protected Marker carMarker;
|
||||
protected Marker directionMarker;
|
||||
protected AMap mAmap = null;
|
||||
protected TextureMapView mapView;
|
||||
protected boolean isDirectionVisible = true;
|
||||
protected LatLng endLatLng = null;
|
||||
protected Polyline leaderLine = null;
|
||||
protected final int DISTANCE_OFFSET = 150;// 默认 500 偏差
|
||||
|
||||
// API 默认 1800 UI 默认 360
|
||||
protected int angleModValue = 1800;
|
||||
|
||||
|
||||
private ScheduledExecutorService executorService;
|
||||
|
||||
public CarOverlay(Context context, TextureMapView mapView) {
|
||||
this.mapView = mapView;
|
||||
|
||||
// fourCornersDescriptor = BitmapDescriptorFactory.fromBitmap(BitmapFactory
|
||||
// .decodeResource(context.getResources(),
|
||||
// R.drawable.module_small_map_navi_direction));
|
||||
|
||||
carDescriptor = BitmapDescriptorFactory.fromBitmap(BitmapFactory
|
||||
.decodeResource(context.getResources(),
|
||||
R.drawable.module_small_map_view_my_location_logo));
|
||||
angleModValue = 1800;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置自车状态
|
||||
*
|
||||
* @param lock true 锁车 false 非锁车
|
||||
*/
|
||||
public void setLock(boolean lock) {
|
||||
mIsLock = lock;
|
||||
if (carMarker == null) {
|
||||
return;
|
||||
}
|
||||
if (mAmap == null) {
|
||||
return;
|
||||
}
|
||||
if (directionMarker == null) {
|
||||
return;
|
||||
}
|
||||
carMarker.setFlat(true);
|
||||
directionMarker.setGeoPoint(carMarker.getGeoPoint());
|
||||
carMarker.setGeoPoint(carMarker.getGeoPoint());
|
||||
carMarker.setRotateAngle(carMarker.getRotateAngle());
|
||||
if (mIsLock) {
|
||||
CameraPosition cameraPosition = new CameraPosition.Builder().target(carMarker.getPosition()).bearing(newAngle).tilt(0).zoom(16).build();
|
||||
mAmap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
|
||||
}
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
if (carMarker != null) {
|
||||
carMarker.remove();
|
||||
}
|
||||
if (directionMarker != null) {
|
||||
directionMarker.remove();
|
||||
}
|
||||
if (leaderLine != null) {
|
||||
leaderLine.remove();
|
||||
}
|
||||
leaderLine = null;
|
||||
carMarker = null;
|
||||
directionMarker = null;
|
||||
|
||||
if (executorService != null) {
|
||||
if (!executorService.isShutdown()) {
|
||||
executorService.shutdown();
|
||||
}
|
||||
isMoveStarted = false;
|
||||
|
||||
executorService = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制自车
|
||||
*
|
||||
* @param aMap
|
||||
* @param mLatLng
|
||||
* @param bearing
|
||||
*/
|
||||
public void draw(AMap aMap, LatLng mLatLng, float bearing) {
|
||||
if (aMap == null || mLatLng == null || carDescriptor == null) {
|
||||
return;
|
||||
}
|
||||
mAmap = aMap;
|
||||
try {
|
||||
if (carMarker == null) {
|
||||
carMarker = aMap.addMarker(new MarkerOptions().anchor(0.5f, 0.5f).setFlat(true).icon(carDescriptor).position(mLatLng));
|
||||
}
|
||||
|
||||
if (directionMarker == null) {
|
||||
directionMarker = aMap.addMarker(new MarkerOptions().anchor(0.5f, 0.5f).setFlat(true).icon(fourCornersDescriptor).position(mLatLng));
|
||||
directionMarker.setVisible(isDirectionVisible);
|
||||
}
|
||||
carMarker.setVisible(true);
|
||||
newAngle = bearing;
|
||||
IPoint resultGeoPnt = IPoint.obtain();
|
||||
// resultGeoPnt = NaviUtil.lonlat2Geo(mLatLng.latitude, mLatLng.longitude, 20);
|
||||
updateCarPosition(resultGeoPnt);
|
||||
resultGeoPnt.recycle();
|
||||
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void updateCarPosition(IPoint p) {
|
||||
carMarker.setGeoPoint(p);
|
||||
carMarker.setFlat(true);
|
||||
carMarker.setRotateAngle(360 - newAngle);
|
||||
if (directionMarker != null) {
|
||||
directionMarker.setGeoPoint(p);
|
||||
}
|
||||
|
||||
if (mIsLock) {
|
||||
CameraPosition cameraPosition = new CameraPosition.Builder().target(carMarker.getPosition()).bearing(newAngle).tilt(0).zoom(16).build();
|
||||
mAmap.moveCamera(CameraUpdateFactory.changeBearingGeoCenter(newAngle, p));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setEndPoi(LatLng latlng) {
|
||||
endLatLng = latlng;
|
||||
}
|
||||
|
||||
/**
|
||||
* 释放自车资源
|
||||
*/
|
||||
public void destroy() {
|
||||
if (carMarker != null) {
|
||||
carMarker.remove();
|
||||
carMarker = null;
|
||||
}
|
||||
if (directionMarker != null) {
|
||||
directionMarker.remove();
|
||||
directionMarker = null;
|
||||
}
|
||||
carDescriptor = null;
|
||||
|
||||
if (executorService != null && !executorService.isShutdown()) {
|
||||
executorService.shutdown();
|
||||
isMoveStarted = false;
|
||||
|
||||
executorService = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void calculateCarSmoothMoveOffset(IPoint newCenter, float newAngle) {
|
||||
if (carMarker == null) {
|
||||
return;
|
||||
}
|
||||
IPoint currentAnchorGeoPoint = carMarker.getGeoPoint();
|
||||
if (currentAnchorGeoPoint == null || currentAnchorGeoPoint.x == 0 || currentAnchorGeoPoint.y == 0) {
|
||||
currentAnchorGeoPoint = newCenter;
|
||||
}
|
||||
currentFrameIndex = 0;
|
||||
mapAnchorBackup = currentAnchorGeoPoint;
|
||||
dXOffStep = (newCenter.x - currentAnchorGeoPoint.x) / carMoveAnimationFrameNum;
|
||||
dYOffStep = (newCenter.y - currentAnchorGeoPoint.y) / carMoveAnimationFrameNum;
|
||||
// 获取当前的旋转角度
|
||||
angleStart = carMarker.getRotateAngle();
|
||||
boolean isFirst = false;
|
||||
|
||||
if (Float.compare(angleStart, newAngle) == 0) {
|
||||
isFirst = true;
|
||||
} else {
|
||||
angleStart = 360 - angleStart;
|
||||
}
|
||||
// 校正旋转角度问题
|
||||
float dAngleDelta = newAngle - angleStart;
|
||||
if (isFirst) {
|
||||
dAngleDelta = 0;
|
||||
}
|
||||
if (dAngleDelta > 180) {
|
||||
dAngleDelta = dAngleDelta - 360;
|
||||
}
|
||||
else if (dAngleDelta < -180) {
|
||||
dAngleDelta = dAngleDelta + 360;
|
||||
}
|
||||
dAngleOffStep = dAngleDelta / carMoveAnimationFrameNum;
|
||||
isMoveStarted = true;
|
||||
}
|
||||
|
||||
// protected void startSmoothMoveTimer() {
|
||||
// if (executorService == null) {
|
||||
// executorService = new ScheduledThreadPoolExecutor(1, new BasicThreadFactory.Builder().namingPattern("caroverlay-schedule-pool-%d").daemon(true).build());
|
||||
//
|
||||
// executorService.scheduleAtFixedRate(new Runnable() {
|
||||
// long currentSeconds;
|
||||
// @Override
|
||||
// public void run() {
|
||||
// try{
|
||||
// currentSeconds = System.currentTimeMillis();
|
||||
// mapSmoothMoveTimerTick();
|
||||
// } catch(Throwable e){
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// }, 0, CAR_MOVE_ANIMATION_PERIOD, TimeUnit.MILLISECONDS);
|
||||
// }
|
||||
// }
|
||||
|
||||
private void mapSmoothMoveTimerTick() {
|
||||
if (!isMoveStarted) {
|
||||
return;
|
||||
}
|
||||
if (carMarker == null) {
|
||||
return;
|
||||
}
|
||||
if (mAmap == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
IPoint p = carMarker.getGeoPoint();
|
||||
double newX, newY;
|
||||
if (currentFrameIndex++ < carMoveAnimationFrameNum) {
|
||||
newX = mapAnchorBackup.x + dXOffStep * currentFrameIndex;
|
||||
newY = mapAnchorBackup.y + dYOffStep * currentFrameIndex;
|
||||
newAngle = angleStart + dAngleOffStep * currentFrameIndex;
|
||||
newAngle %= angleModValue;
|
||||
if (newX != 0 || newY != 0) {
|
||||
p = new IPoint((int)newX, (int)newY);
|
||||
}
|
||||
updateCarPosition(p);
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -40,7 +40,7 @@ public class MarkerUserInfo implements Serializable {
|
||||
int year = cal.get(Calendar.YEAR);
|
||||
|
||||
//2020-30=1990
|
||||
double ageDiffer = year - getAgeNumber();
|
||||
double ageDiffer = (double) (year - getAgeNumber());
|
||||
String ageStr = "" + ageDiffer;
|
||||
char[] ageChars = ageStr.toCharArray();
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ strictfp class Real extends Number {
|
||||
epsilon *= 0.5;
|
||||
} while (1.0 + epsilon != 1.0);
|
||||
int mantissaBits = (int) Math.round(-Math.log(epsilon) / Math.log(2));
|
||||
SPLITTER = (1 << ((mantissaBits + 1) / 2)) + 1;
|
||||
SPLITTER = (double) (1 << ((mantissaBits + 1) / 2)) + 1;
|
||||
}
|
||||
|
||||
/** Returns the result of a + b, without loss of precision. */
|
||||
|
||||
@@ -24,7 +24,7 @@ public class DiskCacheManager {
|
||||
private static DiskLruCache mDiskLruCache = null;
|
||||
private DiskLruCache.Editor mEditor = null;
|
||||
private DiskLruCache.Snapshot mSnapshot = null;
|
||||
public static final long CACHE_MAXSIZE = 10 * 1024 * 1024;
|
||||
public static final long CACHE_MAXSIZE = 10L * 1024 * 1024;
|
||||
|
||||
public DiskCacheManager( Context context, String uniqueName) {
|
||||
try {
|
||||
|
||||
@@ -540,8 +540,12 @@ public class CommonUtils {
|
||||
try {
|
||||
packageName = TextUtils.isEmpty(packageName) ? context.getPackageName() : packageName;
|
||||
PackageManager packageManager = context.getPackageManager();
|
||||
PackageInfo packInfo = packageManager.getPackageInfo(packageName, 0);
|
||||
return packInfo.versionName;
|
||||
if(packageManager != null){
|
||||
PackageInfo packInfo = packageManager.getPackageInfo(packageName, 0);
|
||||
return packInfo.versionName;
|
||||
}else {
|
||||
return "";
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return "";
|
||||
}
|
||||
@@ -558,6 +562,9 @@ public class CommonUtils {
|
||||
try {
|
||||
packageName = TextUtils.isEmpty(packageName) ? context.getPackageName() : packageName;
|
||||
PackageManager packageManager = context.getPackageManager();
|
||||
if(packageManager == null){
|
||||
return 0;
|
||||
}
|
||||
PackageInfo packInfo = packageManager.getPackageInfo(packageName, 0);
|
||||
return packInfo.versionCode;
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -114,7 +114,6 @@ public final class FileUtils {
|
||||
Uri uri = Uri.parse(filePath);
|
||||
ContentResolver cr = Utils.getApp().getContentResolver();
|
||||
AssetFileDescriptor afd = cr.openAssetFileDescriptor(uri, "r");
|
||||
if (afd == null) return false;
|
||||
try {
|
||||
afd.close();
|
||||
} catch (IOException ignore) {
|
||||
|
||||
@@ -1072,17 +1072,17 @@ public final class ImageUtils {
|
||||
Bitmap ret = Bitmap.createBitmap(srcWidth, srcHeight + reflectionHeight, src.getConfig());
|
||||
Canvas canvas = new Canvas(ret);
|
||||
canvas.drawBitmap(src, 0, 0, null);
|
||||
canvas.drawBitmap(reflectionBitmap, 0, srcHeight + REFLECTION_GAP, null);
|
||||
canvas.drawBitmap(reflectionBitmap, 0, (float) (srcHeight + REFLECTION_GAP), null);
|
||||
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
LinearGradient shader = new LinearGradient(
|
||||
0, srcHeight,
|
||||
0, ret.getHeight() + REFLECTION_GAP,
|
||||
0, (float) (ret.getHeight() + REFLECTION_GAP),
|
||||
0x70FFFFFF,
|
||||
0x00FFFFFF,
|
||||
Shader.TileMode.MIRROR);
|
||||
paint.setShader(shader);
|
||||
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
|
||||
canvas.drawRect(0, srcHeight + REFLECTION_GAP, srcWidth, ret.getHeight(), paint);
|
||||
canvas.drawRect(0, (float) (srcHeight + REFLECTION_GAP), srcWidth, ret.getHeight(), paint);
|
||||
if (!reflectionBitmap.isRecycled()) reflectionBitmap.recycle();
|
||||
if (recycle && !src.isRecycled() && ret != src) src.recycle();
|
||||
return ret;
|
||||
|
||||
@@ -1158,7 +1158,7 @@ public final class SpanUtils {
|
||||
p.setStyle(Paint.Style.FILL);
|
||||
p.setColor(this.color);
|
||||
|
||||
c.drawRect(x, top, x + dir * stripeWidth, bottom, p);
|
||||
c.drawRect(x, top, (float) (x + dir * stripeWidth), bottom, p);
|
||||
|
||||
p.setStyle(style);
|
||||
p.setColor(color);
|
||||
@@ -1388,9 +1388,9 @@ public final class SpanUtils {
|
||||
} else if (mVerticalAlignment == ALIGN_CENTER) {
|
||||
transY = (bottom + top - rect.height()) / 2.0f;
|
||||
} else if (mVerticalAlignment == ALIGN_BASELINE) {
|
||||
transY = y - rect.height();
|
||||
transY = (float) (y - rect.height());
|
||||
} else {
|
||||
transY = bottom - rect.height();
|
||||
transY = (float) (bottom - rect.height());
|
||||
}
|
||||
canvas.translate(x, transY);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user