[add] 贝塞尔曲线动画window层添加
This commit is contained in:
@@ -73,11 +73,27 @@ public class BezierAnimationView extends RelativeLayout implements View.OnClickL
|
|||||||
runnable.run();
|
runnable.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void bezierAnimationStart(){
|
||||||
|
runnable = new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
Log.d("点赞--", "");
|
||||||
|
bezierAnimation(resource);
|
||||||
|
handler.postDelayed(this, 500);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
runnable.run();
|
||||||
|
}
|
||||||
|
|
||||||
private void bezierAnimation(int resource) {
|
private void bezierAnimation(int resource) {
|
||||||
final ImageView imageView = new ImageView(context);
|
final ImageView imageView = new ImageView(context);
|
||||||
imageView.setBackgroundResource(animation_drawable[resource]);
|
imageView.setBackgroundResource(animation_drawable[resource]);
|
||||||
RelativeLayout.LayoutParams params = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
RelativeLayout.LayoutParams params = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||||
params.addRule(ALIGN_BOTTOM);
|
// params.addRule(ALIGN_BOTTOM);
|
||||||
params.addRule(CENTER_HORIZONTAL);
|
params.addRule(CENTER_HORIZONTAL);
|
||||||
imageView.setLayoutParams(params);
|
imageView.setLayoutParams(params);
|
||||||
addView(imageView);
|
addView(imageView);
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="#890">
|
||||||
|
|
||||||
|
<com.mogo.module.common.animation.BezierAnimationView
|
||||||
|
android:id="@+id/bezier_view"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="#7810" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
@@ -3,6 +3,7 @@ package com.mogo.module.v2x.adapter.holder;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.os.Handler;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
@@ -10,11 +11,13 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.WindowManager;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
import com.bumptech.glide.request.RequestOptions;
|
import com.bumptech.glide.request.RequestOptions;
|
||||||
|
import com.mogo.commons.AbsMogoApplication;
|
||||||
import com.mogo.commons.debug.DebugConfig;
|
import com.mogo.commons.debug.DebugConfig;
|
||||||
import com.mogo.module.common.animation.BezierAnimationView;
|
import com.mogo.module.common.animation.BezierAnimationView;
|
||||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||||
@@ -23,6 +26,7 @@ import com.mogo.module.common.entity.V2XEventShowEntity;
|
|||||||
import com.mogo.module.common.entity.V2XLiveCarInfoEntity;
|
import com.mogo.module.common.entity.V2XLiveCarInfoEntity;
|
||||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||||
|
import com.mogo.module.common.wm.WindowManagerView;
|
||||||
import com.mogo.module.v2x.R;
|
import com.mogo.module.v2x.R;
|
||||||
import com.mogo.module.v2x.V2XServiceManager;
|
import com.mogo.module.v2x.V2XServiceManager;
|
||||||
import com.mogo.module.v2x.entity.net.V2XUserInfoRes;
|
import com.mogo.module.v2x.entity.net.V2XUserInfoRes;
|
||||||
@@ -81,7 +85,7 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
|
|||||||
private HeartLikeView ivEventZan;
|
private HeartLikeView ivEventZan;
|
||||||
|
|
||||||
private ViewGroup mViewGroup;
|
private ViewGroup mViewGroup;
|
||||||
|
private WindowManagerView mWindowManagerView;
|
||||||
|
|
||||||
// 上传事件的用户信息
|
// 上传事件的用户信息
|
||||||
private MarkerUserInfo mUserInfo;
|
private MarkerUserInfo mUserInfo;
|
||||||
@@ -312,7 +316,7 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 展示事件的图片/视频资源
|
* 展示事件的图片/视频资源
|
||||||
* */
|
* */
|
||||||
@@ -364,6 +368,53 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void bezierAnimation(int[] loc) {
|
||||||
|
if (mWindowManagerView == null) {
|
||||||
|
Log.d(TAG, "bezierAnimation:null");
|
||||||
|
mWindowManagerView = new WindowManagerView.Builder(mContext.getApplicationContext())
|
||||||
|
.contentView(R.layout.module_common_bezier_layout)
|
||||||
|
.size(WindowManager.LayoutParams.WRAP_CONTENT,
|
||||||
|
WindowManager.LayoutParams.WRAP_CONTENT)
|
||||||
|
.position(loc[0], loc[1])
|
||||||
|
.gravity(Gravity.TOP | Gravity.LEFT)
|
||||||
|
.showInWindowManager();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (mWindowManagerView.isShowing()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mWindowManagerView.show();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
BezierAnimationView bezierAnimationView = mWindowManagerView.findViewById(R.id.bezier_view);
|
||||||
|
bezierAnimationView.bezierAnimationStart();
|
||||||
|
new Handler().postDelayed(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
// mWindowManagerView.dismiss();
|
||||||
|
}
|
||||||
|
}, 2000);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[] getLocation(View v) {
|
||||||
|
int[] loc = new int[4];
|
||||||
|
int[] location = new int[2];
|
||||||
|
v.getLocationOnScreen(location);
|
||||||
|
loc[0] = location[0];
|
||||||
|
loc[1] = location[1];
|
||||||
|
int w = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
|
||||||
|
int h = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
|
||||||
|
v.measure(w, h);
|
||||||
|
|
||||||
|
loc[2] = v.getMeasuredWidth();
|
||||||
|
loc[3] = v.getMeasuredHeight();
|
||||||
|
|
||||||
|
//base = computeWH();
|
||||||
|
return loc;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 为了给车聊聊更多的信息需要重新查询一次
|
* 为了给车聊聊更多的信息需要重新查询一次
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -120,5 +120,8 @@
|
|||||||
<dimen name="v2x_driving_heigt">46px</dimen>
|
<dimen name="v2x_driving_heigt">46px</dimen>
|
||||||
<dimen name="v2x_recommond_route_size">26px</dimen>
|
<dimen name="v2x_recommond_route_size">26px</dimen>
|
||||||
|
|
||||||
|
<!--适配贝塞尔曲线-->
|
||||||
|
<dimen name="v2x_bezier_x">1281px</dimen>
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
Reference in New Issue
Block a user