增加播放控制面板
This commit is contained in:
parent
58e1bd0804
commit
a079c0ecf6
@ -39,18 +39,18 @@
|
||||
android:name=".ui.activity.A_HomeActivity"
|
||||
android:exported="true"
|
||||
android:screenOrientation="portrait">
|
||||
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".ui.activity.HomeActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".ui.activity.HomeActivity"
|
||||
android:exported="false"></activity>
|
||||
<activity
|
||||
android:name=".ui.activity.MainActivity"
|
||||
android:exported="false" />
|
||||
|
||||
<activity
|
||||
android:name=".ui.activity.A_SplashActivity"
|
||||
android:exported="true"></activity>
|
||||
|
||||
@ -24,12 +24,20 @@ import com.hi.music.player.api.onImageColorListener;
|
||||
import com.hi.music.player.databinding.ItemCategoryListBinding;
|
||||
import com.hi.music.player.databinding.ItemSingerBinding;
|
||||
import com.hi.music.player.helper.CommonUtils;
|
||||
import com.hi.music.player.helper.MyValue;
|
||||
import com.hi.music.player.javabean.response.ResponsePlayListInfo;
|
||||
import com.hi.music.player.javabean.response.child.ResponseCategoryListChild;
|
||||
import com.hi.music.player.javabean.response.child.ResponseSingle;
|
||||
|
||||
public class AdapterCategoryList extends BaseAdapter<ResponsePlayListInfo, ItemCategoryListBinding> {
|
||||
|
||||
|
||||
private String mPageType;
|
||||
|
||||
public void setPageType(String mPageType) {
|
||||
this.mPageType = mPageType;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ItemCategoryListBinding getViewBinding(ViewGroup parent) {
|
||||
return ItemCategoryListBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
||||
@ -42,43 +50,48 @@ public class AdapterCategoryList extends BaseAdapter<ResponsePlayListInfo, ItemC
|
||||
|
||||
ItemCategoryListBinding vb = itemHolder.getVb();
|
||||
vb.tvSongName.setText(child.getSongTitle());
|
||||
vb.tvSingerName.setText(child.getSingerName());
|
||||
vb.tvDuration.setText(child.getDuration());
|
||||
String singerName = child.getSingerName();
|
||||
String describe = child.getDescribe();
|
||||
|
||||
switch (mPageType){
|
||||
case MyValue.PAGE_TYPE_ALBUM:
|
||||
vb.tvSingerName.setText(describe);
|
||||
vb.image.setVisibility(View.GONE);
|
||||
vb.tvPosition.setVisibility(View.VISIBLE);
|
||||
vb.tvPosition.setText(String.valueOf(position));
|
||||
break;
|
||||
default:
|
||||
vb.tvSingerName.setText(singerName);
|
||||
|
||||
String smallCovert = child.getSmallCovert();
|
||||
if(smallCovert == null){
|
||||
vb.image.setVisibility(View.GONE);
|
||||
vb.tvPosition.setVisibility(View.VISIBLE);
|
||||
vb.tvPosition.setText(position);
|
||||
}else {
|
||||
vb.image.setVisibility(View.VISIBLE);
|
||||
vb.tvPosition.setVisibility(View.GONE);
|
||||
Glide.with(MusicApplication.myApplication)
|
||||
.asDrawable()
|
||||
.apply(RequestOptions.bitmapTransform(new RoundedCorners(CommonUtils.dpToPx(16))))
|
||||
.load(child.getSmallCovert())
|
||||
.placeholder(R.mipmap.ic_launcher)
|
||||
.listener(new RequestListener<Drawable>() {
|
||||
@Override
|
||||
public boolean onLoadFailed(@Nullable GlideException e, @Nullable Object model, @NonNull Target<Drawable> target, boolean isFirstResource) {
|
||||
CommonUtils.LogMsg(e.getMessage());
|
||||
return false;
|
||||
}
|
||||
vb.image.setVisibility(View.VISIBLE);
|
||||
vb.tvPosition.setVisibility(View.GONE);
|
||||
|
||||
@OptIn(markerClass = UnstableApi.class)
|
||||
@Override
|
||||
public boolean onResourceReady(@NonNull Drawable resource, @NonNull Object model, Target<Drawable> target, @NonNull DataSource dataSource, boolean isFirstResource) {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.into(vb.image);
|
||||
Glide.with(MusicApplication.myApplication)
|
||||
.asDrawable()
|
||||
.apply(RequestOptions.bitmapTransform(new RoundedCorners(CommonUtils.dpToPx(16))))
|
||||
.load(child.getSmallCovert())
|
||||
.placeholder(R.mipmap.ic_launcher)
|
||||
.listener(new RequestListener<Drawable>() {
|
||||
@Override
|
||||
public boolean onLoadFailed(@Nullable GlideException e, @Nullable Object model, @NonNull Target<Drawable> target, boolean isFirstResource) {
|
||||
CommonUtils.LogMsg(e.getMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
@OptIn(markerClass = UnstableApi.class)
|
||||
@Override
|
||||
public boolean onResourceReady(@NonNull Drawable resource, @NonNull Object model, Target<Drawable> target, @NonNull DataSource dataSource, boolean isFirstResource) {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.into(vb.image);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
vb.getRoot().setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
homeItemClickListener.onClickItemCategoryList(child,itemHolder.getAbsoluteAdapterPosition());
|
||||
homeItemClickListener.onClickItemCategoryList(child, itemHolder.getAbsoluteAdapterPosition());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -18,6 +18,7 @@ import com.hi.music.player.R;
|
||||
import com.hi.music.player.api.MediaControllerListener;
|
||||
import com.hi.music.player.databinding.ItemPlayListBinding;
|
||||
import com.hi.music.player.helper.CommonUtils;
|
||||
import com.hi.music.player.helper.MyValue;
|
||||
import com.hi.music.player.javabean.response.ResponsePlayListInfo;
|
||||
import com.hi.music.player.media3.MyMediaControllerManager;
|
||||
|
||||
@ -75,14 +76,22 @@ public class AdapterPlayList extends BaseAdapter<ResponsePlayListInfo, ItemPlayL
|
||||
ResponsePlayListInfo listInfo = data.get(position);
|
||||
VHolder<ItemPlayListBinding> itemHolder = (VHolder<ItemPlayListBinding>) holder;
|
||||
ItemPlayListBinding vb = itemHolder.getVb();
|
||||
|
||||
vb.songName.setText(listInfo.getSongTitle());
|
||||
String singerName = listInfo.getSingerName();
|
||||
String describe = listInfo.getDescribe();
|
||||
if(singerName!= null&&!singerName.isEmpty()){
|
||||
vb.artistName.setText(singerName);
|
||||
}else if(describe!= null&&!describe.isEmpty()){
|
||||
vb.artistName.setText(describe);
|
||||
}
|
||||
String covert = listInfo.getSmallCovert();
|
||||
Glide.with(MusicApplication.myApplication)
|
||||
.asDrawable()
|
||||
.apply(RequestOptions.bitmapTransform(new RoundedCorners(CommonUtils.dpToPx(10))))
|
||||
.load(listInfo.getSmallCovert())
|
||||
.load(covert)
|
||||
.placeholder(R.mipmap.ic_launcher)
|
||||
.into(vb.imCovert);
|
||||
vb.songName.setText(listInfo.getSongTitle());
|
||||
vb.artistName.setText(listInfo.getSingerName());
|
||||
|
||||
MediaItem currentMediaItem = instance.getMediaController().getCurrentMediaItem();
|
||||
if (currentMediaItem != null && currentMediaItem.mediaId.equals(listInfo.getVideoId())) {
|
||||
|
||||
@ -32,6 +32,10 @@ abstract public class BaseAdapter<K, T extends ViewBinding> extends RecyclerView
|
||||
this.homeItemClickListener = homeItemClickListener;
|
||||
}
|
||||
|
||||
public boolean isLoadingAdded() {
|
||||
return isLoadingAdded;
|
||||
}
|
||||
|
||||
public void addData(List<K> data) {
|
||||
this.data.addAll(data);
|
||||
notifyDataSetChanged();
|
||||
@ -46,7 +50,7 @@ abstract public class BaseAdapter<K, T extends ViewBinding> extends RecyclerView
|
||||
|
||||
public void addLoadingFooter() {
|
||||
isLoadingAdded = true;
|
||||
// notifyItemInserted(data.size());
|
||||
notifyItemInserted(data.size());
|
||||
}
|
||||
|
||||
// Hide loading footer
|
||||
|
||||
@ -2,9 +2,21 @@ package com.hi.music.player.helper;
|
||||
|
||||
public class MyValue {
|
||||
|
||||
public static String PAGE_TYPE_MV="MUSIC_PAGE_TYPE_ARTIST";
|
||||
public static String PAGE_TYPE_LIST="MUSIC_PAGE_TYPE_PLAYLIST";
|
||||
public static String PAGE_TYPE_ALBUM="MUSIC_PAGE_TYPE_ALBUM";
|
||||
|
||||
|
||||
//live合集
|
||||
public static final String PAGE_TYPE_MV_LIST="MUSIC_PAGE_TYPE_USER_CHANNEL";
|
||||
|
||||
|
||||
//个人live
|
||||
public static final String PAGE_TYPE_MV="MUSIC_PAGE_TYPE_ARTIST";
|
||||
|
||||
|
||||
//风格音乐合集:乡村音乐
|
||||
public static final String PAGE_TYPE_LIST="MUSIC_PAGE_TYPE_PLAYLIST";
|
||||
|
||||
//专辑
|
||||
public static final String PAGE_TYPE_ALBUM="MUSIC_PAGE_TYPE_ALBUM";
|
||||
|
||||
//-----------------------------PlayActivity
|
||||
|
||||
|
||||
@ -25,6 +25,7 @@ public class ContextBody {
|
||||
|
||||
public static class Client implements Serializable {
|
||||
private String clientName = "WEB_REMIX";
|
||||
//1.20240506.01.00
|
||||
private String clientVersion = "1.20220918";
|
||||
private String hl = Locale.getDefault().getLanguage();
|
||||
private String gl = "US";
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package com.hi.music.player.javabean.response;
|
||||
|
||||
import com.hi.music.player.helper.MyValue;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
@ -33,6 +35,8 @@ public class ResponsePlayListInfo implements Serializable {
|
||||
//歌曲时长 毫秒
|
||||
private long DurationMs;
|
||||
|
||||
private String describe;
|
||||
|
||||
|
||||
private String videoId;
|
||||
private String playlistId;
|
||||
@ -47,6 +51,20 @@ public class ResponsePlayListInfo implements Serializable {
|
||||
// private String audioUrlMedium;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public String getDescribe() {
|
||||
return describe;
|
||||
}
|
||||
|
||||
public void setDescribe(String describe) {
|
||||
this.describe = describe;
|
||||
}
|
||||
|
||||
public String getSmallCovert() {
|
||||
return smallCovert;
|
||||
}
|
||||
|
||||
@ -10,6 +10,10 @@ public class ResponseCategory implements Serializable {
|
||||
private String twoTitle;
|
||||
|
||||
//类别描述
|
||||
/**
|
||||
* PAGE_TYPE_ALBUM : 专辑.歌手名字
|
||||
* PAGE_TYPE_LIST :多个歌手名字
|
||||
*/
|
||||
private String twoSubtitle;
|
||||
|
||||
|
||||
@ -25,9 +29,12 @@ public class ResponseCategory implements Serializable {
|
||||
|
||||
|
||||
/**
|
||||
* 视频Mv
|
||||
* 视频Mv合集
|
||||
*MUSIC_PAGE_TYPE_USER_CHANNEL
|
||||
*
|
||||
* 视频Mv单个
|
||||
* MUSIC_PAGE_TYPE_USER_CHANNEL
|
||||
*
|
||||
* 音乐合集列表
|
||||
* MUSIC_PAGE_TYPE_PLAYLIST
|
||||
*
|
||||
|
||||
@ -24,6 +24,7 @@ import com.hi.music.player.helper.MyValue;
|
||||
import com.hi.music.player.javabean.response.ResponsePlayListInfo;
|
||||
import com.hi.music.player.javabean.response.ResponsePlayUrl;
|
||||
import com.hi.music.player.network.RetrofitManager;
|
||||
import com.hi.music.player.ui.activity.viewmodel.VMApplication;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -37,6 +38,10 @@ public class MyMediaControllerManager {
|
||||
|
||||
private MediaControllerListener mListener;
|
||||
|
||||
private VMApplication mVmApplication;
|
||||
|
||||
|
||||
|
||||
//播放列表总数量
|
||||
private List<ResponsePlayListInfo> playList;
|
||||
|
||||
@ -74,12 +79,14 @@ public class MyMediaControllerManager {
|
||||
|
||||
}
|
||||
|
||||
public void addListener(MediaControllerListener listener) {
|
||||
public void addListener(VMApplication vmApplication, MediaControllerListener listener) {
|
||||
mVmApplication = vmApplication;
|
||||
mListener = listener;
|
||||
mediaController.addListener(new Player.Listener() {
|
||||
@Override
|
||||
public void onPlayerError(PlaybackException error) {
|
||||
mListener.onPlayStatus(MyValue.PLAY_STATUS_CODE_ERROR);
|
||||
mVmApplication.setPlayStatus(MyValue.PLAY_STATUS_CODE_ERROR);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -97,36 +104,21 @@ public class MyMediaControllerManager {
|
||||
|
||||
if (isPlaying) {
|
||||
mListener.onPlayStatus(MyValue.PLAY_STATUS_CODE_PLAYING);
|
||||
// TODO: 2024/9/26 自动播放完成切歌到下一首播放没有触发这里请求下一首
|
||||
if (mediaController.hasNextMediaItem()) {
|
||||
int nextMediaItemIndex = mediaController.getNextMediaItemIndex();
|
||||
onCallRequestUrl(nextMediaItemIndex, false, new OnHasUrlAction() {
|
||||
@Override
|
||||
public void onHasUrl() {
|
||||
CommonUtils.LogMsg("-------------有有效URl--播放检查下一首 位置=" + nextMediaItemIndex);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (mediaController.hasPreviousMediaItem()) {
|
||||
int previousMediaItemIndex = mediaController.getPreviousMediaItemIndex();
|
||||
onCallRequestUrl(previousMediaItemIndex, false, new OnHasUrlAction() {
|
||||
@Override
|
||||
public void onHasUrl() {
|
||||
CommonUtils.LogMsg("-------------有有效URl--播放检查上一首 位置=" + previousMediaItemIndex);
|
||||
}
|
||||
});
|
||||
}
|
||||
mVmApplication.setPlayStatus(MyValue.PLAY_STATUS_CODE_PLAYING);
|
||||
// TODO: 2024/10/15 自动播放完成切歌到下一首播放没有触发这里请求下一首
|
||||
checkUrl(false);
|
||||
|
||||
} else {
|
||||
// 播放器暂停或停止
|
||||
mListener.onPlayStatus(MyValue.PLAY_STATUS_CODE_PAUSE);
|
||||
mVmApplication.setPlayStatus(MyValue.PLAY_STATUS_CODE_PAUSE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlaybackStateChanged(int playbackState) {
|
||||
mListener.onPlayStatus(playbackState);
|
||||
|
||||
mVmApplication.setPlayStatus(playbackState);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -138,6 +130,27 @@ public class MyMediaControllerManager {
|
||||
});
|
||||
}
|
||||
|
||||
public void checkUrl(boolean playNextNow){
|
||||
if (mediaController.hasNextMediaItem()) {
|
||||
int nextMediaItemIndex = mediaController.getNextMediaItemIndex();
|
||||
onCallRequestUrl(nextMediaItemIndex, playNextNow, new OnHasUrlAction() {
|
||||
@Override
|
||||
public void onHasUrl() {
|
||||
CommonUtils.LogMsg("-------------有有效URl--播放检查下一首 位置=" + nextMediaItemIndex);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (mediaController.hasPreviousMediaItem()) {
|
||||
int previousMediaItemIndex = mediaController.getPreviousMediaItemIndex();
|
||||
onCallRequestUrl(previousMediaItemIndex, false, new OnHasUrlAction() {
|
||||
@Override
|
||||
public void onHasUrl() {
|
||||
CommonUtils.LogMsg("-------------有有效URl--播放检查上一首 位置=" + previousMediaItemIndex);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public MediaController getMediaController() {
|
||||
return mediaController;
|
||||
}
|
||||
@ -211,41 +224,41 @@ public class MyMediaControllerManager {
|
||||
*
|
||||
* @param playUrl
|
||||
*/
|
||||
@OptIn(markerClass = UnstableApi.class)
|
||||
public void addMusicToPlayList(ResponsePlayUrl playUrl, int playListIndex) {
|
||||
if (playListIndex < playList.size() && playListIndex >= mediaController.getMediaItemCount()) {
|
||||
ResponsePlayListInfo listInfo = playList.get(playListIndex);
|
||||
if (listInfo.getVideoId().equals(playUrl.getVideoId())) {
|
||||
MediaItem.Builder builder = new MediaItem.Builder();
|
||||
|
||||
//唯一标识符
|
||||
builder.setMediaId(playUrl.getVideoId());
|
||||
if (playUrl.getAudioUrlMedium() != null) {
|
||||
builder.setUri(playUrl.getAudioUrlMedium());
|
||||
} else {
|
||||
builder.setUri(playUrl.getAudioUrlLow());
|
||||
}
|
||||
|
||||
MediaMetadata.Builder MediaMetadata_builder = new MediaMetadata.Builder();
|
||||
|
||||
MediaMetadata_builder.setArtist(listInfo.getSingerName());
|
||||
/**
|
||||
* 这里使用setDescription保存歌曲时长的分秒字符串
|
||||
*/
|
||||
MediaMetadata_builder.setDescription(listInfo.getDuration());
|
||||
MediaMetadata_builder.setDurationMs(listInfo.getDurationMs());
|
||||
MediaMetadata_builder.setArtworkUri(Uri.parse(listInfo.getCovert()));
|
||||
// MediaMetadata_builder.setArtworkUri(Uri.parse("https://t7.baidu.com/it/u=2604797219,1573897854&fm=193&f=GIF"));
|
||||
MediaMetadata_builder.setTitle(listInfo.getSongTitle());
|
||||
|
||||
CommonUtils.LogMsg("----------添加到播放列表 i=" + playListIndex + "---" + listInfo.getSongTitle() + "-------VideoId=" + listInfo.getVideoId());
|
||||
// MediaMetadata_builder.setRecordingYear(Integer.parseInt(playInfo.getYear()));
|
||||
builder.setMediaMetadata(MediaMetadata_builder.build());
|
||||
mediaController.addMediaItem(builder.build());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
// @OptIn(markerClass = UnstableApi.class)
|
||||
// public void addMusicToPlayList(ResponsePlayUrl playUrl, int playListIndex) {
|
||||
// if (playListIndex < playList.size() && playListIndex >= mediaController.getMediaItemCount()) {
|
||||
// ResponsePlayListInfo listInfo = playList.get(playListIndex);
|
||||
// if (listInfo.getVideoId().equals(playUrl.getVideoId())) {
|
||||
// MediaItem.Builder builder = new MediaItem.Builder();
|
||||
//
|
||||
// //唯一标识符
|
||||
// builder.setMediaId(playUrl.getVideoId());
|
||||
// if (playUrl.getAudioUrlMedium() != null) {
|
||||
// builder.setUri(playUrl.getAudioUrlMedium());
|
||||
// } else {
|
||||
// builder.setUri(playUrl.getAudioUrlLow());
|
||||
// }
|
||||
//
|
||||
// MediaMetadata.Builder MediaMetadata_builder = new MediaMetadata.Builder();
|
||||
//
|
||||
// MediaMetadata_builder.setArtist(listInfo.getSingerName());
|
||||
// /**
|
||||
// * 这里使用setDescription保存歌曲时长的分秒字符串
|
||||
// */
|
||||
// MediaMetadata_builder.setDescription(listInfo.getDuration());
|
||||
// MediaMetadata_builder.setDurationMs(listInfo.getDurationMs());
|
||||
// MediaMetadata_builder.setArtworkUri(Uri.parse(listInfo.getCovert()));
|
||||
//// MediaMetadata_builder.setArtworkUri(Uri.parse("https://t7.baidu.com/it/u=2604797219,1573897854&fm=193&f=GIF"));
|
||||
// MediaMetadata_builder.setTitle(listInfo.getSongTitle());
|
||||
//
|
||||
// CommonUtils.LogMsg("----------添加到播放列表 i=" + playListIndex + "---" + listInfo.getSongTitle() + "-------VideoId=" + listInfo.getVideoId());
|
||||
//// MediaMetadata_builder.setRecordingYear(Integer.parseInt(playInfo.getYear()));
|
||||
// builder.setMediaMetadata(MediaMetadata_builder.build());
|
||||
// mediaController.addMediaItem(builder.build());
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* 添加播放列表(不带音频url)
|
||||
@ -271,11 +284,11 @@ public class MyMediaControllerManager {
|
||||
MediaMetadata_builder.setArtist(playInfo.getSingerName());
|
||||
MediaMetadata_builder.setDescription(playInfo.getDuration());
|
||||
MediaMetadata_builder.setDurationMs(playInfo.getDurationMs());
|
||||
if (playInfo.getCovert() != null)
|
||||
if (playInfo.getCovert() != null&&!playInfo.getCovert().isEmpty())
|
||||
MediaMetadata_builder.setArtworkUri(Uri.parse(playInfo.getCovert()));
|
||||
MediaMetadata_builder.setTitle(playInfo.getSongTitle());
|
||||
|
||||
CommonUtils.LogMsg("----------添加播放列表 i=" + i + "---" + playInfo.getSongTitle() + "-------VideoId=" + playInfo.getVideoId());
|
||||
CommonUtils.LogMsg("----------添加播放列表 i=" + i + "---" + playInfo.getSingerName() + "-------VideoId=" + playInfo.getVideoId());
|
||||
// MediaMetadata_builder.setRecordingYear(Integer.parseInt(playInfo.getYear()));
|
||||
builder.setMediaMetadata(MediaMetadata_builder.build());
|
||||
mediaController.addMediaItem(builder.build());
|
||||
|
||||
@ -22,6 +22,7 @@ public class JsonHelper {
|
||||
|
||||
/**
|
||||
* 解析首页单曲
|
||||
*
|
||||
* @param jsonObject
|
||||
* @return
|
||||
*/
|
||||
@ -54,6 +55,7 @@ public class JsonHelper {
|
||||
|
||||
/**
|
||||
* 解析首页不同类型的音乐分类
|
||||
*
|
||||
* @param jsonObject
|
||||
* @return
|
||||
*/
|
||||
@ -79,6 +81,7 @@ public class JsonHelper {
|
||||
|
||||
/**
|
||||
* 解析根据单曲获取的播放列表
|
||||
*
|
||||
* @param jsonObject
|
||||
* @return
|
||||
*/
|
||||
@ -97,6 +100,8 @@ public class JsonHelper {
|
||||
|
||||
String smallUrl = getCovertUrl(playlistPanelVideoRenderer, false);
|
||||
|
||||
CommonUtils.LogMsg("--图片--------maxUrl=" + maxUrl + "---smallUrl=" + smallUrl);
|
||||
|
||||
String songName = getJsonTitle(playlistPanelVideoRenderer.getJSONObject("title"), 0);
|
||||
|
||||
JSONObject longBylineText = playlistPanelVideoRenderer.getJSONObject("longBylineText");
|
||||
@ -136,8 +141,10 @@ public class JsonHelper {
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析音乐音频源地址
|
||||
*
|
||||
* @param jsonObject
|
||||
* @return
|
||||
*/
|
||||
@ -191,100 +198,110 @@ public class JsonHelper {
|
||||
|
||||
/**
|
||||
* 解析音乐分类合集列表
|
||||
* MUSIC_PAGE_TYPE_ALBUM、MUSIC_PAGE_TYPE_PLAYLIST、MUSIC_PAGE_TYPE_USER_CHANNEL
|
||||
*
|
||||
* @param jsonObject
|
||||
* @return
|
||||
*/
|
||||
public static ResponseCategoryList ResolveCategoryList(JSONObject jsonObject) {
|
||||
public static ResponseCategoryList ResolveCategoryList(JSONObject jsonObject,String browseId) {
|
||||
try {
|
||||
ResponseCategoryList responseCategoryList = new ResponseCategoryList();
|
||||
JSONObject jsonObject1 = jsonObject.getJSONObject("contents")
|
||||
.getJSONObject("twoColumnBrowseResultsRenderer");
|
||||
JSONObject musicResponsiveHeaderRenderer = jsonObject1
|
||||
.getJSONArray("tabs")
|
||||
.getJSONObject(0)
|
||||
.getJSONObject("tabRenderer")
|
||||
.getJSONObject("content")
|
||||
.getJSONObject("sectionListRenderer")
|
||||
.getJSONArray("contents")
|
||||
.getJSONObject(0)
|
||||
.getJSONObject("musicResponsiveHeaderRenderer");
|
||||
|
||||
//封面图
|
||||
String covert = getCovertUrl(musicResponsiveHeaderRenderer.getJSONObject("thumbnail")
|
||||
.getJSONObject("musicThumbnailRenderer"), true);
|
||||
JSONObject contents = jsonObject.getJSONObject("contents");
|
||||
JSONObject twoColumnBrowseResultsRenderer = contents.optJSONObject("twoColumnBrowseResultsRenderer");
|
||||
if (twoColumnBrowseResultsRenderer != null) {
|
||||
// MUSIC_PAGE_TYPE_ALBUM、MUSIC_PAGE_TYPE_PLAYLIST
|
||||
JSONObject jsonObject1 = contents
|
||||
.getJSONObject("twoColumnBrowseResultsRenderer");
|
||||
|
||||
|
||||
//轻松愉悦的经典摇滚乐
|
||||
String title = getJsonTitle(musicResponsiveHeaderRenderer.getJSONObject("title"), 0);
|
||||
JSONObject musicResponsiveHeaderRenderer = jsonObject1
|
||||
.getJSONArray("tabs")
|
||||
.getJSONObject(0)
|
||||
.getJSONObject("tabRenderer")
|
||||
.getJSONObject("content")
|
||||
.getJSONObject("sectionListRenderer")
|
||||
.getJSONArray("contents")
|
||||
.getJSONObject(0)
|
||||
.getJSONObject("musicResponsiveHeaderRenderer");
|
||||
|
||||
String description = "";
|
||||
//封面图
|
||||
String covert = getCovertUrl(musicResponsiveHeaderRenderer.getJSONObject("thumbnail"), true);
|
||||
CommonUtils.LogMsg("----图片-------------covert=" + covert);
|
||||
|
||||
//轻松愉悦的经典摇滚乐
|
||||
String title = getJsonTitle(musicResponsiveHeaderRenderer.getJSONObject("title"), 0);
|
||||
|
||||
String description = "";
|
||||
|
||||
|
||||
//110 首歌曲.超过6小时
|
||||
String secondSubtitle = getJsonTextNew(musicResponsiveHeaderRenderer.getJSONObject("secondSubtitle"));
|
||||
//110 首歌曲.超过6小时
|
||||
String secondSubtitle = getJsonTextNew(musicResponsiveHeaderRenderer.getJSONObject("secondSubtitle"));
|
||||
|
||||
if(musicResponsiveHeaderRenderer.has("description")){
|
||||
//-----------------单曲合集类型
|
||||
//Hold on to the feeling.
|
||||
description = getJsonTitle(musicResponsiveHeaderRenderer.getJSONObject("description")
|
||||
.getJSONObject("musicDescriptionShelfRenderer")
|
||||
.getJSONObject("description"), 0);
|
||||
}
|
||||
if(musicResponsiveHeaderRenderer.has("subtitle")){
|
||||
//-----------------专辑类型
|
||||
//专辑.1998
|
||||
description = getJsonTextNew(musicResponsiveHeaderRenderer.getJSONObject("subtitle"));
|
||||
}
|
||||
if (musicResponsiveHeaderRenderer.has("description")) {
|
||||
//-----------------单曲合集类型
|
||||
//Hold on to the feeling.
|
||||
description = getJsonTitle(musicResponsiveHeaderRenderer.getJSONObject("description")
|
||||
.getJSONObject("musicDescriptionShelfRenderer")
|
||||
.getJSONObject("description"), 0);
|
||||
}
|
||||
if (musicResponsiveHeaderRenderer.has("subtitle")) {
|
||||
//-----------------专辑类型
|
||||
//专辑.1998
|
||||
description = getJsonTextNew(musicResponsiveHeaderRenderer.getJSONObject("subtitle"));
|
||||
}
|
||||
|
||||
|
||||
responseCategoryList.setCovert(covert);
|
||||
responseCategoryList.setDescription(description);
|
||||
responseCategoryList.setTitle(title);
|
||||
responseCategoryList.setSecondSubtitle(secondSubtitle);
|
||||
responseCategoryList.setCovert(covert);
|
||||
responseCategoryList.setDescription(description);
|
||||
responseCategoryList.setTitle(title);
|
||||
responseCategoryList.setSecondSubtitle(secondSubtitle);
|
||||
|
||||
CommonUtils.LogMsg("-------------title="+title+"--description="+description+"---secondSubtitle="+secondSubtitle+"---covert="+covert);
|
||||
CommonUtils.LogMsg("-------------title=" + title + "--description=" + description + "---secondSubtitle=" + secondSubtitle + "---covert=" + covert);
|
||||
|
||||
JSONObject contentsArray = jsonObject1.getJSONObject("secondaryContents")
|
||||
.getJSONObject("sectionListRenderer")
|
||||
.getJSONArray("contents")
|
||||
.getJSONObject(0);
|
||||
List<ResponsePlayListInfo> mList = new ArrayList<>();
|
||||
if(contentsArray.has("musicPlaylistShelfRenderer")){
|
||||
//分类音乐合集的播放列表
|
||||
JSONArray jsonArray = contentsArray.getJSONObject("musicPlaylistShelfRenderer")
|
||||
.getJSONArray("contents");
|
||||
JSONObject contentsArray = jsonObject1.getJSONObject("secondaryContents")
|
||||
.getJSONObject("sectionListRenderer")
|
||||
.getJSONArray("contents")
|
||||
.getJSONObject(0);
|
||||
List<ResponsePlayListInfo> mList = new ArrayList<>();
|
||||
if (contentsArray.has("musicPlaylistShelfRenderer")) {
|
||||
// MUSIC_PAGE_TYPE_PLAYLIST、MUSIC_PAGE_TYPE_USER_CHANNEL
|
||||
JSONArray jsonArray = contentsArray.getJSONObject("musicPlaylistShelfRenderer")
|
||||
.getJSONArray("contents");
|
||||
|
||||
|
||||
for(int i = 0;i<jsonArray.length();i++){
|
||||
JSONObject arrayJSONObject = jsonArray.getJSONObject(i).getJSONObject("musicResponsiveListItemRenderer");
|
||||
ResponsePlayListInfo child = getCommonCategoryList(arrayJSONObject);
|
||||
String thumbnail = getCovertUrl(arrayJSONObject.getJSONObject("thumbnail"), true);
|
||||
|
||||
child.setSmallCovert(thumbnail);
|
||||
for (int i = 0; i < jsonArray.length(); i++) {
|
||||
JSONObject arrayJSONObject = jsonArray.getJSONObject(i).getJSONObject("musicResponsiveListItemRenderer");
|
||||
ResponsePlayListInfo child = getCommonCategoryList(arrayJSONObject);
|
||||
String thumbnail = getCovertUrl(arrayJSONObject.getJSONObject("thumbnail"), true);
|
||||
CommonUtils.LogMsg("----图片-------------thumbnail=" + thumbnail);
|
||||
child.setSmallCovert(thumbnail);
|
||||
// child.setCovert(thumbnail);
|
||||
mList.add(child);
|
||||
mList.add(child);
|
||||
|
||||
CommonUtils.LogMsg("--歌曲"+i+"-------------SongTitle="+child.getSongTitle()+"--getVideoId="+child.getVideoId());
|
||||
}
|
||||
}
|
||||
|
||||
if(contentsArray.has("musicShelfRenderer")){
|
||||
// 专辑音乐的播放列表
|
||||
JSONArray jsonArray = contentsArray.getJSONObject("musicShelfRenderer")
|
||||
.getJSONArray("contents");
|
||||
for(int i = 0;i<jsonArray.length();i++){
|
||||
JSONObject arrayJSONObject = jsonArray.getJSONObject(i).getJSONObject("musicResponsiveListItemRenderer");
|
||||
ResponsePlayListInfo child = getCommonCategoryList(arrayJSONObject);
|
||||
child.setCovert(covert);
|
||||
|
||||
mList.add(child);
|
||||
if (child.getVideoId() == null || child.getVideoId().isEmpty())
|
||||
CommonUtils.LogErrorMsg("--歌曲" + i + "-------------SongTitle=" + child.getSongTitle() + "--getVideoId=" + child.getVideoId()+"---请求参数browseId="+browseId);
|
||||
}
|
||||
}
|
||||
|
||||
if (contentsArray.has("musicShelfRenderer")) {
|
||||
// MUSIC_PAGE_TYPE_ALBUM
|
||||
JSONArray jsonArray = contentsArray.getJSONObject("musicShelfRenderer")
|
||||
.getJSONArray("contents");
|
||||
for (int i = 0; i < jsonArray.length(); i++) {
|
||||
JSONObject arrayJSONObject = jsonArray.getJSONObject(i).getJSONObject("musicResponsiveListItemRenderer");
|
||||
ResponsePlayListInfo child = getCommonCategoryList(arrayJSONObject);
|
||||
child.setCovert(covert);
|
||||
child.setSmallCovert(covert);
|
||||
mList.add(child);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
responseCategoryList.setList(mList);
|
||||
}
|
||||
|
||||
|
||||
responseCategoryList.setList(mList);
|
||||
|
||||
return responseCategoryList;
|
||||
|
||||
} catch (JSONException e) {
|
||||
@ -295,34 +312,27 @@ public class JsonHelper {
|
||||
}
|
||||
|
||||
|
||||
private static ResponsePlayListInfo getCommonCategoryList(JSONObject musicResponsiveListItemRenderer) throws JSONException {
|
||||
JSONObject jsonText = musicResponsiveListItemRenderer.getJSONArray("fixedColumns")
|
||||
.getJSONObject(0)
|
||||
.getJSONObject("musicResponsiveListItemFixedColumnRenderer")
|
||||
.getJSONObject("text");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private static ResponsePlayListInfo getCommonCategoryList(JSONObject musicResponsiveListItemRenderer) throws JSONException {
|
||||
String duration = getJsonTitle(musicResponsiveListItemRenderer.getJSONArray("fixedColumns").getJSONObject(0).getJSONObject("musicResponsiveListItemFixedColumnRenderer").getJSONObject("text"), 0);
|
||||
String duration = getJsonTitle(jsonText, 0);
|
||||
long ms = CommonUtils.convertToMilliseconds(duration);
|
||||
|
||||
JSONArray flexColumns = musicResponsiveListItemRenderer
|
||||
.getJSONArray("flexColumns");
|
||||
|
||||
ResponsePlayListInfo listInfo = new ResponsePlayListInfo();
|
||||
ResponsePlayListInfo listInfo = new ResponsePlayListInfo();
|
||||
//歌名、歌手名字、描述
|
||||
String SongTitle = "";
|
||||
String SingerName = "";
|
||||
String Description = "";
|
||||
for (int g = 0; g < flexColumns.length(); g++) {
|
||||
JSONObject jsonObjectText = flexColumns.getJSONObject(g).getJSONObject("musicResponsiveListItemFlexColumnRenderer").getJSONObject("text");
|
||||
JSONObject jsonObjectText = flexColumns.getJSONObject(g)
|
||||
.getJSONObject("musicResponsiveListItemFlexColumnRenderer")
|
||||
.getJSONObject("text");
|
||||
String text = getJsonTitle(jsonObjectText, 0);
|
||||
if (g == 0) {
|
||||
SongTitle = text;
|
||||
@ -340,6 +350,7 @@ public class JsonHelper {
|
||||
if (g == 1) SingerName = text;
|
||||
if (g == 2) Description = text;
|
||||
}
|
||||
listInfo.setDescribe(Description);
|
||||
listInfo.setDuration(duration);
|
||||
listInfo.setDurationMs(ms);
|
||||
listInfo.setSingerName(SingerName);
|
||||
@ -347,6 +358,7 @@ public class JsonHelper {
|
||||
|
||||
return listInfo;
|
||||
}
|
||||
|
||||
private static void getCommonHome(JSONObject sectionListRenderer, ResponseHome responseHome) throws JSONException {
|
||||
|
||||
|
||||
@ -356,8 +368,7 @@ public class JsonHelper {
|
||||
|
||||
String clickTrackingParams = nextContinuationData.getString("clickTrackingParams");
|
||||
String continuation = nextContinuationData.getString("continuation");
|
||||
// CommonUtils.LogMsg("---------参数---clickTrackingParams=" + clickTrackingParams);
|
||||
// CommonUtils.LogMsg("---------参数--continuation=" + continuation);
|
||||
|
||||
responseHome.setClickTrackingParams(clickTrackingParams);
|
||||
responseHome.setContinuation(continuation);
|
||||
|
||||
@ -371,10 +382,10 @@ public class JsonHelper {
|
||||
|
||||
JSONObject musicCarouselShelfRenderer = object.optJSONObject("musicCarouselShelfRenderer");
|
||||
if (musicCarouselShelfRenderer != null) {
|
||||
//-------------------------单曲
|
||||
|
||||
//模块标题
|
||||
String title = getJsonTitle(musicCarouselShelfRenderer.getJSONObject("header").getJSONObject("musicCarouselShelfBasicHeaderRenderer").getJSONObject("title"), 0);
|
||||
CommonUtils.LogMsg("----------headertitle=" + title);
|
||||
CommonUtils.LogMsg("----------模块标题=" + title);
|
||||
responseHomeChild.setHeaderTitle(title);
|
||||
JSONArray childContents = musicCarouselShelfRenderer.getJSONArray("contents");
|
||||
|
||||
@ -385,10 +396,11 @@ public class JsonHelper {
|
||||
JSONObject jsonList = childContents.getJSONObject(j);
|
||||
JSONObject musicResponsiveListItemRenderer = jsonList.optJSONObject("musicResponsiveListItemRenderer");
|
||||
if (musicResponsiveListItemRenderer != null) {
|
||||
//-------------------------单曲
|
||||
ResponseSingle responseSingle = new ResponseSingle();
|
||||
|
||||
String SingerHead = getCovertUrl(musicResponsiveListItemRenderer.getJSONObject("thumbnail"), true);
|
||||
|
||||
CommonUtils.LogMsg("----图片-------------SingerHead=" + SingerHead);
|
||||
|
||||
JSONArray flexColumns = musicResponsiveListItemRenderer.getJSONArray("flexColumns");
|
||||
|
||||
@ -425,7 +437,8 @@ public class JsonHelper {
|
||||
singleList.add(responseSingle);
|
||||
|
||||
//"musicVideoType":"MUSIC_VIDEO_TYPE_UGC"
|
||||
// CommonUtils.LogMsg(" ----------111111111111----SongTitle=" + SongTitle + "--getMusicVideoType=" + responseSingle.getMusicVideoType() );
|
||||
if (j == 0)
|
||||
CommonUtils.LogMsg(" ----------111111111111----SongTitle=" + SongTitle + "--getMusicVideoType=" + responseSingle.getMusicVideoType());
|
||||
}
|
||||
|
||||
JSONObject musicTwoRowItemRenderer = jsonList.optJSONObject("musicTwoRowItemRenderer");
|
||||
@ -433,6 +446,7 @@ public class JsonHelper {
|
||||
//------------------------音乐合集或者专辑
|
||||
ResponseCategory responseCategory = new ResponseCategory();
|
||||
String covert = getCovertUrl(musicTwoRowItemRenderer.getJSONObject("thumbnailRenderer"), true);
|
||||
CommonUtils.LogMsg("----图片-------------音乐合集或者专辑=" + covert);
|
||||
|
||||
JSONObject title1 = musicTwoRowItemRenderer.getJSONObject("title");
|
||||
String twoTitle = getJsonTitle(title1, 0);
|
||||
@ -449,71 +463,62 @@ public class JsonHelper {
|
||||
.getJSONObject(0);
|
||||
|
||||
JSONObject browseEndpoint = null;
|
||||
if(runs.has("navigationEndpoint")){
|
||||
if (runs.has("navigationEndpoint")) {
|
||||
//-------------当pageType="MUSIC_PAGE_TYPE_PLAYLIST"或"MUSIC_PAGE_TYPE_ALBUM" 走这里
|
||||
browseEndpoint = runs.getJSONObject("navigationEndpoint")
|
||||
.getJSONObject("browseEndpoint");
|
||||
CommonUtils.LogMsg(" ----------2222222222----twoTitle=" + twoTitle + "-browseId 111=" + browseId);
|
||||
|
||||
}
|
||||
if(subtitle.has("navigationEndpoint")){
|
||||
//-------------当pageType="MUSIC_PAGE_TYPE_ARTIST" 走这里
|
||||
browseEndpoint = subtitle.getJSONObject("navigationEndpoint")
|
||||
.getJSONObject("browseEndpoint");
|
||||
CommonUtils.LogMsg(" ----------2222222222----twoTitle=" + twoTitle + "-browseId 222=" + browseId);
|
||||
|
||||
// else if (subtitle.has("navigationEndpoint")) {
|
||||
// //-------------当pageType="MUSIC_PAGE_TYPE_ARTIST" 走这里
|
||||
// browseEndpoint = subtitle.getJSONObject("navigationEndpoint")
|
||||
// .getJSONObject("browseEndpoint");
|
||||
// // browsID = UCTruu07wXSulRSQ2sOPR5mQ
|
||||
// }
|
||||
if (browseEndpoint != null) {
|
||||
browseId = browseEndpoint
|
||||
.getString("browseId");
|
||||
CommonUtils.LogMsg(" ----------2222222222----twoTitle=" + twoTitle + "-browseId=" + browseId);
|
||||
String pageType = browseEndpoint.getJSONObject("browseEndpointContextSupportedConfigs")
|
||||
.getJSONObject("browseEndpointContextMusicConfig")
|
||||
.getString("pageType");
|
||||
|
||||
responseCategory.setPageType(pageType);
|
||||
responseCategory.setBrowseId(browseId);
|
||||
if (pageType.equals(MyValue.PAGE_TYPE_MV)) {
|
||||
//视频mv 需要获取videoId 和PlayListId 用于进入播放页面请求播放列表数据
|
||||
|
||||
JSONObject jsonObject = musicTwoRowItemRenderer.getJSONObject("menu")
|
||||
.getJSONObject("menuRenderer")
|
||||
.getJSONArray("items")
|
||||
.getJSONObject(0)
|
||||
.getJSONObject("menuNavigationItemRenderer");
|
||||
String[] watchEndPoint = getWatchEndPoint(jsonObject);
|
||||
if (watchEndPoint[0] != null) {
|
||||
responseCategory.setVideoId(watchEndPoint[0]);
|
||||
}
|
||||
if (watchEndPoint[1] != null) {
|
||||
responseCategory.setPlayListId(watchEndPoint[1]);
|
||||
}
|
||||
if (watchEndPoint[2] != null) {
|
||||
responseCategory.setParams(watchEndPoint[2]);
|
||||
}
|
||||
if (watchEndPoint[3] != null) {
|
||||
responseCategory.setMusicVideoType(watchEndPoint[3]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(browseEndpoint!= null){
|
||||
browseId = browseEndpoint
|
||||
.getString("browseId");
|
||||
String pageType = browseEndpoint.getJSONObject("browseEndpointContextSupportedConfigs")
|
||||
.getJSONObject("browseEndpointContextMusicConfig")
|
||||
.getString("pageType");
|
||||
|
||||
responseCategory.setPageType(pageType);
|
||||
responseCategory.setBrowseId(browseId);
|
||||
if(pageType.equals(MyValue.PAGE_TYPE_MV)){
|
||||
//视频mv 需要获取videoId 和PlayListId 用于进入播放页面请求播放列表数据
|
||||
|
||||
JSONObject jsonObject = musicTwoRowItemRenderer.getJSONObject("menu")
|
||||
.getJSONObject("menuRenderer")
|
||||
.getJSONArray("items")
|
||||
.getJSONObject(0)
|
||||
.getJSONObject("menuNavigationItemRenderer");
|
||||
String[] watchEndPoint = getWatchEndPoint(jsonObject);
|
||||
if(watchEndPoint[0]!=null){
|
||||
responseCategory.setVideoId(watchEndPoint[0]);
|
||||
}
|
||||
if(watchEndPoint[1]!=null){
|
||||
responseCategory.setPlayListId(watchEndPoint[1]);
|
||||
}
|
||||
if(watchEndPoint[2]!=null) {
|
||||
responseCategory.setParams(watchEndPoint[2]);
|
||||
}
|
||||
if(watchEndPoint[3]!=null) {
|
||||
responseCategory.setMusicVideoType(watchEndPoint[3]);
|
||||
}
|
||||
|
||||
CommonUtils.LogMsg("");
|
||||
}
|
||||
}
|
||||
// if(musicTwoRowItemRenderer.has("navigationEndpoint")){
|
||||
// String[] navigationEndpoints = getWatchEndPoint(musicTwoRowItemRenderer);
|
||||
// if(navigationEndpoints[0]!=null){
|
||||
// responseCategory.setVideoId(navigationEndpoints[0]);
|
||||
// }
|
||||
// if(navigationEndpoints[1]!=null){
|
||||
// responseCategory.setPlayListId(navigationEndpoints[0]);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
responseCategory.setCovert(covert);
|
||||
responseCategory.setTwoTitle(twoTitle);
|
||||
responseCategory.setTwoSubtitle(twoSubtitle);
|
||||
categoryList.add(responseCategory);
|
||||
CommonUtils.LogMsg(" ----------2222222222----twoTitle=" + twoTitle + "-twoSubtitle="
|
||||
+ twoSubtitle+"---pageType="+responseCategory.getPageType()
|
||||
+"--VideoId="+responseCategory.getVideoId()
|
||||
+"---PlayListId="+responseCategory.getPlayListId());
|
||||
if (j == 0) {
|
||||
CommonUtils.LogMsg(" ----------2222222222----twoTitle=" + twoTitle + "--BrowseId="
|
||||
+ responseCategory.getBrowseId() + "---pageType=" + responseCategory.getPageType()
|
||||
+ "--VideoId=" + responseCategory.getVideoId()
|
||||
+ "---PlayListId=" + responseCategory.getPlayListId());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -528,8 +533,6 @@ public class JsonHelper {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private static String[] getWatchEndPoint(JSONObject job) {
|
||||
|
||||
String[] strings = new String[4];
|
||||
@ -567,11 +570,20 @@ public class JsonHelper {
|
||||
*/
|
||||
private static String getCovertUrl(JSONObject jsonObject, boolean maxBig) {
|
||||
try {
|
||||
boolean b = jsonObject.has("musicThumbnailRenderer");
|
||||
if (b) {
|
||||
jsonObject = jsonObject.getJSONObject("musicThumbnailRenderer");
|
||||
|
||||
JSONArray jsonArray;
|
||||
JSONObject musicThumbnailRenderer = jsonObject.optJSONObject("musicThumbnailRenderer");
|
||||
if (musicThumbnailRenderer == null) {
|
||||
JSONObject thumbnail = jsonObject.optJSONObject("thumbnail");
|
||||
if (thumbnail != null) {
|
||||
jsonArray = thumbnail.getJSONArray("thumbnails");
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
jsonArray = musicThumbnailRenderer.getJSONObject("thumbnail").getJSONArray("thumbnails");
|
||||
}
|
||||
JSONArray jsonArray = jsonObject.getJSONObject("thumbnail").getJSONArray("thumbnails");
|
||||
|
||||
int length = jsonArray.length();
|
||||
int index = 0;
|
||||
if (maxBig) {
|
||||
@ -581,7 +593,7 @@ public class JsonHelper {
|
||||
|
||||
return pngUrl;
|
||||
} catch (JSONException exception) {
|
||||
return "";
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -603,6 +615,7 @@ public class JsonHelper {
|
||||
|
||||
/**
|
||||
* runs 数组的字符串拼接
|
||||
*
|
||||
* @param jsonObject
|
||||
* @return
|
||||
*/
|
||||
|
||||
@ -49,14 +49,8 @@ public interface MusicApi {
|
||||
Observable<ResponseBody> getMusicPlayUrl(@Body RequestBody requestBody);
|
||||
|
||||
|
||||
|
||||
@GET("videoplayback?expire=1727100941&ei=rSPxZoSXJ_eM2_gPgqT8mAs&ip=146.19.167.8&id=o-ADGacaLEhb3NOOc74tfR50VCTKy0vnUb2_GAm-tPlv9n&itag=137&source=youtube&requiressl=yes&xpc=EgVo2aDSNQ%3D%3D&mh=f8&mm=31%2C29&mn=sn-tt1e7nlz%2Csn-vgqsknzd&ms=au%2Crdu&mv=m&mvi=2&pl=24&gcr=us&initcwndbps=6450000&vprv=1&svpuc=1&mime=video%2Fmp4&rqh=1&gir=yes&clen=4444925&dur=293.280&lmt=1688643558849956&mt=1727078942&fvip=3&keepalive=yes&fexp=51299152&c=ANDROID_MUSIC&txp=4532434&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cxpc%2Cgcr%2Cvprv%2Csvpuc%2Cmime%2Crqh%2Cgir%2Cclen%2Cdur%2Clmt&sig=AJfQdSswRgIhAKjjifMN7NMLqeoVXyqHPK1uHqev1PcnVMoycknt4QGfAiEAiCEcEYPDpQsCbE0tJ6MXjvPs4HmT0yM8Yoa26rWpc7M%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=ABPmVW0wRAIgeur5lMiKDgdWV5rrRTkmt0jbOQnifmVQwoTXk_Y17E0CIBfjGXpbdW2u3mtu1I-")
|
||||
Observable<ResponseBody> getTest();
|
||||
|
||||
|
||||
|
||||
//首页分类项下的播放列表子页面 (类型1:单曲合集、2:专辑、3:音乐视频 ,不同类型返回数据结构有区别)
|
||||
@POST("youtubei/v1/browse")
|
||||
//首页分类项下的播放列表子页面 (类型1:单曲合集、2:专辑、3:音乐视频合集 ,不同类型返回数据结构有区别)
|
||||
@POST("youtubei/v1/browse?prettyPrint=false")
|
||||
@Headers("X-Goog-Api-Key:AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8")
|
||||
Observable<ResponseBody> getCategoryList(@Body RequestBody requestBody);
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@ public class RetrofitManager {
|
||||
.connectTimeout(DEFAULT_TIMEOUT, TimeUnit.SECONDS)
|
||||
.writeTimeout(DEFAULT_TIMEOUT, TimeUnit.SECONDS)
|
||||
.readTimeout(DEFAULT_TIMEOUT, TimeUnit.SECONDS)
|
||||
// .addInterceptor(httpLoggingInterceptor)
|
||||
.addInterceptor(httpLoggingInterceptor)
|
||||
.build();
|
||||
retrofit = new Retrofit.Builder()
|
||||
.baseUrl(base_Host)
|
||||
@ -153,9 +153,18 @@ public class RetrofitManager {
|
||||
public void getCategoryList(String browserId,RequestListener<ResponseBody> requestListener) {
|
||||
BodyHome bodyHome = new BodyHome();
|
||||
bodyHome.setBrowseId(browserId);
|
||||
// bodyHome.setBrowseId("VLPLI-asvmHZWNo_xjMMfD_v2O2lTyCdrjaK");
|
||||
|
||||
ContextBody.Client client = bodyHome.getContext().getClient();
|
||||
client.setClientVersion("1.20240506.01.00");
|
||||
|
||||
|
||||
Gson gson = new Gson();
|
||||
String s = gson.toJson(bodyHome);
|
||||
RequestBody requestBody = RequestBody.Companion.create(s, JSON);
|
||||
|
||||
|
||||
|
||||
musicApi.getCategoryList(requestBody)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.unsubscribeOn(Schedulers.io())
|
||||
|
||||
@ -92,6 +92,11 @@ public class A_HomeActivity extends BaseActivity<ActivityAhomeBinding> {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showPanel() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 设置进度条
|
||||
private void setupProgressBar() {
|
||||
vb.circularProgressBar.setMaxProgress(100); // 设置进度条最大值
|
||||
|
||||
@ -313,6 +313,11 @@ public class A_PlayActivity extends BaseActivity<ActivityAplayBinding> {
|
||||
return false; // 设置状态栏为非亮色
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showPanel() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// 处理其他点击事件
|
||||
|
||||
@ -53,6 +53,11 @@ public class A_SettingActivity extends BaseActivity<ActivityAsettingBinding> {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showPanel() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
|
||||
@ -39,6 +39,11 @@ public class A_SplashActivity extends BaseActivity<ActivityAsplashBinding> {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showPanel() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void intData(){
|
||||
|
||||
countDownTimer = new CountDownTimer(SPLASH_TIME_OUT, 100) {
|
||||
|
||||
@ -1,22 +1,40 @@
|
||||
package com.hi.music.player.ui.activity;
|
||||
|
||||
import static android.view.Gravity.CENTER_HORIZONTAL;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.MediaController;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.view.WindowCompat;
|
||||
import androidx.core.view.WindowInsetsControllerCompat;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
import androidx.media3.common.MediaItem;
|
||||
import androidx.media3.common.Player;
|
||||
import androidx.viewbinding.ViewBinding;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.resource.bitmap.CircleCrop;
|
||||
import com.hi.music.player.MusicApplication;
|
||||
import com.hi.music.player.databinding.ActivityBaseBinding;
|
||||
import com.hi.music.player.databinding.LayoutPanelBinding;
|
||||
import com.hi.music.player.helper.CommonUtils;
|
||||
import com.hi.music.player.helper.MyValue;
|
||||
import com.hi.music.player.helper.ViewModelScope;
|
||||
import com.hi.music.player.media3.MyMediaControllerManager;
|
||||
import com.hi.music.player.ui.activity.viewmodel.VMApplication;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public abstract class BaseActivity<T extends ViewBinding> extends AppCompatActivity implements View.OnClickListener{
|
||||
public abstract class BaseActivity<T extends ViewBinding> extends AppCompatActivity implements View.OnClickListener {
|
||||
|
||||
private final ViewModelScope mViewModelScope = new ViewModelScope();
|
||||
|
||||
@ -25,33 +43,138 @@ public abstract class BaseActivity<T extends ViewBinding> extends AppCompatActiv
|
||||
private Window window;
|
||||
private View decorView;
|
||||
protected View mView;
|
||||
private ActivityBaseBinding rootVb;
|
||||
|
||||
protected VMApplication vmApplication;
|
||||
protected MyMediaControllerManager mediaControllerManager;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
vb = getViewBinding();
|
||||
View root = vb.getRoot();
|
||||
setContentView(root);
|
||||
rootVb = ActivityBaseBinding.inflate(getLayoutInflater(), null, false);
|
||||
rootVb.frameLayout.addView(root);
|
||||
setContentView(rootVb.getRoot());
|
||||
window = getWindow();
|
||||
decorView = window.getDecorView();
|
||||
mView = decorView.getRootView();
|
||||
vmApplication = getApplicationScopeViewModel(VMApplication.class);
|
||||
mediaControllerManager = MyMediaControllerManager.getInstance();
|
||||
|
||||
if (showPanel())
|
||||
initPanel();
|
||||
setStatusBar();
|
||||
if (isFullScreen()) {
|
||||
root.setPadding(0,100,0,0);
|
||||
root.setPadding(0, 100, 0, 0);
|
||||
initFullScreen();
|
||||
}
|
||||
onCreateInit();
|
||||
onInitClick();
|
||||
}
|
||||
protected abstract T getViewBinding();
|
||||
|
||||
protected abstract void onCreateInit();
|
||||
protected abstract T getViewBinding();
|
||||
|
||||
protected abstract void onInitClick();
|
||||
|
||||
protected abstract void onCreateInit();
|
||||
|
||||
protected abstract void onInitClick();
|
||||
|
||||
public abstract boolean isFullScreen();
|
||||
|
||||
public abstract boolean statusBarLight();
|
||||
|
||||
public abstract boolean showPanel();
|
||||
|
||||
private void initPanel() {
|
||||
LayoutPanelBinding panelVb = LayoutPanelBinding.inflate(getLayoutInflater());
|
||||
View panelView = panelVb.getRoot();
|
||||
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
|
||||
FrameLayout.LayoutParams.MATCH_PARENT,
|
||||
CommonUtils.dpToPx(74)
|
||||
);
|
||||
panelVb.imPlay.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
panelVb.imPlay.setSelected(!panelVb.imPlay.isSelected());
|
||||
if (panelVb.imPlay.isSelected()) {
|
||||
mediaControllerManager.play();
|
||||
} else {
|
||||
mediaControllerManager.pause();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
if (this instanceof HomeActivity) {
|
||||
layoutParams.setMargins(CommonUtils.dpToPx(22), 0, CommonUtils.dpToPx(22), CommonUtils.dpToPx(82));
|
||||
} else {
|
||||
layoutParams.setMargins(CommonUtils.dpToPx(22), 0, CommonUtils.dpToPx(22), CommonUtils.dpToPx(10));
|
||||
}
|
||||
|
||||
layoutParams.gravity = Gravity.BOTTOM;
|
||||
vmApplication.playStatus.observe(this, new Observer<Integer>() {
|
||||
@Override
|
||||
public void onChanged(Integer integer) {
|
||||
CommonUtils.LogMsg("----------播放状态更新=" + integer);
|
||||
if (panelView.getParent() == null) {
|
||||
CommonUtils.LogMsg("----------显示面板");
|
||||
rootVb.frameLayout.addView(panelView, layoutParams);
|
||||
}
|
||||
MediaItem currentMediaItem = mediaControllerManager.getMediaController().getCurrentMediaItem();
|
||||
if(currentMediaItem!= null){
|
||||
Uri artworkUri = currentMediaItem.mediaMetadata.artworkUri;
|
||||
CharSequence title = currentMediaItem.mediaMetadata.title;
|
||||
CharSequence artist = currentMediaItem.mediaMetadata.artist;
|
||||
|
||||
if(artworkUri!= null){
|
||||
CommonUtils.LogMsg("----------artworkUri="+artworkUri.toString());
|
||||
Glide.with(MusicApplication.myApplication)
|
||||
.load(artworkUri.toString())
|
||||
.transform(new CircleCrop())
|
||||
.into(panelVb.image);
|
||||
}
|
||||
panelVb.title.setText(title);
|
||||
panelVb.singer.setText(artist);
|
||||
}
|
||||
|
||||
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 MyValue.PLAY_STATUS_CODE_PAUSE:
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void setStatusBar() {
|
||||
//深色模式
|
||||
WindowInsetsControllerCompat insetsController = WindowCompat.getInsetsController(getWindow(), getWindow().getDecorView());
|
||||
@ -62,7 +185,7 @@ public abstract class BaseActivity<T extends ViewBinding> extends AppCompatActiv
|
||||
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||
// mView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
|
||||
mView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN );
|
||||
mView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
||||
}
|
||||
|
||||
protected <K extends ViewModel> K getActivityScopeViewModel(@NonNull Class<K> modelClass) {
|
||||
|
||||
@ -53,10 +53,11 @@ public class CategoryListActivity extends BaseActivity<ActivityCategoryListBindi
|
||||
|
||||
|
||||
private VMCategoryList vm;
|
||||
private VMApplication vmApplication;
|
||||
// private VMApplication vmApplication;
|
||||
|
||||
private ResponseCategoryList mCategoryList;
|
||||
private String mPageType;
|
||||
private String twoSubtitle;
|
||||
|
||||
@Override
|
||||
protected ActivityCategoryListBinding getViewBinding() {
|
||||
@ -66,10 +67,9 @@ public class CategoryListActivity extends BaseActivity<ActivityCategoryListBindi
|
||||
@Override
|
||||
protected void onCreateInit() {
|
||||
vm = getActivityScopeViewModel(VMCategoryList.class);
|
||||
vmApplication = getApplicationScopeViewModel(VMApplication.class);
|
||||
// vmApplication = getApplicationScopeViewModel(VMApplication.class);
|
||||
Intent intent = getIntent();
|
||||
if (intent == null) {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -80,6 +80,7 @@ public class CategoryListActivity extends BaseActivity<ActivityCategoryListBindi
|
||||
if (category == null)
|
||||
return;
|
||||
mPageType = category.getPageType();
|
||||
twoSubtitle = category.getTwoSubtitle();
|
||||
|
||||
|
||||
vb.pbLoading.setVisibility(View.VISIBLE);
|
||||
@ -114,6 +115,11 @@ public class CategoryListActivity extends BaseActivity<ActivityCategoryListBindi
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showPanel() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v.equals(vb.imBack)) {
|
||||
@ -130,11 +136,29 @@ public class CategoryListActivity extends BaseActivity<ActivityCategoryListBindi
|
||||
}
|
||||
|
||||
private void loadInfo(ResponseCategoryList info) {
|
||||
switch (mPageType) {
|
||||
case MyValue.PAGE_TYPE_LIST:
|
||||
vb.tvSingerName.setVisibility(View.GONE);
|
||||
break;
|
||||
case MyValue.PAGE_TYPE_ALBUM:
|
||||
vb.tvSingerName.setVisibility(View.VISIBLE);
|
||||
String[] split = twoSubtitle.split("•");
|
||||
CommonUtils.LogMsg("twoSubtitle=" + twoSubtitle);
|
||||
if (split != null && split.length > 1) {
|
||||
vb.tvSingerName.setText(split[1]);
|
||||
for (ResponsePlayListInfo playListInfo : info.getList()) {
|
||||
playListInfo.setSingerName(split[1]);
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
vb.tvTitle.setText(info.getTitle());
|
||||
vb.tvSubTitle.setText(info.getDescription());
|
||||
|
||||
AdapterCategoryList adapterCategoryList = new AdapterCategoryList();
|
||||
adapterCategoryList.setHomeItemClickListener(this);
|
||||
adapterCategoryList.setPageType(mPageType);
|
||||
vb.recyclerview.setLayoutManager(new LinearLayoutManager(this));
|
||||
adapterCategoryList.setData(info.getList());
|
||||
vb.recyclerview.setAdapter(adapterCategoryList);
|
||||
@ -207,4 +231,11 @@ public class CategoryListActivity extends BaseActivity<ActivityCategoryListBindi
|
||||
startActivity(intent);
|
||||
vmApplication.reSetPlayList(mCategoryList.getList());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -52,6 +52,11 @@ public class HomeActivity extends BaseActivity<ActivityHomeBinding> {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showPanel() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void initView() {
|
||||
|
||||
int statusBarHeight = CommonUtils.getStatusBarHeight(MusicApplication.myApplication);
|
||||
|
||||
@ -1,58 +0,0 @@
|
||||
package com.hi.music.player.ui.activity;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import com.hi.music.player.databinding.ActivityMainBinding;
|
||||
import com.hi.music.player.network.RetrofitManager;
|
||||
|
||||
public class MainActivity extends BaseActivity<ActivityMainBinding> {
|
||||
|
||||
|
||||
// EdgeToEdge.enable(this);
|
||||
@Override
|
||||
protected ActivityMainBinding getViewBinding() {
|
||||
return ActivityMainBinding.inflate(getLayoutInflater());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreateInit() {
|
||||
vb.tv.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
vb.tv1.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
String continuation = "4qmFsgKrAhIMRkVtdXNpY19ob21lGpoCQ0FONnpBRkhVSGswZFMxUVIzazBaMFJYYjFWQ1EyOUpRa05wVWpWa1JqbDNXVmRrYkZnelRuVlpXRUo2WVVjNU1GZ3lNVEZqTW14cVdETkNhRm95Vm1aamJWWnVZVmM1ZFZsWGQxTklNV3Q1V2tSUmRHRldUa2RoTUZKS1ZteEdSR0ZXVG5GbFIzaERWVlZvTVZORlVYUlVXR3hLVVcxellVOVZNVEZqTW14cVVrZHNlbGt5T1RKYVdFbzFWVWRHYmxwV1RteGpibHB3V1RKVmRGSXlWakJUUnpsMFdsWkNhRm95VlVGQlVVSTJZVU14UkZSblFVSldWazFCUVZaV1ZFRkJSVUpCWDNGamVEY3dTa0ZuWjBVJTNE";
|
||||
String clickTrackingParams = "CBAQybcCIhMIw4eu48bLiAMVvoDkBh2lGTJl";
|
||||
String visitorData = "CgtFQThPOThGYzV0OCjDkqm3BjIKCgJVUxIEGgAgGg%3D%3D";
|
||||
// RetrofitManager.getInstance().getHomeMoreData(continuation,clickTrackingParams,visitorData);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onInitClick() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullScreen() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean statusBarLight() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
}
|
||||
}
|
||||
@ -54,7 +54,7 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
|
||||
private ResponseSingle responseSingle;
|
||||
private VMPlay vmPlay;
|
||||
|
||||
private VMApplication vmApplication;
|
||||
// private VMApplication vmApplication;
|
||||
|
||||
|
||||
//接口返回的播放列表(没有音频数据)
|
||||
@ -65,7 +65,7 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
|
||||
private ResponsePlayListInfo musicInfo;
|
||||
private Handler mHandler;
|
||||
private Runnable mRunnable;
|
||||
private MyMediaControllerManager mediaControllerManager;
|
||||
// private MyMediaControllerManager mediaControllerManager;
|
||||
|
||||
private AdapterPlayList adapterPlayList;
|
||||
|
||||
@ -99,7 +99,7 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
|
||||
@Override
|
||||
protected void onCreateInit() {
|
||||
vmPlay = getActivityScopeViewModel(VMPlay.class);
|
||||
vmApplication = getApplicationScopeViewModel(VMApplication.class);
|
||||
// vmApplication = getApplicationScopeViewModel(VMApplication.class);
|
||||
initMediaController();
|
||||
vb.progressBarLoading.setVisibility(View.VISIBLE);
|
||||
|
||||
@ -159,6 +159,7 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
|
||||
}
|
||||
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);
|
||||
@ -177,6 +178,7 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
|
||||
mCustomerUrlInfo = customerUrlInfo;
|
||||
initShowPlayList(false);
|
||||
vb.linearRetry.setVisibility(View.VISIBLE);
|
||||
vb.progressBarLoading.setVisibility(View.GONE);
|
||||
mediaControllerManager.pause();
|
||||
return;
|
||||
}
|
||||
@ -213,7 +215,7 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
|
||||
}
|
||||
|
||||
private void initMediaController() {
|
||||
mediaControllerManager = MyMediaControllerManager.getInstance();
|
||||
// mediaControllerManager = MyMediaControllerManager.getInstance();
|
||||
// String videoId = responseSingle.getVideoId();
|
||||
MediaItem currentMediaItem = mediaControllerManager.getMediaController().getCurrentMediaItem();
|
||||
if (currentMediaItem != null) {
|
||||
@ -227,7 +229,7 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
|
||||
mediaControllerManager.resetPlayList();
|
||||
}
|
||||
|
||||
mediaControllerManager.addListener(new MediaControllerListener() {
|
||||
mediaControllerManager.addListener(vmApplication,new MediaControllerListener() {
|
||||
@Override
|
||||
public void onPlayStatus(int playStatus) {
|
||||
|
||||
@ -254,7 +256,6 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
|
||||
CommonUtils.LogMsg("------------- 播放完成");
|
||||
mHandler.removeCallbacks(mRunnable); // 停止更新
|
||||
updatePlayComplete();
|
||||
mediaControllerManager.playNext();
|
||||
break;
|
||||
|
||||
case MyValue.PLAY_STATUS_CODE_PAUSE:
|
||||
@ -427,6 +428,11 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showPanel() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v.equals(vb.btnPlay)) {
|
||||
|
||||
@ -27,8 +27,8 @@ public class VMApplication extends ViewModel {
|
||||
public LiveData<List<ResponsePlayListInfo>> playList = _playList;
|
||||
|
||||
|
||||
private MutableLiveData<CustomerUrlInfo> _playUrlMutableLiveData = new MutableLiveData<CustomerUrlInfo>();
|
||||
public LiveData<CustomerUrlInfo> playUrlLiveData = _playUrlMutableLiveData;
|
||||
private MutableLiveData<Integer> _playStatus = new MutableLiveData<Integer>();
|
||||
public LiveData<Integer> playStatus = _playStatus;
|
||||
|
||||
|
||||
/**
|
||||
@ -39,7 +39,9 @@ public class VMApplication extends ViewModel {
|
||||
_playList.setValue(list);
|
||||
}
|
||||
|
||||
|
||||
public void setPlayStatus(int status) {
|
||||
_playStatus.setValue(status);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -40,7 +40,8 @@ public class HomeFragment extends BaseFragment<FragmentHomeBinding> implements H
|
||||
|
||||
private int requestCount = 1;
|
||||
|
||||
private int totalPage = 2;
|
||||
private int totalPage = 3;
|
||||
|
||||
|
||||
private List<ResponseHomeChild> childList = new ArrayList<>();
|
||||
|
||||
@ -70,6 +71,7 @@ public class HomeFragment extends BaseFragment<FragmentHomeBinding> implements H
|
||||
@Override
|
||||
public void onChanged(ResponseHome responseHome) {
|
||||
if(responseHome == null){
|
||||
adapterHome.removeLoadingFooter();
|
||||
requestCount--;
|
||||
return;
|
||||
}
|
||||
@ -90,7 +92,7 @@ public class HomeFragment extends BaseFragment<FragmentHomeBinding> implements H
|
||||
super.onScrolled(recyclerView, dx, dy);
|
||||
LinearLayoutManager layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager();
|
||||
if (layoutManager != null && layoutManager.findLastVisibleItemPosition() == childList.size() - 1) {
|
||||
if (requestCount < totalPage) {
|
||||
if (requestCount < totalPage&&!adapterHome.isLoadingAdded()) {
|
||||
CommonUtils.LogMsg("------loadmore--");
|
||||
adapterHome.addLoadingFooter();
|
||||
vmHome.getHomeMore();
|
||||
@ -124,6 +126,10 @@ public class HomeFragment extends BaseFragment<FragmentHomeBinding> implements H
|
||||
intent.putExtra(MyValue.KEY_PLAY_ACTIVITY_MV, data);
|
||||
intent.putExtra(MyValue.KEY_ENTER_SOURCE, MyValue.TYPE_ENTER_SOURCE_MV);
|
||||
startActivity(intent);
|
||||
}else if(pageType.equals(MyValue.PAGE_TYPE_ALBUM)){
|
||||
Intent intent = new Intent(activity, CategoryListActivity.class);
|
||||
intent.putExtra(MyValue.KEY_PLAY_ACTIVITY_CATEGORY, data);
|
||||
startActivity(intent);
|
||||
}else {
|
||||
Intent intent = new Intent(activity, CategoryListActivity.class);
|
||||
intent.putExtra(MyValue.KEY_PLAY_ACTIVITY_CATEGORY, data);
|
||||
|
||||
@ -31,14 +31,11 @@ public class VMCategoryList extends ViewModel {
|
||||
|
||||
@Override
|
||||
public void onSuccess(JSONObject data) {
|
||||
// JSONObject jsonObject = CommonUtils.toJsonObject(data);
|
||||
if (data != null) {
|
||||
ResponseCategoryList responseCategoryList = JsonHelper.ResolveCategoryList(data);
|
||||
ResponseCategoryList responseCategoryList = JsonHelper.ResolveCategoryList(data,browseId);
|
||||
_data.setValue(responseCategoryList);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
7
app/src/main/res/drawable/panel_bg.xml
Normal file
7
app/src/main/res/drawable/panel_bg.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">
|
||||
<solid android:color="@color/panel_bg" />
|
||||
<corners android:radius="36dp" />
|
||||
|
||||
</shape>
|
||||
9
app/src/main/res/drawable/panel_icon_list.xml
Normal file
9
app/src/main/res/drawable/panel_icon_list.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="32dp"
|
||||
android:height="32dp"
|
||||
android:viewportWidth="32"
|
||||
android:viewportHeight="32">
|
||||
<path
|
||||
android:pathData="M24.697,13.909C24.829,13.909 24.958,13.948 25.067,14.021L30.085,17.377L28.61,19.595L26.689,18.311V24L26.667,23.969V24C26.666,24.85 26.395,25.679 25.892,26.365C25.389,27.05 24.681,27.558 23.87,27.814C23.059,28.069 22.187,28.06 21.382,27.787C20.576,27.514 19.879,26.991 19.391,26.295C18.903,25.598 18.649,24.764 18.668,23.914C18.686,23.064 18.974,22.241 19.491,21.566C20.009,20.891 20.728,20.399 21.544,20.16C22.36,19.921 23.231,19.949 24.031,20.239V14.575C24.031,14.488 24.048,14.401 24.081,14.32C24.115,14.239 24.164,14.166 24.226,14.104C24.288,14.042 24.361,13.993 24.442,13.959C24.523,13.926 24.61,13.909 24.697,13.909H24.697ZM13.969,24C14.056,24 14.143,24.017 14.224,24.051C14.305,24.084 14.378,24.133 14.44,24.195C14.502,24.257 14.551,24.331 14.585,24.412C14.618,24.492 14.635,24.579 14.635,24.667V26C14.635,26.087 14.618,26.174 14.585,26.255C14.551,26.336 14.502,26.41 14.44,26.471C14.378,26.533 14.305,26.582 14.224,26.616C14.143,26.649 14.056,26.667 13.969,26.667H4.667C4.579,26.667 4.492,26.649 4.412,26.616C4.331,26.582 4.257,26.533 4.195,26.471C4.133,26.41 4.084,26.336 4.051,26.255C4.017,26.174 4,26.087 4,26V24.667C4,24.579 4.017,24.492 4.051,24.412C4.084,24.331 4.133,24.257 4.195,24.195C4.257,24.133 4.331,24.084 4.412,24.051C4.492,24.017 4.579,24 4.667,24H13.969ZM22.667,22.667C22.313,22.667 21.974,22.807 21.724,23.057C21.474,23.307 21.333,23.646 21.333,24C21.333,24.354 21.474,24.693 21.724,24.943C21.974,25.193 22.313,25.333 22.667,25.333C23.02,25.333 23.359,25.193 23.61,24.943C23.86,24.693 24,24.354 24,24C24,23.646 23.86,23.307 23.61,23.057C23.359,22.807 23.02,22.667 22.667,22.667ZM19.287,14.667C19.374,14.667 19.461,14.684 19.542,14.717C19.623,14.751 19.696,14.8 19.758,14.862C19.82,14.924 19.869,14.997 19.903,15.078C19.936,15.159 19.953,15.246 19.953,15.333V16.667C19.953,16.754 19.936,16.841 19.903,16.922C19.869,17.003 19.82,17.076 19.758,17.138C19.696,17.2 19.623,17.249 19.542,17.283C19.461,17.316 19.374,17.333 19.287,17.333H4.667C4.579,17.333 4.492,17.316 4.412,17.283C4.331,17.249 4.257,17.2 4.195,17.138C4.133,17.076 4.084,17.003 4.051,16.922C4.017,16.841 4,16.754 4,16.667V15.333C4,15.246 4.017,15.159 4.051,15.078C4.084,14.997 4.133,14.924 4.195,14.862C4.257,14.8 4.331,14.751 4.412,14.717C4.492,14.684 4.579,14.667 4.667,14.667H19.287ZM26,5.333C26.177,5.333 26.346,5.404 26.471,5.529C26.596,5.654 26.667,5.823 26.667,6V7.333C26.667,7.51 26.596,7.68 26.471,7.805C26.346,7.93 26.177,8 26,8H4.667C4.579,8 4.492,7.983 4.412,7.949C4.331,7.916 4.257,7.867 4.195,7.805C4.133,7.743 4.084,7.669 4.051,7.588C4.017,7.508 4,7.421 4,7.333V6C4,5.912 4.017,5.826 4.051,5.745C4.084,5.664 4.133,5.59 4.195,5.529C4.257,5.467 4.331,5.418 4.412,5.384C4.492,5.351 4.579,5.333 4.667,5.333H26Z"
|
||||
android:fillColor="#000000"/>
|
||||
</vector>
|
||||
22
app/src/main/res/drawable/panel_icon_pause.xml
Normal file
22
app/src/main/res/drawable/panel_icon_pause.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<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:pathData="M17.571,2.57V21.57"
|
||||
android:strokeWidth="5"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="@color/black"
|
||||
android:strokeLineCap="round"/>
|
||||
<path
|
||||
android:pathData="M6.429,2.57V21.57"
|
||||
android:strokeWidth="5"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="@color/black"
|
||||
android:strokeLineCap="round"/>
|
||||
</group>
|
||||
</vector>
|
||||
18
app/src/main/res/drawable/panel_icon_play.xml
Normal file
18
app/src/main/res/drawable/panel_icon_play.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="39dp"
|
||||
android:height="39dp"
|
||||
android:viewportWidth="34"
|
||||
android:viewportHeight="34">
|
||||
<path
|
||||
android:pathData="M17,31.167C24.824,31.167 31.167,24.824 31.167,17C31.167,9.176 24.824,2.833 17,2.833C9.176,2.833 2.833,9.176 2.833,17C2.833,24.824 9.176,31.167 17,31.167Z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="1.66667"
|
||||
android:fillColor="@color/black"
|
||||
android:strokeColor="@color/black"/>
|
||||
<path
|
||||
android:pathData="M14.167,17V12.092L18.417,14.546L22.667,17L18.417,19.454L14.167,21.907V17Z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="1.66667"
|
||||
android:fillColor="@color/white"
|
||||
android:strokeColor="@color/white"/>
|
||||
</vector>
|
||||
7
app/src/main/res/drawable/selector_panel_play.xml
Normal file
7
app/src/main/res/drawable/selector_panel_play.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_selected="true" android:drawable="@drawable/panel_icon_pause"/>
|
||||
<item android:state_selected="false" android:drawable="@drawable/panel_icon_play"/>
|
||||
|
||||
|
||||
</selector>
|
||||
@ -1,9 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
|
||||
<FrameLayout 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"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.activity.BaseActivity">
|
||||
android:id="@+id/frame_layout"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</FrameLayout>
|
||||
@ -15,24 +15,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dp" />
|
||||
|
||||
<!-- <com.google.android.material.appbar.AppBarLayout-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="60dp"-->
|
||||
<!-- app:statusBarForeground="@color/color_transparent"-->
|
||||
<!-- android:background="@color/color_transparent">-->
|
||||
|
||||
<!-- <com.google.android.material.appbar.CollapsingToolbarLayout-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="60dp"-->
|
||||
<!-- app:contentScrim="@color/black"-->
|
||||
<!-- app:layout_scrollFlags="scroll|exitUntilCollapsed">-->
|
||||
|
||||
<!-- </com.google.android.material.appbar.CollapsingToolbarLayout>-->
|
||||
|
||||
|
||||
<!-- </com.google.android.material.appbar.AppBarLayout>-->
|
||||
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
@ -64,11 +46,15 @@
|
||||
android:layout_below="@id/imCovert"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:textColor="@color/white"
|
||||
android:text="@string/app_name"
|
||||
android:textSize="21sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSubTitle"
|
||||
android:id="@+id/tvSingerName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/tvTitle"
|
||||
@ -77,6 +63,21 @@
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSubTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/tvSingerName"
|
||||
android:layout_centerHorizontal="true"
|
||||
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" />
|
||||
|
||||
|
||||
@ -86,12 +86,14 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_song_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="25dp"
|
||||
android:text="@string/app_name"
|
||||
android:text="9999999999999999999999999999999999999999"
|
||||
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_constraintTop_toBottomOf="@id/im_covert" />
|
||||
|
||||
|
||||
@ -6,25 +6,25 @@
|
||||
android:orientation="vertical"
|
||||
tools:context=".ui.fragmnt.HomeFragment">
|
||||
|
||||
<!-- 顶部应用栏 -->
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:color/transparent">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
|
||||
<TextView
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
app:title="@string/musicoo" />
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_name"
|
||||
android:textSize="22sp"
|
||||
android:padding="15dp"
|
||||
android:textColor="@color/white"/>
|
||||
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_song_of_the_day"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="74dp"
|
||||
android:orientation="horizontal" />
|
||||
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="70dp"
|
||||
android:paddingStart="15dp"
|
||||
android:paddingEnd="15dp"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingBottom="5dp">
|
||||
|
||||
@ -15,12 +16,16 @@
|
||||
android:id="@+id/image"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_position"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/app_name" />
|
||||
</LinearLayout>
|
||||
@ -31,6 +36,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_toStartOf="@id/tv_duration"
|
||||
android:layout_toEndOf="@id/left_layout"
|
||||
android:orientation="vertical">
|
||||
|
||||
@ -38,7 +44,8 @@
|
||||
android:id="@+id/tv_song_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_name"
|
||||
android:layout_marginEnd="6dp"
|
||||
android:text="9999999999999999"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp" />
|
||||
|
||||
@ -51,4 +58,14 @@
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_duration"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_name"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:textColor="@color/white_60_color"
|
||||
android:textSize="12sp" />
|
||||
</RelativeLayout>
|
||||
78
app/src/main/res/layout/layout_panel.xml
Normal file
78
app/src/main/res/layout/layout_panel.xml
Normal file
@ -0,0 +1,78 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/layout_panel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="74dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="@drawable/panel_bg"
|
||||
android:paddingStart="14dp"
|
||||
android:paddingEnd="14dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="52dp"
|
||||
android:layout_height="52dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="4dp"
|
||||
android:src="@mipmap/ic_launcher" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="22dp"
|
||||
android:layout_toStartOf="@id/frame_play"
|
||||
android:layout_toEndOf="@id/image"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/singer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/panel_singer_color"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/frame_play"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_toStartOf="@id/im_list"
|
||||
android:paddingStart="10dp"
|
||||
android:paddingEnd="10dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/im_play"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/selector_panel_play" />
|
||||
</FrameLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/im_list"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:paddingStart="5dp"
|
||||
android:paddingEnd="5dp"
|
||||
android:visibility="invisible"
|
||||
android:src="@drawable/panel_icon_list" />
|
||||
|
||||
</RelativeLayout>
|
||||
@ -12,6 +12,9 @@
|
||||
<color name="default_play_list_color">#1A1A1A</color>
|
||||
<color name="cur_play_music">#4DFFFFFF</color>
|
||||
<color name="dark_music">#FF424242</color>
|
||||
<color name="panel_bg">#80F988</color>
|
||||
|
||||
<color name="panel_singer_color">#99000000</color>
|
||||
|
||||
<color name="test">#2D9C31</color>
|
||||
</resources>
|
||||
Loading…
Reference in New Issue
Block a user