下沉可共用的自定义控件

Signed-off-by: 董宏宇 <martindhy@gmail.com>
This commit is contained in:
董宏宇
2021-09-22 11:33:06 +08:00
committed by liujing
parent 32d200623c
commit 4db130816b
38 changed files with 161 additions and 211 deletions

2
.idea/misc.xml generated
View File

@@ -13,6 +13,7 @@
<map>
<entry key="../../../../../../layout/custom_preview.xml" value="0.390625" />
<entry key="../../../../../layout/custom_preview.xml" value="0.19947916666666668" />
<entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_warning.xml" value="0.19895833333333332" />
<entry key="modules/mogo-module-hmi/src/main/res/layout/fragment_warning.xml" value="0.34427083333333336" />
<entry key="modules/mogo-module-hmi/src/main/res/layout/module_hmi_warning_v2x.xml" value="0.246875" />
<entry key="modules/mogo-module-hmi/src/main/res/layout/notification_v2x_msg_vr.xml" value="0.3453125" />
@@ -28,6 +29,7 @@
<entry key="modules/mogo-module-service/src/main/res/layout/module_dialog_adas_dispatch_cars.xml" value="0.5546876453218006" />
<entry key="modules/mogo-module-service/src/main/res/layout/module_dialog_adas_dispatch_remind.xml" value="0.35734252929687504" />
<entry key="modules/mogo-module-service/src/main/res/layout/module_services_fragment_online_car_panel.xml" value="0.28919677734374993" />
<entry key="modules/mogo-module-service/src/main/res/layout/module_services_online_car_panel_item.xml" value="0.2734375" />
</map>
</option>
</component>

View File

@@ -27,7 +27,7 @@ import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.function.smp.animation.DirectionRotateAnimation;
import com.mogo.eagle.core.function.smp.utils.MapAssetStyleUtils;
import com.mogo.eagle.core.function.smp.view.ISmallMapDirectionView;
import com.mogo.eagle.core.view.RoundLayout;
import com.mogo.eagle.core.widget.RoundLayout;
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
import com.mogo.module.common.MogoApisHandler;

View File

@@ -12,7 +12,7 @@
android:layout_centerInParent="true"
android:background="@drawable/module_small_map_view_border" />
<com.mogo.eagle.core.view.RoundLayout
<com.mogo.eagle.core.widget.RoundLayout
android:id="@+id/rlSmallMapBorder"
android:layout_width="@dimen/module_small_map_view_width"
android:layout_height="@dimen/module_small_map_view_width"
@@ -28,7 +28,7 @@
android:id="@+id/aMapNaviView"
android:layout_width="match_parent"
android:layout_height="match_parent" />-->
</com.mogo.eagle.core.view.RoundLayout>
</com.mogo.eagle.core.widget.RoundLayout>
<ImageView
android:id="@+id/ivMapBorder"

View File

@@ -60,6 +60,18 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
implementation rootProject.ext.dependencies.androidxccorektx
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.androidxrecyclerview
implementation rootProject.ext.dependencies.androidxconstraintlayout
if (Boolean.valueOf(RELEASE)) {
} else {
implementation project(':core:mogo-core-utils')
}
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="VideoView_info_text_video_not_supported">"不支持该视频。"</string>
<string name="file_not_support">此文件不支持播放</string>
</resources>

View File

@@ -5,4 +5,10 @@
<attr name="roundLayoutRadius" format="dimension" />
</declare-styleable>
<declare-styleable name="CustomCircleImageView">
<attr name="civ_border_width" format="dimension" />
<attr name="civ_border_color" format="color" />
<attr name="civ_border_overlay" format="boolean" />
<attr name="civ_fill_color" format="color" />
</declare-styleable>
</resources>

View File

