优化逻辑
This commit is contained in:
parent
a079c0ecf6
commit
bd31ac8780
@ -18,7 +18,7 @@
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:roundIcon="@mipmap/ic_launcher"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.MusicApp"
|
||||
tools:targetApi="31">
|
||||
|
||||
@ -55,7 +55,7 @@ public class AdapterCategory extends BaseAdapter<ResponseCategory, ItemCategoryB
|
||||
.asDrawable()
|
||||
.apply(RequestOptions.bitmapTransform(new RoundedCorners(CommonUtils.dpToPx(13))))
|
||||
.load(responseCategory.getCovert())
|
||||
.placeholder(R.mipmap.ic_launcher)
|
||||
.placeholder(R.drawable.placeholder)
|
||||
.listener(new RequestListener<Drawable>() {
|
||||
@Override
|
||||
public boolean onLoadFailed(@Nullable GlideException e, @Nullable Object model, @NonNull Target<Drawable> target, boolean isFirstResource) {
|
||||
|
||||
@ -71,7 +71,7 @@ public class AdapterCategoryList extends BaseAdapter<ResponsePlayListInfo, ItemC
|
||||
.asDrawable()
|
||||
.apply(RequestOptions.bitmapTransform(new RoundedCorners(CommonUtils.dpToPx(16))))
|
||||
.load(child.getSmallCovert())
|
||||
.placeholder(R.mipmap.ic_launcher)
|
||||
.placeholder(R.drawable.placeholder)
|
||||
.listener(new RequestListener<Drawable>() {
|
||||
@Override
|
||||
public boolean onLoadFailed(@Nullable GlideException e, @Nullable Object model, @NonNull Target<Drawable> target, boolean isFirstResource) {
|
||||
|
||||
@ -90,7 +90,7 @@ public class AdapterPlayList extends BaseAdapter<ResponsePlayListInfo, ItemPlayL
|
||||
.asDrawable()
|
||||
.apply(RequestOptions.bitmapTransform(new RoundedCorners(CommonUtils.dpToPx(10))))
|
||||
.load(covert)
|
||||
.placeholder(R.mipmap.ic_launcher)
|
||||
.placeholder(R.drawable.placeholder)
|
||||
.into(vb.imCovert);
|
||||
|
||||
MediaItem currentMediaItem = instance.getMediaController().getCurrentMediaItem();
|
||||
|
||||
@ -41,7 +41,7 @@ public class AdapterSinger extends BaseAdapter<ResponseSingle, ItemSingerBinding
|
||||
.asDrawable()
|
||||
.load(responseSingle.getSingerHead())
|
||||
.apply(RequestOptions.bitmapTransform(new RoundedCorners(CommonUtils.dpToPx(4))))
|
||||
.placeholder(R.mipmap.ic_launcher)
|
||||
.placeholder(R.drawable.placeholder)
|
||||
.listener(new RequestListener<Drawable>() {
|
||||
@Override
|
||||
public boolean onLoadFailed(@Nullable GlideException e, @Nullable Object model, @NonNull Target<Drawable> target, boolean isFirstResource) {
|
||||
|
||||
@ -57,7 +57,7 @@ public class DialogPlayList extends BaseDialog<DialogPlayListBinding> {
|
||||
.asDrawable()
|
||||
.apply(RequestOptions.bitmapTransform(new RoundedCorners(CommonUtils.dpToPx(10))))
|
||||
.load(artworkUri)
|
||||
.placeholder(R.mipmap.ic_launcher)
|
||||
.placeholder(R.drawable.placeholder)
|
||||
.listener(new RequestListener<Drawable>() {
|
||||
@Override
|
||||
public boolean onLoadFailed(@Nullable GlideException e, @Nullable Object model, @NonNull Target<Drawable> target, boolean isFirstResource) {
|
||||
|
||||
@ -57,12 +57,15 @@ public class MyValue {
|
||||
//暂停或者停止
|
||||
public final static int PLAY_STATUS_CODE_PAUSE = -3;
|
||||
|
||||
//切歌
|
||||
public final static int PLAY_STATUS_CHANGE_MUSIC= -4;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 进入播放页面的来源
|
||||
* 0--单曲进入、 1--音乐分类合集列表进入 2--视频mv进入
|
||||
* 0--首页单曲进入、 1--首页音乐分类合集列表进入 2--首页单个视频mv进入
|
||||
* 3--控制面板进入
|
||||
*/
|
||||
|
||||
public static String KEY_ENTER_SOURCE = "ENTER_SOURCE";
|
||||
@ -73,6 +76,9 @@ public class MyValue {
|
||||
public final static int TYPE_ENTER_SOURCE_MV = 2;
|
||||
|
||||
|
||||
public final static int TYPE_ENTER_PANEL = 3;
|
||||
|
||||
|
||||
//-----------------------------PlayActivity
|
||||
|
||||
|
||||
|
||||
@ -97,6 +97,7 @@ public class MyMediaControllerManager {
|
||||
return;
|
||||
}
|
||||
mListener.onChangeMusic(mediaItem);
|
||||
mVmApplication.setPlayStatus(MyValue.PLAY_STATUS_CHANGE_MUSIC);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -165,12 +166,46 @@ public class MyMediaControllerManager {
|
||||
if (mediaController == null) return 0;
|
||||
return mediaController.getBufferedPosition();
|
||||
}
|
||||
|
||||
|
||||
public MediaItem getCurMediaItem() {
|
||||
return mediaController.getCurrentMediaItem();
|
||||
}
|
||||
public Boolean getIsPlaying() {
|
||||
return mediaController.isPlaying();
|
||||
}
|
||||
public int getCurIndex() {
|
||||
return mediaController.getCurrentMediaItemIndex();
|
||||
}
|
||||
|
||||
/**
|
||||
* //0 不循环、1 列表循环、2 单曲循环、
|
||||
* @param mode
|
||||
*/
|
||||
public void setMode(int mode){
|
||||
switch (mode){
|
||||
case 0:
|
||||
mediaController.setRepeatMode(Player.REPEAT_MODE_OFF);
|
||||
break;
|
||||
case 1:
|
||||
mediaController.setRepeatMode(Player.REPEAT_MODE_ALL);
|
||||
break;
|
||||
case 2:
|
||||
mediaController.setRepeatMode(Player.REPEAT_MODE_ONE);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String getCurVideoId() {
|
||||
MediaItem currentMediaItem = mediaController.getCurrentMediaItem();
|
||||
if(currentMediaItem!= null){
|
||||
return currentMediaItem.mediaId;
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新播放列表中的音频url
|
||||
*
|
||||
@ -275,9 +310,9 @@ public class MyMediaControllerManager {
|
||||
ResponsePlayListInfo playInfo = listInfo.get(i);
|
||||
|
||||
MediaItem.Builder builder = new MediaItem.Builder();
|
||||
|
||||
String videoId = playInfo.getVideoId();
|
||||
//唯一标识符
|
||||
builder.setMediaId(playInfo.getVideoId());
|
||||
builder.setMediaId(videoId);
|
||||
builder.setUri("-------test-----");
|
||||
MediaMetadata.Builder MediaMetadata_builder = new MediaMetadata.Builder();
|
||||
|
||||
@ -288,7 +323,7 @@ public class MyMediaControllerManager {
|
||||
MediaMetadata_builder.setArtworkUri(Uri.parse(playInfo.getCovert()));
|
||||
MediaMetadata_builder.setTitle(playInfo.getSongTitle());
|
||||
|
||||
CommonUtils.LogMsg("----------添加播放列表 i=" + i + "---" + playInfo.getSingerName() + "-------VideoId=" + playInfo.getVideoId());
|
||||
CommonUtils.LogMsg("----------添加播放列表 i=" + i + "---" + playInfo.getSingerName() + "-------VideoId=" + videoId);
|
||||
// MediaMetadata_builder.setRecordingYear(Integer.parseInt(playInfo.getYear()));
|
||||
builder.setMediaMetadata(MediaMetadata_builder.build());
|
||||
mediaController.addMediaItem(builder.build());
|
||||
@ -302,7 +337,6 @@ public class MyMediaControllerManager {
|
||||
CommonUtils.LogMsg("-----------prepare");
|
||||
mediaController.prepare();
|
||||
mediaController.play();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -342,8 +376,8 @@ public class MyMediaControllerManager {
|
||||
public void playPrevious() {
|
||||
if (mediaController.hasPreviousMediaItem()) {
|
||||
|
||||
int nextMediaItemIndex = mediaController.getNextMediaItemIndex();
|
||||
onCallRequestUrl(nextMediaItemIndex, true, new OnHasUrlAction() {
|
||||
int previousMediaItemIndex = mediaController.getPreviousMediaItemIndex();
|
||||
onCallRequestUrl(previousMediaItemIndex, true, new OnHasUrlAction() {
|
||||
@Override
|
||||
public void onHasUrl() {
|
||||
mediaController.seekToPreviousMediaItem();
|
||||
@ -375,7 +409,7 @@ public class MyMediaControllerManager {
|
||||
@Override
|
||||
public void onHasUrl() {
|
||||
mediaController.play();
|
||||
CommonUtils.LogMsg("-------------有有效URl--播放指定播放列表位置的歌曲");
|
||||
CommonUtils.LogMsg("-------------有有效URl--播放指定播放列表位置的歌曲 index="+index);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -125,6 +125,10 @@ public class JsonHelper {
|
||||
responsePlayListInfo.setDuration(SongDuration);
|
||||
responsePlayListInfo.setDurationMs(ms);
|
||||
responsePlayListInfo.setVideoId(watchEndPoint[0]);
|
||||
if (watchEndPoint[0] == null || watchEndPoint[0].isEmpty()) {
|
||||
CommonUtils.LogMsg("----------songName=" + songName + "---setVideoId=null");
|
||||
continue;
|
||||
}
|
||||
responsePlayListInfo.setPlaylistId(watchEndPoint[1]);
|
||||
responsePlayListInfo.setParams(watchEndPoint[2]);
|
||||
responsePlayListInfo.setMusicVideoType(watchEndPoint[3]);
|
||||
@ -203,7 +207,7 @@ public class JsonHelper {
|
||||
* @param jsonObject
|
||||
* @return
|
||||
*/
|
||||
public static ResponseCategoryList ResolveCategoryList(JSONObject jsonObject,String browseId) {
|
||||
public static ResponseCategoryList ResolveCategoryList(JSONObject jsonObject, String browseId) {
|
||||
try {
|
||||
ResponseCategoryList responseCategoryList = new ResponseCategoryList();
|
||||
JSONObject contents = jsonObject.getJSONObject("contents");
|
||||
@ -276,10 +280,14 @@ public class JsonHelper {
|
||||
CommonUtils.LogMsg("----图片-------------thumbnail=" + thumbnail);
|
||||
child.setSmallCovert(thumbnail);
|
||||
// child.setCovert(thumbnail);
|
||||
|
||||
|
||||
if (child.getVideoId() == null || child.getVideoId().isEmpty()) {
|
||||
CommonUtils.LogErrorMsg("--歌曲" + i + "-------------SongTitle=" + child.getSongTitle() + "--getVideoId=" + child.getVideoId() + "---请求参数browseId=" + browseId);
|
||||
continue;
|
||||
}
|
||||
mList.add(child);
|
||||
|
||||
if (child.getVideoId() == null || child.getVideoId().isEmpty())
|
||||
CommonUtils.LogErrorMsg("--歌曲" + i + "-------------SongTitle=" + child.getSongTitle() + "--getVideoId=" + child.getVideoId()+"---请求参数browseId="+browseId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -292,6 +300,9 @@ public class JsonHelper {
|
||||
ResponsePlayListInfo child = getCommonCategoryList(arrayJSONObject);
|
||||
child.setCovert(covert);
|
||||
child.setSmallCovert(covert);
|
||||
if (child.getVideoId() == null || child.getVideoId().isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
mList.add(child);
|
||||
}
|
||||
|
||||
@ -342,6 +353,10 @@ public class JsonHelper {
|
||||
String[] watchEndPoint = getWatchEndPoint(runs);
|
||||
|
||||
listInfo.setVideoId(watchEndPoint[0]);
|
||||
if (watchEndPoint[0] == null || watchEndPoint[0].isEmpty()) {
|
||||
CommonUtils.LogMsg("---------getCommonCategoryList-SongTitle=" + SongTitle + "---setVideoId=null");
|
||||
}
|
||||
|
||||
listInfo.setPlaylistId(watchEndPoint[1]);
|
||||
listInfo.setParams(watchEndPoint[2]);
|
||||
listInfo.setMusicVideoType(watchEndPoint[3]);
|
||||
@ -588,9 +603,13 @@ public class JsonHelper {
|
||||
int index = 0;
|
||||
if (maxBig) {
|
||||
index = length - 1;
|
||||
}else if(length>2){
|
||||
index = length - 2;
|
||||
}
|
||||
String pngUrl = jsonArray.getJSONObject(index).getString("url");
|
||||
|
||||
CommonUtils.LogMsg("----------取封面index="+index);
|
||||
|
||||
return pngUrl;
|
||||
} catch (JSONException exception) {
|
||||
return null;
|
||||
|
||||
@ -2,6 +2,8 @@ package com.hi.music.player.ui.activity;
|
||||
|
||||
import static android.view.Gravity.CENTER_HORIZONTAL;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
@ -48,6 +50,8 @@ public abstract class BaseActivity<T extends ViewBinding> extends AppCompatActiv
|
||||
protected VMApplication vmApplication;
|
||||
protected MyMediaControllerManager mediaControllerManager;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@ -86,6 +90,8 @@ public abstract class BaseActivity<T extends ViewBinding> extends AppCompatActiv
|
||||
|
||||
public abstract boolean showPanel();
|
||||
|
||||
|
||||
|
||||
private void initPanel() {
|
||||
LayoutPanelBinding panelVb = LayoutPanelBinding.inflate(getLayoutInflater());
|
||||
View panelView = panelVb.getRoot();
|
||||
@ -105,6 +111,14 @@ public abstract class BaseActivity<T extends ViewBinding> extends AppCompatActiv
|
||||
|
||||
}
|
||||
});
|
||||
panelVb.layoutPanel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(MusicApplication.myApplication, PlayActivity.class);
|
||||
intent.putExtra(MyValue.KEY_ENTER_SOURCE, MyValue.TYPE_ENTER_PANEL);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
if (this instanceof HomeActivity) {
|
||||
layoutParams.setMargins(CommonUtils.dpToPx(22), 0, CommonUtils.dpToPx(22), CommonUtils.dpToPx(82));
|
||||
@ -116,7 +130,7 @@ public abstract class BaseActivity<T extends ViewBinding> extends AppCompatActiv
|
||||
vmApplication.playStatus.observe(this, new Observer<Integer>() {
|
||||
@Override
|
||||
public void onChanged(Integer integer) {
|
||||
CommonUtils.LogMsg("----------播放状态更新=" + integer);
|
||||
CommonUtils.LogMsg("----------面板 播放状态更新=" + integer);
|
||||
if (panelView.getParent() == null) {
|
||||
CommonUtils.LogMsg("----------显示面板");
|
||||
rootVb.frameLayout.addView(panelView, layoutParams);
|
||||
@ -140,30 +154,21 @@ public abstract class BaseActivity<T extends ViewBinding> extends AppCompatActiv
|
||||
|
||||
switch (integer) {
|
||||
case Player.STATE_IDLE:
|
||||
panelVb.imPlay.setSelected(false);
|
||||
break;
|
||||
case Player.STATE_BUFFERING:
|
||||
//快进没有缓冲的时候触发
|
||||
panelVb.imPlay.setSelected(false);
|
||||
break;
|
||||
case Player.STATE_READY:
|
||||
panelVb.imPlay.setSelected(false);
|
||||
break;
|
||||
|
||||
case Player.STATE_ENDED:
|
||||
//播放完成
|
||||
panelVb.imPlay.setSelected(false);
|
||||
break;
|
||||
|
||||
case Player.STATE_READY:
|
||||
case MyValue.PLAY_STATUS_CHANGE_MUSIC:
|
||||
case MyValue.PLAY_STATUS_CODE_PAUSE:
|
||||
case Player.STATE_BUFFERING:
|
||||
case MyValue.PLAY_STATUS_CODE_ERROR:
|
||||
|
||||
//快进没有缓冲的时候触发
|
||||
//播放完成
|
||||
panelVb.imPlay.setSelected(false);
|
||||
break;
|
||||
case MyValue.PLAY_STATUS_CODE_PLAYING:
|
||||
panelVb.imPlay.setSelected(true);
|
||||
break;
|
||||
case MyValue.PLAY_STATUS_CODE_ERROR:
|
||||
panelVb.imPlay.setSelected(false);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -10,6 +10,7 @@ import androidx.lifecycle.Observer;
|
||||
import androidx.media3.common.util.UnstableApi;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.GradientDrawable;
|
||||
@ -136,6 +137,7 @@ public class CategoryListActivity extends BaseActivity<ActivityCategoryListBindi
|
||||
}
|
||||
|
||||
private void loadInfo(ResponseCategoryList info) {
|
||||
vb.btnPlay.setVisibility(View.VISIBLE);
|
||||
switch (mPageType) {
|
||||
case MyValue.PAGE_TYPE_LIST:
|
||||
vb.tvSingerName.setVisibility(View.GONE);
|
||||
@ -192,7 +194,7 @@ public class CategoryListActivity extends BaseActivity<ActivityCategoryListBindi
|
||||
.asDrawable()
|
||||
.apply(bitmapTransform(new RoundedCorners(CommonUtils.dpToPx(10))))
|
||||
.load(url)
|
||||
.placeholder(R.mipmap.ic_launcher)
|
||||
.placeholder(R.drawable.placeholder)
|
||||
.listener(new RequestListener<Drawable>() {
|
||||
@Override
|
||||
public boolean onLoadFailed(@Nullable GlideException e, @Nullable Object model, @NonNull Target<Drawable> target, boolean isFirstResource) {
|
||||
@ -222,6 +224,8 @@ public class CategoryListActivity extends BaseActivity<ActivityCategoryListBindi
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onClickItemCategoryList(ResponsePlayListInfo data, int musicIndex) {
|
||||
Intent intent = new Intent(this, PlayActivity.class);
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.hi.music.player.ui.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
||||
@ -100,6 +101,8 @@ public class HomeActivity extends BaseActivity<ActivityHomeBinding> {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void updateTabIcon(TabLayout.Tab tab, boolean isSelected) {
|
||||
HomeTabCustomBinding tabBinding = HomeTabCustomBinding.bind(tab.getCustomView());
|
||||
int position = tab.getPosition();
|
||||
|
||||
@ -76,7 +76,7 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
|
||||
private GradientDrawable gradientDrawable;
|
||||
private int lighterColor, darkerColor;
|
||||
|
||||
// 0 播放列表请求失败 1 立即播放的歌曲请求失败
|
||||
// 0 播放列表请求失败 1 立即播放的歌曲请求失败 2 封面图加载失败
|
||||
private int netError = 0;
|
||||
|
||||
|
||||
@ -91,6 +91,16 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
|
||||
|
||||
private int mDefaultPlayStartIndex = 0;
|
||||
|
||||
|
||||
private int[] imageStates = {
|
||||
R.drawable.icon_looper_no,
|
||||
R.drawable.icon_looper,
|
||||
R.drawable.icon_looper_1
|
||||
};
|
||||
|
||||
//0 不循环、1 列表循环、2 单曲循环、
|
||||
private int currentMode = 0;
|
||||
|
||||
@Override
|
||||
protected ActivityPlayBinding getViewBinding() {
|
||||
return ActivityPlayBinding.inflate(getLayoutInflater());
|
||||
@ -105,9 +115,13 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
|
||||
|
||||
Intent intent = getIntent();
|
||||
mEnterType = intent.getIntExtra(MyValue.KEY_ENTER_SOURCE, MyValue.TYPE_ENTER_SOURCE_SINGLE);
|
||||
initPlayerView();
|
||||
initProgressHandler();
|
||||
|
||||
switch (mEnterType) {
|
||||
case MyValue.TYPE_ENTER_SOURCE_SINGLE:
|
||||
// 0--首页单曲进入
|
||||
updateMediaPlayList();
|
||||
responseSingle = (ResponseSingle) intent.getSerializableExtra(MyValue.KEY_PLAY_ACTIVITY_SINGER);
|
||||
playlistId = responseSingle.getPlaylistId();
|
||||
videoId = responseSingle.getVideoId();
|
||||
@ -122,6 +136,9 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
|
||||
});
|
||||
break;
|
||||
case MyValue.TYPE_ENTER_SOURCE_CATEGORY:
|
||||
// 1--首页音乐分类合集列表进入
|
||||
|
||||
updateMediaPlayList();
|
||||
ResponsePlayListInfo playListInfo = (ResponsePlayListInfo) intent.getSerializableExtra(MyValue.KEY_PLAY_ACTIVITY_CATEGORY_LIST);
|
||||
mDefaultPlayStartIndex = intent.getIntExtra(MyValue.KEY_PLAY_ACTIVITY_CATEGORY_LIST_INDEX, mDefaultPlayStartIndex);
|
||||
videoId = playListInfo.getVideoId();
|
||||
@ -129,6 +146,9 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
|
||||
break;
|
||||
|
||||
case MyValue.TYPE_ENTER_SOURCE_MV:
|
||||
// 2--首页单个视频mv进入
|
||||
|
||||
updateMediaPlayList();
|
||||
ResponseCategory responseCategory = (ResponseCategory) intent.getSerializableExtra(MyValue.KEY_PLAY_ACTIVITY_MV);
|
||||
videoId = responseCategory.getVideoId();
|
||||
playlistId = responseCategory.getPlayListId();
|
||||
@ -141,33 +161,20 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
|
||||
vmApplication.reSetPlayList(listInfos);
|
||||
}
|
||||
});
|
||||
|
||||
break;
|
||||
|
||||
case MyValue.TYPE_ENTER_PANEL:
|
||||
// 3--控制面板进入
|
||||
MediaItem curMediaItem = mediaControllerManager.getCurMediaItem();
|
||||
loadInfo(curMediaItem);
|
||||
mHandler.post(mRunnable);
|
||||
vb.progressBarLoading.setVisibility(View.GONE);
|
||||
vb.btnPlay.setSelected(mediaControllerManager.getIsPlaying());
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
initPlayerView();
|
||||
initProgressHandler();
|
||||
|
||||
vmApplication.playList.observe(this, new Observer<List<ResponsePlayListInfo>>() {
|
||||
@Override
|
||||
public void onChanged(List<ResponsePlayListInfo> playList) {
|
||||
if (playList == null) {
|
||||
CommonUtils.LogErrorMsg("--------更新-playList null");
|
||||
netError = 0;
|
||||
vb.linearRetry.setVisibility(View.VISIBLE);
|
||||
return;
|
||||
}
|
||||
CommonUtils.LogMsg("--------更新-playList " + playList.size() + "--videoId=" + videoId);
|
||||
if (playList.size() > 0) {
|
||||
vb.linearRetry.setVisibility(View.GONE);
|
||||
mPlayList = playList;
|
||||
musicInfo = playList.get(0);
|
||||
setPlayListAndGetUrl(playList, videoId, mDefaultPlayStartIndex);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
vmPlay.playUrlLiveData.observe(this, new Observer<CustomerUrlInfo>() {
|
||||
@Override
|
||||
public void onChanged(CustomerUrlInfo customerUrlInfo) {
|
||||
@ -195,6 +202,28 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
|
||||
}
|
||||
|
||||
|
||||
private void updateMediaPlayList() {
|
||||
vmApplication.playList.observe(this, new Observer<List<ResponsePlayListInfo>>() {
|
||||
@Override
|
||||
public void onChanged(List<ResponsePlayListInfo> playList) {
|
||||
if (playList == null) {
|
||||
CommonUtils.LogErrorMsg("--------更新-playList null");
|
||||
netError = 0;
|
||||
vb.linearRetry.setVisibility(View.VISIBLE);
|
||||
return;
|
||||
}
|
||||
CommonUtils.LogMsg("--------更新-playList " + playList.size() + "--videoId=" + videoId);
|
||||
if (playList.size() > 0) {
|
||||
vb.linearRetry.setVisibility(View.GONE);
|
||||
mPlayList = playList;
|
||||
musicInfo = playList.get(0);
|
||||
setPlayListAndGetUrl(playList, videoId, mDefaultPlayStartIndex);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置播放列表,并请求当前需要播放的音乐url
|
||||
*
|
||||
@ -203,6 +232,7 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
|
||||
* @param index
|
||||
*/
|
||||
private void setPlayListAndGetUrl(List<ResponsePlayListInfo> list, String id, int index) {
|
||||
mediaControllerManager.resetPlayList();
|
||||
MyMediaControllerManager.getInstance().setPlayList(list);
|
||||
vmPlay.getPlayUrl(id, index, true);
|
||||
}
|
||||
@ -223,13 +253,13 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
|
||||
// TODO: 2024/9/27 正在播放当前歌曲,又点进来
|
||||
// mediaControllerManager.getMediaController().seekTo(0);
|
||||
// }
|
||||
if (mediaControllerManager.getMediaController().isPlaying()) {
|
||||
mediaControllerManager.stop();
|
||||
}
|
||||
mediaControllerManager.resetPlayList();
|
||||
// if (mediaControllerManager.getMediaController().isPlaying()) {
|
||||
// mediaControllerManager.stop();
|
||||
// }
|
||||
// mediaControllerManager.resetPlayList();
|
||||
}
|
||||
|
||||
mediaControllerManager.addListener(vmApplication,new MediaControllerListener() {
|
||||
mediaControllerManager.setMode(currentMode);
|
||||
mediaControllerManager.addListener(vmApplication, new MediaControllerListener() {
|
||||
@Override
|
||||
public void onPlayStatus(int playStatus) {
|
||||
|
||||
@ -264,8 +294,10 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
|
||||
vb.layoutPlayList.imPlay.setSelected(false);
|
||||
break;
|
||||
case MyValue.PLAY_STATUS_CODE_PLAYING:
|
||||
|
||||
CommonUtils.LogMsg("------------- 播放ing getCurIndex=" + mediaControllerManager.getCurIndex());
|
||||
vb.progressBarLoading.setVisibility(View.GONE);
|
||||
vb.linearRetry.setVisibility(View.GONE);
|
||||
vb.btnPlay.setSelected(true);
|
||||
vb.layoutPlayList.imPlay.setSelected(true);
|
||||
break;
|
||||
@ -273,6 +305,8 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
|
||||
vb.progressBarLoading.setVisibility(View.GONE);
|
||||
int currentMediaItemIndex = mediaControllerManager.getMediaController().getCurrentMediaItemIndex();
|
||||
CommonUtils.LogMsg("------------- 播放错误 currentMediaItemIndex=" + currentMediaItemIndex);
|
||||
mediaControllerManager.playPositionMusic(currentMediaItemIndex);
|
||||
// TODO: 2024/10/16
|
||||
break;
|
||||
|
||||
}
|
||||
@ -305,6 +339,7 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
|
||||
vb.imBack.setOnClickListener(this);
|
||||
vb.btnMusicList.setOnClickListener(this);
|
||||
vb.tvRetry.setOnClickListener(this);
|
||||
vb.btnLoop.setOnClickListener(this);
|
||||
}
|
||||
|
||||
|
||||
@ -365,11 +400,13 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
|
||||
.asDrawable()
|
||||
.apply(RequestOptions.bitmapTransform(new RoundedCorners(CommonUtils.dpToPx(16))))
|
||||
.load(url)
|
||||
.placeholder(R.mipmap.ic_launcher)
|
||||
.placeholder(R.drawable.placeholder)
|
||||
.listener(new RequestListener<Drawable>() {
|
||||
@Override
|
||||
public boolean onLoadFailed(@Nullable GlideException e, @Nullable Object model, @NonNull Target<Drawable> target, boolean isFirstResource) {
|
||||
CommonUtils.LogMsg(e.getMessage());
|
||||
netError = 2;
|
||||
vb.linearRetry.setVisibility(View.VISIBLE);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -464,19 +501,40 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
|
||||
} else if (v.equals(vb.tvRetry)) {
|
||||
//重试按钮
|
||||
vb.linearRetry.setVisibility(View.GONE);
|
||||
if (netError == 0) {
|
||||
switch (mEnterType) {
|
||||
case MyValue.TYPE_ENTER_SOURCE_SINGLE:
|
||||
vmPlay.getPlayMusicList(playlistId, videoId, params, musicVideoType);
|
||||
break;
|
||||
}
|
||||
switch (netError){
|
||||
case 0:
|
||||
switch (mEnterType) {
|
||||
case MyValue.TYPE_ENTER_SOURCE_SINGLE:
|
||||
vmPlay.getPlayMusicList(playlistId, videoId, params, musicVideoType);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
int curIndex = mediaControllerManager.getCurIndex();
|
||||
|
||||
String curVideoId = mediaControllerManager.getCurVideoId();
|
||||
|
||||
String videoId1 = mCustomerUrlInfo.getVideoId();
|
||||
int playMusicIndex = mCustomerUrlInfo.getPlayMusicIndex();
|
||||
|
||||
CommonUtils.LogMsg("-------重试 curIndex=" + curIndex + "----curVideoId=" + curVideoId + "---videoId1=" + videoId1 + "---playMusicIndex=" + playMusicIndex);
|
||||
|
||||
} else {
|
||||
if (mCustomerUrlInfo != null) {
|
||||
vmPlay.getPlayUrl(mCustomerUrlInfo.getVideoId(), mCustomerUrlInfo.getPlayMusicIndex(), true);
|
||||
}
|
||||
|
||||
break;
|
||||
case 2:
|
||||
MediaItem curMediaItem = mediaControllerManager.getCurMediaItem();
|
||||
MediaMetadata mediaMetadata = curMediaItem.mediaMetadata;
|
||||
if (mediaMetadata.artworkUri != null) {
|
||||
loadCovert(mediaMetadata.artworkUri.toString());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
} else if (v.equals(vb.btnLoop)) {
|
||||
currentMode = (currentMode + 1) % imageStates.length;
|
||||
vb.btnLoop.setImageResource(imageStates[currentMode]);
|
||||
CommonUtils.LogMsg("----currentMode=" + currentMode);
|
||||
mediaControllerManager.setMode(currentMode);
|
||||
}
|
||||
|
||||
}
|
||||
@ -499,6 +557,7 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
|
||||
adapterPlayList = new AdapterPlayList();
|
||||
vb.layoutPlayList.recyclerList.setLayoutManager(new LinearLayoutManager(MusicApplication.myApplication));
|
||||
adapterPlayList.setData(playList);
|
||||
// TODO: 2024/10/16
|
||||
vb.layoutPlayList.recyclerList.setAdapter(adapterPlayList);
|
||||
vb.layoutPlayList.imPlay.setOnClickListener(this);
|
||||
initPlayList = true;
|
||||
@ -537,7 +596,7 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
|
||||
.asDrawable()
|
||||
.apply(RequestOptions.bitmapTransform(new RoundedCorners(CommonUtils.dpToPx(10))))
|
||||
.load(artworkUri)
|
||||
.placeholder(R.mipmap.ic_launcher)
|
||||
.placeholder(R.drawable.placeholder)
|
||||
.listener(new RequestListener<Drawable>() {
|
||||
@Override
|
||||
public boolean onLoadFailed(@Nullable GlideException e, @Nullable Object model, @NonNull Target<Drawable> target, boolean isFirstResource) {
|
||||
|
||||
@ -59,11 +59,12 @@ public class VMPlay extends ViewModel {
|
||||
CustomerUrlInfo customerUrlInfo = new CustomerUrlInfo();
|
||||
customerUrlInfo.setNeedPlayNow(playNow);
|
||||
customerUrlInfo.setVideoId(videoId);
|
||||
customerUrlInfo.setPlayMusicIndex(playListIndex);
|
||||
RetrofitManager.getInstance().getPlayUrl(videoId, new RequestListener<ResponseBody>() {
|
||||
|
||||
@Override
|
||||
public void onFail(String errorMsg) {
|
||||
CommonUtils.LogMsg("-------------此次网络请求失败 playNow="+playNow);
|
||||
CommonUtils.LogMsg("-------------此次网络请求失败 playNow="+playNow +"--playListIndex="+playListIndex);
|
||||
_playUrlMutableLiveData.setValue(customerUrlInfo);
|
||||
}
|
||||
|
||||
@ -79,7 +80,6 @@ public class VMPlay extends ViewModel {
|
||||
MyMediaControllerManager.getInstance().UpdateAudioUrl(responsePlayUrl,playListIndex);
|
||||
// MyMediaControllerManager.getInstance().addMusicToPlayList(responsePlayUrl,playListIndex);
|
||||
customerUrlInfo.setPlayUrl(responsePlayUrl);
|
||||
customerUrlInfo.setPlayMusicIndex(playListIndex);
|
||||
|
||||
}
|
||||
_playUrlMutableLiveData.setValue(customerUrlInfo);
|
||||
|
||||
@ -2,6 +2,6 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="10dp"/>
|
||||
<solid android:color="@color/cur_play_music"/>
|
||||
<solid android:color="@color/retry_bg"/>
|
||||
|
||||
</shape>
|
||||
7
app/src/main/res/drawable/bg_retry_btn.xml
Normal file
7
app/src/main/res/drawable/bg_retry_btn.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="10dp"/>
|
||||
<solid android:color="@color/panel_bg"/>
|
||||
|
||||
</shape>
|
||||
12
app/src/main/res/drawable/icon_looper.xml
Normal file
12
app/src/main/res/drawable/icon_looper.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<group>
|
||||
<clip-path android:pathData="M0,0h24v24h-24z" />
|
||||
<path
|
||||
android:fillColor="#ffffff"
|
||||
android:pathData="M21.806,6.569C23.229,8.017 24.021,9.97 24.011,12C24.014,12.695 23.92,13.386 23.734,14.055C23.673,14.267 23.53,14.446 23.338,14.553C23.145,14.66 22.918,14.686 22.706,14.625C22.492,14.566 22.31,14.425 22.198,14.233C22.086,14.041 22.053,13.814 22.106,13.598C22.243,13.076 22.313,12.539 22.316,12C22.33,10.443 21.727,8.943 20.639,7.828C19.552,6.714 18.067,6.075 16.51,6.051H8.603V7.589C8.603,8.077 8.265,8.272 7.853,8.009L4.237,5.759C4.146,5.717 4.069,5.649 4.016,5.565C3.962,5.481 3.933,5.382 3.933,5.282C3.933,5.182 3.962,5.084 4.016,5C4.069,4.915 4.146,4.848 4.237,4.806L7.86,2.368C8.265,2.105 8.611,2.285 8.611,2.781V4.318H16.51C17.501,4.319 18.481,4.518 19.394,4.905C20.306,5.291 21.131,5.857 21.821,6.569H21.806ZM20.41,18.279C20.501,18.321 20.578,18.388 20.632,18.473C20.686,18.557 20.715,18.655 20.715,18.755C20.715,18.855 20.686,18.953 20.632,19.038C20.578,19.122 20.501,19.189 20.41,19.232L16.78,21.632C16.375,21.895 16.03,21.715 16.03,21.219V19.682H7.508C6.517,19.681 5.536,19.482 4.624,19.095C3.711,18.709 2.886,18.143 2.197,17.431C0.98,16.174 0.221,14.545 0.041,12.805C-0.138,11.065 0.272,9.315 1.207,7.837C1.265,7.742 1.343,7.659 1.434,7.595C1.525,7.53 1.628,7.485 1.738,7.461C1.847,7.437 1.96,7.435 2.069,7.456C2.179,7.477 2.284,7.52 2.377,7.582C2.567,7.707 2.701,7.903 2.748,8.126C2.796,8.349 2.754,8.582 2.632,8.774C2.023,9.74 1.701,10.858 1.702,12C1.688,13.557 2.29,15.057 3.378,16.172C4.466,17.286 5.951,17.925 7.508,17.949H16.052V16.411C16.052,15.923 16.382,15.728 16.802,15.991L20.418,18.279H20.41Z" />
|
||||
</group>
|
||||
</vector>
|
||||
15
app/src/main/res/drawable/icon_looper_1.xml
Normal file
15
app/src/main/res/drawable/icon_looper_1.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<group>
|
||||
<clip-path android:pathData="M0,0h24v24h-24z" />
|
||||
<path
|
||||
android:fillColor="#ffffff"
|
||||
android:pathData="M21.806,6.569C23.229,8.017 24.021,9.97 24.011,12C24.014,12.695 23.92,13.386 23.734,14.055C23.673,14.267 23.53,14.446 23.338,14.553C23.145,14.66 22.918,14.686 22.706,14.625C22.492,14.566 22.31,14.425 22.198,14.233C22.086,14.041 22.053,13.814 22.106,13.598C22.243,13.076 22.313,12.539 22.316,12C22.33,10.443 21.727,8.943 20.639,7.828C19.552,6.714 18.067,6.075 16.51,6.051H8.603V7.589C8.603,8.077 8.265,8.272 7.853,8.009L4.237,5.759C4.146,5.717 4.069,5.649 4.016,5.565C3.962,5.481 3.933,5.382 3.933,5.282C3.933,5.182 3.962,5.084 4.016,5C4.069,4.915 4.146,4.848 4.237,4.806L7.86,2.368C8.265,2.105 8.611,2.285 8.611,2.781V4.318H16.51C17.501,4.319 18.481,4.518 19.394,4.905C20.306,5.291 21.131,5.857 21.821,6.569H21.806ZM20.41,18.279C20.501,18.321 20.578,18.388 20.632,18.473C20.686,18.557 20.715,18.655 20.715,18.755C20.715,18.855 20.686,18.953 20.632,19.038C20.578,19.122 20.501,19.189 20.41,19.232L16.78,21.632C16.375,21.895 16.03,21.715 16.03,21.219V19.682H7.508C6.517,19.681 5.536,19.482 4.624,19.095C3.711,18.709 2.886,18.143 2.197,17.431C0.98,16.174 0.221,14.545 0.041,12.805C-0.138,11.065 0.272,9.315 1.207,7.837C1.265,7.742 1.343,7.659 1.434,7.595C1.525,7.53 1.628,7.485 1.738,7.461C1.847,7.437 1.96,7.435 2.069,7.456C2.179,7.477 2.284,7.52 2.377,7.582C2.567,7.707 2.701,7.903 2.748,8.126C2.796,8.349 2.754,8.582 2.632,8.774C2.023,9.74 1.701,10.858 1.702,12C1.688,13.557 2.29,15.057 3.378,16.172C4.466,17.286 5.951,17.925 7.508,17.949H16.052V16.411C16.052,15.923 16.382,15.728 16.802,15.991L20.418,18.279H20.41Z" />
|
||||
<path
|
||||
android:fillColor="#ffffff"
|
||||
android:pathData="M13.064,16.192C13.064,16.64 12.704,17 12.256,17C11.808,17 11.448,16.64 11.448,16.192V10.256L10.68,10.504C10.68,10.504 10.68,10.504 10.672,10.504C10.664,10.504 10.656,10.512 10.648,10.512C10.632,10.512 10.616,10.52 10.6,10.52C10.592,10.528 10.584,10.528 10.576,10.528C10.56,10.528 10.544,10.536 10.52,10.536C10.52,10.536 10.512,10.536 10.504,10.536C10.48,10.544 10.456,10.544 10.424,10.544C9.976,10.544 9.616,10.176 9.616,9.728C9.616,9.368 9.856,9.064 10.176,8.96H10.184C10.184,8.96 10.184,8.96 10.192,8.96L11.96,8.384C11.96,8.384 11.952,8.384 11.944,8.384C11.96,8.384 11.968,8.376 11.984,8.376L11.96,8.384C11.976,8.376 11.992,8.368 12.008,8.368L12.016,8.36C12.04,8.352 12.064,8.352 12.088,8.344C12.096,8.344 12.104,8.344 12.104,8.344C12.128,8.336 12.144,8.336 12.16,8.328C12.144,8.336 12.128,8.336 12.112,8.336C12.128,8.336 12.144,8.336 12.16,8.328H12.168C12.176,8.328 12.176,8.328 12.184,8.328C12.2,8.328 12.208,8.328 12.216,8.328C12.208,8.328 12.2,8.328 12.192,8.328C12.208,8.328 12.232,8.328 12.256,8.328C12.704,8.328 13.064,8.688 13.064,9.136V16.192ZM11.864,8.424C11.824,8.448 11.784,8.48 11.744,8.504C11.784,8.48 11.824,8.448 11.864,8.424ZM11.68,8.568C11.664,8.584 11.648,8.6 11.64,8.616C11.648,8.6 11.664,8.584 11.68,8.568ZM11.448,9.064C11.448,9.088 11.448,9.112 11.448,9.136C11.448,9.112 11.448,9.088 11.448,9.064ZM11.632,8.624C11.616,8.64 11.6,8.664 11.584,8.68C11.6,8.664 11.616,8.64 11.632,8.624ZM11.504,8.824C11.496,8.848 11.488,8.872 11.48,8.896C11.488,8.872 11.496,8.848 11.504,8.824Z" />
|
||||
</group>
|
||||
</vector>
|
||||
12
app/src/main/res/drawable/icon_looper_no.xml
Normal file
12
app/src/main/res/drawable/icon_looper_no.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<group>
|
||||
<clip-path android:pathData="M0,0h24v24h-24z" />
|
||||
<path
|
||||
android:fillColor="@color/seek_bg_color"
|
||||
android:pathData="M21.806,6.569C23.229,8.017 24.021,9.97 24.011,12C24.014,12.695 23.92,13.386 23.734,14.055C23.673,14.267 23.53,14.446 23.338,14.553C23.145,14.66 22.918,14.686 22.706,14.625C22.492,14.566 22.31,14.425 22.198,14.233C22.086,14.041 22.053,13.814 22.106,13.598C22.243,13.076 22.313,12.539 22.316,12C22.33,10.443 21.727,8.943 20.639,7.828C19.552,6.714 18.067,6.075 16.51,6.051H8.603V7.589C8.603,8.077 8.265,8.272 7.853,8.009L4.237,5.759C4.146,5.717 4.069,5.649 4.016,5.565C3.962,5.481 3.933,5.382 3.933,5.282C3.933,5.182 3.962,5.084 4.016,5C4.069,4.915 4.146,4.848 4.237,4.806L7.86,2.368C8.265,2.105 8.611,2.285 8.611,2.781V4.318H16.51C17.501,4.319 18.481,4.518 19.394,4.905C20.306,5.291 21.131,5.857 21.821,6.569H21.806ZM20.41,18.279C20.501,18.321 20.578,18.388 20.632,18.473C20.686,18.557 20.715,18.655 20.715,18.755C20.715,18.855 20.686,18.953 20.632,19.038C20.578,19.122 20.501,19.189 20.41,19.232L16.78,21.632C16.375,21.895 16.03,21.715 16.03,21.219V19.682H7.508C6.517,19.681 5.536,19.482 4.624,19.095C3.711,18.709 2.886,18.143 2.197,17.431C0.98,16.174 0.221,14.545 0.041,12.805C-0.138,11.065 0.272,9.315 1.207,7.837C1.265,7.742 1.343,7.659 1.434,7.595C1.525,7.53 1.628,7.485 1.738,7.461C1.847,7.437 1.96,7.435 2.069,7.456C2.179,7.477 2.284,7.52 2.377,7.582C2.567,7.707 2.701,7.903 2.748,8.126C2.796,8.349 2.754,8.582 2.632,8.774C2.023,9.74 1.701,10.858 1.702,12C1.688,13.557 2.29,15.057 3.378,16.172C4.466,17.286 5.951,17.925 7.508,17.949H16.052V16.411C16.052,15.923 16.382,15.728 16.802,15.991L20.418,18.279H20.41Z" />
|
||||
</group>
|
||||
</vector>
|
||||
32
app/src/main/res/drawable/icon_random.xml
Normal file
32
app/src/main/res/drawable/icon_random.xml
Normal file
@ -0,0 +1,32 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M20,16.5L22,18.5L20,20.5"
|
||||
android:strokeWidth="1.5"
|
||||
android:strokeColor="#ffffff"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M20,3.5L22,5.5L20,7.5"
|
||||
android:strokeWidth="1.5"
|
||||
android:strokeColor="#ffffff"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M22,5.5H18.5C14.91,5.5 12,8.41 12,12C12,15.59 14.91,18.5 18.5,18.5H22"
|
||||
android:strokeWidth="1.5"
|
||||
android:strokeColor="#ffffff"
|
||||
android:strokeLineCap="round" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M2,18.5H5.5C9.09,18.5 12,15.59 12,12C12,8.41 9.09,5.5 5.5,5.5H2"
|
||||
android:strokeWidth="1.5"
|
||||
android:strokeColor="#ffffff"
|
||||
android:strokeLineCap="round" />
|
||||
</vector>
|
||||
47
app/src/main/res/drawable/placeholder.xml
Normal file
47
app/src/main/res/drawable/placeholder.xml
Normal file
@ -0,0 +1,47 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="160dp"
|
||||
android:height="120dp"
|
||||
android:viewportWidth="160"
|
||||
android:viewportHeight="120">
|
||||
<path
|
||||
android:pathData="M75.79,83.92C75.79,83.92 75.4,85.61 72.08,85.06C68.76,84.52 66.18,85.85 65.13,88.73C65.13,88.72 72.88,95.33 75.79,83.92Z"
|
||||
android:fillColor="#ffffff"/>
|
||||
<path
|
||||
android:pathData="M123.68,40.51C123.68,55.92 111.18,68.41 95.77,68.41C80.36,68.41 67.86,55.92 67.86,40.51C67.86,25.09 80.36,12.6 95.77,12.6C111.18,12.6 123.68,25.09 123.68,40.51Z"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#EFF2F4"/>
|
||||
<path
|
||||
android:pathData="M84.7,35.78C85.71,35.78 86.68,35.38 87.39,34.66C88.1,33.95 88.51,32.98 88.51,31.97C88.51,30.96 88.1,29.99 87.39,29.28C86.68,28.56 85.71,28.16 84.7,28.16C83.69,28.16 82.72,28.56 82,29.28C81.29,29.99 80.89,30.96 80.89,31.97C80.89,32.98 81.29,33.95 82,34.66C82.72,35.38 83.69,35.78 84.7,35.78ZM108.3,41.44C109.31,41.44 110.28,41.04 110.99,40.32C111.71,39.61 112.11,38.64 112.11,37.63C112.11,36.62 111.71,35.65 110.99,34.94C110.28,34.22 109.31,33.82 108.3,33.82C107.29,33.82 106.32,34.22 105.61,34.94C104.89,35.65 104.49,36.62 104.49,37.63C104.49,38.64 104.89,39.61 105.61,40.32C106.32,41.04 107.29,41.44 108.3,41.44Z"
|
||||
android:fillColor="#ffffff"/>
|
||||
<path
|
||||
android:pathData="M125.6,61.23C125.25,57.38 122.17,50.89 114.62,50.89C108.2,50.89 104.02,56.33 102.95,57.9C101.88,56.33 97.74,50.89 91.29,50.89C83.73,50.89 80.59,57.39 80.3,61.25C80.01,65.11 81.12,68.17 88.86,76.03C96.59,83.9 102.95,90.65 102.95,90.65C102.95,90.65 109.37,83.87 117.09,76.01C124.82,68.16 125.94,65.08 125.6,61.23Z"
|
||||
android:fillColor="#80F988"/>
|
||||
<path
|
||||
android:pathData="M40.07,75.22C40.07,75.22 30.23,42.52 60.53,46.18C71.33,47.5 55.39,65.01 49.03,55.25C42.68,45.49 51.07,33.06 59.39,30.04"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#ffffff"/>
|
||||
<path
|
||||
android:pathData="M103.68,61.55L98.46,67.58L104.05,72.46L99.17,78.22L103.99,83.11"
|
||||
android:strokeWidth="2.407"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#ffffff"/>
|
||||
<path
|
||||
android:pathData="M40.58,75.33L40.58,75.33A6,6 120.25,0 1,48.76 77.58L51.24,81.92A6,6 77.46,0 1,48.99 90.11L48.99,90.11A6,6 77.46,0 1,40.81 87.86L38.33,83.52A6,6 120.25,0 1,40.58 75.33z"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#ffffff"/>
|
||||
<path
|
||||
android:pathData="M47.23,90.84L49.21,94.31A1,1 85.8,0 1,48.84 95.68L48.84,95.68A1,1 85.8,0 1,47.48 95.3L45.5,91.83A1,1 125.64,0 1,45.87 90.46L45.87,90.46A1,1 125.64,0 1,47.23 90.84z"
|
||||
android:fillColor="#ffffff"/>
|
||||
<path
|
||||
android:pathData="M52.45,87.87L54.43,91.34A1,1 105.19,0 1,54.05 92.71L54.05,92.71A1,1 105.19,0 1,52.69 92.33L50.71,88.86A1,1 128.48,0 1,51.08 87.49L51.08,87.49A1,1 128.48,0 1,52.45 87.87z"
|
||||
android:fillColor="#ffffff"/>
|
||||
<path
|
||||
android:pathData="M84,47.15C87.12,44.42 94.84,41.12 100.8,49.72"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#ffffff"
|
||||
android:strokeLineCap="round"/>
|
||||
</vector>
|
||||
@ -45,12 +45,11 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/imCovert"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/white"
|
||||
android:text="@string/app_name"
|
||||
android:textSize="21sp" />
|
||||
|
||||
<TextView
|
||||
@ -63,7 +62,6 @@
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp" />
|
||||
|
||||
@ -76,7 +74,6 @@
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:text="@string/app_name"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp" />
|
||||
@ -88,6 +85,7 @@
|
||||
android:layout_below="@id/tvSubTitle"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="15dp"
|
||||
android:visibility="invisible"
|
||||
android:src="@drawable/selector_icon_play" />
|
||||
|
||||
|
||||
|
||||
@ -32,40 +32,44 @@
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginEnd="40dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@mipmap/ic_launcher"
|
||||
android:src="@drawable/placeholder"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/im_back" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="140dp"
|
||||
android:layout_height="100dp"
|
||||
android:background="@drawable/bg_retry"
|
||||
android:id="@+id/linear_retry"
|
||||
android:layout_width="210dp"
|
||||
android:layout_height="120dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:id="@+id/linear_retry"
|
||||
android:visibility="gone"
|
||||
android:background="@drawable/bg_retry"
|
||||
app:layout_constraintBottom_toBottomOf="@id/im_covert"
|
||||
app:layout_constraintLeft_toLeftOf="@id/im_covert"
|
||||
app:layout_constraintRight_toRightOf="@id/im_covert"
|
||||
app:layout_constraintTop_toTopOf="@id/im_covert">
|
||||
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/An_error_occurred"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp" />
|
||||
android:textColor="@color/white"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_retry"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:paddingStart="15dp"
|
||||
android:paddingEnd="15dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:text="@string/retry"
|
||||
android:textColor="@color/black"
|
||||
android:background="@drawable/bg_retry_btn"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="17sp" />
|
||||
|
||||
</LinearLayout>
|
||||
@ -89,12 +93,12 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="25dp"
|
||||
android:text="9999999999999999999999999999999999999999"
|
||||
android:layout_marginEnd="40dp"
|
||||
android:text=""
|
||||
android:textColor="@color/text_color_1"
|
||||
android:textSize="19sp"
|
||||
android:layout_marginEnd="40dp"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="@id/im_covert"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/im_covert" />
|
||||
|
||||
<TextView
|
||||
@ -102,7 +106,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="7dp"
|
||||
android:text="@string/app_name"
|
||||
android:text=""
|
||||
android:textColor="@color/white_60_color"
|
||||
android:textSize="13sp"
|
||||
app:layout_constraintLeft_toLeftOf="@id/tv_song_name"
|
||||
@ -177,9 +181,10 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btn_previous"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginEnd="36dp"
|
||||
android:layout_width="45dp"
|
||||
android:layout_height="45dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:padding="12dp"
|
||||
android:src="@mipmap/icon_previous_true"
|
||||
app:layout_constraintBottom_toBottomOf="@id/btn_play"
|
||||
app:layout_constraintEnd_toStartOf="@id/btn_play"
|
||||
@ -188,24 +193,38 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btn_next"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginStart="36dp"
|
||||
android:layout_width="45dp"
|
||||
android:layout_height="45dp"
|
||||
android:layout_marginStart="24dp"
|
||||
android:src="@mipmap/icon_next_true"
|
||||
android:padding="12dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/btn_play"
|
||||
app:layout_constraintStart_toEndOf="@id/btn_play"
|
||||
app:layout_constraintTop_toTopOf="@id/btn_play" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btn_music_list"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="44dp"
|
||||
android:src="@mipmap/icon_list"
|
||||
android:padding="10dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/btn_play"
|
||||
app:layout_constraintLeft_toRightOf="@id/btn_next"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/btn_play" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btn_loop"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="44dp"
|
||||
android:src="@drawable/icon_looper_no"
|
||||
android:padding="10dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/btn_play"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@id/btn_previous"
|
||||
app:layout_constraintTop_toTopOf="@id/btn_play" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<include
|
||||
|
||||
@ -25,9 +25,9 @@
|
||||
android:id="@+id/top_im"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:scaleType="fitXY"
|
||||
android:scaleType="fitCenter"
|
||||
android:layout_marginStart="10dp"
|
||||
android:src="@mipmap/ic_launcher" />
|
||||
android:src="@drawable/placeholder" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
android:id="@+id/header"
|
||||
android:layout_width="170dp"
|
||||
android:layout_height="170dp"
|
||||
android:src="@mipmap/ic_launcher" />
|
||||
android:src="@drawable/placeholder" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@mipmap/ic_launcher" />
|
||||
android:src="@drawable/placeholder" />
|
||||
|
||||
|
||||
<com.hi.music.player.customerview.AnimaPlayingView
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
android:scaleType="fitXY"
|
||||
android:layout_marginStart="14dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@mipmap/ic_launcher" />
|
||||
android:src="@drawable/placeholder" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
android:layout_height="52dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="4dp"
|
||||
android:src="@mipmap/ic_launcher" />
|
||||
android:src="@drawable/placeholder" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@ -13,8 +13,9 @@
|
||||
<color name="cur_play_music">#4DFFFFFF</color>
|
||||
<color name="dark_music">#FF424242</color>
|
||||
<color name="panel_bg">#80F988</color>
|
||||
<color name="retry_bg">#E03D3D3F</color>
|
||||
|
||||
<color name="panel_singer_color">#99000000</color>
|
||||
|
||||
<color name="retry_layout">#000000</color>
|
||||
<color name="test">#2D9C31</color>
|
||||
</resources>
|
||||
@ -22,6 +22,6 @@
|
||||
<string name="privacy_policy">Privacy Policy</string>
|
||||
<string name="terms_of_service">Terms of Service</string>
|
||||
<string name="play_next">Play next</string>
|
||||
<string name="retry">Retry</string>
|
||||
<string name="retry">Try again</string>
|
||||
<string name="An_error_occurred">An error occurred</string>
|
||||
</resources>
|
||||
Loading…
Reference in New Issue
Block a user