播放视频

This commit is contained in:
litingting 2024-10-29 17:34:49 +08:00
parent f342e2ff7a
commit 26eb76deb3
37 changed files with 705 additions and 443 deletions

View File

@ -39,38 +39,32 @@ public class AdapterCategory extends BaseAdapter<ResponseCategory, ItemCategoryB
ItemCategoryBinding vb = itemHolder.getVb(); ItemCategoryBinding vb = itemHolder.getVb();
ResponseCategory responseCategory = data.get(position); ResponseCategory responseCategory = data.get(position);
String pageType = responseCategory.getPageType(); String pageType = responseCategory.getPageType();
if(pageType.equals(MyValue.PAGE_TYPE_MV)){
ViewGroup.LayoutParams layoutParams = vb.header.getLayoutParams();
layoutParams.width = CommonUtils.dpToPx(260);
vb.header.setLayoutParams(layoutParams);
}else {
ViewGroup.LayoutParams layoutParams = vb.header.getLayoutParams();
layoutParams.width = CommonUtils.dpToPx(170);
vb.header.setLayoutParams(layoutParams);
}
Glide.with(MusicApplication.myApplication) Glide.with(MusicApplication.myApplication)
.asDrawable() .asDrawable()
.apply(RequestOptions.bitmapTransform(new RoundedCorners(CommonUtils.dpToPx(13))))
.load(responseCategory.getCovert()) .load(responseCategory.getCovert())
.placeholder(R.drawable.placeholder) .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());
return false;
}
@Override
public boolean onResourceReady(@NonNull Drawable resource, @NonNull Object model, Target<Drawable> target, @NonNull DataSource dataSource, boolean isFirstResource) {
return false;
}
})
.into(vb.header); .into(vb.header);
vb.tvTitle.setText(responseCategory.getTwoTitle()); vb.tvTitle.setText(responseCategory.getTwoTitle());
vb.tvSubtitle.setText(responseCategory.getTwoSubtitle()); vb.tvSubtitle.setText(responseCategory.getTwoSubtitle());
CommonUtils.LogMsg("title="+responseCategory.getTwoTitle()+"----------pageType="+pageType
+"---browserId="+responseCategory.getBrowseId()+"---videoId="+responseCategory.getVideoId()+"---playListId="+responseCategory.getPlayListId());
if(pageType == null){
return;
}
// if(pageType.equals(MyValue.PAGE_TYPE_MV)||pageType.equals(MyValue.PAGE_TYPE_MV_LIST)){
// ViewGroup.LayoutParams layoutParams = vb.header.getLayoutParams();
// layoutParams.width = CommonUtils.dpToPx(280);
// vb.header.setLayoutParams(layoutParams);
// vb.header.setBackgroundResource(R.drawable.bg_black_13);
//
// }else {
// ViewGroup.LayoutParams layoutParams = vb.header.getLayoutParams();
// layoutParams.width = CommonUtils.dpToPx(170);
// vb.header.setLayoutParams(layoutParams);
// vb.header.setBackground(null);
// }
vb.header.setOnClickListener(new View.OnClickListener() { vb.header.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {

View File

@ -57,19 +57,18 @@ public class AdapterCategoryList extends BaseAdapter<ResponsePlayListInfo, ItemC
switch (mPageType){ switch (mPageType){
case MyValue.PAGE_TYPE_ALBUM: case MyValue.PAGE_TYPE_ALBUM:
vb.tvSingerName.setText(describe); vb.tvSingerName.setText(describe);
vb.image.setVisibility(View.GONE); vb.imCard.setVisibility(View.GONE);
vb.tvPosition.setVisibility(View.VISIBLE); vb.tvPosition.setVisibility(View.VISIBLE);
vb.tvPosition.setText(String.valueOf(position+1)); vb.tvPosition.setText(String.valueOf(position+1));
break; break;
default: default:
vb.tvSingerName.setText(singerName); vb.tvSingerName.setText(singerName);
vb.image.setVisibility(View.VISIBLE); vb.imCard.setVisibility(View.VISIBLE);
vb.tvPosition.setVisibility(View.GONE); vb.tvPosition.setVisibility(View.GONE);
Glide.with(MusicApplication.myApplication) Glide.with(MusicApplication.myApplication)
.asDrawable() .asDrawable()
.apply(RequestOptions.bitmapTransform(new RoundedCorners(CommonUtils.dpToPx(16))))
.load(child.getSmallCovert()) .load(child.getSmallCovert())
.placeholder(R.drawable.placeholder) .placeholder(R.drawable.placeholder)
.listener(new RequestListener<Drawable>() { .listener(new RequestListener<Drawable>() {
@ -94,6 +93,12 @@ public class AdapterCategoryList extends BaseAdapter<ResponsePlayListInfo, ItemC
homeItemClickListener.onClickItemCategoryList(child, itemHolder.getAbsoluteAdapterPosition()); homeItemClickListener.onClickItemCategoryList(child, itemHolder.getAbsoluteAdapterPosition());
} }
}); });
if(position == data.size() - 1){
vb.place.setVisibility(View.VISIBLE);
}else {
vb.place.setVisibility(View.GONE);
}
} }

View File

@ -36,12 +36,12 @@ public class AdapterHome extends BaseAdapter<ResponseHomeChild, ItemHomeBinding>
ItemHomeBinding vb = itemHolder.getVb(); ItemHomeBinding vb = itemHolder.getVb();
ResponseHomeChild responseHomeChild = data.get(position); ResponseHomeChild responseHomeChild = data.get(position);
vb.headTitle.setText(responseHomeChild.getHeaderTitle()); vb.headTitle.setText(responseHomeChild.getHeaderTitle());
CommonUtils.LogMsg("position="+position+"-----------headTitle-=" + responseHomeChild.getHeaderTitle());
List<ResponseSingle> singleList = responseHomeChild.getSingleList(); List<ResponseSingle> singleList = responseHomeChild.getSingleList();
List<ResponseCategory> categoryList = responseHomeChild.getCategoryList();
if (singleList != null && singleList.size() > 0) { if (singleList != null && singleList.size() > 0) {
vb.recyclerSinger.setVisibility(View.VISIBLE); vb.recyclerSinger.setVisibility(View.VISIBLE);
CommonUtils.LogMsg("-----------singleList-=" + singleList.size());
AdapterSinger adapterSinger = new AdapterSinger(); AdapterSinger adapterSinger = new AdapterSinger();
adapterSinger.setHomeItemClickListener(homeItemClickListener); adapterSinger.setHomeItemClickListener(homeItemClickListener);
adapterSinger.addData(singleList); adapterSinger.addData(singleList);
@ -50,10 +50,9 @@ public class AdapterHome extends BaseAdapter<ResponseHomeChild, ItemHomeBinding>
} else { } else {
vb.recyclerSinger.setVisibility(View.GONE); vb.recyclerSinger.setVisibility(View.GONE);
} }
List<ResponseCategory> categoryList = responseHomeChild.getCategoryList();
if (categoryList != null && categoryList.size() > 0) { if (categoryList != null && categoryList.size() > 0) {
vb.recyclerCategory.setVisibility(View.VISIBLE); vb.recyclerCategory.setVisibility(View.VISIBLE);
CommonUtils.LogMsg("-----------categoryList-=" + categoryList.size());
AdapterCategory adapterCategory = new AdapterCategory(); AdapterCategory adapterCategory = new AdapterCategory();
adapterCategory.setHomeItemClickListener(homeItemClickListener); adapterCategory.setHomeItemClickListener(homeItemClickListener);
adapterCategory.addData(categoryList); adapterCategory.addData(categoryList);
@ -62,6 +61,12 @@ public class AdapterHome extends BaseAdapter<ResponseHomeChild, ItemHomeBinding>
} else { } else {
vb.recyclerCategory.setVisibility(View.GONE); vb.recyclerCategory.setVisibility(View.GONE);
} }
if(position == data.size() - 1){
vb.place.setVisibility(View.VISIBLE);
}else {
vb.place.setVisibility(View.GONE);
}
} else { } else {
VHolder<ItemFooterLoadingBinding> footerHolder = (VHolder<ItemFooterLoadingBinding>) holder; VHolder<ItemFooterLoadingBinding> footerHolder = (VHolder<ItemFooterLoadingBinding>) holder;
FrameLayout root = footerHolder.getVb().getRoot(); FrameLayout root = footerHolder.getVb().getRoot();

View File

@ -88,7 +88,7 @@ public class AdapterPlayList extends BaseAdapter<ResponsePlayListInfo, ItemPlayL
String covert = listInfo.getSmallCovert(); String covert = listInfo.getSmallCovert();
Glide.with(MusicApplication.myApplication) Glide.with(MusicApplication.myApplication)
.asDrawable() .asDrawable()
.apply(RequestOptions.bitmapTransform(new RoundedCorners(CommonUtils.dpToPx(10)))) // .apply(RequestOptions.bitmapTransform(new RoundedCorners(CommonUtils.dpToPx(10))))
.load(covert) .load(covert)
.placeholder(R.drawable.placeholder) .placeholder(R.drawable.placeholder)
.into(vb.imCovert); .into(vb.imCovert);

View File

@ -3,6 +3,7 @@ package com.hi.music.player.adapter;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@ -61,5 +62,11 @@ public class AdapterResult extends BaseAdapter<ResponseResultList, ItemResultBin
} }
// vb.listChild.addItemDecoration(itemDecoration); // vb.listChild.addItemDecoration(itemDecoration);
if(position == data.size() - 1){
vb.place.setVisibility(View.VISIBLE);
}else {
vb.place.setVisibility(View.GONE);
}
} }
} }

View File

@ -16,6 +16,9 @@ import com.hi.music.player.R;
import com.hi.music.player.databinding.ItemSearchBinding; import com.hi.music.player.databinding.ItemSearchBinding;
import com.hi.music.player.helper.CommonUtils; import com.hi.music.player.helper.CommonUtils;
import com.hi.music.player.javabean.response.ResponseSearch; import com.hi.music.player.javabean.response.ResponseSearch;
import com.hi.music.player.javabean.response.child.ResponseSearchChild;
import java.util.List;
public class AdapterSearch extends BaseAdapter<ResponseSearch, ItemSearchBinding> { public class AdapterSearch extends BaseAdapter<ResponseSearch, ItemSearchBinding> {
@Override @Override
@ -58,12 +61,22 @@ public class AdapterSearch extends BaseAdapter<ResponseSearch, ItemSearchBinding
vb.layout.setPadding(0, 0, 0, 0); vb.layout.setPadding(0, 0, 0, 0);
} }
List<ResponseSearchChild> list = responseSearch.getList();
if(list!= null&&list.size()>0){
AdapterSearchChild adapterSearchChild = new AdapterSearchChild(); AdapterSearchChild adapterSearchChild = new AdapterSearchChild();
adapterSearchChild.setData(responseSearch.getList()); adapterSearchChild.setData(list);
vb.list.setAdapter(adapterSearchChild); vb.list.setAdapter(adapterSearchChild);
if (homeItemClickListener != null) if (homeItemClickListener != null)
adapterSearchChild.setHomeItemClickListener(homeItemClickListener); adapterSearchChild.setHomeItemClickListener(homeItemClickListener);
vb.list.setLayoutManager(new LinearLayoutManager(MusicApplication.myApplication)); vb.list.setLayoutManager(new LinearLayoutManager(MusicApplication.myApplication));
}
if(position == data.size() - 1){
vb.place.setVisibility(View.VISIBLE);
}else {
vb.place.setVisibility(View.GONE);
}
} }
} }

