diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/animation/BezierAnimationView.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/animation/BezierAnimationView.java index 2bed0dae80..2e3b93492d 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/animation/BezierAnimationView.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/animation/BezierAnimationView.java @@ -73,11 +73,27 @@ public class BezierAnimationView extends RelativeLayout implements View.OnClickL 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) { final ImageView imageView = new ImageView(context); imageView.setBackgroundResource(animation_drawable[resource]); 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); imageView.setLayoutParams(params); addView(imageView); diff --git a/modules/mogo-module-common/src/main/res/layout/module_common_bezier_layout.xml b/modules/mogo-module-common/src/main/res/layout/module_common_bezier_layout.xml new file mode 100644 index 0000000000..f5838417a5 --- /dev/null +++ b/modules/mogo-module-common/src/main/res/layout/module_common_bezier_layout.xml @@ -0,0 +1,13 @@ + + + + + + \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XRoadEventVH.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XRoadEventVH.java index f269856f7b..d94f0c7d15 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XRoadEventVH.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XRoadEventVH.java @@ -3,6 +3,7 @@ package com.mogo.module.v2x.adapter.holder; import android.content.Context; import android.content.Intent; import android.graphics.drawable.Drawable; +import android.os.Handler; import android.text.TextUtils; import android.util.Log; import android.view.Gravity; @@ -10,11 +11,13 @@ import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; +import android.view.WindowManager; import android.widget.ImageView; import android.widget.TextView; import com.bumptech.glide.Glide; import com.bumptech.glide.request.RequestOptions; +import com.mogo.commons.AbsMogoApplication; import com.mogo.commons.debug.DebugConfig; import com.mogo.module.common.animation.BezierAnimationView; 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.V2XMessageEntity; 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.V2XServiceManager; import com.mogo.module.v2x.entity.net.V2XUserInfoRes; @@ -81,7 +85,7 @@ public class V2XRoadEventVH extends V2XBaseViewHolder { private HeartLikeView ivEventZan; private ViewGroup mViewGroup; - + private WindowManagerView mWindowManagerView; // 上传事件的用户信息 private MarkerUserInfo mUserInfo; @@ -312,7 +316,7 @@ public class V2XRoadEventVH extends V2XBaseViewHolder { e.printStackTrace(); } } - + /* * 展示事件的图片/视频资源 * */ @@ -364,6 +368,53 @@ public class V2XRoadEventVH extends V2XBaseViewHolder { } } + 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; + } + /** * 为了给车聊聊更多的信息需要重新查询一次 * diff --git a/modules/mogo-module-v2x/src/main/res/values-xhdpi/dimens.xml b/modules/mogo-module-v2x/src/main/res/values-xhdpi/dimens.xml index 4fb423afdc..5e05de0f6b 100644 --- a/modules/mogo-module-v2x/src/main/res/values-xhdpi/dimens.xml +++ b/modules/mogo-module-v2x/src/main/res/values-xhdpi/dimens.xml @@ -120,5 +120,8 @@ 46px 26px + + 1281px +