modify music
This commit is contained in:
@@ -30,6 +30,9 @@ class MogoSnapshotSetData implements Parcelable {
|
||||
//红绿灯
|
||||
private CloudRoadData trafficLight;
|
||||
|
||||
//路边摄像头
|
||||
private CloudRoadData camera;
|
||||
|
||||
// 自车速度 本地添加
|
||||
public double curSpeed = 0.0;
|
||||
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
package com.mogo.module.media.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Paint.Align;
|
||||
import android.graphics.RectF;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
import com.mogo.module.media.R;
|
||||
|
||||
/**
|
||||
* 环形进度条
|
||||
*/
|
||||
public class PercentageRingView extends View {
|
||||
private Paint mCirclePaint;
|
||||
private Paint mTextPaint;
|
||||
private Paint mArcPaint;
|
||||
private int mCircleX;
|
||||
private int mCircleY;
|
||||
private float mCurrentAngle;
|
||||
private RectF mArcRectF;
|
||||
private float mStartSweepValue;
|
||||
private float mTargetPercent;
|
||||
private float mCurrentPercent;
|
||||
|
||||
private int mRadius;
|
||||
private int mCircleBackground;
|
||||
private int mRingColor;
|
||||
private int mTextSize;
|
||||
private int mTextColor;
|
||||
|
||||
|
||||
public PercentageRingView(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
init(context);
|
||||
}
|
||||
|
||||
public PercentageRingView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
//自定义属性 values/attr
|
||||
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.PercentageRing);
|
||||
//中间圆的背景颜色 默认为浅紫色
|
||||
mCircleBackground = typedArray.getColor(R.styleable.PercentageRing_circleBackground, 0xffafb4db);
|
||||
//外圆环的颜色 默认为深紫色
|
||||
mRingColor = typedArray.getColor(R.styleable.PercentageRing_ringColor, 0xff6950a1);
|
||||
//中间圆的半径 默认为60
|
||||
mRadius = typedArray.getInt(R.styleable.PercentageRing_radius, 60);
|
||||
//字体颜色 默认为白色
|
||||
mTextColor = typedArray.getColor(R.styleable.PercentageRing_textColor, 0xffffffff);
|
||||
//最后一定要调用这个 释放掉TypedArray
|
||||
typedArray.recycle();
|
||||
//初始化数据
|
||||
init(context);
|
||||
}
|
||||
|
||||
public PercentageRingView(Context context) {
|
||||
super(context);
|
||||
init(context);
|
||||
}
|
||||
|
||||
private void init(Context context) {
|
||||
//圆环开始角度 -90° 正北方向
|
||||
mStartSweepValue = -90;
|
||||
//当前角度
|
||||
mCurrentAngle = 0;
|
||||
//当前百分比
|
||||
mCurrentPercent = 0;
|
||||
//设置中心园的画笔
|
||||
mCirclePaint = new Paint();
|
||||
mCirclePaint.setAntiAlias(true);
|
||||
mCirclePaint.setColor(mCircleBackground);
|
||||
mCirclePaint.setStyle(Paint.Style.FILL);
|
||||
//设置文字的画笔
|
||||
mTextPaint = new Paint();
|
||||
mTextPaint.setColor(mTextColor);
|
||||
mTextPaint.setAntiAlias(true);
|
||||
mTextPaint.setStyle(Paint.Style.FILL);
|
||||
mTextPaint.setStrokeWidth((float) (0.025 * mRadius));
|
||||
mTextPaint.setTextSize(mRadius / 2);
|
||||
mTextPaint.setTextAlign(Align.CENTER);
|
||||
//设置外圆环的画笔
|
||||
mArcPaint = new Paint();
|
||||
mArcPaint.setAntiAlias(true);
|
||||
mArcPaint.setColor(mRingColor);
|
||||
mArcPaint.setStyle(Paint.Style.STROKE);
|
||||
// mArcPaint.setStrokeWidth((float) (0.075 * mRadius));
|
||||
mArcPaint.setStrokeWidth((float) (0.17 * mRadius));
|
||||
//获得文字的字号 因为要设置文字在圆的中心位置
|
||||
mTextSize = (int) mTextPaint.getTextSize();
|
||||
}
|
||||
|
||||
//主要是测量wrap_content时候的宽和高,因为宽高一样,只需要测量一次宽即可,高等于宽
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
setMeasuredDimension(measure(widthMeasureSpec), measure(widthMeasureSpec));
|
||||
//设置圆心坐标
|
||||
mCircleX = getMeasuredWidth() / 2;
|
||||
mCircleY = getMeasuredHeight() / 2;
|
||||
//如果半径大于圆心横坐标,需要手动缩小半径的值,否则就画到外面去了
|
||||
if (mRadius > mCircleX) {
|
||||
//设置半径大小为圆心横坐标到原点的距离
|
||||
mRadius = mCircleX;
|
||||
mRadius = (int) (mCircleX - 0.075 * mRadius);
|
||||
//因为半径改变了,所以要重新设置一下字体宽度
|
||||
mTextPaint.setStrokeWidth((float) (0.025 * mRadius));
|
||||
//重新设置字号
|
||||
mTextPaint.setTextSize(mRadius / 2);
|
||||
//重新设置外圆环宽度
|
||||
// mArcPaint.setStrokeWidth((float) (0.075 * mRadius));
|
||||
mArcPaint.setStrokeWidth((float) (0.17 * mRadius));
|
||||
//重新获得字号大小
|
||||
mTextSize = (int) mTextPaint.getTextSize();
|
||||
}
|
||||
//画中心园的外接矩形,用来画圆环用
|
||||
mArcRectF = new RectF(mCircleX - mRadius, mCircleY - mRadius, mCircleX + mRadius, mCircleY + mRadius);
|
||||
}
|
||||
|
||||
//当wrap_content的时候,view的大小根据半径大小改变,但最大不会超过屏幕
|
||||
private int measure(int measureSpec) {
|
||||
int result = 0;
|
||||
int specMode = MeasureSpec.getMode(measureSpec);
|
||||
int specSize = MeasureSpec.getSize(measureSpec);
|
||||
if (specMode == MeasureSpec.EXACTLY) {
|
||||
result = specSize;
|
||||
} else {
|
||||
result = (int) (1.075 * mRadius * 2);
|
||||
if (specMode == MeasureSpec.AT_MOST) {
|
||||
result = Math.min(result, specSize);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
//开始画中间圆、文字和外圆环
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
//画中间圆
|
||||
canvas.drawCircle(mCircleX, mCircleY, mRadius, mCirclePaint);
|
||||
//画圆环
|
||||
canvas.drawArc(mArcRectF, mStartSweepValue, mCurrentAngle, false, mArcPaint);
|
||||
//画文字
|
||||
canvas.drawText(String.valueOf(mCurrentPercent) + "%", mCircleX, mCircleY + mTextSize / 4, mTextPaint);
|
||||
//判断当前百分比是否小于设置目标的百分比
|
||||
if (mCurrentPercent < mTargetPercent) {
|
||||
//当前百分比+1
|
||||
mCurrentPercent += 1;
|
||||
//当前角度+360
|
||||
mCurrentAngle += 3.6;
|
||||
//每10ms重画一次
|
||||
postInvalidateDelayed(10);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//设置目标的百分比
|
||||
public void setTargetPercent(int percent) {
|
||||
this.mTargetPercent = percent;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -26,6 +26,7 @@ import com.mogo.module.media.presenter.PresenterFactory;
|
||||
import com.mogo.module.media.utils.Utils;
|
||||
import com.mogo.module.media.view.IMusicView;
|
||||
import com.mogo.module.media.widget.AnimCircleImageView;
|
||||
import com.mogo.module.media.widget.PercentageRingView;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
@@ -65,6 +66,10 @@ public class MediaWindow2 implements IMusicView , IMogoStatusChangedListener {
|
||||
private boolean mIsCallChatWindowVisible;
|
||||
|
||||
private ICallProviderResponse mCallProviderResponse;
|
||||
private PercentageRingView mPercentageRingView;
|
||||
private ImageView mPauseImage;
|
||||
private AnimCircleImageView mAnimCircleImageView;
|
||||
|
||||
|
||||
public void initMedia(Context context) {
|
||||
mContext = context;
|
||||
@@ -122,71 +127,129 @@ public class MediaWindow2 implements IMusicView , IMogoStatusChangedListener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mHasAddWindow) {
|
||||
if (!mHasAddWindow) { //TODO
|
||||
mHasAddWindow = true;
|
||||
mWindowView =
|
||||
LayoutInflater.from(mContext).inflate(R.layout.module_media_music_window_alert_layout, null);
|
||||
mCircleImg = mWindowView.findViewById(R.id.window_circle_img);
|
||||
mScrollText = mWindowView.findViewById(R.id.window_scroll_txt);
|
||||
mWindowPlayPause = mWindowView.findViewById(R.id.window_play_pause);
|
||||
mWindowPlayNext = mWindowView.findViewById(R.id.window_music_next);
|
||||
mWindowCurrTime = mWindowView.findViewById(R.id.window_current_time);
|
||||
mWindowMaxTime = mWindowView.findViewById(R.id.window_max_time);
|
||||
mWindowProgress = mWindowView.findViewById(R.id.window_progress_bar);
|
||||
if (mWindowPlayPause != null) {
|
||||
mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_pause);
|
||||
}
|
||||
int yPos =
|
||||
getContext().getResources().getDimensionPixelOffset(R.dimen.module_media_music_state_location);
|
||||
int xPos =
|
||||
getContext().getResources().getDimensionPixelOffset(R.dimen.module_media_music_state_location_x);
|
||||
int statusBarHeight = WindowUtils.getStatusBarHeight(mContext);
|
||||
Logger.d(TAG,
|
||||
"yPos: " + yPos + " xPos: " + xPos + " statusBarHeight: " + statusBarHeight);
|
||||
Log.d(TAG, "addMediaWindoView");
|
||||
FrameLayout.LayoutParams params =
|
||||
new FrameLayout.LayoutParams((int) mContext.getResources().getDimension(R.dimen.module_media_pop_window_width), (int) mContext.getResources().getDimension(R.dimen.module_media_pop_window_height));
|
||||
params.leftMargin = xPos;
|
||||
params.topMargin = yPos;
|
||||
ServiceMediaHandler.getMogoWindowManager().addView(mWindowView, params, false);
|
||||
updateWindowUI(true);
|
||||
mWindowView.setOnClickListener(new NoDoubleClickListener() {
|
||||
@Override
|
||||
public void onClicks(View view) {
|
||||
mPresenter.openApp();
|
||||
}
|
||||
});
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
mWindowView =
|
||||
LayoutInflater.from(mContext).inflate(R.layout.module_media_music_window_alert_layout_new, null);
|
||||
mPercentageRingView = mWindowView.findViewById(R.id.window_circle_bg);
|
||||
mAnimCircleImageView = mWindowView.findViewById(R.id.window_circle_img_new);
|
||||
mPauseImage = mWindowView.findViewById(R.id.window_play_pause_new);
|
||||
|
||||
mWindowPlayPause.setOnClickListener(new NoDoubleClickListener() {
|
||||
@Override
|
||||
public void onClicks(View view) {
|
||||
if (mMediaInfoData != null) {
|
||||
if (mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_PAUSE_OR_STOP) {
|
||||
mPresenter.play(mMediaInfoData);
|
||||
} else {
|
||||
// 没有做详细判断,不是暂停就是播放
|
||||
mPresenter.pause(mMediaInfoData);
|
||||
}
|
||||
} else {
|
||||
if (mPauseImage != null) {
|
||||
mPauseImage.setImageResource(R.drawable.module_media_window_pop_pause);
|
||||
}
|
||||
|
||||
int yPos =
|
||||
getContext().getResources().getDimensionPixelOffset(R.dimen.module_media_music_state_location_new);
|
||||
int xPos =
|
||||
getContext().getResources().getDimensionPixelOffset(R.dimen.module_media_music_state_location_x_new);
|
||||
int statusBarHeight = WindowUtils.getStatusBarHeight(mContext);
|
||||
Logger.d(TAG,
|
||||
"yPos: " + yPos + " xPos: " + xPos + " statusBarHeight: " + statusBarHeight);
|
||||
Log.d(TAG, "addMediaWindoView");
|
||||
FrameLayout.LayoutParams params =
|
||||
new FrameLayout.LayoutParams((int) mContext.getResources().getDimension(R.dimen.module_media_pop_window_width_new), (int) mContext.getResources().getDimension(R.dimen.module_media_pop_window_height_new));
|
||||
params.leftMargin = xPos;
|
||||
params.topMargin = yPos;
|
||||
ServiceMediaHandler.getMogoWindowManager().addView(mWindowView, params, false);
|
||||
updateWindowUI(true);
|
||||
|
||||
mWindowView.setOnClickListener(new NoDoubleClickListener() {
|
||||
@Override
|
||||
public void onClicks(View view) {
|
||||
mPresenter.openApp();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
mWindowPlayNext.setOnClickListener(new NoDoubleClickListener() {
|
||||
@Override
|
||||
public void onClicks(View view) {
|
||||
if (mPresenter != null) {
|
||||
mPresenter.next();
|
||||
mPauseImage.setOnClickListener(new NoDoubleClickListener() {
|
||||
@Override
|
||||
public void onClicks(View view) {
|
||||
if (mMediaInfoData != null) {
|
||||
if (mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_PAUSE_OR_STOP) {
|
||||
mPresenter.play(mMediaInfoData);
|
||||
} else {
|
||||
// 没有做详细判断,不是暂停就是播放
|
||||
mPresenter.pause(mMediaInfoData);
|
||||
}
|
||||
} else {
|
||||
mPresenter.openApp();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
if ( mIsCallChatWindowVisible ) {
|
||||
Logger.d( TAG, "vr mWindowView.setVisibility: status = " + mIsCallChatWindowVisible );
|
||||
mWindowView.setVisibility(View.GONE);
|
||||
} else {
|
||||
mWindowView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if ( mIsCallChatWindowVisible ) {
|
||||
Logger.d( TAG, "mWindowView.setVisibility: status = " + mIsCallChatWindowVisible );
|
||||
mWindowView.setVisibility(View.GONE);
|
||||
} else {
|
||||
mWindowView.setVisibility(View.VISIBLE);
|
||||
mWindowView =
|
||||
LayoutInflater.from(mContext).inflate(R.layout.module_media_music_window_alert_layout, null);
|
||||
mCircleImg = mWindowView.findViewById(R.id.window_circle_img);
|
||||
mScrollText = mWindowView.findViewById(R.id.window_scroll_txt);
|
||||
mWindowPlayPause = mWindowView.findViewById(R.id.window_play_pause);
|
||||
mWindowPlayNext = mWindowView.findViewById(R.id.window_music_next);
|
||||
mWindowCurrTime = mWindowView.findViewById(R.id.window_current_time);
|
||||
mWindowMaxTime = mWindowView.findViewById(R.id.window_max_time);
|
||||
mWindowProgress = mWindowView.findViewById(R.id.window_progress_bar);
|
||||
if (mWindowPlayPause != null) {
|
||||
mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_pause);
|
||||
}
|
||||
int yPos =
|
||||
getContext().getResources().getDimensionPixelOffset(R.dimen.module_media_music_state_location);
|
||||
int xPos =
|
||||
getContext().getResources().getDimensionPixelOffset(R.dimen.module_media_music_state_location_x);
|
||||
int statusBarHeight = WindowUtils.getStatusBarHeight(mContext);
|
||||
Logger.d(TAG,
|
||||
"yPos: " + yPos + " xPos: " + xPos + " statusBarHeight: " + statusBarHeight);
|
||||
Log.d(TAG, "addMediaWindoView");
|
||||
FrameLayout.LayoutParams params =
|
||||
new FrameLayout.LayoutParams((int) mContext.getResources().getDimension(R.dimen.module_media_pop_window_width), (int) mContext.getResources().getDimension(R.dimen.module_media_pop_window_height));
|
||||
params.leftMargin = xPos;
|
||||
params.topMargin = yPos;
|
||||
ServiceMediaHandler.getMogoWindowManager().addView(mWindowView, params, false);
|
||||
updateWindowUI(true);
|
||||
mWindowView.setOnClickListener(new NoDoubleClickListener() {
|
||||
@Override
|
||||
public void onClicks(View view) {
|
||||
mPresenter.openApp();
|
||||
}
|
||||
});
|
||||
|
||||
mWindowPlayPause.setOnClickListener(new NoDoubleClickListener() {
|
||||
@Override
|
||||
public void onClicks(View view) {
|
||||
if (mMediaInfoData != null) {
|
||||
if (mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_PAUSE_OR_STOP) {
|
||||
mPresenter.play(mMediaInfoData);
|
||||
} else {
|
||||
// 没有做详细判断,不是暂停就是播放
|
||||
mPresenter.pause(mMediaInfoData);
|
||||
}
|
||||
} else {
|
||||
mPresenter.openApp();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
mWindowPlayNext.setOnClickListener(new NoDoubleClickListener() {
|
||||
@Override
|
||||
public void onClicks(View view) {
|
||||
if (mPresenter != null) {
|
||||
mPresenter.next();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if ( mIsCallChatWindowVisible ) {
|
||||
Logger.d( TAG, "mWindowView.setVisibility: status = " + mIsCallChatWindowVisible );
|
||||
mWindowView.setVisibility(View.GONE);
|
||||
} else {
|
||||
mWindowView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -214,41 +277,71 @@ public class MediaWindow2 implements IMusicView , IMogoStatusChangedListener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mScrollText != null) {
|
||||
mScrollText.setText(mMediaInfoData.getMediaName());
|
||||
}
|
||||
|
||||
if (first || mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_PLAYING || mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_BUFF) {
|
||||
if (mWindowMaxTime != null) {
|
||||
mWindowMaxTime.setText(Utils.calculateTime((int) mMediaInfoData.getMaxTime()));
|
||||
}
|
||||
if (mWindowCurrTime != null) {
|
||||
mWindowCurrTime.setText(Utils.calculateTime((int) mMediaInfoData.getCurTime()));
|
||||
}
|
||||
|
||||
if( mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_PLAYING) {
|
||||
// kw音乐做的容错
|
||||
if (mWindowPlayPause != null) {
|
||||
mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_play);
|
||||
}
|
||||
if (mCircleImg != null) {
|
||||
mCircleImg.startAnim();
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
if (first || mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_PLAYING || mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_BUFF) {
|
||||
if( mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_PLAYING) {
|
||||
// kw音乐做的容错
|
||||
if (mPauseImage != null) {
|
||||
mPauseImage.setImageResource(R.drawable.module_media_window_pop_play);
|
||||
}
|
||||
if (mAnimCircleImageView != null) {
|
||||
mAnimCircleImageView.startAnim();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mCircleImg != null) {
|
||||
if(mMediaInfoData!=null&&mMediaInfoData.getMediaImg()!=null&&!mMediaInfoData.getMediaImg().isEmpty()) {
|
||||
int size =
|
||||
mContext.getResources().getDimensionPixelSize(R.dimen.module_media_pop_window_anim_img_size);
|
||||
Logger.d(TAG, "overload: " + size);
|
||||
com.bumptech.glide.request.RequestOptions options =
|
||||
new com.bumptech.glide.request.RequestOptions()
|
||||
.placeholder(R.drawable.module_media_default_music_img).error(R.drawable.module_media_default_music_img).override(size, size);
|
||||
GlideApp.with(mContext).asBitmap().apply(options).load(mMediaInfoData.getMediaImg()).into(new SkinAbleBitmapTarget(mCircleImg, options));
|
||||
if (mAnimCircleImageView != null) {
|
||||
if(mMediaInfoData!=null&&mMediaInfoData.getMediaImg()!=null&&!mMediaInfoData.getMediaImg().isEmpty()) {
|
||||
int size =
|
||||
mContext.getResources().getDimensionPixelSize(R.dimen.module_media_pop_window_anim_img_size_new);
|
||||
Logger.d(TAG, "overload: " + size);
|
||||
com.bumptech.glide.request.RequestOptions options =
|
||||
new com.bumptech.glide.request.RequestOptions()
|
||||
.placeholder(R.drawable.module_media_default_music_img).error(R.drawable.module_media_default_music_img).override(size, size);
|
||||
GlideApp.with(mContext).asBitmap().apply(options).load(mMediaInfoData.getMediaImg()).into(new SkinAbleBitmapTarget(mAnimCircleImageView, options));
|
||||
// GlideApp.with(mContext).applyDefaultRequestOptions(options).load(mMediaInfoData.getMediaImg()).into(new SkinAbleBitmapTarget(mCircleImg, options));
|
||||
}else{
|
||||
mCircleImg.setImageResource(R.drawable.module_media_default_music_img);
|
||||
}else{
|
||||
mAnimCircleImageView.setImageResource(R.drawable.module_media_default_music_img);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
if (mScrollText != null) {
|
||||
mScrollText.setText(mMediaInfoData.getMediaName());
|
||||
}
|
||||
|
||||
if (first || mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_PLAYING || mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_BUFF) {
|
||||
if (mWindowMaxTime != null) {
|
||||
mWindowMaxTime.setText(Utils.calculateTime((int) mMediaInfoData.getMaxTime()));
|
||||
}
|
||||
if (mWindowCurrTime != null) {
|
||||
mWindowCurrTime.setText(Utils.calculateTime((int) mMediaInfoData.getCurTime()));
|
||||
}
|
||||
|
||||
if( mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_PLAYING) {
|
||||
// kw音乐做的容错
|
||||
if (mWindowPlayPause != null) {
|
||||
mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_play);
|
||||
}
|
||||
if (mCircleImg != null) {
|
||||
mCircleImg.startAnim();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mCircleImg != null) {
|
||||
if(mMediaInfoData!=null&&mMediaInfoData.getMediaImg()!=null&&!mMediaInfoData.getMediaImg().isEmpty()) {
|
||||
int size =
|
||||
mContext.getResources().getDimensionPixelSize(R.dimen.module_media_pop_window_anim_img_size);
|
||||
Logger.d(TAG, "overload: " + size);
|
||||
com.bumptech.glide.request.RequestOptions options =
|
||||
new com.bumptech.glide.request.RequestOptions()
|
||||
.placeholder(R.drawable.module_media_default_music_img).error(R.drawable.module_media_default_music_img).override(size, size);
|
||||
GlideApp.with(mContext).asBitmap().apply(options).load(mMediaInfoData.getMediaImg()).into(new SkinAbleBitmapTarget(mCircleImg, options));
|
||||
// GlideApp.with(mContext).applyDefaultRequestOptions(options).load(mMediaInfoData.getMediaImg()).into(new SkinAbleBitmapTarget(mCircleImg, options));
|
||||
}else{
|
||||
mCircleImg.setImageResource(R.drawable.module_media_default_music_img);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -265,12 +358,22 @@ public class MediaWindow2 implements IMusicView , IMogoStatusChangedListener {
|
||||
Log.d(TAG, "onMusicPlaying===" + mMediaInfoData);
|
||||
isFirstPlay = false;
|
||||
updateWindowUI(false);
|
||||
if (mWindowPlayPause != null) {
|
||||
mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_play);
|
||||
}
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
if (mPauseImage != null) {
|
||||
mPauseImage.setImageResource(R.drawable.module_media_window_pop_play);
|
||||
}
|
||||
|
||||
if (mCircleImg != null) {
|
||||
mCircleImg.startAnim();
|
||||
if (mAnimCircleImageView != null) {
|
||||
mAnimCircleImageView.startAnim();
|
||||
}
|
||||
} else {
|
||||
if (mWindowPlayPause != null) {
|
||||
mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_play);
|
||||
}
|
||||
|
||||
if (mCircleImg != null) {
|
||||
mCircleImg.startAnim();
|
||||
}
|
||||
}
|
||||
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setMediaPlayStatus(TAG, true);
|
||||
@@ -280,12 +383,22 @@ public class MediaWindow2 implements IMusicView , IMogoStatusChangedListener {
|
||||
public void onMusicPause() {
|
||||
Logger.d(TAG, "onMusicPause: ===" + mMediaInfoData);
|
||||
Log.d(TAG, "onMusicPause: ===" + mMediaInfoData);
|
||||
if (mWindowPlayPause != null) {
|
||||
mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_pause);
|
||||
}
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
if (mPauseImage != null) {
|
||||
mPauseImage.setImageResource(R.drawable.module_media_window_pop_pause);
|
||||
}
|
||||
|
||||
if (mCircleImg != null) {
|
||||
mCircleImg.stopAnim();
|
||||
if (mAnimCircleImageView != null) {
|
||||
mAnimCircleImageView.stopAnim();
|
||||
}
|
||||
} else {
|
||||
if (mWindowPlayPause != null) {
|
||||
mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_pause);
|
||||
}
|
||||
|
||||
if (mAnimCircleImageView != null) {
|
||||
mAnimCircleImageView.stopAnim();
|
||||
}
|
||||
}
|
||||
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setMediaPlayStatus(TAG,false);
|
||||
@@ -295,12 +408,22 @@ public class MediaWindow2 implements IMusicView , IMogoStatusChangedListener {
|
||||
public void onMusicStopped() {
|
||||
Logger.d(TAG, "onMusicStopped===" + mMediaInfoData);
|
||||
Log.d(TAG, "onMusicStopped===" + mMediaInfoData);
|
||||
if (mWindowPlayPause != null) {
|
||||
mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_pause);
|
||||
}
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
if (mPauseImage != null) {
|
||||
mPauseImage.setImageResource(R.drawable.module_media_window_pop_pause);
|
||||
}
|
||||
|
||||
if (mCircleImg != null) {
|
||||
mCircleImg.stopAnim();
|
||||
if (mAnimCircleImageView != null) {
|
||||
mAnimCircleImageView.stopAnim();
|
||||
}
|
||||
} else {
|
||||
if (mWindowPlayPause != null) {
|
||||
mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_pause);
|
||||
}
|
||||
|
||||
if (mCircleImg != null) {
|
||||
mCircleImg.stopAnim();
|
||||
}
|
||||
}
|
||||
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setMediaPlayStatus(TAG,false);
|
||||
@@ -318,22 +441,37 @@ public class MediaWindow2 implements IMusicView , IMogoStatusChangedListener {
|
||||
@Override
|
||||
public void onMusicProgress(long current, long total) {
|
||||
// Logger.d(TAG, "onMusicProgress==current: " + current + " total: " + total);
|
||||
if (mMediaInfoData != null) {
|
||||
mMediaInfoData.setCurTime((int) current);
|
||||
mMediaInfoData.setMaxTime((int) total);
|
||||
}
|
||||
if (mWindowCurrTime != null) {
|
||||
mWindowCurrTime.setText(Utils.calculateTime((int) current));
|
||||
mWindowMaxTime.setText(Utils.calculateTime((int) total));
|
||||
}
|
||||
try {
|
||||
int progress =
|
||||
(int) ((current * 1.0f * 100) / (total * 1.0f));
|
||||
if (mWindowProgress != null) {
|
||||
mWindowProgress.setProgress(progress);
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
try {
|
||||
int progress =
|
||||
(int) ((current * 1.0f * 100) / (total * 1.0f));
|
||||
if (mPercentageRingView != null) {
|
||||
mPercentageRingView.setVisibility(View.VISIBLE);
|
||||
Log.d(TAG, "progress vr = " + progress);
|
||||
mPercentageRingView.setTargetPercent(progress);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
if (mMediaInfoData != null) {
|
||||
mMediaInfoData.setCurTime((int) current);
|
||||
mMediaInfoData.setMaxTime((int) total);
|
||||
}
|
||||
if (mWindowCurrTime != null) {
|
||||
mWindowCurrTime.setText(Utils.calculateTime((int) current));
|
||||
mWindowMaxTime.setText(Utils.calculateTime((int) total));
|
||||
}
|
||||
try {
|
||||
int progress =
|
||||
(int) ((current * 1.0f * 100) / (total * 1.0f));
|
||||
if (mWindowProgress != null) {
|
||||
Log.d(TAG, "progress = " + progress);
|
||||
mWindowProgress.setProgress(progress);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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="@dimen/module_media_pop_window_size"
|
||||
android:layout_height="@dimen/module_media_pop_window_size">
|
||||
|
||||
<com.mogo.module.media.widget.PercentageRingView
|
||||
android:id="@+id/window_circle_bg"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:circleBackground="@color/modules_media_music_bg_color"
|
||||
app:radius="100"
|
||||
app:ringColor="@color/modules_media_music_circle_color" />
|
||||
|
||||
<com.mogo.module.media.widget.AnimCircleImageView
|
||||
android:id="@+id/window_circle_img_new"
|
||||
android:layout_width="@dimen/module_media_pop_window_anim_img_size_new"
|
||||
android:layout_height="@dimen/module_media_pop_window_anim_img_size_new"
|
||||
android:src="@drawable/module_media_default_music_img"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/window_play_pause_new"
|
||||
android:layout_width="@dimen/module_media_pop_window_pause"
|
||||
android:layout_height="@dimen/module_media_pop_window_pause"
|
||||
android:background="@drawable/module_media_play_bg_selector"
|
||||
android:src="@drawable/module_media_window_pop_play"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
<resources>
|
||||
<dimen name="module_media_music_state_location">872px</dimen>
|
||||
<dimen name="module_media_music_state_location_x">1067px</dimen>
|
||||
|
||||
<dimen name="module_media_music_state_location_new">40px</dimen>
|
||||
<dimen name="module_media_music_state_location_x_new">1760px</dimen>
|
||||
<!-- lcc start-->
|
||||
<dimen name="module_media_back_width">660px</dimen>
|
||||
<dimen name="module_media_back_height">660px</dimen>
|
||||
@@ -63,9 +64,14 @@
|
||||
|
||||
<dimen name="module_media_pop_window_width">600px</dimen>
|
||||
<dimen name="module_media_pop_window_height">140px</dimen>
|
||||
<dimen name="module_media_pop_window_width_new">116px</dimen>
|
||||
<dimen name="module_media_pop_window_height_new">116px</dimen>
|
||||
<dimen name="module_media_pop_window_inner_height">112px</dimen>
|
||||
<dimen name="module_media_pop_window_inner_padding">30px</dimen>
|
||||
<dimen name="module_media_pop_window_anim_img_size">80px</dimen>
|
||||
<dimen name="module_media_pop_window_anim_img_size_new">90px</dimen>
|
||||
<dimen name="module_media_pop_window_pause">60px</dimen>
|
||||
<dimen name="module_media_pop_window_size">116px</dimen>
|
||||
<dimen name="module_media_pop_window_text_width">230px</dimen>
|
||||
<dimen name="module_media_pop_window_text_margin">14px</dimen>
|
||||
<dimen name="module_media_pop_window_text_top_size">35px</dimen>
|
||||
|
||||
@@ -35,4 +35,12 @@
|
||||
<attr format="color" name="civ_fill_color"/>
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="PercentageRing">
|
||||
<attr name="radius" format="integer"/>
|
||||
<attr name="circleBackground" format="color"/>
|
||||
<attr name="ringColor" format="color"/>
|
||||
<attr name="textColor" format = "color"/>
|
||||
</declare-styleable>
|
||||
|
||||
|
||||
</resources>
|
||||
@@ -2,4 +2,6 @@
|
||||
<resources>
|
||||
<color name="modules_media_music_title_text_color">#fff</color>
|
||||
<color name="modules_media_music_time_text_color">#7affffff</color>
|
||||
<color name="modules_media_music_bg_color">#444E6E</color>
|
||||
<color name="modules_media_music_circle_color">#B63737</color>
|
||||
</resources>
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
<resources>
|
||||
<dimen name="module_media_music_state_location">467px</dimen>
|
||||
<dimen name="module_media_music_state_location_x">573px</dimen>
|
||||
<dimen name="module_media_music_state_location_new">80px</dimen>
|
||||
<dimen name="module_media_music_state_location_x_new">930px</dimen>
|
||||
|
||||
<!-- lcc start-->
|
||||
<dimen name="module_media_back_width">352px</dimen>
|
||||
@@ -63,9 +65,13 @@
|
||||
|
||||
<dimen name="module_media_pop_window_width">338px</dimen>
|
||||
<dimen name="module_media_pop_window_height">82px</dimen>
|
||||
<dimen name="module_media_pop_window_width_new">116px</dimen>
|
||||
<dimen name="module_media_pop_window_height_new">116px</dimen>
|
||||
<dimen name="module_media_pop_window_inner_height">60px</dimen>
|
||||
<dimen name="module_media_pop_window_inner_padding">18px</dimen>
|
||||
<dimen name="module_media_pop_window_anim_img_size">44px</dimen>
|
||||
<dimen name="module_media_pop_window_anim_img_size_new">55px</dimen>
|
||||
<dimen name="module_media_pop_window_pause">60px</dimen>
|
||||
<dimen name="module_media_pop_window_text_width">123px</dimen>
|
||||
<dimen name="module_media_pop_window_text_margin">10px</dimen>
|
||||
<dimen name="module_media_pop_window_text_top_size">18px</dimen>
|
||||
|
||||
Reference in New Issue
Block a user