@@ -1,4 +1,4 @@
package com.mogo.module.v2x.view;
package com.mogo.eagle.core.widget;
import android.content.Context;
import android.graphics.Bitmap;
@@ -13,7 +13,8 @@ import android.view.View;
import androidx.annotation.Nullable;
import com.mogo.module.v2x.utils.ImageUtil;
import com.mogo.eagle.core.utilcode.util.ImageUtils;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
@@ -173,7 +174,7 @@ public class AnimationView extends View implements Handler.Callback {
if (mAnimDataList != null && mAnimDataList.size() > 0) {
mCurAnimPos = 0;
AnimData animData = mAnimDataList.get(mCurAnimPos);
mCurShowBmp = ImageUtil.getBitmap(getContext(), animData.filePath, mWidth, mHeight);
mCurShowBmp = ImageUtils.getBitmap(animData.filePath, mWidth, mHeight);
invalidate();
if (mListener != null) {
mListener.onAnimChange(mCurAnimPos, mCurShowBmp);
@@ -296,7 +297,7 @@ public class AnimationView extends View implements Handler.Callback {
}
public static class AnimData {
public Object filePath;
public String filePath;
}
public static class ProcessAnimThread {
@@ -312,7 +313,7 @@ public class AnimationView extends View implements Handler.Callback {
public ProcessAnimThread(Context context, Handler handler) {
mUiHandler = handler;
mContext = new WeakReference<Context>(context);
mContext = new WeakReference<>(context);
init();
}
@@ -333,7 +334,7 @@ public class AnimationView extends View implements Handler.Callback {
switch (msg.what) {
case PROCESS_DATA: {
AnimData animData = (AnimData) msg.obj;
Bitmap bitmap = ImageUtil.getBitmap(mContext.get(), animData.filePath, mWidth, mHeight);
Bitmap bitmap = ImageUtils.getBitmap(animData.filePath, mWidth, mHeight);
if (bitmap != null) {
Message finishMsg = Message.obtain();
finishMsg.what = PROCESS_ANIM_FINISH;

View File

@@ -1,4 +1,4 @@
package com.mogo.module.common.widget;
package com.mogo.eagle.core.widget;
import android.annotation.SuppressLint;
import android.content.Context;
@@ -23,7 +23,8 @@ import androidx.annotation.ColorInt;
import androidx.annotation.ColorRes;
import androidx.annotation.DrawableRes;
import com.mogo.module.common.R;
import com.mogo.eagle.core.function.call.api.R;
@SuppressLint("AppCompatCustomView")
public class CustomCircleImageView extends ImageView {

View File

@@ -1,4 +1,4 @@
package com.mogo.module.v2x.view;
package com.mogo.eagle.core.widget;
import android.content.Context;
import android.util.AttributeSet;
@@ -9,8 +9,7 @@ import androidx.annotation.NonNull;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.customview.widget.ViewDragHelper;
import com.mogo.module.v2x.V2XConst;
import com.mogo.utils.logger.Logger;
import com.mogo.eagle.core.utilcode.util.LogUtils;
import org.jetbrains.annotations.NotNull;
@@ -22,6 +21,9 @@ import org.jetbrains.annotations.NotNull;
* version: 1.0
*/
public class GestureTopCloseLayout extends ConstraintLayout {
private String TAG = "GestureTopCloseLayout";
private ViewDragHelper mViewDragHelper;
private ViewCloseListener mViewCloseListener;
@@ -77,7 +79,7 @@ public class GestureTopCloseLayout extends ConstraintLayout {
@Override
public void onViewPositionChanged(@NonNull View changedView, int left, int top, int dx, int dy) {
super.onViewPositionChanged(changedView, left, top, dx, dy);
Logger.w(V2XConst.MODULE_NAME, "onViewPositionChanged==top=" + top +
LogUtils.wTag(TAG, "onViewPositionChanged==top=" + top +
" changedView.getHeight()==" + changedView.getHeight());
if (top < 0) {
mTop = top;
@@ -94,7 +96,7 @@ public class GestureTopCloseLayout extends ConstraintLayout {
//手指释放的时候回调
@Override
public void onViewReleased(View releasedChild, float xvel, float yvel) {
Logger.w(V2XConst.MODULE_NAME, "onViewReleased==mTop=" + mTop + " getHeight=" + getHeight());
LogUtils.wTag(TAG, "onViewReleased==mTop=" + mTop + " getHeight=" + getHeight());
if (mTop < 0) {
mViewDragHelper.settleCapturedViewAt(0, -getHeight());
invalidate();

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.view;
package com.mogo.eagle.core.widget;
import android.content.Context;
import android.content.res.TypedArray;

View File

@@ -1,4 +1,4 @@
package com.mogo.module.v2x.view;
package com.mogo.eagle.core.widget;
import android.content.Context;
import android.content.res.TypedArray;
@@ -9,7 +9,8 @@ import android.util.AttributeSet;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.mogo.module.v2x.R;
import com.mogo.eagle.core.function.call.api.R;
/**
* author : donghongyu

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.view;
package com.mogo.eagle.core.widget;
import android.content.Context;
import android.content.res.TypedArray;

View File

@@ -1,4 +1,4 @@
package com.mogo.module.v2x.view;
package com.mogo.eagle.core.widget;
/*
* Copyright (C) 2006 The Android Open Source Project
@@ -33,14 +33,13 @@ import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.MediaController.MediaPlayerControl;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XConst;
import com.mogo.utils.logger.Logger;
import com.mogo.eagle.core.function.call.api.R;
import com.mogo.eagle.core.utilcode.util.LogUtils;
import java.io.IOException;
import java.util.Map;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
/**
* Displays a video file. The VideoView class can load images from various
@@ -50,15 +49,25 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
*/
public class TextureVideoView extends TextureView implements MediaPlayerControl {
private String TAG = "V2XModuleProvider";
public static final int STATE_ERROR = -1;
public static final int STATE_IDLE = 0;
public static final int STATE_PREPARING = 1;
public static final int STATE_PREPARED = 2;
public static final int STATE_PLAYING = 3;
public static final int STATE_PAUSED = 4;
public static final int STATE_PLAYBACK_COMPLETED = 5;
public static final int STATE_SEEKING = 6;
// settable by the client
private Uri mUri;
private Map<String, String> mHeaders;
private int mDuration;
// all possible internal states
private int mCurrentState = V2XConst.STATE_IDLE;
private int mCurrentState = STATE_IDLE;
private int mTargetState = mCurrentState, mTagetStateBackup = mCurrentState;
private int mPrepareState = V2XConst.STATE_PREPARED;
private int mPrepareState = STATE_PREPARED;
// All the stuff we need for playing and showing a video
private Surface mSurface = null;
@@ -113,8 +122,8 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl
setFocusable(true);
setFocusableInTouchMode(true);
requestFocus();
mCurrentState = V2XConst.STATE_IDLE;
mTargetState = V2XConst.STATE_IDLE;
mCurrentState = STATE_IDLE;
mTargetState = STATE_IDLE;
}
public boolean requestAudioFocus() {
@@ -131,9 +140,9 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl
public void setVideoURI(Uri uri, Map<String, String> headers) {
if (uri == null) {
Logger.i(MODULE_NAME, "setVideoURI--- uri = null");
LogUtils.iTag(TAG, "setVideoURI--- uri = null");
} else {
Logger.i(MODULE_NAME, "setVideoURI--- uri = " + uri.getPath());
LogUtils.iTag(TAG, "setVideoURI--- uri = " + uri.getPath());
}
mUri = uri;
mHeaders = headers;
@@ -149,21 +158,21 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl
mMediaPlayer.stop();
mMediaPlayer.release();
mMediaPlayer = null;
mTargetState = mCurrentState = V2XConst.STATE_IDLE;
mTargetState = mCurrentState = STATE_IDLE;
}
}
@SuppressLint("NewApi")
private void openVideo() {
Logger.i(MODULE_NAME, "openVideo");
LogUtils.iTag(TAG, "openVideo");
if (mUri == null) {
Logger.i(MODULE_NAME, "mUri == null ");
LogUtils.iTag(TAG, "mUri == null ");
}
if (mSurface == null) {
Logger.i(MODULE_NAME, "mSurface == null ");
LogUtils.iTag(TAG, "mSurface == null ");
}
if (mUri == null || mSurface == null || isSuspendFromActivity) {
Logger.i(MODULE_NAME, "isSuspendFromActivity = " + isSuspendFromActivity);
LogUtils.iTag(TAG, "isSuspendFromActivity = " + isSuspendFromActivity);
return;
}
release(false);
@@ -192,7 +201,7 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl
mMediaPlayer.setScreenOnWhilePlaying(true);
mMediaPlayer.setVolume(0, 0);
mMediaPlayer.prepare();
mPrepareState = mCurrentState = V2XConst.STATE_PREPARING;
mPrepareState = mCurrentState = STATE_PREPARING;
} catch (IOException | SecurityException | IllegalStateException | IllegalArgumentException ex) {
ex.printStackTrace();
onError();
@@ -200,7 +209,7 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl
}
private void onError() {
mTargetState = mCurrentState = V2XConst.STATE_ERROR;
mTargetState = mCurrentState = STATE_ERROR;
if (mErrorListener != null)
mErrorListener.onError(mMediaPlayer,
MediaPlayer.MEDIA_ERROR_UNKNOWN, 0);
@@ -211,24 +220,24 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl
mVideoWidth = mp.getVideoWidth();
mVideoHeight = mp.getVideoHeight();
if (mVideoWidth != 0 && mVideoHeight != 0) {
Logger.d(MODULE_NAME, "OnVideoSizeChangedListener mVideoWidth:" + " mVideoWidth:" + mVideoWidth + " mVideoHeight:" + mVideoHeight);
LogUtils.dTag(TAG, "OnVideoSizeChangedListener mVideoWidth:" + " mVideoWidth:" + mVideoWidth + " mVideoHeight:" + mVideoHeight);
}
}
};
MediaPlayer.OnPreparedListener mPreparedListener = new MediaPlayer.OnPreparedListener() {
public void onPrepared(MediaPlayer mp) {
Logger.i(MODULE_NAME, "MediaPlayer.OnPreparedListener");
mPrepareState = mCurrentState = V2XConst.STATE_PREPARED;
LogUtils.iTag(TAG, "MediaPlayer.OnPreparedListener");
mPrepareState = mCurrentState = STATE_PREPARED;
mVideoWidth = mp.getVideoWidth();
mVideoHeight = mp.getVideoHeight();
int seekToPosition = mSeekWhenPrepared;
// Logger.i(MODULE_NAME, "seekToPosition = " + seekToPosition);
// LogUtils.iTag(TAG, "seekToPosition = " + seekToPosition);
if (seekToPosition != 0) {
seekTo(seekToPosition);
}
if (mTargetState == V2XConst.STATE_PLAYING) {
if (mTargetState == STATE_PLAYING) {
start();
}
if (mOnPreparedListener != null) {
@@ -244,8 +253,8 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl
private OnCompletionListener mCompletionListener = new OnCompletionListener() {
public void onCompletion(MediaPlayer mp) {
Logger.i(MODULE_NAME, "MediaPlayer.OnCompletionListener");
mTargetState = mCurrentState = V2XConst.STATE_PLAYBACK_COMPLETED;
LogUtils.iTag(TAG, "MediaPlayer.OnCompletionListener");
mTargetState = mCurrentState = STATE_PLAYBACK_COMPLETED;
if (mOnCompletionListener != null) {
mOnCompletionListener.onCompletion(mMediaPlayer);
}
@@ -253,19 +262,19 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl
};
private OnSeekCompleteListener mSeekCompleteListener = mp -> {
Logger.i(MODULE_NAME, "MediaPlayer.OnSeekCompleteListener");
LogUtils.iTag(TAG, "MediaPlayer.OnSeekCompleteListener");
try {
mCurrentState = mMediaPlayer.isPlaying() ? V2XConst.STATE_PLAYING : V2XConst.STATE_PAUSED;
mCurrentState = mMediaPlayer.isPlaying() ? STATE_PLAYING : STATE_PAUSED;
} catch (Exception e) {
mCurrentState = V2XConst.STATE_PLAYING;
mCurrentState = STATE_PLAYING;
e.printStackTrace();
}
};
private OnErrorListener mErrorListener = new OnErrorListener() {
public boolean onError(MediaPlayer mp, int framework_err, int impl_err) {
Logger.i(MODULE_NAME, "MediaPlayer.onError");
mTargetState = mPrepareState = mCurrentState = V2XConst.STATE_ERROR;
LogUtils.iTag(TAG, "MediaPlayer.onError");
mTargetState = mPrepareState = mCurrentState = STATE_ERROR;
if (mOnErrorListener != null) {
mOnErrorListener.onError(mMediaPlayer, framework_err,
impl_err);
@@ -279,7 +288,7 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl
@Override
public boolean onInfo(MediaPlayer mp, int what, int extra) {
Logger.i(MODULE_NAME, "MediaPlayer.OnInfoListener---what = " + what + ";extra = " + extra);
LogUtils.iTag(TAG, "MediaPlayer.OnInfoListener---what = " + what + ";extra = " + extra);
int messageId = 0;
if (what == MEDIA_INFO_VIDEO_NOT_SUPPORTED) {
messageId = R.string.VideoView_info_text_video_not_supported;
@@ -298,7 +307,7 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl
private MediaPlayer.OnBufferingUpdateListener mBufferingUpdateListener = new MediaPlayer.OnBufferingUpdateListener() {
public void onBufferingUpdate(MediaPlayer mp, int percent) {
Logger.i(MODULE_NAME, "MediaPlayer.OnBufferingUpdateListener");
LogUtils.iTag(TAG, "MediaPlayer.OnBufferingUpdateListener");
mCurrentBufferPercentage = percent;
}
};
@@ -341,15 +350,15 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl
SurfaceTextureListener mSurfaceTextureListener = new SurfaceTextureListener() {
@Override
public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {
Logger.i(MODULE_NAME, "onSurfaceTextureAvailable");
LogUtils.iTag(TAG, "onSurfaceTextureAvailable");
mSurface = new Surface(surface);
openVideo();
}
@Override
public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {
Logger.d(MODULE_NAME, "onSurfaceTextureSizeChanged mVideoWidth:" + " mVideoWidth:" + mVideoWidth + " mVideoHeight:" + mVideoHeight);
boolean isValidState = (mTargetState == V2XConst.STATE_PLAYING);
LogUtils.dTag(TAG, "onSurfaceTextureSizeChanged mVideoWidth:" + " mVideoWidth:" + mVideoWidth + " mVideoHeight:" + mVideoHeight);
boolean isValidState = (mTargetState == STATE_PLAYING);
boolean hasValidSize = (mVideoWidth == width && mVideoHeight == height);
if (mMediaPlayer != null && isValidState && hasValidSize) {
if (mSeekWhenPrepared != 0) {
@@ -366,7 +375,7 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl
@Override
public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
Logger.i(MODULE_NAME, "onSurfaceTextureDestroyed");
LogUtils.iTag(TAG, "onSurfaceTextureDestroyed");
mSurface = null;
release(false);
return false;
@@ -382,11 +391,11 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl
* release the media player in any state
*/
private void release(boolean cleartargetstate) {
Logger.i(MODULE_NAME, "release ---cleartargetstate=" + cleartargetstate);
mCurrentState = V2XConst.STATE_IDLE;
LogUtils.iTag(TAG, "release ---cleartargetstate=" + cleartargetstate);
mCurrentState = STATE_IDLE;
if (cleartargetstate) {
mTargetState = V2XConst.STATE_IDLE;
mTargetState = STATE_IDLE;
new Thread(new Runnable() {
@Override
@@ -429,40 +438,40 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl
}
public boolean isPrepared() {
return mPrepareState == V2XConst.STATE_PREPARED
return mPrepareState == STATE_PREPARED
|| isSuspendFromActivity;
}
public void start() {
Logger.i(MODULE_NAME, "TextureVideoView---start");
LogUtils.iTag(TAG, "TextureVideoView---start");
if (isFocusLoss) {
mTagetStateBackup = V2XConst.STATE_PLAYING;
mTagetStateBackup = STATE_PLAYING;
return;
}
//Logger.i(MODULE_NAME, "mCurrentState = " + mCurrentState);
//LogUtils.iTag(TAG, "mCurrentState = " + mCurrentState);
if (isInPlaybackState()) {
Logger.i(MODULE_NAME, "MediaPlayer.start");
LogUtils.iTag(TAG, "MediaPlayer.start");
mMediaPlayer.start();
mCurrentState = V2XConst.STATE_PLAYING;
mCurrentState = STATE_PLAYING;
}
mTargetState = V2XConst.STATE_PLAYING;
mTargetState = STATE_PLAYING;
}
public void pause() {
Logger.i(MODULE_NAME, "TextureVideoView---pause");
Logger.i(MODULE_NAME, "mCurrentState = " + mCurrentState);
LogUtils.iTag(TAG, "TextureVideoView---pause");
LogUtils.iTag(TAG, "mCurrentState = " + mCurrentState);
if (isInPlaybackState()) {
if (mMediaPlayer.isPlaying()) {
Logger.i(MODULE_NAME, " MediaPlayer.pause");
LogUtils.iTag(TAG, " MediaPlayer.pause");
mMediaPlayer.pause();
mCurrentState = V2XConst.STATE_PAUSED;
mCurrentState = STATE_PAUSED;
}
}
mTagetStateBackup = mTargetState = V2XConst.STATE_PAUSED;
mTagetStateBackup = mTargetState = STATE_PAUSED;
}
public void suspend() {
Logger.i(MODULE_NAME, "TextureVideoView---suspend");
LogUtils.iTag(TAG, "TextureVideoView---suspend");
if (!isSuspendFromActivity) {
isSuspendFromActivity = true;
if (mMediaPlayer != null) {
@@ -475,20 +484,20 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl
}
public void resume() {
Logger.i(MODULE_NAME, "TextureVideoView---resume");
LogUtils.iTag(TAG, "TextureVideoView---resume");
isSuspendFromActivity = false;
openVideo();
seekTo(progressWhileSuspend);
if (mTagetStateBackup == V2XConst.STATE_IDLE)
if (mTagetStateBackup == STATE_IDLE)
mTagetStateBackup = mTargetState;
Logger.i(MODULE_NAME, "isFocusLoss = " + isFocusLoss);
Logger.i(MODULE_NAME, "isInPlaybackState() = " + isInPlaybackState());
LogUtils.iTag(TAG, "isFocusLoss = " + isFocusLoss);
LogUtils.iTag(TAG, "isInPlaybackState() = " + isInPlaybackState());
if (isFocusLoss) {
if (isInPlaybackState()) {
if (mMediaPlayer.isPlaying()) {
mMediaPlayer.pause();
mCurrentState = V2XConst.STATE_PAUSED;
mCurrentState = STATE_PAUSED;
}
}
}
@@ -515,12 +524,12 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl
}
public void seekTo(int msec) {
Logger.i(MODULE_NAME, "TextureVideoView---seekTo---msec = " + msec);
if (isInPlaybackState() && mCurrentState != V2XConst.STATE_SEEKING
LogUtils.iTag(TAG, "TextureVideoView---seekTo---msec = " + msec);
if (isInPlaybackState() && mCurrentState != STATE_SEEKING
&& msec > 0 && msec < getDuration()) {
mCurrentState = V2XConst.STATE_SEEKING;
mCurrentState = STATE_SEEKING;
Logger.i(MODULE_NAME, "MediaPlayer.seekTo(msec) = " + msec);
LogUtils.iTag(TAG, "MediaPlayer.seekTo(msec) = " + msec);
mMediaPlayer.seekTo(msec);
mSeekWhenPrepared = 0;
} else {
@@ -541,8 +550,8 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl
}
private boolean isInPlaybackState() {
return (mMediaPlayer != null && mCurrentState != V2XConst.STATE_ERROR
&& mCurrentState != V2XConst.STATE_IDLE && mCurrentState != V2XConst.STATE_PREPARING);
return (mMediaPlayer != null && mCurrentState != STATE_ERROR
&& mCurrentState != STATE_IDLE && mCurrentState != STATE_PREPARING);
}
@Override
@@ -575,7 +584,7 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl
}
public boolean isPause() {
return mTargetState == V2XConst.STATE_PAUSED;
return mTargetState == STATE_PAUSED;
}
@Override
@@ -584,7 +593,7 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl
}
public int getCurrentState() {
Logger.i(MODULE_NAME, "mCurrentState == " + mCurrentState);
LogUtils.iTag(TAG, "mCurrentState == " + mCurrentState);
return mCurrentState;
}
}

View File

@@ -7,12 +7,7 @@
</attr>
</declare-styleable>
<declare-styleable name="CustomCircleImageView">
<attr name="civ_border_width" format="dimension" />
<attr name="civ_border_color" format="color" />
<attr name="civ_border_overlay" format="boolean" />
<attr name="civ_fill_color" format="color" />
</declare-styleable>
<declare-styleable name="CustomRatingBar">
<!---->
<attr name="elenmentWidth" format="dimension" />

View File

@@ -13,7 +13,7 @@ import android.widget.TextView;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat;
import com.mogo.eagle.core.view.LiveRoundLayout;
import com.mogo.eagle.core.widget.LiveRoundLayout;
import com.mogo.module.extensions.R;
import com.mogo.utils.logger.Logger;
import com.tencent.rtmp.ITXLivePlayListener;

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<com.mogo.eagle.core.view.LiveRoundLayout xmlns:android="http://schemas.android.com/apk/res/android"
<com.mogo.eagle.core.widget.LiveRoundLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
@@ -65,4 +65,4 @@
app:layout_constraintTop_toBottomOf="@+id/ivErrorIcon" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.mogo.eagle.core.view.LiveRoundLayout>
</com.mogo.eagle.core.widget.LiveRoundLayout>

View File

@@ -60,6 +60,7 @@ dependencies {
implementation project(':modules:mogo-module-common')
implementation project(':core:mogo-core-data')
implementation project(':core:mogo-core-res')
}
}

View File

@@ -10,7 +10,7 @@
android:paddingStart="@dimen/module_services_panel_item_start"
android:paddingBottom="@dimen/module_services_panel_item_padding">
<com.mogo.module.common.widget.CustomCircleImageView
<com.mogo.eagle.core.widget.CustomCircleImageView
android:id="@+id/module_services_id_panel_item_avatar"
android:layout_width="@dimen/module_services_panel_item_avatar_size"
android:layout_height="@dimen/module_services_panel_item_avatar_size"

View File

@@ -85,6 +85,7 @@ dependencies {
implementation project(':modules:mogo-module-service')
implementation project(':modules:mogo-module-obu')
implementation project(':core:mogo-core-res')
implementation project(':core:mogo-core-data')
implementation project(':core:mogo-core-function-call')
}

View File

@@ -54,14 +54,6 @@ public class V2XConst {
public static final String V2X_ACC_OFF_TIME_STR = "v2x_acc_off_time_str";
public static final String V2X_STRATEGY_PUSH = "v2x_strategy_push";
public static final int STATE_ERROR = -1;
public static final int STATE_IDLE = 0;
public static final int STATE_PREPARING = 1;
public static final int STATE_PREPARED = 2;
public static final int STATE_PLAYING = 3;
public static final int STATE_PAUSED = 4;
public static final int STATE_PLAYBACK_COMPLETED = 5;
public static final int STATE_SEEKING = 6;
/**
* V2X 埋点

View File

@@ -14,7 +14,7 @@ import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.view.TextureVideoView;
import com.mogo.eagle.core.widget.TextureVideoView;
import com.mogo.utils.logger.Logger;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;

View File

@@ -17,6 +17,7 @@ import com.mogo.cloud.trafficlive.api.ITrafficCarLiveCallBack;
import com.mogo.cloud.trafficlive.api.MoGoAiCloudTrafficLive;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.voice.AIAssist;
import com.mogo.eagle.core.widget.RoundLayout;
import com.mogo.map.location.MogoLocation;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;

View File

@@ -1,79 +0,0 @@
package com.mogo.module.v2x.view;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Path;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.widget.RelativeLayout;
import com.mogo.module.v2x.R;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
* date : 2020/3/25 11:39 AM
* desc :
* version: 1.0
*/
public class RoundLayout extends RelativeLayout {
private float roundLayoutRadius = 14f;
private Path roundPath;
private RectF rectF;
public RoundLayout(Context context) {
this(context, null);
}
public RoundLayout(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public RoundLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.RoundLayout);
roundLayoutRadius = typedArray.getDimensionPixelSize(R.styleable.RoundLayout_roundLayoutRadius, (int) roundLayoutRadius);
typedArray.recycle();
init();
}
private void init() {
setWillNotDraw(false);//如果你继承的是ViewGroup,注意此行,否则draw方法是不会回调的;
roundPath = new Path();
rectF = new RectF();
}
private void setRoundPath() {
//添加一个圆角矩形到path中, 如果要实现任意形状的View, 只需要手动添加path就行
roundPath.addRoundRect(rectF, roundLayoutRadius, roundLayoutRadius, Path.Direction.CW);
}
public void setRoundLayoutRadius(float roundLayoutRadius) {
this.roundLayoutRadius = roundLayoutRadius;
setRoundPath();
postInvalidate();
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);
rectF.set(0f, 0f, getMeasuredWidth(), getMeasuredHeight());
setRoundPath();
}
@Override
public void draw(Canvas canvas) {
if (roundLayoutRadius > 0f) {
canvas.clipPath(roundPath);
}
super.draw(canvas);
}
}

View File

@@ -16,6 +16,7 @@ import androidx.core.content.ContextCompat;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.voice.AIAssist;
import com.mogo.eagle.core.widget.RoundLayout;
import com.mogo.module.common.entity.MarkerCarInfo;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;

View File

@@ -15,6 +15,7 @@ import androidx.core.content.ContextCompat;
import com.mogo.cloud.trafficlive.api.ITrafficIntersectionLiveCallBack;
import com.mogo.cloud.trafficlive.api.MoGoAiCloudTrafficLive;
import com.mogo.commons.voice.AIAssist;
import com.mogo.eagle.core.widget.RoundLayout;
import com.mogo.map.location.MogoLocation;
import com.mogo.module.common.entity.MarkerCarInfo;
import com.mogo.module.v2x.R;

View File

@@ -16,6 +16,7 @@ import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat;
import com.mogo.commons.voice.AIAssist;
import com.mogo.eagle.core.widget.RoundLayout;
import com.mogo.module.common.entity.MarkerCarInfo;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.utils.V2XUtils;

View File

@@ -9,7 +9,7 @@
android:paddingBottom="@dimen/dp_20"
app:roundLayoutRadius="@dimen/dp_30">
<com.mogo.module.v2x.view.RoundLayout
<com.mogo.eagle.core.widget.RoundLayout
android:id="@+id/rlRoadEventImg"
android:layout_width="wrap_content"
android:layout_height="match_parent"
@@ -37,7 +37,7 @@
android:src="@drawable/v2x_icon_event_play"
android:visibility="gone" />
</com.mogo.module.v2x.view.RoundLayout>
</com.mogo.eagle.core.widget.RoundLayout>
<TextView
android:id="@+id/tvEventTypeTitle"

View File

@@ -5,7 +5,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.mogo.module.v2x.view.RoundLayout
<com.mogo.eagle.core.widget.RoundLayout
android:id="@+id/rlRoadEventList"
android:layout_width="match_parent"
android:layout_height="@dimen/module_v2x_push_img_height"
@@ -15,7 +15,7 @@
app:layout_constraintTop_toTopOf="parent"
app:roundLayoutRadius="@dimen/dp_30">
<com.mogo.module.v2x.view.RoundLayout
<com.mogo.eagle.core.widget.RoundLayout
android:id="@+id/rlRoadEventImg"
android:layout_width="match_parent"
android:layout_height="match_parent"
@@ -28,8 +28,8 @@
android:scaleType="fitXY"
app:actualImageScaleType="fitXY" />
</com.mogo.module.v2x.view.RoundLayout>
</com.mogo.module.v2x.view.RoundLayout>
</com.mogo.eagle.core.widget.RoundLayout>
</com.mogo.eagle.core.widget.RoundLayout>
<com.mogo.service.imageloader.MogoImageView
android:id="@+id/ivReportHead"

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<com.mogo.module.v2x.view.RoundLayout xmlns:android="http://schemas.android.com/apk/res/android"
<com.mogo.eagle.core.widget.RoundLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
@@ -50,4 +50,4 @@
android:textSize="@dimen/dp_30"
android:visibility="gone" />
</com.mogo.module.v2x.view.RoundLayout>
</com.mogo.eagle.core.widget.RoundLayout>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<com.mogo.module.v2x.view.RoundLayout xmlns:android="http://schemas.android.com/apk/res/android"
<com.mogo.eagle.core.widget.RoundLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="@dimen/module_v2x_event_see_live_window_height"
@@ -48,4 +48,4 @@
android:textSize="@dimen/dp_30"
android:visibility="gone" />
</com.mogo.module.v2x.view.RoundLayout>
</com.mogo.eagle.core.widget.RoundLayout>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<com.mogo.module.v2x.view.RoundLayout xmlns:android="http://schemas.android.com/apk/res/android"
<com.mogo.eagle.core.widget.RoundLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -48,4 +48,4 @@
android:textSize="@dimen/dp_30"
android:visibility="gone" />
</com.mogo.module.v2x.view.RoundLayout>
</com.mogo.eagle.core.widget.RoundLayout>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<com.mogo.module.v2x.view.RoundLayout xmlns:android="http://schemas.android.com/apk/res/android"
<com.mogo.eagle.core.widget.RoundLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
@@ -65,4 +65,4 @@
app:layout_constraintTop_toBottomOf="@+id/ivErrorIcon" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.mogo.module.v2x.view.RoundLayout>
</com.mogo.eagle.core.widget.RoundLayout>

View File

@@ -6,7 +6,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.mogo.module.v2x.view.RoundLayout
<com.mogo.eagle.core.widget.RoundLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:roundLayoutRadius="@dimen/dp_26">
@@ -70,6 +70,6 @@
app:layout_constraintTop_toBottomOf="@+id/ivErrorIcon" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.mogo.module.v2x.view.RoundLayout>
</com.mogo.eagle.core.widget.RoundLayout>
</FrameLayout>

View File

@@ -6,14 +6,14 @@
android:layout_height="match_parent"
android:paddingStart="@dimen/module_main_v2x_animation_width">
<com.mogo.module.v2x.view.RoundLayout
<com.mogo.eagle.core.widget.RoundLayout
android:id="@+id/rlRoadEventList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="@dimen/dp_30"
app:roundLayoutRadius="@dimen/dp_28">
<com.mogo.module.v2x.view.TextureVideoView
<com.mogo.eagle.core.widget.TextureVideoView
android:id="@+id/vvCarAnimation"
android:layout_width="match_parent"
android:layout_height="match_parent"
@@ -24,6 +24,6 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</com.mogo.module.v2x.view.RoundLayout>
</com.mogo.eagle.core.widget.RoundLayout>
</RelativeLayout>

View File

@@ -7,7 +7,7 @@
android:background="@drawable/v2x_alert_window_bg"
android:layout_margin="@dimen/dp_3">
<com.mogo.module.v2x.view.RoundLayout
<com.mogo.eagle.core.widget.RoundLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:roundLayoutRadius="@dimen/dp_26">
@@ -47,6 +47,6 @@
android:layout_marginLeft="@dimen/dp_20"
android:layout_marginTop="@dimen/dp_20"
android:src="@drawable/module_common_close_selector" />
</com.mogo.module.v2x.view.RoundLayout>
</com.mogo.eagle.core.widget.RoundLayout>
</FrameLayout>

View File

@@ -8,7 +8,7 @@
android:layout_margin="@dimen/dp_3"
android:background="@drawable/v2x_bg_video_tip_vr">
<com.mogo.module.v2x.view.RoundLayout
<com.mogo.eagle.core.widget.RoundLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:roundLayoutRadius="@dimen/dp_20">
@@ -48,6 +48,6 @@
android:layout_marginLeft="@dimen/dp_20"
android:layout_marginTop="@dimen/dp_20"
android:src="@drawable/module_common_close_selector_vr" />
</com.mogo.module.v2x.view.RoundLayout>
</com.mogo.eagle.core.widget.RoundLayout>
</RelativeLayout>

View File

@@ -1,7 +1,5 @@
<resources>
<string name="app_name">mogo-module-v2x</string>
<string name="VideoView_info_text_video_not_supported">"不支持该视频。"</string>
<string name="file_not_support">此文件不支持播放</string>
<string name="v2x_help_speed_txt">车速</string>
<string name="v2x_report_pop_submit_txt">已提交</string>
<string name="v2x_report_pop_thank_txt">感谢已送达</string>

View File

@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="RoundLayout">
<attr name="roundLayoutRadius" format="dimension" />
</declare-styleable>
<style name="customTabLayoutTextAppearance" parent="TextAppearance.Design.Tab">
<item name="android:textSize">@dimen/dp_40</item>