View File

@ -152,6 +152,29 @@ public class CommonUtils {
} }
public static void getMainColor(Drawable imDraw, onImageColorListener listener){
BitmapDrawable drawable = (BitmapDrawable) imDraw;
// 使用 Palette 提取颜色
if (drawable != null) {
Bitmap bitmap = drawable.getBitmap();
Palette.from(bitmap).generate(new Palette.PaletteAsyncListener() {
@Override
public void onGenerated(Palette palette) {
// 获取占比最大的颜色
Palette.Swatch dominantSwatch = palette.getDominantSwatch();
if (dominantSwatch != null) {
int dominantColor = dominantSwatch.getRgb(); // 获取 RGB 颜色
listener.onImageColor(dominantColor);
}else {
listener.onImageColor(-1);
}
}
});
}
}
public static Drawable getNewDrawable(int color, float RadiusTopLeft, float RadiusTopRight, float RadiusBottomRight, float RadiusBottomLeft) { public static Drawable getNewDrawable(int color, float RadiusTopLeft, float RadiusTopRight, float RadiusBottomRight, float RadiusBottomLeft) {
// 创建 GradientDrawable // 创建 GradientDrawable
GradientDrawable drawable = new GradientDrawable(); GradientDrawable drawable = new GradientDrawable();

View File

@ -4,7 +4,7 @@ public class MyValue {
//live合集 // 现场表演
public static final String PAGE_TYPE_MV_LIST="MUSIC_PAGE_TYPE_USER_CHANNEL"; public static final String PAGE_TYPE_MV_LIST="MUSIC_PAGE_TYPE_USER_CHANNEL";
@ -94,4 +94,10 @@ public class MyValue {
//-----------------------------CategoryListActivity //-----------------------------CategoryListActivity
//------------------------ResultListActivity
public static String KEY_SEARCH_RESULT_BROWSER_ID= "search_result_browser_id";
//-------------------------------------ResultListActivity
} }

View File

@ -12,9 +12,19 @@ public class ResponseCategoryList implements Serializable {
private String description; private String description;
private String secondSubtitle; private String secondSubtitle;
private String singName;
private List<ResponsePlayListInfo> list; private List<ResponsePlayListInfo> list;
public String getSingName() {
return singName;
}
public void setSingName(String singName) {
this.singName = singName;
}
public String getCovert() { public String getCovert() {
return covert; return covert;
} }

View File

@ -13,8 +13,17 @@ public class ResponsePlayUrl {
private String videoId; private String videoId;
private String BigCovert; private String BigCovert;
private String videoUrlMedium;
public String getVideoUrlMedium() {
return videoUrlMedium;
}
public void setVideoUrlMedium(String videoUrlMedium) {
this.videoUrlMedium = videoUrlMedium;
}
public String getBigCovert() { public String getBigCovert() {
return BigCovert; return BigCovert;
} }

View File

@ -220,11 +220,12 @@ public class MyMediaControllerManager {
MediaItem.Builder builder = mediaItemAt.buildUpon(); MediaItem.Builder builder = mediaItemAt.buildUpon();
builder.setMediaId(playUrl.getVideoId()); builder.setMediaId(playUrl.getVideoId());
if (playUrl.getAudioUrlMedium() != null) { builder.setUri(playUrl.getVideoUrlMedium());
builder.setUri(playUrl.getAudioUrlMedium()); // if (playUrl.getAudioUrlMedium() != null) {
} else { // builder.setUri(playUrl.getAudioUrlMedium());
builder.setUri(playUrl.getAudioUrlLow()); // } else {
} // builder.setUri(playUrl.getAudioUrlLow());
// }
//针对于已经从分类合集列表页面进入播放页面的数据(只有小的封面图) //针对于已经从分类合集列表页面进入播放页面的数据(只有小的封面图)
if (mediaItemAt.mediaMetadata.artworkUri == null) { if (mediaItemAt.mediaMetadata.artworkUri == null) {

View File

@ -163,36 +163,46 @@ public class JsonHelper {
try { try {
ResponsePlayUrl responsePlayUrl = new ResponsePlayUrl(); ResponsePlayUrl responsePlayUrl = new ResponsePlayUrl();
String status = jsonObject.getJSONObject("playabilityStatus").getString("status"); String status = jsonObject.getJSONObject("playabilityStatus").getString("status");
JSONObject streamingData = jsonObject.getJSONObject("streamingData");
// JSONArray jsonArray = streamingData.getJSONArray("adaptiveFormats");
// for (int i = 0; i < jsonArray.length(); i++) {
// JSONObject jsonIndex = jsonArray.getJSONObject(i);
//
// String mimeType = jsonIndex.getString("mimeType");
// String itag = jsonIndex.getString("itag");
// String url = jsonIndex.getString("url");
// if (mimeType.contains("video/mp4")) {
// String quality = jsonIndex.optString("quality");
// if(quality.equals("medium")){
// responsePlayUrl.setVideoUrlMedium(url);
// }
//
// }
// if (mimeType.contains("audio/mp4")) {
// String audioQuality1 = jsonIndex.optString("audioQuality");
// if (audioQuality1.equals("AUDIO_QUALITY_MEDIUM")) {
// responsePlayUrl.setAudioUrlMedium(url);
// } else {
// responsePlayUrl.setAudioUrlLow(url);
// }
//
// }
//
// }
JSONArray jsonArray = jsonObject.getJSONObject("streamingData").getJSONArray("adaptiveFormats");
for (int i = 0; i < jsonArray.length(); i++) { String videoUrl = streamingData.getJSONArray("formats").getJSONObject(0).getString("url");
JSONObject jsonIndex = jsonArray.getJSONObject(i); responsePlayUrl.setVideoUrlMedium(videoUrl);
String mimeType = jsonIndex.getString("mimeType");
String itag = jsonIndex.getString("itag");
if (mimeType.contains("audio/mp4")) {
String url = jsonIndex.getString("url");
boolean audioQuality1 = jsonIndex.has("audioQuality");
if (jsonIndex.has("audioQuality")) {
String audioQuality = jsonIndex.getString("audioQuality");
if (audioQuality.equals("AUDIO_QUALITY_MEDIUM")) {
responsePlayUrl.setAudioUrlMedium(url);
} else {
responsePlayUrl.setAudioUrlLow(url);
}
}
}
}
JSONObject videoDetails = jsonObject.getJSONObject("videoDetails"); JSONObject videoDetails = jsonObject.getJSONObject("videoDetails");
String videoId = videoDetails.getString("videoId"); String videoId = videoDetails.getString("videoId");
String title = videoDetails.getString("title");
JSONArray thumbnails = videoDetails.getJSONObject("thumbnail").getJSONArray("thumbnails"); JSONArray thumbnails = videoDetails.getJSONObject("thumbnail").getJSONArray("thumbnails");
String url = thumbnails.getJSONObject(thumbnails.length() - 1).getString("url"); String url = thumbnails.getJSONObject(thumbnails.length() - 1).getString("url");
CommonUtils.LogMsg("title="+title+"-------videoUrl="+videoUrl);
responsePlayUrl.setBigCovert(url); responsePlayUrl.setBigCovert(url);
responsePlayUrl.setVideoId(videoId); responsePlayUrl.setVideoId(videoId);
@ -245,6 +255,12 @@ public class JsonHelper {
String description = ""; String description = "";
JSONObject straplineTextOne = musicResponsiveHeaderRenderer.optJSONObject("straplineTextOne");
if (straplineTextOne != null) {
String jsonTitle = getJsonTitle(straplineTextOne, 0);
responseCategoryList.setSingName(jsonTitle);
}
//110 首歌曲.超过6小时 //110 首歌曲.超过6小时
String secondSubtitle = getJsonTextNew(musicResponsiveHeaderRenderer.getJSONObject("secondSubtitle")); String secondSubtitle = getJsonTextNew(musicResponsiveHeaderRenderer.getJSONObject("secondSubtitle"));
@ -395,7 +411,7 @@ public class JsonHelper {
JSONObject musicShelfRenderer = contents.optJSONObject("musicShelfRenderer"); JSONObject musicShelfRenderer = contents.optJSONObject("musicShelfRenderer");
if(musicCardShelfRenderer!= null){ if (musicCardShelfRenderer != null) {
String covertUrl = getCovertUrl(musicCardShelfRenderer.getJSONObject("thumbnail"), true); String covertUrl = getCovertUrl(musicCardShelfRenderer.getJSONObject("thumbnail"), true);
String title = getJsonTitle(musicCardShelfRenderer.getJSONObject("title"), 0); String title = getJsonTitle(musicCardShelfRenderer.getJSONObject("title"), 0);
String subtitle = getJsonTextNew(musicCardShelfRenderer.getJSONObject("subtitle")); String subtitle = getJsonTextNew(musicCardShelfRenderer.getJSONObject("subtitle"));
@ -403,7 +419,7 @@ public class JsonHelper {
headerTitle = getJsonTitle(musicCardShelfRenderer.getJSONObject("header") headerTitle = getJsonTitle(musicCardShelfRenderer.getJSONObject("header")
.getJSONObject("musicCardShelfHeaderBasicRenderer") .getJSONObject("musicCardShelfHeaderBasicRenderer")
.getJSONObject("title"), 0); .getJSONObject("title"), 0);
contents1 = musicCardShelfRenderer.getJSONArray("contents"); contents1 = musicCardShelfRenderer.optJSONArray("contents");
JSONObject jsonObject1 = musicCardShelfRenderer.getJSONObject("title") JSONObject jsonObject1 = musicCardShelfRenderer.getJSONObject("title")
@ -417,7 +433,7 @@ public class JsonHelper {
} }
String[] watchEndPoint = getWatchEndPoint(jsonObject1); String[] watchEndPoint = getWatchEndPoint(jsonObject1);
if(watchEndPoint!= null){ if (watchEndPoint != null) {
responseSearch.setBeastVideoId(watchEndPoint[0]); responseSearch.setBeastVideoId(watchEndPoint[0]);
} }
@ -425,16 +441,16 @@ public class JsonHelper {
responseSearch.setBeastSongTitle(title); responseSearch.setBeastSongTitle(title);
responseSearch.setBeastSongDescribe(subtitle); responseSearch.setBeastSongDescribe(subtitle);
CommonUtils.LogMsg("--搜索结果 最佳" + "--songTitle=" + responseSearch.getBeastSongTitle() + "---videoId="+responseSearch.getBeastVideoId()+"---browserId="+responseSearch.getBeastBrowserId() ); CommonUtils.LogMsg("--搜索结果 最佳" + "--songTitle=" + responseSearch.getBeastSongTitle() + "---videoId=" + responseSearch.getBeastVideoId() + "---browserId=" + responseSearch.getBeastBrowserId());
}else if(musicShelfRenderer!= null){ } else if (musicShelfRenderer != null) {
headerTitle = getJsonTitle(musicShelfRenderer.getJSONObject("title"), 0); headerTitle = getJsonTitle(musicShelfRenderer.getJSONObject("title"), 0);
contents1 = musicShelfRenderer.getJSONArray("contents"); contents1 = musicShelfRenderer.optJSONArray("contents");
} }
responseSearch.setHeaderTitle(headerTitle); responseSearch.setHeaderTitle(headerTitle);
List<ResponseSearchChild> list = new ArrayList<>(); List<ResponseSearchChild> list = new ArrayList<>();
if(contents1!=null){ if (contents1 != null) {
for (int k = 0; k < contents1.length(); k++) { for (int k = 0; k < contents1.length(); k++) {
ResponseSearchChild responseSearchChild = new ResponseSearchChild(); ResponseSearchChild responseSearchChild = new ResponseSearchChild();
@ -449,7 +465,7 @@ public class JsonHelper {
String pageType = ""; String pageType = "";
String covertUrl1 = ""; String covertUrl1 = "";
if(musicResponsiveListItemRenderer!= null){ if (musicResponsiveListItemRenderer != null) {
covertUrl1 = getCovertUrl(musicResponsiveListItemRenderer. covertUrl1 = getCovertUrl(musicResponsiveListItemRenderer.
getJSONObject("thumbnail") getJSONObject("thumbnail")
.getJSONObject("musicThumbnailRenderer"), true); .getJSONObject("musicThumbnailRenderer"), true);
@ -459,7 +475,7 @@ public class JsonHelper {
if (browser1 != null) { if (browser1 != null) {
browserId = browser1[0]; browserId = browser1[0];
pageType = browser1[1]; pageType = browser1[1];
if(Objects.equals(pageType, "MUSIC_PAGE_TYPE_PODCAST_SHOW_DETAIL_PAGE") ||pageType.equals("MUSIC_PAGE_TYPE_USER_CHANNEL")){ if (Objects.equals(pageType, "MUSIC_PAGE_TYPE_PODCAST_SHOW_DETAIL_PAGE") || pageType.equals("MUSIC_PAGE_TYPE_USER_CHANNEL")) {
//博客或者个人资料 //博客或者个人资料
continue; continue;
} }
@ -492,7 +508,7 @@ public class JsonHelper {
} }
boolean b = videoId == null || videoId.isEmpty(); boolean b = videoId == null || videoId.isEmpty();
if(b&&pageType.isEmpty()){ if (b && pageType.isEmpty()) {
continue; continue;
} }
responseSearchChild.setBrowserId(browserId); responseSearchChild.setBrowserId(browserId);
@ -502,18 +518,17 @@ public class JsonHelper {
responseSearchChild.setSongDescribe(describe); responseSearchChild.setSongDescribe(describe);
responseSearchChild.setSongPlayCount(playCount); responseSearchChild.setSongPlayCount(playCount);
responseSearchChild.setSongVideoId(videoId); responseSearchChild.setSongVideoId(videoId);
CommonUtils.LogMsg("--搜索结果 videoId=" + videoId + "--songTitle=" + songTitle + "---browserId=" + browserId+"---pageType="+pageType); CommonUtils.LogMsg("--搜索结果 videoId=" + videoId + "--songTitle=" + songTitle + "---browserId=" + browserId + "---pageType=" + pageType);
list.add(responseSearchChild); list.add(responseSearchChild);
} }
} }
} }
if(list.size()>0){ if (list.size() > 0) {
responseSearch.setList(list); responseSearch.setList(list);
searchList.add(responseSearch);
} }
searchList.add(responseSearch);
} }
return searchList; return searchList;
@ -565,7 +580,7 @@ public class JsonHelper {
if (musicShelfRenderer != null) { if (musicShelfRenderer != null) {
String headerTitle = getJsonTitle(musicShelfRenderer.getJSONObject("title"), 0); String headerTitle = getJsonTitle(musicShelfRenderer.getJSONObject("title"), 0);
resultList.setHeaderTitle(headerTitle); resultList.setHeaderTitle(headerTitle);
CommonUtils.LogMsg("----------结果子页面111--------------------headerTitle"+headerTitle); CommonUtils.LogMsg("----------结果子页面111--------------------headerTitle" + headerTitle);
JSONArray contents1 = musicShelfRenderer.getJSONArray("contents"); JSONArray contents1 = musicShelfRenderer.getJSONArray("contents");
for (int f = 0; f < contents1.length(); f++) { for (int f = 0; f < contents1.length(); f++) {
ResponseResultListChild responseResultListChild = new ResponseResultListChild(); ResponseResultListChild responseResultListChild = new ResponseResultListChild();
@ -610,15 +625,15 @@ public class JsonHelper {
responseResultListChild.setVideoId(videoId); responseResultListChild.setVideoId(videoId);
responseResultListChild.setPlayListId(playLIstId); responseResultListChild.setPlayListId(playLIstId);
CommonUtils.LogMsg("----------结果子页面111 songName="+songName+"---videoId="+videoId+"--playLIstId="+playLIstId); CommonUtils.LogMsg("----------结果子页面111 songName=" + songName + "---videoId=" + videoId + "--playLIstId=" + playLIstId);
childList.add(responseResultListChild); childList.add(responseResultListChild);
} }
} else if (musicCarouselShelfRenderer != null) { } else if (musicCarouselShelfRenderer != null) {
String headerTitle = getJsonTitle(musicCarouselShelfRenderer.getJSONObject("header") String headerTitle = getJsonTitle(musicCarouselShelfRenderer.getJSONObject("header")
.getJSONObject("musicCarouselShelfBasicHeaderRenderer") .getJSONObject("musicCarouselShelfBasicHeaderRenderer")
.getJSONObject("title"),0); .getJSONObject("title"), 0);
resultList.setHeaderTitle(headerTitle); resultList.setHeaderTitle(headerTitle);
CommonUtils.LogMsg("----------结果子页面222--------------------headerTitle"+headerTitle); CommonUtils.LogMsg("----------结果子页面222--------------------headerTitle" + headerTitle);
JSONArray contents1 = musicCarouselShelfRenderer.getJSONArray("contents"); JSONArray contents1 = musicCarouselShelfRenderer.getJSONArray("contents");
for (int f = 0; f < contents1.length(); f++) { for (int f = 0; f < contents1.length(); f++) {
ResponseResultListChild responseResultListChild = new ResponseResultListChild(); ResponseResultListChild responseResultListChild = new ResponseResultListChild();
@ -634,13 +649,13 @@ public class JsonHelper {
String[] browser = getBrowser(title.getJSONArray("runs").getJSONObject(0)); String[] browser = getBrowser(title.getJSONArray("runs").getJSONObject(0));
String subtitle = getJsonTextNew(musicTwoRowItemRenderer.getJSONObject("subtitle")); String subtitle = getJsonTextNew(musicTwoRowItemRenderer.getJSONObject("subtitle"));
if(browser!= null){ if (browser != null) {
String browserId = browser[0]; String browserId = browser[0];
responseResultListChild.setBrowserId(browserId); responseResultListChild.setBrowserId(browserId);
responseResultListChild.setPageType(browser[1]); responseResultListChild.setPageType(browser[1]);
} }
String[] watchEndPoint = getWatchEndPoint(musicTwoRowItemRenderer); String[] watchEndPoint = getWatchEndPoint(musicTwoRowItemRenderer);
if(watchEndPoint!=null){ if (watchEndPoint != null) {
responseResultListChild.setVideoId(watchEndPoint[0]); responseResultListChild.setVideoId(watchEndPoint[0]);
responseResultListChild.setPlayListId(watchEndPoint[1]); responseResultListChild.setPlayListId(watchEndPoint[1]);
} }
@ -648,8 +663,8 @@ public class JsonHelper {
responseResultListChild.setSongName(albumName); responseResultListChild.setSongName(albumName);
responseResultListChild.setSubTitle(subtitle); responseResultListChild.setSubTitle(subtitle);
CommonUtils.LogMsg("----------结果子页面222 songName="+albumName+"---videoId="+responseResultListChild.getVideoId()+"--playLIstId="+responseResultListChild.getPlayListId() CommonUtils.LogMsg("----------结果子页面222 songName=" + albumName + "---videoId=" + responseResultListChild.getVideoId() + "--playLIstId=" + responseResultListChild.getPlayListId()
+"---BrowserId="+responseResultListChild.getBrowserId()+"---PageType="+responseResultListChild.getPageType()); + "---BrowserId=" + responseResultListChild.getBrowserId() + "---PageType=" + responseResultListChild.getPageType());
childList.add(responseResultListChild); childList.add(responseResultListChild);
} }
} }
@ -672,27 +687,6 @@ public class JsonHelper {
} }
private static ResponsePlayListInfo getCommonCategoryList(JSONObject musicResponsiveListItemRenderer) throws JSONException { private static ResponsePlayListInfo getCommonCategoryList(JSONObject musicResponsiveListItemRenderer) throws JSONException {
JSONObject jsonText = musicResponsiveListItemRenderer.getJSONArray("fixedColumns") JSONObject jsonText = musicResponsiveListItemRenderer.getJSONArray("fixedColumns")
.getJSONObject(0) .getJSONObject(0)
@ -831,7 +825,6 @@ public class JsonHelper {
//------------------------音乐合集或者专辑 //------------------------音乐合集或者专辑
ResponseCategory responseCategory = new ResponseCategory(); ResponseCategory responseCategory = new ResponseCategory();
String covert = getCovertUrl(musicTwoRowItemRenderer.getJSONObject("thumbnailRenderer"), true); String covert = getCovertUrl(musicTwoRowItemRenderer.getJSONObject("thumbnailRenderer"), true);
CommonUtils.LogMsg("----图片-------------音乐合集或者专辑=" + covert);
JSONObject title1 = musicTwoRowItemRenderer.getJSONObject("title"); JSONObject title1 = musicTwoRowItemRenderer.getJSONObject("title");
String twoTitle = getJsonTitle(title1, 0); String twoTitle = getJsonTitle(title1, 0);
@ -839,6 +832,7 @@ public class JsonHelper {
String browseId = ""; String browseId = "";
String pageType = "";
JSONObject runs = title1 JSONObject runs = title1
.getJSONArray("runs") .getJSONArray("runs")
.getJSONObject(0); .getJSONObject(0);
@ -847,24 +841,22 @@ public class JsonHelper {
.getJSONArray("runs") .getJSONArray("runs")
.getJSONObject(0); .getJSONObject(0);
JSONObject browseEndpoint = null; String[] browser = null;
if (runs.has("navigationEndpoint")) { String[] browserTiTle = getBrowser(runs);
//-------------当pageType="MUSIC_PAGE_TYPE_PLAYLIST""MUSIC_PAGE_TYPE_ALBUM" 走这里 String[] browserSub = getBrowser(subtitle);
browseEndpoint = runs.getJSONObject("navigationEndpoint") if (browserTiTle != null) {
.getJSONObject("browseEndpoint"); browser = browserTiTle;
} else {
browser = browserSub;
} }
if (browseEndpoint != null) { if (browser != null) {
browseId = browseEndpoint //-------------当pageType="MUSIC_PAGE_TYPE_PLAYLIST""MUSIC_PAGE_TYPE_ALBUM" 走这里
.getString("browseId"); browseId = browser[0];
CommonUtils.LogMsg(" ----------2222222222----twoTitle=" + twoTitle + "-browseId=" + browseId); pageType = browser[1];
String pageType = browseEndpoint.getJSONObject("browseEndpointContextSupportedConfigs")
.getJSONObject("browseEndpointContextMusicConfig")
.getString("pageType");
responseCategory.setPageType(pageType); responseCategory.setPageType(pageType);
responseCategory.setBrowseId(browseId); responseCategory.setBrowseId(browseId);
if (pageType.equals(MyValue.PAGE_TYPE_MV)) { if (pageType.equals(MyValue.PAGE_TYPE_MV) || pageType.equals(MyValue.PAGE_TYPE_MV_LIST)) {
//视频mv 需要获取videoId 和PlayListId 用于进入播放页面请求播放列表数据 //视频mv 需要获取videoId 和PlayListId 用于进入播放页面请求播放列表数据
JSONObject jsonObject = musicTwoRowItemRenderer.getJSONObject("menu") JSONObject jsonObject = musicTwoRowItemRenderer.getJSONObject("menu")
@ -969,9 +961,6 @@ public class JsonHelper {
index = length - 2; index = length - 2;
} }
String pngUrl = jsonArray.getJSONObject(index).getString("url"); String pngUrl = jsonArray.getJSONObject(index).getString("url");
CommonUtils.LogMsg("----------取封面index=" + index);
return pngUrl; return pngUrl;
} catch (JSONException exception) { } catch (JSONException exception) {
return null; return null;

View File

@ -42,10 +42,10 @@ public interface MusicApi {
// "X-Goog-FieldMask:playabilityStatus.status,playerConfig.audioConfig,streamingData.adaptiveFormats,videoDetails.videoId,videoDetails.thumbnail"
//获取播放音频资源url "X-Goog-Api-Key:AIzaSyC9XL3ZjwddXya6X74dJOCTL-WEYFDNX30" //获取播放音频资源url "X-Goog-Api-Key:AIzaSyC9XL3ZjwddXya6X74dJOCTL-WEYFDNX30"
@POST("youtubei/v1/player?prettyPrint=false") @POST("youtubei/v1/player?prettyPrint=false")
@Headers({"X-Goog-Api-Key:AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8", @Headers({"X-Goog-Api-Key:AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8"})
"X-Goog-FieldMask:playabilityStatus.status,playerConfig.audioConfig,streamingData.adaptiveFormats,videoDetails.videoId,videoDetails.thumbnail"})
Observable<ResponseBody> getMusicPlayUrl(@Body RequestBody requestBody); Observable<ResponseBody> getMusicPlayUrl(@Body RequestBody requestBody);

View File

@ -1,8 +1,5 @@
package com.hi.music.player.ui.activity; package com.hi.music.player.ui.activity;
import static android.view.Gravity.CENTER_HORIZONTAL;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
@ -11,11 +8,9 @@ import android.view.View;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.MediaController;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import androidx.core.view.WindowCompat; import androidx.core.view.WindowCompat;
import androidx.core.view.WindowInsetsControllerCompat; import androidx.core.view.WindowInsetsControllerCompat;
import androidx.lifecycle.Observer; import androidx.lifecycle.Observer;
@ -26,9 +21,7 @@ import androidx.viewbinding.ViewBinding;
import com.bumptech.glide.Glide; import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.CircleCrop; import com.bumptech.glide.load.resource.bitmap.CircleCrop;
import com.gyf.immersionbar.ImmersionBar;
import com.hi.music.player.MusicApplication; import com.hi.music.player.MusicApplication;
import com.hi.music.player.R;
import com.hi.music.player.databinding.ActivityBaseBinding; import com.hi.music.player.databinding.ActivityBaseBinding;
import com.hi.music.player.databinding.LayoutPanelBinding; import com.hi.music.player.databinding.LayoutPanelBinding;
import com.hi.music.player.helper.CommonUtils; import com.hi.music.player.helper.CommonUtils;
@ -37,8 +30,6 @@ import com.hi.music.player.helper.ViewModelScope;
import com.hi.music.player.media3.MyMediaControllerManager; import com.hi.music.player.media3.MyMediaControllerManager;
import com.hi.music.player.ui.activity.viewmodel.VMApplication; 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(); private final ViewModelScope mViewModelScope = new ViewModelScope();
@ -108,10 +99,8 @@ public abstract class BaseActivity<T extends ViewBinding> extends AppCompatActiv
public void onClick(View v) { public void onClick(View v) {
panelVb.imPlay.setSelected(!panelVb.imPlay.isSelected()); panelVb.imPlay.setSelected(!panelVb.imPlay.isSelected());
if (panelVb.imPlay.isSelected()) { if (panelVb.imPlay.isSelected()) {
// panelVb.imPlay.setImageResource(R.drawable.panel_icon_pause);
mediaControllerManager.play(); mediaControllerManager.play();
} else { } else {
// panelVb.imPlay.setImageResource(R.drawable.panel_icon_play);
mediaControllerManager.pause(); mediaControllerManager.pause();
} }
@ -163,7 +152,7 @@ public abstract class BaseActivity<T extends ViewBinding> extends AppCompatActiv
case Player.STATE_ENDED: case Player.STATE_ENDED:
case Player.STATE_READY: case Player.STATE_READY:
case MyValue.PLAY_STATUS_CHANGE_MUSIC:
case MyValue.PLAY_STATUS_CODE_PAUSE: case MyValue.PLAY_STATUS_CODE_PAUSE:
case Player.STATE_BUFFERING: case Player.STATE_BUFFERING:
case MyValue.PLAY_STATUS_CODE_ERROR: case MyValue.PLAY_STATUS_CODE_ERROR:
@ -172,6 +161,7 @@ public abstract class BaseActivity<T extends ViewBinding> extends AppCompatActiv
//播放完成 //播放完成
panelVb.imPlay.setSelected(false); panelVb.imPlay.setSelected(false);
break; break;
case MyValue.PLAY_STATUS_CHANGE_MUSIC:
case MyValue.PLAY_STATUS_CODE_PLAYING: case MyValue.PLAY_STATUS_CODE_PLAYING:
panelVb.imPlay.setSelected(true); panelVb.imPlay.setSelected(true);
break; break;

View File

@ -85,7 +85,8 @@ public class CategoryListActivity extends BaseActivity<ActivityCategoryListBindi
@Override @Override
public void onChanged(ResponseCategoryList responseCategoryList) { public void onChanged(ResponseCategoryList responseCategoryList) {
if (responseCategoryList == null) { if (responseCategoryList == null) {
vb.pbLoading.setVisibility(View.GONE);
updateErrorLayout(getString(R.string.playList_loading_failed),true);
return; return;
} }
mCategoryList = responseCategoryList; mCategoryList = responseCategoryList;
@ -94,11 +95,20 @@ public class CategoryListActivity extends BaseActivity<ActivityCategoryListBindi
} }
}); });
} }
private void updateErrorLayout(String msg, boolean isShow) {
if (isShow)
vb.layoutError.linearRetry.setVisibility(View.VISIBLE);
else vb.layoutError.linearRetry.setVisibility(View.GONE);
if(msg!= null&&!msg.isEmpty()){
vb.layoutError.tvErrorMsg.setText(msg);
}
}
@Override @Override
protected void onInitClick() { protected void onInitClick() {
vb.imBack.setOnClickListener(this); vb.imBack.setOnClickListener(this);
vb.btnPlay.setOnClickListener(this); vb.btnPlay.setOnClickListener(this);
vb.layoutError.tvRetry.setOnClickListener(this);
} }
@Override @Override
@ -128,6 +138,10 @@ public class CategoryListActivity extends BaseActivity<ActivityCategoryListBindi
intent.putExtra(MyValue.KEY_ENTER_SOURCE, MyValue.TYPE_ENTER_SOURCE_CATEGORY); intent.putExtra(MyValue.KEY_ENTER_SOURCE, MyValue.TYPE_ENTER_SOURCE_CATEGORY);
startActivity(intent); startActivity(intent);
vmApplication.reSetPlayList(mCategoryList.getList()); vmApplication.reSetPlayList(mCategoryList.getList());
}else if(v.equals(vb.layoutError.tvRetry)){
vb.pbLoading.setVisibility(View.VISIBLE);
updateErrorLayout(null,false);
vm.getList(browseId);
} }
} }
@ -139,14 +153,20 @@ public class CategoryListActivity extends BaseActivity<ActivityCategoryListBindi
break; break;
case MyValue.PAGE_TYPE_ALBUM: case MyValue.PAGE_TYPE_ALBUM:
vb.tvSingerName.setVisibility(View.VISIBLE); vb.tvSingerName.setVisibility(View.VISIBLE);
String singNameValue = "";
String singName = info.getSingName();
if(singName!= null&&!singName.isEmpty()){
singNameValue= singName;
}else {
String[] split = twoSubtitle.split(""); String[] split = twoSubtitle.split("");
CommonUtils.LogMsg("twoSubtitle=" + twoSubtitle);
if (split != null && split.length > 1) { if (split != null && split.length > 1) {
vb.tvSingerName.setText(split[1]); singNameValue = split[1];
for (ResponsePlayListInfo playListInfo : info.getList()) {
playListInfo.setSingerName(split[1]);
} }
}
CommonUtils.LogMsg("singNameValue=" + singNameValue);
vb.tvSingerName.setText(singNameValue);
for (ResponsePlayListInfo playListInfo : info.getList()) {
playListInfo.setSingerName(singNameValue);
} }
break; break;
} }
@ -177,8 +197,7 @@ public class CategoryListActivity extends BaseActivity<ActivityCategoryListBindi
@Override @Override
public boolean onResourceReady(@NonNull Drawable resource, @NonNull Object model, Target<Drawable> target, @NonNull DataSource dataSource, boolean isFirstResource) { public boolean onResourceReady(@NonNull Drawable resource, @NonNull Object model, Target<Drawable> target, @NonNull DataSource dataSource, boolean isFirstResource) {
CommonUtils.extractColorsFromImage(resource,vb.imBg);
// CommonUtils.extractColorsFromImage(resource,vb.imBg);
return false; return false;
} }
}) })

View File

@ -56,17 +56,10 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
private ResponseSingle responseSingle; private ResponseSingle responseSingle;
private VMPlay vmPlay; private VMPlay vmPlay;
// private VMApplication vmApplication;
private ResponsePlayUrl mCurPlayInfo;
private Handler mHandler; private Handler mHandler;
private Runnable mRunnable; private Runnable mRunnable;
// private MyMediaControllerManager mediaControllerManager;
private AdapterPlayList adapterPlayList; private AdapterPlayList adapterPlayList;
@ -112,13 +105,15 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
vmPlay = getActivityScopeViewModel(VMPlay.class); vmPlay = getActivityScopeViewModel(VMPlay.class);
// vmApplication = getApplicationScopeViewModel(VMApplication.class); // vmApplication = getApplicationScopeViewModel(VMApplication.class);
initMediaController(); initMediaController();
vb.progressBarLoading.setVisibility(View.VISIBLE); // vb.progressBarLoading.setVisibility(View.VISIBLE);
Intent intent = getIntent(); Intent intent = getIntent();
mEnterType = intent.getIntExtra(MyValue.KEY_ENTER_SOURCE, MyValue.TYPE_ENTER_SOURCE_SINGLE); mEnterType = intent.getIntExtra(MyValue.KEY_ENTER_SOURCE, MyValue.TYPE_ENTER_SOURCE_SINGLE);
initPlayerView(); initPlayerView();
initProgressHandler(); initProgressHandler();
CommonUtils.LogMsg("--------mEnterType=" + mEnterType);
switch (mEnterType) { switch (mEnterType) {
case MyValue.TYPE_ENTER_SOURCE_SINGLE: case MyValue.TYPE_ENTER_SOURCE_SINGLE:
// 0--首页单曲进入 // 0--首页单曲进入
@ -144,7 +139,6 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
ResponsePlayListInfo playListInfo = (ResponsePlayListInfo) intent.getSerializableExtra(MyValue.KEY_PLAY_ACTIVITY_CATEGORY_LIST); ResponsePlayListInfo playListInfo = (ResponsePlayListInfo) intent.getSerializableExtra(MyValue.KEY_PLAY_ACTIVITY_CATEGORY_LIST);
mDefaultPlayStartIndex = intent.getIntExtra(MyValue.KEY_PLAY_ACTIVITY_CATEGORY_LIST_INDEX, mDefaultPlayStartIndex); mDefaultPlayStartIndex = intent.getIntExtra(MyValue.KEY_PLAY_ACTIVITY_CATEGORY_LIST_INDEX, mDefaultPlayStartIndex);
videoId = playListInfo.getVideoId(); videoId = playListInfo.getVideoId();
CommonUtils.LogMsg("--------更新---videoId=" + videoId);
break; break;
case MyValue.TYPE_ENTER_SOURCE_MV: case MyValue.TYPE_ENTER_SOURCE_MV:
@ -183,16 +177,15 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
if (customerUrlInfo.isNeedPlayNow() && customerUrlInfo.getPlayUrl() == null) { if (customerUrlInfo.isNeedPlayNow() && customerUrlInfo.getPlayUrl() == null) {
// TODO: 2024/9/26 需要马上播放这首歌曲但是此次网络请求失败 // TODO: 2024/9/26 需要马上播放这首歌曲但是此次网络请求失败
CommonUtils.LogErrorMsg("-------------需要马上播放这首歌曲,但是此次网络请求失败"); CommonUtils.LogErrorMsg("-------------需要马上播放这首歌曲,但是此次网络请求失败");
updateErrorLayout(getString(R.string.song_loading_failed),true);
netError = 1; netError = 1;
mCustomerUrlInfo = customerUrlInfo; mCustomerUrlInfo = customerUrlInfo;
initShowPlayList(false); initShowPlayList(false);
vb.linearRetry.setVisibility(View.VISIBLE);
vb.progressBarLoading.setVisibility(View.GONE); vb.progressBarLoading.setVisibility(View.GONE);
mediaControllerManager.pause(); mediaControllerManager.pause();
return; return;
} }
mCurPlayInfo = customerUrlInfo.getPlayUrl();
int second = customerUrlInfo.getPlayMusicIndex(); int second = customerUrlInfo.getPlayMusicIndex();
boolean needPlayNow = customerUrlInfo.isNeedPlayNow(); boolean needPlayNow = customerUrlInfo.isNeedPlayNow();
if (needPlayNow) { if (needPlayNow) {
@ -211,12 +204,13 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
if (playList == null) { if (playList == null) {
CommonUtils.LogErrorMsg("--------更新-playList null"); CommonUtils.LogErrorMsg("--------更新-playList null");
netError = 0; netError = 0;
vb.linearRetry.setVisibility(View.VISIBLE); updateErrorLayout(getString(R.string.playList_loading_failed),true);
vb.progressBarLoading.setVisibility(View.GONE);
return; return;
} }
CommonUtils.LogMsg("--------更新-playList " + playList.size() + "--videoId=" + videoId); CommonUtils.LogMsg("--------更新-playList " + playList.size() + "--videoId=" + videoId);
if (playList.size() > 0) { if (playList.size() > 0) {
vb.linearRetry.setVisibility(View.GONE); updateErrorLayout(null,false);
setPlayListAndGetUrl(playList, videoId, mDefaultPlayStartIndex); setPlayListAndGetUrl(playList, videoId, mDefaultPlayStartIndex);
} }
@ -224,6 +218,16 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
}); });
} }
private void updateErrorLayout(String msg, boolean isShow) {
if (isShow)
vb.layoutError.linearRetry.setVisibility(View.VISIBLE);
else vb.layoutError.linearRetry.setVisibility(View.GONE);
if(msg!= null&&!msg.isEmpty()){
vb.layoutError.tvErrorMsg.setText(msg);
}
}
/** /**
* 设置播放列表并请求当前需要播放的音乐url * 设置播放列表并请求当前需要播放的音乐url
* *
@ -241,7 +245,7 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
private void initPlayerView() { private void initPlayerView() {
vb.playerView.setShowRewindButton(false); vb.playerView.setShowRewindButton(false);
vb.playerView.setShowPreviousButton(false); vb.playerView.setShowPreviousButton(false);
vb.playerView.setDefaultArtwork(ContextCompat.getDrawable(this, R.mipmap.ic_launcher)); vb.playerView.setPlayer(mediaControllerManager.getMediaController());
} }
private void initMediaController() { private void initMediaController() {
@ -270,7 +274,7 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
case Player.STATE_BUFFERING: case Player.STATE_BUFFERING:
//快进没有缓冲的时候触发 //快进没有缓冲的时候触发
vb.btnPlay.setSelected(false); vb.btnPlay.setSelected(false);
vb.progressBarLoading.setVisibility(View.VISIBLE); // vb.progressBarLoading.setVisibility(View.VISIBLE);
CommonUtils.LogMsg("-------------缓冲"); CommonUtils.LogMsg("-------------缓冲");
break; break;
case Player.STATE_READY: case Player.STATE_READY:
@ -297,7 +301,7 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
CommonUtils.LogMsg("------------- 播放ing getCurIndex=" + mediaControllerManager.getCurIndex()); CommonUtils.LogMsg("------------- 播放ing getCurIndex=" + mediaControllerManager.getCurIndex());
vb.progressBarLoading.setVisibility(View.GONE); vb.progressBarLoading.setVisibility(View.GONE);
vb.linearRetry.setVisibility(View.GONE); updateErrorLayout(null,false);
vb.btnPlay.setSelected(true); vb.btnPlay.setSelected(true);
vb.layoutPlayList.imPlay.setSelected(true); vb.layoutPlayList.imPlay.setSelected(true);
break; break;
@ -315,7 +319,7 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
@Override @Override
public void onRequestNextUri(String videoId, int playListIndex, boolean playNow) { public void onRequestNextUri(String videoId, int playListIndex, boolean playNow) {
if (playNow) { if (playNow) {
vb.progressBarLoading.setVisibility(View.VISIBLE); // vb.progressBarLoading.setVisibility(View.VISIBLE);
} }
vmPlay.getPlayUrl(videoId, playListIndex, playNow); vmPlay.getPlayUrl(videoId, playListIndex, playNow);
} }
@ -338,7 +342,7 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
vb.btnPrevious.setOnClickListener(this); vb.btnPrevious.setOnClickListener(this);
vb.imBack.setOnClickListener(this); vb.imBack.setOnClickListener(this);
vb.btnMusicList.setOnClickListener(this); vb.btnMusicList.setOnClickListener(this);
vb.tvRetry.setOnClickListener(this); vb.layoutError.tvRetry.setOnClickListener(this);
vb.btnLoop.setOnClickListener(this); vb.btnLoop.setOnClickListener(this);
} }
@ -396,6 +400,7 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
} }
private void loadCovert(String url) { private void loadCovert(String url) {
Glide.with(MusicApplication.myApplication) Glide.with(MusicApplication.myApplication)
.asDrawable() .asDrawable()
.apply(RequestOptions.bitmapTransform(new RoundedCorners(CommonUtils.dpToPx(16)))) .apply(RequestOptions.bitmapTransform(new RoundedCorners(CommonUtils.dpToPx(16))))
@ -405,22 +410,25 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
@Override @Override
public boolean onLoadFailed(@Nullable GlideException e, @Nullable Object model, @NonNull Target<Drawable> target, boolean isFirstResource) { public boolean onLoadFailed(@Nullable GlideException e, @Nullable Object model, @NonNull Target<Drawable> target, boolean isFirstResource) {
CommonUtils.LogMsg(e.getMessage()); CommonUtils.LogMsg(e.getMessage());
netError = 2; // netError = 2;
vb.linearRetry.setVisibility(View.VISIBLE); // vb.tvErrorMsg.setText(getString(R.string.image_loading_failed));
// vb.linearRetry.setVisibility(View.VISIBLE);
return false; return false;
} }
@OptIn(markerClass = UnstableApi.class) @OptIn(markerClass = UnstableApi.class)
@Override @Override
public boolean onResourceReady(@NonNull Drawable resource, @NonNull Object model, Target<Drawable> target, @NonNull DataSource dataSource, boolean isFirstResource) { public boolean onResourceReady(@NonNull Drawable resource, @NonNull Object model, Target<Drawable> target, @NonNull DataSource dataSource, boolean isFirstResource) {
CommonUtils.getDominantDarkColor1(resource, new onImageColorListener() { vb.playerView.setDefaultArtwork(resource);
CommonUtils.getMainColor(resource, new onImageColorListener() {
@Override @Override
public void onImageColor(int color) { public void onImageColor(int color) {
if (color == -1) { if (color == -1) {
return; return;
} }
lighterColor = CommonUtils.adjustBrightness(color, 1.2f); // 比原始颜色亮 20% lighterColor = CommonUtils.adjustBrightness(color, 1f); // 比原始颜色亮 20%
darkerColor = CommonUtils.adjustBrightness(color, 0.8f); // 比原始颜色暗 20% darkerColor = CommonUtils.adjustBrightness(color, 0.6f); // 比原始颜色暗 20%
gradientDrawable = new GradientDrawable( gradientDrawable = new GradientDrawable(
GradientDrawable.Orientation.TOP_BOTTOM, GradientDrawable.Orientation.TOP_BOTTOM,
new int[]{lighterColor, darkerColor} // 浅到深渐变 new int[]{lighterColor, darkerColor} // 浅到深渐变
@ -430,15 +438,34 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
if (vb.layoutPlayList.linearLayout.getVisibility() == View.VISIBLE) { if (vb.layoutPlayList.linearLayout.getVisibility() == View.VISIBLE) {
updatePlayListColor(); updatePlayListColor();
} }
} }
}); });
// CommonUtils.getDominantDarkColor1(resource, new onImageColorListener() {
// @Override
// public void onImageColor(int color) {
// if (color == -1) {
// return;
// }
// lighterColor = CommonUtils.adjustBrightness(color, 1f); // 比原始颜色亮 20%
// darkerColor = CommonUtils.adjustBrightness(color, 0.6f); // 比原始颜色暗 20%
// gradientDrawable = new GradientDrawable(
// GradientDrawable.Orientation.TOP_BOTTOM,
// new int[]{lighterColor, darkerColor} // 浅到深渐变
// );
// vb.rootLayout.setBackground(gradientDrawable);
//
// if (vb.layoutPlayList.linearLayout.getVisibility() == View.VISIBLE) {
// updatePlayListColor();
// }
//
//
// }
// });
return false; return false;
} }
}) })
.into(vb.imCovert); .preload();
} }
@ -483,8 +510,8 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
mediaControllerManager.playNext(new onPlayNextListener() { mediaControllerManager.playNext(new onPlayNextListener() {
@Override @Override
public void onPlayNext(boolean hasNext) { public void onPlayNext(boolean hasNext) {
if(!hasNext){ if (!hasNext) {
Toast.makeText(PlayActivity.this,getString(R.string.no_next_song_yet),Toast.LENGTH_SHORT).show(); Toast.makeText(PlayActivity.this, getString(R.string.no_next_song_yet), Toast.LENGTH_SHORT).show();
} }
} }
}); });
@ -505,10 +532,10 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
if (adapterPlayList != null) { if (adapterPlayList != null) {
adapterPlayList.updateCurMusicAnimation(); adapterPlayList.updateCurMusicAnimation();
} }
} else if (v.equals(vb.tvRetry)) { } else if (v.equals(vb.layoutError.tvRetry)) {
//重试按钮 //重试按钮
vb.linearRetry.setVisibility(View.GONE); updateErrorLayout(null,false);
switch (netError){ switch (netError) {
case 0: case 0:
switch (mEnterType) { switch (mEnterType) {
case MyValue.TYPE_ENTER_SOURCE_SINGLE: case MyValue.TYPE_ENTER_SOURCE_SINGLE:
@ -601,7 +628,7 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
updatePlayListColor(); updatePlayListColor();
Glide.with(MusicApplication.myApplication) Glide.with(MusicApplication.myApplication)
.asDrawable() .asDrawable()
.apply(RequestOptions.bitmapTransform(new RoundedCorners(CommonUtils.dpToPx(10)))) // .apply(RequestOptions.bitmapTransform(new RoundedCorners(CommonUtils.dpToPx(10))))
.load(artworkUri) .load(artworkUri)
.placeholder(R.drawable.placeholder) .placeholder(R.drawable.placeholder)
.listener(new RequestListener<Drawable>() { .listener(new RequestListener<Drawable>() {

View File

@ -40,7 +40,7 @@ public class ResultListActivity extends BaseActivity<ActivityResultListBinding>
@Override @Override
protected void onCreateInit() { protected void onCreateInit() {
vm = getActivityScopeViewModel(VMResultList.class); vm = getActivityScopeViewModel(VMResultList.class);
String key = getIntent().getStringExtra("key"); String key = getIntent().getStringExtra(MyValue.KEY_SEARCH_RESULT_BROWSER_ID);
vm.getList(key); vm.getList(key);
vm.data.observe(this, new Observer<ResponseResult>() { vm.data.observe(this, new Observer<ResponseResult>() {
@ -136,8 +136,7 @@ public class ResultListActivity extends BaseActivity<ActivityResultListBinding>
switch (pageType){ switch (pageType){
case "MUSIC_PAGE_TYPE_ALBUM": case "MUSIC_PAGE_TYPE_ALBUM":
//专辑 //专辑
CommonUtils.LogMsg("------------专辑-index="+index+"--subTitle="+subTitle);
case "MUSIC_PAGE_TYPE_PLAYLIST": case "MUSIC_PAGE_TYPE_PLAYLIST":
//精选 //精选
Intent intent1 = new Intent(this, CategoryListActivity.class); Intent intent1 = new Intent(this, CategoryListActivity.class);
@ -149,7 +148,7 @@ public class ResultListActivity extends BaseActivity<ActivityResultListBinding>
case "MUSIC_PAGE_TYPE_ARTIST": case "MUSIC_PAGE_TYPE_ARTIST":
//粉丝可能还喜欢 //粉丝可能还喜欢
Intent intent = new Intent(this, ResultListActivity.class); Intent intent = new Intent(this, ResultListActivity.class);
intent.putExtra("key", browserId); intent.putExtra(MyValue.KEY_SEARCH_RESULT_BROWSER_ID, browserId);
startActivity(intent); startActivity(intent);
finish(); finish();
break; break;

View File

@ -66,20 +66,24 @@ public class HomeFragment extends BaseFragment<FragmentHomeBinding> implements H
vmHome.getHome(); vmHome.getHome();
vmHome.data.observe(getViewLifecycleOwner(), new Observer<ResponseHome>() { vmHome.data.observe(getViewLifecycleOwner(), new Observer<ResponseHome>() {
@Override @Override
public void onChanged(ResponseHome responseHome) { public void onChanged(ResponseHome responseHome) {
if(responseHome == null){ if (responseHome == null) {
adapterHome.removeLoadingFooter(); adapterHome.removeLoadingFooter();
requestCount--; requestCount--;
return; return;
} }
List<ResponseHomeChild> childList1 = responseHome.getChildList(); List<ResponseHomeChild> childList1 = responseHome.getChildList();
if(childList1 == null) return; if (childList1 == null) return;
childList.addAll(childList1); childList.addAll(childList1);
adapterHome.removeLoadingFooter(); adapterHome.removeLoadingFooter();
adapterHome.addData(childList1); adapterHome.addData(childList1);
if (requestCount == 1) {
adapterHome.addLoadingFooter();
vmHome.getHomeMore();
requestCount++;
}
} }
@ -92,7 +96,7 @@ public class HomeFragment extends BaseFragment<FragmentHomeBinding> implements H
super.onScrolled(recyclerView, dx, dy); super.onScrolled(recyclerView, dx, dy);
LinearLayoutManager layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager(); LinearLayoutManager layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager();
if (layoutManager != null && layoutManager.findLastVisibleItemPosition() == childList.size() - 1) { if (layoutManager != null && layoutManager.findLastVisibleItemPosition() == childList.size() - 1) {
if (requestCount < totalPage&&!adapterHome.isLoadingAdded()) { if (requestCount < totalPage && !adapterHome.isLoadingAdded()) {
CommonUtils.LogMsg("------loadmore--"); CommonUtils.LogMsg("------loadmore--");
adapterHome.addLoadingFooter(); adapterHome.addLoadingFooter();
vmHome.getHomeMore(); vmHome.getHomeMore();
@ -109,7 +113,7 @@ public class HomeFragment extends BaseFragment<FragmentHomeBinding> implements H
@Override @Override
public void onClickItemSinger(ResponseSingle data) { public void onClickItemSinger(ResponseSingle data) {
FragmentActivity activity = getActivity(); FragmentActivity activity = getActivity();
if(activity!= null){ if (activity != null) {
Intent intent = new Intent(activity, PlayActivity.class); Intent intent = new Intent(activity, PlayActivity.class);
intent.putExtra(MyValue.KEY_PLAY_ACTIVITY_SINGER, data); intent.putExtra(MyValue.KEY_PLAY_ACTIVITY_SINGER, data);
startActivity(intent); startActivity(intent);
@ -119,22 +123,24 @@ public class HomeFragment extends BaseFragment<FragmentHomeBinding> implements H
@Override @Override
public void onClickItemCategory(ResponseCategory data) { public void onClickItemCategory(ResponseCategory data) {
FragmentActivity activity = getActivity(); FragmentActivity activity = getActivity();
if(activity!= null){ if (activity != null) {
String pageType = data.getPageType(); String pageType = data.getPageType();
String browseId = data.getBrowseId(); String browseId = data.getBrowseId();
String twoSubtitle = data.getTwoSubtitle(); String twoSubtitle = data.getTwoSubtitle();
if(pageType.equals(MyValue.PAGE_TYPE_MV)){ if (pageType.equals(MyValue.PAGE_TYPE_MV)||pageType.equals(MyValue.PAGE_TYPE_MV_LIST)) {
Intent intent = new Intent(activity, PlayActivity.class); Intent intent = new Intent(activity, PlayActivity.class);
intent.putExtra(MyValue.KEY_PLAY_ACTIVITY_MV, data); intent.putExtra(MyValue.KEY_PLAY_ACTIVITY_MV, data);
intent.putExtra(MyValue.KEY_ENTER_SOURCE, MyValue.TYPE_ENTER_SOURCE_MV); intent.putExtra(MyValue.KEY_ENTER_SOURCE, MyValue.TYPE_ENTER_SOURCE_MV);
startActivity(intent); startActivity(intent);
}else if(pageType.equals(MyValue.PAGE_TYPE_ALBUM)){ }
Intent intent = new Intent(activity, CategoryListActivity.class); // else if (pageType.equals(MyValue.PAGE_TYPE_ALBUM)) {
intent.putExtra(MyValue.KEY_CATEGORY_LIST_TYPE, pageType); // Intent intent = new Intent(activity, CategoryListActivity.class);
intent.putExtra(MyValue.KEY_CATEGORY_LIST_SINGER_NAME, twoSubtitle); // intent.putExtra(MyValue.KEY_CATEGORY_LIST_TYPE, pageType);
intent.putExtra(MyValue.KEY_CATEGORY_LIST_BROWSER_ID, browseId); // intent.putExtra(MyValue.KEY_CATEGORY_LIST_SINGER_NAME, twoSubtitle);
startActivity(intent); // intent.putExtra(MyValue.KEY_CATEGORY_LIST_BROWSER_ID, browseId);
}else { // startActivity(intent);
// }
else {
Intent intent = new Intent(activity, CategoryListActivity.class); Intent intent = new Intent(activity, CategoryListActivity.class);
intent.putExtra(MyValue.KEY_CATEGORY_LIST_TYPE, pageType); intent.putExtra(MyValue.KEY_CATEGORY_LIST_TYPE, pageType);
intent.putExtra(MyValue.KEY_CATEGORY_LIST_SINGER_NAME, twoSubtitle); intent.putExtra(MyValue.KEY_CATEGORY_LIST_SINGER_NAME, twoSubtitle);

View File

@ -150,7 +150,7 @@ public class SearchFragment extends BaseFragment<FragmentSearchBinding> implemen
if(beastBrowserId!= null&&!beastBrowserId.isEmpty()){ if(beastBrowserId!= null&&!beastBrowserId.isEmpty()){
Intent intent = new Intent(requireActivity(), ResultListActivity.class); Intent intent = new Intent(requireActivity(), ResultListActivity.class);
intent.putExtra("key", beastBrowserId); intent.putExtra(MyValue.KEY_SEARCH_RESULT_BROWSER_ID, beastBrowserId);
startActivity(intent); startActivity(intent);
}else { }else {
CommonUtils.LogMsg("---------击搜索结果的play按钮--beastVideoId="+beastVideoId); CommonUtils.LogMsg("---------击搜索结果的play按钮--beastVideoId="+beastVideoId);
@ -184,7 +184,7 @@ public class SearchFragment extends BaseFragment<FragmentSearchBinding> implemen
switch (pageType){ switch (pageType){
case "MUSIC_PAGE_TYPE_ARTIST": case "MUSIC_PAGE_TYPE_ARTIST":
Intent intent = new Intent(requireActivity(), ResultListActivity.class); Intent intent = new Intent(requireActivity(), ResultListActivity.class);
intent.putExtra("key", browserId); intent.putExtra(MyValue.KEY_SEARCH_RESULT_BROWSER_ID, browserId);
startActivity(intent); startActivity(intent);
break; break;
default: default:

View 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="13dp"/>
<solid android:color="@color/black"/>
</shape>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" <shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"> android:shape="rectangle">
<corners android:radius="10dp"/> <corners android:radius="8dp"/>
<solid android:color="@color/retry_bg"/> <solid android:color="@color/retry_bg"/>
</shape> </shape>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" <shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"> android:shape="rectangle">
<corners android:radius="10dp"/> <corners android:radius="8dp"/>
<solid android:color="@color/panel_bg"/> <solid android:color="@color/panel_bg"/>
</shape> </shape>

View File

@ -5,6 +5,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:id="@+id/frame_layout" android:id="@+id/frame_layout"
android:background="@color/color_transparent"
android:layout_height="match_parent"> android:layout_height="match_parent">

View File

@ -3,17 +3,22 @@
<FrameLayout 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:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/black" android:background="@color/black"
android:id="@+id/root_layout"
tools:context=".ui.activity.CategoryListActivity"> tools:context=".ui.activity.CategoryListActivity">
<ImageView <ImageView
android:id="@+id/im_bg" android:id="@+id/im_bg"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="200dp" /> android:layout_height="390dp" />
<View
android:layout_width="match_parent"
android:layout_height="390dp"
android:background="@drawable/black_gradient" />
<androidx.core.widget.NestedScrollView <androidx.core.widget.NestedScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
@ -29,9 +34,9 @@
<RelativeLayout <RelativeLayout
android:id="@+id/layout_covert" android:id="@+id/layout_covert"
android:layout_marginTop="60dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:layout_marginTop="77dp">
<ImageView <ImageView
android:id="@+id/imCovert" android:id="@+id/imCovert"
@ -58,8 +63,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/tvTitle" android:layout_below="@id/tvTitle"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:layout_marginStart="20dp" android:layout_marginStart="20dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="20dp" android:layout_marginEnd="20dp"
android:gravity="center" android:gravity="center"
android:textColor="@color/white" android:textColor="@color/white"
@ -71,8 +76,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/tvSingerName" android:layout_below="@id/tvSingerName"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:layout_marginStart="20dp" android:layout_marginStart="20dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="20dp" android:layout_marginEnd="20dp"
android:gravity="center" android:gravity="center"
android:textColor="@color/white" android:textColor="@color/white"
@ -85,16 +90,16 @@
android:layout_below="@id/tvSubTitle" android:layout_below="@id/tvSubTitle"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginTop="15dp" android:layout_marginTop="15dp"
android:visibility="invisible" android:src="@drawable/selector_icon_play"
android:src="@drawable/selector_icon_play" /> android:visibility="invisible" />
<ProgressBar <ProgressBar
android:id="@+id/pb_loading"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerInParent="true" android:layout_centerInParent="true"
android:indeterminateTint="@color/white" android:indeterminateTint="@color/white" />
android:id="@+id/pb_loading"/>
</RelativeLayout> </RelativeLayout>
@ -106,18 +111,20 @@
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
<FrameLayout
android:layout_width="match_parent"
android:background="@color/black"
android:layout_height="60dp">
<ImageView <ImageView
android:id="@+id/im_back" android:id="@+id/im_back"
android:layout_width="42dp" android:layout_width="42dp"
android:layout_height="match_parent" android:layout_height="42dp"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginTop="35dp"
android:padding="9dp" android:padding="9dp"
android:src="@drawable/arrow_bottom" /> android:src="@drawable/arrow_bottom" />
</FrameLayout>
<include
layout="@layout/layout_error"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="80dp"
android:id="@+id/layout_error"
android:layout_gravity="center" />
</FrameLayout> </FrameLayout>

View File

@ -24,68 +24,89 @@
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<ImageView <!-- <ImageView-->
android:id="@+id/im_covert" <!-- android:id="@+id/im_covert"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="300dp"-->
<!-- android:layout_marginStart="40dp"-->
<!-- android:layout_marginTop="30dp"-->
<!-- android:layout_marginEnd="40dp"-->
<!-- android:scaleType="centerCrop"-->
<!-- android:visibility="gone"-->
<!-- android:src="@drawable/placeholder"-->
<!-- app:layout_constraintLeft_toLeftOf="parent"-->
<!-- app:layout_constraintRight_toRightOf="parent"-->
<!-- app:layout_constraintTop_toBottomOf="@id/im_back" />-->
<androidx.cardview.widget.CardView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="300dp" android:layout_height="300dp"
android:layout_marginStart="40dp"
android:layout_marginTop="30dp" android:layout_marginTop="30dp"
android:layout_marginEnd="40dp" android:layout_marginStart="20dp"
android:scaleType="fitCenter" android:layout_marginEnd="20dp"
android:src="@drawable/placeholder" app:cardBackgroundColor="@color/black"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/im_back" />
<LinearLayout
android:id="@+id/linear_retry"
android:layout_width="210dp"
android:layout_height="120dp"
android:gravity="center"
android:orientation="vertical"
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/white"
android:textSize="18sp" />
<TextView
android:id="@+id/tv_retry"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:paddingStart="15dp"
android:paddingEnd="15dp"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:text="@string/retry"
android:background="@drawable/bg_retry_btn"
android:textColor="@color/white"
android:textSize="17sp" />
</LinearLayout>
<androidx.media3.ui.PlayerView
android:id="@+id/player_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/im_back" app:layout_constraintTop_toBottomOf="@id/im_back"
android:id="@+id/card_playerView"
app:cardElevation="0dp"
app:cardCornerRadius="8dp">
<androidx.media3.ui.PlayerView
android:id="@+id/player_view"
app:resize_mode="zoom"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:show_buffering="when_playing" app:show_buffering="when_playing"
app:show_shuffle_button="true" /> app:show_shuffle_button="false"
app:use_controller="false" />
</androidx.cardview.widget.CardView>
<include layout="@layout/layout_error"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/layout_error"
app:layout_constraintBottom_toBottomOf="@id/card_playerView"
app:layout_constraintLeft_toLeftOf="@id/card_playerView"
app:layout_constraintRight_toRightOf="@id/card_playerView"
app:layout_constraintTop_toTopOf="@id/card_playerView"/>
<!-- <LinearLayout-->
<!-- android:id="@+id/linear_retry"-->
<!-- android:layout_width="210dp"-->
<!-- android:layout_height="120dp"-->
<!-- android:background="@drawable/bg_retry"-->
<!-- android:gravity="center"-->
<!-- android:orientation="vertical"-->
<!-- android:visibility="gone"-->
<!-- app:layout_constraintBottom_toBottomOf="@id/card_playerView"-->
<!-- app:layout_constraintLeft_toLeftOf="@id/card_playerView"-->
<!-- app:layout_constraintRight_toRightOf="@id/card_playerView"-->
<!-- app:layout_constraintTop_toTopOf="@id/card_playerView">-->
<!-- <TextView-->
<!-- android:id="@+id/tv_error_msg"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="@string/An_error_occurred"-->
<!-- android:textColor="@color/white"-->
<!-- android:textSize="18sp" />-->
<!-- <TextView-->
<!-- android:id="@+id/tv_retry"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginTop="15dp"-->
<!-- android:background="@drawable/bg_retry_btn"-->
<!-- android:paddingStart="15dp"-->
<!-- android:paddingTop="8dp"-->
<!-- android:paddingEnd="15dp"-->
<!-- android:paddingBottom="8dp"-->
<!-- android:text="@string/retry"-->
<!-- android:textColor="@color/white"-->
<!-- android:textSize="17sp" />-->
<!-- </LinearLayout>-->
<TextView <TextView
@ -95,11 +116,12 @@
android:layout_marginTop="25dp" android:layout_marginTop="25dp"
android:layout_marginEnd="40dp" android:layout_marginEnd="40dp"
android:text="" android:text=""
android:layout_marginStart="10dp"
android:textColor="@color/text_color_1" android:textColor="@color/text_color_1"
android:textSize="19sp" android:textSize="19sp"
app:layout_constraintLeft_toLeftOf="@id/im_covert" app:layout_constraintLeft_toLeftOf="@id/card_playerView"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/im_covert" /> app:layout_constraintTop_toBottomOf="@id/card_playerView" />
<TextView <TextView
android:id="@+id/tv_singer_name" android:id="@+id/tv_singer_name"
@ -117,19 +139,17 @@
android:id="@+id/play_progress" android:id="@+id/play_progress"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="35dp"
android:layout_marginTop="25dp" android:layout_marginTop="25dp"
android:layout_marginEnd="35dp"
android:maxHeight="3dp" android:maxHeight="3dp"
android:paddingStart="5dp" android:paddingStart="5dp"
android:paddingLeft="0dp" android:paddingLeft="0dp"
android:paddingEnd="5dp" android:paddingEnd="5dp"
android:paddingRight="0dp" android:paddingRight="0dp"
android:progress="30" android:progress="3"
android:progressDrawable="@drawable/seekbar_progress_drawable" android:progressDrawable="@drawable/seekbar_progress_drawable"
android:thumb="@drawable/seekbar_thumb" android:thumb="@drawable/seekbar_thumb"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="@id/card_playerView"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="@id/card_playerView"
app:layout_constraintTop_toBottomOf="@id/tv_singer_name" /> app:layout_constraintTop_toBottomOf="@id/tv_singer_name" />
@ -140,7 +160,7 @@
android:layout_height="3dp" android:layout_height="3dp"
android:paddingStart="5dp" android:paddingStart="5dp"
android:paddingEnd="5dp" android:paddingEnd="5dp"
android:progress="100" android:progress="10"
android:progressDrawable="@drawable/horizontal_progressbar" android:progressDrawable="@drawable/horizontal_progressbar"
app:layout_constraintBottom_toBottomOf="@id/play_progress" app:layout_constraintBottom_toBottomOf="@id/play_progress"
app:layout_constraintLeft_toLeftOf="@id/play_progress" app:layout_constraintLeft_toLeftOf="@id/play_progress"
@ -196,8 +216,8 @@
android:layout_width="45dp" android:layout_width="45dp"
android:layout_height="45dp" android:layout_height="45dp"
android:layout_marginStart="24dp" android:layout_marginStart="24dp"
android:src="@mipmap/icon_next_true"
android:padding="12dp" android:padding="12dp"
android:src="@mipmap/icon_next_true"
app:layout_constraintBottom_toBottomOf="@id/btn_play" app:layout_constraintBottom_toBottomOf="@id/btn_play"
app:layout_constraintStart_toEndOf="@id/btn_play" app:layout_constraintStart_toEndOf="@id/btn_play"
app:layout_constraintTop_toTopOf="@id/btn_play" /> app:layout_constraintTop_toTopOf="@id/btn_play" />
@ -206,8 +226,8 @@
android:id="@+id/btn_music_list" android:id="@+id/btn_music_list"
android:layout_width="44dp" android:layout_width="44dp"
android:layout_height="44dp" android:layout_height="44dp"
android:src="@mipmap/icon_list"
android:padding="10dp" android:padding="10dp"
android:src="@mipmap/icon_list"
app:layout_constraintBottom_toBottomOf="@id/btn_play" app:layout_constraintBottom_toBottomOf="@id/btn_play"
app:layout_constraintLeft_toRightOf="@id/btn_next" app:layout_constraintLeft_toRightOf="@id/btn_next"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
@ -218,8 +238,8 @@
android:id="@+id/btn_loop" android:id="@+id/btn_loop"
android:layout_width="44dp" android:layout_width="44dp"
android:layout_height="44dp" android:layout_height="44dp"
android:src="@drawable/icon_looper_no"
android:padding="10dp" android:padding="10dp"
android:src="@drawable/icon_looper_no"
app:layout_constraintBottom_toBottomOf="@id/btn_play" app:layout_constraintBottom_toBottomOf="@id/btn_play"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/btn_previous" app:layout_constraintRight_toLeftOf="@id/btn_previous"

View File

@ -2,6 +2,7 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_marginTop="35dp" android:layout_marginTop="35dp"
android:orientation="vertical"> android:orientation="vertical">
@ -22,22 +23,30 @@
android:paddingEnd="10dp" android:paddingEnd="10dp"
android:paddingBottom="25dp"> android:paddingBottom="25dp">
<ImageView <androidx.cardview.widget.CardView
android:id="@+id/top_im"
android:layout_width="60dp" android:layout_width="60dp"
android:layout_height="60dp" android:layout_height="60dp"
android:scaleType="fitCenter" app:cardCornerRadius="6dp"
android:id="@+id/card_view"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
app:cardElevation="0dp">
<ImageView
android:id="@+id/top_im"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:adjustViewBounds="true"
android:src="@drawable/placeholder" /> android:src="@drawable/placeholder" />
</androidx.cardview.widget.CardView>
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignTop="@id/top_im" android:layout_alignTop="@id/card_view"
android:layout_alignBottom="@id/top_im" android:layout_alignBottom="@id/card_view"
android:layout_marginStart="15dp" android:layout_marginStart="15dp"
android:layout_toStartOf="@id/im_play" android:layout_toStartOf="@id/im_play"
android:layout_toEndOf="@id/top_im" android:layout_toEndOf="@id/card_view"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="vertical" android:orientation="vertical"
android:paddingEnd="15dp"> android:paddingEnd="15dp">

View File

@ -6,8 +6,6 @@
android:orientation="vertical" android:orientation="vertical"
tools:context=".ui.fragmnt.HomeFragment"> tools:context=".ui.fragmnt.HomeFragment">
<TextView <TextView
android:id="@+id/toolbar" android:id="@+id/toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -18,14 +16,11 @@
android:textColor="@color/white"/> android:textColor="@color/white"/>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_song_of_the_day" android:id="@+id/recycler_song_of_the_day"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingBottom="74dp" android:paddingStart="6dp" />
android:orientation="horizontal" />
</LinearLayout> </LinearLayout>

View File

@ -1,40 +1,61 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:orientation="vertical"> android:orientation="vertical">
<androidx.cardview.widget.CardView
android:id="@+id/header_card"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/black"
app:cardCornerRadius="8dp"
app:cardElevation="0dp">
<ImageView <ImageView
android:id="@+id/header" android:id="@+id/header"
android:layout_width="170dp" android:layout_width="180dp"
android:layout_height="170dp" android:layout_height="180dp"
android:src="@drawable/placeholder" /> android:layout_gravity="center"
android:adjustViewBounds="true"
android:scaleType="centerCrop" />
</androidx.cardview.widget.CardView>
<TextView <TextView
android:id="@+id/tv_title" android:id="@+id/tv_title"
android:layout_width="169dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ellipsize="end" android:layout_below="@id/header_card"
android:maxLines="2" android:layout_alignStart="@id/header_card"
android:layout_alignEnd="@id/header_card"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:text="@string/app_name" android:ellipsize="end"
android:gravity="start"
android:maxLines="2"
android:text="999999"
android:textColor="@color/text_color_1" android:textColor="@color/text_color_1"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView
android:id="@+id/tv_subtitle" android:id="@+id/tv_subtitle"
android:layout_width="169dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/tv_title"
android:layout_alignStart="@id/header_card"
android:layout_alignEnd="@id/header_card"
android:layout_marginTop="4dp" android:layout_marginTop="4dp"
android:ellipsize="end" android:ellipsize="end"
android:gravity="start"
android:maxLines="2" android:maxLines="2"
android:text="@string/app_name" android:text="ddddddd"
android:textColor="@color/text_color_2" android:textColor="@color/text_color_2"
android:textSize="12sp" /> android:textSize="12sp" />
</LinearLayout>
</RelativeLayout>

View File

@ -1,10 +1,11 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="70dp" android:layout_height="wrap_content"
android:paddingStart="15dp" android:paddingStart="15dp"
android:paddingEnd="15dp"
android:paddingTop="5dp" android:paddingTop="5dp"
android:paddingEnd="15dp"
android:paddingBottom="5dp"> android:paddingBottom="5dp">
<LinearLayout <LinearLayout
@ -12,32 +13,43 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="60dp"> android:layout_height="60dp">
<ImageView <androidx.cardview.widget.CardView
android:id="@+id/image" android:id="@+id/im_card"
android:layout_width="60dp" android:layout_width="60dp"
android:layout_height="60dp" android:layout_height="60dp"
android:scaleType="centerCrop" android:visibility="gone"
android:visibility="gone" /> app:cardCornerRadius="6dp"
app:cardElevation="0dp">
<ImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:scaleType="centerCrop" />
</androidx.cardview.widget.CardView>
<TextView <TextView
android:id="@+id/tv_position" android:id="@+id/tv_position"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/app_name"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="14sp" android:textSize="14sp"
android:textStyle="bold" android:textStyle="bold" />
android:layout_gravity="center"
android:text="@string/app_name" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_alignTop="@id/left_layout"
android:layout_alignBottom="@id/left_layout"
android:layout_marginStart="12dp" android:layout_marginStart="12dp"
android:layout_toStartOf="@id/tv_duration" android:layout_toStartOf="@id/tv_duration"
android:layout_toEndOf="@id/left_layout" android:layout_toEndOf="@id/left_layout"
android:gravity="center_vertical"
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
@ -62,10 +74,19 @@
<TextView <TextView
android:id="@+id/tv_duration" android:id="@+id/tv_duration"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="0dp"
android:text="@string/app_name" android:layout_alignTop="@id/left_layout"
android:layout_alignBottom="@id/left_layout"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_centerVertical="true" android:gravity="center_vertical"
android:text="@string/app_name"
android:textColor="@color/white_60_color" android:textColor="@color/white_60_color"
android:textSize="12sp" /> android:textSize="12sp" />
<View
android:id="@+id/place"
android:layout_width="wrap_content"
android:layout_height="74dp"
android:layout_below="@id/left_layout" />
</RelativeLayout> </RelativeLayout>

View File

@ -11,19 +11,27 @@
android:layout_marginStart="15dp" android:layout_marginStart="15dp"
android:textColor="@color/text_color_1" android:textColor="@color/text_color_1"
android:paddingBottom="10dp" android:paddingBottom="10dp"
android:paddingTop="15dp" android:paddingTop="10dp"
android:textSize="18sp" /> android:textSize="18sp" />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_singer" android:id="@+id/recycler_singer"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="400dp" /> android:visibility="gone"
android:layout_height="wrap_content" />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_category" android:id="@+id/recycler_category"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:visibility="gone"
android:paddingStart="5dp" android:paddingStart="7dp"
android:paddingEnd="5dp" /> android:paddingEnd="14dp"
android:layout_height="wrap_content" />
<View
android:layout_width="wrap_content"
android:id="@+id/place"
android:layout_height="74dp" />
</LinearLayout> </LinearLayout>

View File

@ -6,22 +6,31 @@
android:id="@+id/item_layout" android:id="@+id/item_layout"
android:paddingStart="20dp"> android:paddingStart="20dp">
<ImageView <androidx.cardview.widget.CardView
android:id="@+id/im_covert" android:id="@+id/card"
android:layout_width="60dp" android:layout_width="60dp"
android:layout_height="60dp" android:layout_height="60dp"
app:cardElevation="0dp"
android:layout_centerVertical="true" android:layout_centerVertical="true"
app:cardCornerRadius="6dp">
<ImageView
android:id="@+id/im_covert"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:adjustViewBounds="true"
android:src="@drawable/placeholder" /> android:src="@drawable/placeholder" />
</androidx.cardview.widget.CardView>
<com.hi.music.player.customerview.AnimaPlayingView <com.hi.music.player.customerview.AnimaPlayingView
android:id="@+id/view_playing" android:id="@+id/view_playing"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignStart="@id/im_covert" android:layout_alignStart="@id/card"
android:layout_alignTop="@id/im_covert" android:layout_alignTop="@id/card"
android:layout_alignEnd="@id/im_covert" android:layout_alignEnd="@id/card"
android:layout_alignBottom="@id/im_covert" android:layout_alignBottom="@id/card"
android:layout_marginBottom="10dp" /> android:layout_marginBottom="10dp" />
@ -30,7 +39,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginStart="12dp" android:layout_marginStart="12dp"
android:layout_toEndOf="@id/im_covert" android:layout_toEndOf="@id/card"
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView

View File

@ -20,8 +20,13 @@
android:id="@+id/list_child" android:id="@+id/list_child"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingBottom="5dp"
android:layout_below="@id/tv_header_title" /> android:layout_below="@id/tv_header_title" />
<View
android:layout_width="wrap_content"
android:id="@+id/place"
android:layout_below="@id/list_child"
android:layout_height="74dp" />
</RelativeLayout> </RelativeLayout>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<TextView <TextView
@ -17,7 +18,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:layout_below="@id/tv_header_title"
android:id="@+id/layout" android:id="@+id/layout"
android:orientation="vertical"> android:orientation="vertical">
@ -85,5 +85,8 @@
android:layout_below="@id/layout_best" /> android:layout_below="@id/layout_best" />
</LinearLayout> </LinearLayout>
<View
</RelativeLayout> android:layout_width="wrap_content"
android:id="@+id/place"
android:layout_height="74dp" />
</LinearLayout>

View File

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="80dp" android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:orientation="vertical"> android:orientation="vertical">
@ -15,10 +16,9 @@
android:src="@drawable/placeholder" /> android:src="@drawable/placeholder" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:layout_marginEnd="50dp"
android:paddingEnd="10dp" android:paddingEnd="10dp"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toEndOf="@id/header" android:layout_toEndOf="@id/header"
@ -28,8 +28,9 @@
android:id="@+id/tv_song_name" android:id="@+id/tv_song_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/app_name" android:text="99999999999999999999999999999999999"
android:maxLines="1" android:maxLines="1"
android:maxWidth="200dp"
android:ellipsize="end" android:ellipsize="end"
android:textColor="@color/text_color_1" android:textColor="@color/text_color_1"
android:textSize="14sp" /> android:textSize="14sp" />
@ -42,9 +43,10 @@
android:layout_marginTop="4dp" android:layout_marginTop="4dp"
android:text="@string/app_name" android:text="@string/app_name"
android:maxLines="1" android:maxLines="1"
android:maxWidth="200dp"
android:ellipsize="end" android:ellipsize="end"
android:textColor="@color/text_color_1" android:textColor="@color/text_color_2"
android:textSize="14sp" /> android:textSize="12sp" />
<!-- <TextView--> <!-- <TextView-->
<!-- android:id="@+id/tv_describe"--> <!-- android:id="@+id/tv_describe"-->

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/linear_retry"
android:layout_width="210dp"
android:layout_height="120dp"
android:background="@drawable/bg_retry"
android:gravity="center"
android:visibility="gone"
android:orientation="vertical">
<TextView
android:id="@+id/tv_error_msg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/An_error_occurred"
android:textColor="@color/white"
android:textSize="18sp" />
<TextView
android:id="@+id/tv_retry"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="@drawable/bg_retry_btn"
android:paddingStart="15dp"
android:paddingTop="8dp"
android:paddingEnd="15dp"
android:paddingBottom="8dp"
android:text="@string/retry"
android:textColor="@color/white"
android:textSize="17sp" />
</LinearLayout>
</FrameLayout>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<View xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:id="@+id/place_view"
android:layout_height="74dp">
</View>

View File

@ -27,4 +27,7 @@
<string name="search_hint">Search songs, artists…</string> <string name="search_hint">Search songs, artists…</string>
<string name="play">Play</string> <string name="play">Play</string>
<string name="no_next_song_yet">There is no next song yet</string> <string name="no_next_song_yet">There is no next song yet</string>
<string name="image_loading_failed">Image loading failed</string>
<string name="song_loading_failed">Song loading failed</string>
<string name="playList_loading_failed">Playlist loading failed</string>
</resources> </resources>