添加喜爱列表
This commit is contained in:
parent
c3cf575e02
commit
39020493e6
@ -1,5 +1,8 @@
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
// id("org.jetbrains.kotlin.android")
|
||||
// id ("kotlin-kapt")
|
||||
id("io.objectbox")
|
||||
}
|
||||
|
||||
android {
|
||||
@ -26,6 +29,9 @@ android {
|
||||
)
|
||||
}
|
||||
}
|
||||
// kotlinOptions{
|
||||
// jvmTarget = "1.8"
|
||||
// }
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
@ -56,7 +62,7 @@ dependencies {
|
||||
implementation("androidx.paging:paging-runtime-ktx:3.3.2")
|
||||
|
||||
implementation("com.github.bumptech.glide:glide:4.16.0")
|
||||
annotationProcessor("com.github.bumptech.glide:compiler:4.16.0")
|
||||
// kapt("com.github.bumptech.glide:compiler:4.16.0")
|
||||
// Glide 的图片变换库,包括高斯模糊
|
||||
implementation ("jp.wasabeef:glide-transformations:4.3.0")
|
||||
|
||||
@ -75,6 +81,7 @@ dependencies {
|
||||
//----------media3
|
||||
|
||||
|
||||
implementation ("com.geyifeng.immersionbar:immersionbar:3.2.2")
|
||||
implementation ("com.geyifeng.immersionbar:immersionbar-components:3.2.2")
|
||||
|
||||
// implementation ("com.geyifeng.immersionbar:immersionbar:3.2.2")
|
||||
// implementation ("com.geyifeng.immersionbar:immersionbar-components:3.2.2")
|
||||
}
|
||||
62
app/objectbox-models/default.json
Normal file
62
app/objectbox-models/default.json
Normal file
@ -0,0 +1,62 @@
|
||||
{
|
||||
"_note1": "KEEP THIS FILE! Check it into a version control system (VCS) like git.",
|
||||
"_note2": "ObjectBox manages crucial IDs for your object model. See docs for details.",
|
||||
"_note3": "If you have VCS merge conflicts, you must resolve them according to ObjectBox docs.",
|
||||
"entities": [
|
||||
{
|
||||
"id": "1:7260744904384376845",
|
||||
"lastPropertyId": "7:5800407979727692220",
|
||||
"name": "BoxLikeSong",
|
||||
"properties": [
|
||||
{
|
||||
"id": "1:745788217094734749",
|
||||
"name": "id",
|
||||
"type": 6,
|
||||
"flags": 1
|
||||
},
|
||||
{
|
||||
"id": "2:2477600117284929424",
|
||||
"name": "songName",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "3:79559302744310012",
|
||||
"name": "singerName",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "4:5779546109489824553",
|
||||
"name": "videoId",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "5:2803528372963628007",
|
||||
"name": "covert",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "6:3852926266057742085",
|
||||
"name": "durationMs",
|
||||
"type": 6
|
||||
},
|
||||
{
|
||||
"id": "7:5800407979727692220",
|
||||
"name": "duration",
|
||||
"type": 9
|
||||
}
|
||||
],
|
||||
"relations": []
|
||||
}
|
||||
],
|
||||
"lastEntityId": "1:7260744904384376845",
|
||||
"lastIndexId": "0:0",
|
||||
"lastRelationId": "0:0",
|
||||
"lastSequenceId": "0:0",
|
||||
"modelVersion": 5,
|
||||
"modelVersionParserMinimum": 5,
|
||||
"retiredEntityUids": [],
|
||||
"retiredIndexUids": [],
|
||||
"retiredPropertyUids": [],
|
||||
"retiredRelationUids": [],
|
||||
"version": 1
|
||||
}
|
||||
@ -22,6 +22,9 @@
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.MusicApp"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".ui.activity.LikeSongActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".ui.activity.ResultListActivity"
|
||||
android:exported="false" />
|
||||
@ -41,7 +44,7 @@
|
||||
<activity
|
||||
android:name=".ui.activity.A_HomeActivity"
|
||||
android:exported="true"
|
||||
android:screenOrientation="portrait"></activity>
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".ui.activity.HomeActivity"
|
||||
android:exported="true">
|
||||
|
||||
@ -5,7 +5,11 @@ import android.content.Context;
|
||||
|
||||
import com.hi.music.player.api.MediaControllerStatusListener;
|
||||
import com.hi.music.player.helper.CommonUtils;
|
||||
import com.hi.music.player.javabean.MyObjectBox;
|
||||
import com.hi.music.player.media3.MyMediaControllerManager;
|
||||
import com.hi.music.player.objectbox.ObjectBoxManager;
|
||||
|
||||
import io.objectbox.BoxStore;
|
||||
|
||||
public class MusicApplication extends Application {
|
||||
|
||||
@ -16,6 +20,8 @@ public class MusicApplication extends Application {
|
||||
|
||||
public static String visitorData;
|
||||
|
||||
|
||||
|
||||
public static void setVisitorData(String visitorData) {
|
||||
MusicApplication.visitorData = visitorData;
|
||||
}
|
||||
@ -28,6 +34,7 @@ public class MusicApplication extends Application {
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
myApplication = this;
|
||||
ObjectBoxManager.init(this);
|
||||
MyMediaControllerManager.getInstance().init(new MediaControllerStatusListener() {
|
||||
@Override
|
||||
public void onMediaControllerComplete(boolean isOk) {
|
||||
@ -35,4 +42,6 @@ public class MusicApplication extends Application {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,75 @@
|
||||
package com.hi.music.player.adapter;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.engine.GlideException;
|
||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||
import com.bumptech.glide.request.RequestListener;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
import com.hi.music.player.MusicApplication;
|
||||
import com.hi.music.player.R;
|
||||
import com.hi.music.player.databinding.ItemLikeSongBinding;
|
||||
import com.hi.music.player.databinding.ItemSingerBinding;
|
||||
import com.hi.music.player.helper.CommonUtils;
|
||||
import com.hi.music.player.javabean.BoxLikeSong;
|
||||
import com.hi.music.player.javabean.response.child.ResponseSingle;
|
||||
|
||||
public class AdapterLikeSong extends BaseAdapter<BoxLikeSong, ItemLikeSongBinding> {
|
||||
|
||||
@Override
|
||||
protected ItemLikeSongBinding getViewBinding(ViewGroup parent) {
|
||||
return ItemLikeSongBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
VHolder<ItemLikeSongBinding> itemHolder = (VHolder<ItemLikeSongBinding>) holder;
|
||||
ItemLikeSongBinding vb = itemHolder.getVb();
|
||||
BoxLikeSong boxLikeSong = data.get(position);
|
||||
|
||||
|
||||
Glide.with(MusicApplication.myApplication)
|
||||
.asDrawable()
|
||||
.load(boxLikeSong.getCovert())
|
||||
.apply(RequestOptions.bitmapTransform(new RoundedCorners(CommonUtils.dpToPx(4))))
|
||||
.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.imCovert);
|
||||
vb.tvTitle.setText(boxLikeSong.getSongName());
|
||||
vb.tvSingerName.setText(boxLikeSong.getSingerName());
|
||||
|
||||
vb.getRoot().setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if(homeItemClickListener!= null){
|
||||
int absoluteAdapterPosition = itemHolder.getAbsoluteAdapterPosition();
|
||||
homeItemClickListener.onClickLikeSong(boxLikeSong,absoluteAdapterPosition);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
package com.hi.music.player.api;
|
||||
|
||||
import com.hi.music.player.javabean.BoxLikeSong;
|
||||
import com.hi.music.player.javabean.response.ResponsePlayListInfo;
|
||||
import com.hi.music.player.javabean.response.ResponseSearch;
|
||||
import com.hi.music.player.javabean.response.child.ResponseCategory;
|
||||
@ -47,7 +48,7 @@ public interface HomeItemClickListener {
|
||||
}
|
||||
|
||||
/**
|
||||
* 点击搜索结果第
|
||||
* 点击搜索结果
|
||||
* @param
|
||||
*/
|
||||
default void onClickSearchResult(ResponseSearchChild responseSearchChild){
|
||||
@ -66,4 +67,9 @@ public interface HomeItemClickListener {
|
||||
|
||||
}
|
||||
|
||||
|
||||
default void onClickLikeSong(BoxLikeSong boxLikeSong, int index){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
package com.hi.music.player.api;
|
||||
|
||||
import com.hi.music.player.javabean.BoxLikeSong;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface LikeSongListener {
|
||||
|
||||
void onLikeSongChange(List<BoxLikeSong> data);
|
||||
}
|
||||
@ -41,8 +41,16 @@ public class MyValue {
|
||||
*/
|
||||
public static String KEY_PLAY_ACTIVITY_MV = "click_mv";
|
||||
|
||||
/**
|
||||
* 进入PlayActivity传递的即将播放的歌曲videoId
|
||||
*/
|
||||
public static String KEY_PLAY_VIDEO_ID = "video_id";
|
||||
|
||||
|
||||
/**
|
||||
* 进入PlayActivity传递的即将播放的歌曲index(针对在进入PlayActivity之前已经调用vmApplication.reSetPlayList
|
||||
* 重置了播放列表的情况)
|
||||
*/
|
||||
public static String KEY_PLAY_INDEX = "play_index";
|
||||
|
||||
|
||||
|
||||
@ -79,6 +87,10 @@ public class MyValue {
|
||||
public final static int TYPE_ENTER_PANEL = 3;
|
||||
|
||||
|
||||
//从喜爱歌曲进入
|
||||
public final static int TYPE_ENTER_LIKE= 4;
|
||||
|
||||
|
||||
//-----------------------------PlayActivity
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,80 @@
|
||||
package com.hi.music.player.javabean;
|
||||
|
||||
import io.objectbox.annotation.Entity;
|
||||
import io.objectbox.annotation.Id;
|
||||
|
||||
@Entity
|
||||
public class BoxLikeSong {
|
||||
@Id
|
||||
public long id;
|
||||
private String songName;
|
||||
|
||||
private String singerName;
|
||||
private String videoId;
|
||||
|
||||
private String covert;
|
||||
private long durationMs;
|
||||
private String duration ;
|
||||
|
||||
|
||||
|
||||
public BoxLikeSong( ) {
|
||||
|
||||
}
|
||||
|
||||
public BoxLikeSong(String songName, String singerName, String videoId, String covert,long durationMs,String duration) {
|
||||
this.songName = songName;
|
||||
this.singerName = singerName;
|
||||
this.videoId = videoId;
|
||||
this.covert = covert;
|
||||
this.durationMs = durationMs;
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
|
||||
public long getDurationMs() {
|
||||
return durationMs;
|
||||
}
|
||||
public String getDuration() {
|
||||
return duration;
|
||||
}
|
||||
|
||||
public void setDuration(String duration) {
|
||||
this.duration = duration;
|
||||
}
|
||||
public void setDurationMs(long durationMs) {
|
||||
this.durationMs = durationMs;
|
||||
}
|
||||
|
||||
public String getSingerName() {
|
||||
return singerName;
|
||||
}
|
||||
|
||||
public void setSingerName(String singerName) {
|
||||
this.singerName = singerName;
|
||||
}
|
||||
|
||||
public String getVideoId() {
|
||||
return videoId;
|
||||
}
|
||||
|
||||
public void setVideoId(String videoId) {
|
||||
this.videoId = videoId;
|
||||
}
|
||||
|
||||
public String getCovert() {
|
||||
return covert;
|
||||
}
|
||||
|
||||
public void setCovert(String covert) {
|
||||
this.covert = covert;
|
||||
}
|
||||
|
||||
public String getSongName() {
|
||||
return songName;
|
||||
}
|
||||
|
||||
public void setSongName(String songName) {
|
||||
this.songName = songName;
|
||||
}
|
||||
}
|
||||
@ -43,19 +43,18 @@ public class ResponsePlayListInfo implements Serializable {
|
||||
private String params;
|
||||
private String musicVideoType;
|
||||
|
||||
public ResponsePlayListInfo() {
|
||||
|
||||
//
|
||||
// //------------自定义属性,由另外接口请求返回的数据流组装
|
||||
// private String audioUrlLow;
|
||||
//
|
||||
// private String audioUrlMedium;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public ResponsePlayListInfo(String covert, String songTitle, String singerName, long durationMs, String videoId,String duration) {
|
||||
this.covert = covert;
|
||||
SongTitle = songTitle;
|
||||
SingerName = singerName;
|
||||
DurationMs = durationMs;
|
||||
this.Duration = duration;
|
||||
this.videoId = videoId;
|
||||
}
|
||||
|
||||
public String getDescribe() {
|
||||
return describe;
|
||||
|
||||
@ -330,7 +330,7 @@ public class MyMediaControllerManager {
|
||||
MediaMetadata_builder.setArtworkUri(Uri.parse(playInfo.getCovert()));
|
||||
MediaMetadata_builder.setTitle(playInfo.getSongTitle());
|
||||
|
||||
CommonUtils.LogMsg("----------添加播放列表 i=" + i + "---" + playInfo.getSingerName() + "-------VideoId=" + videoId);
|
||||
CommonUtils.LogMsg("----------添加播放列表 i=" + i + "---" + playInfo.getSingerName() + "-------VideoId=" + videoId+"---playInfo.getDuration()="+playInfo.getDuration());
|
||||
// MediaMetadata_builder.setRecordingYear(Integer.parseInt(playInfo.getYear()));
|
||||
builder.setMediaMetadata(MediaMetadata_builder.build());
|
||||
mediaController.addMediaItem(builder.build());
|
||||
|
||||
@ -0,0 +1,109 @@
|
||||
package com.hi.music.player.objectbox;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.hi.music.player.api.LikeSongListener;
|
||||
import com.hi.music.player.helper.CommonUtils;
|
||||
import com.hi.music.player.javabean.BoxLikeSong;
|
||||
import com.hi.music.player.javabean.BoxLikeSong_;
|
||||
import com.hi.music.player.javabean.MyObjectBox;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.objectbox.Box;
|
||||
import io.objectbox.BoxStore;
|
||||
import io.objectbox.android.AndroidScheduler;
|
||||
import io.objectbox.query.Query;
|
||||
import io.objectbox.query.QueryBuilder;
|
||||
import io.objectbox.reactive.DataObserver;
|
||||
import io.objectbox.reactive.DataSubscription;
|
||||
import io.objectbox.reactive.DataSubscriptionList;
|
||||
|
||||
public class ObjectBoxManager {
|
||||
|
||||
private static BoxStore boxStore;
|
||||
|
||||
private static Box<BoxLikeSong> boxLikeSongBox;
|
||||
|
||||
private static DataSubscription observer;
|
||||
|
||||
|
||||
public static void init(Context context) {
|
||||
boxStore = MyObjectBox.builder().androidContext(context).build();
|
||||
}
|
||||
|
||||
public static Box<BoxLikeSong> getObjectBoxLike() {
|
||||
if (boxLikeSongBox == null) {
|
||||
return boxStore.boxFor(BoxLikeSong.class);
|
||||
}
|
||||
return boxLikeSongBox;
|
||||
}
|
||||
|
||||
public static DataSubscription setLikeDataListener(LikeSongListener listener) {
|
||||
Query<BoxLikeSong> build = getObjectBoxLike().query().build();
|
||||
return build.subscribe(new DataSubscriptionList())
|
||||
.on(AndroidScheduler.mainThread())
|
||||
.observer(new DataObserver<List<BoxLikeSong>>() {
|
||||
@Override
|
||||
public void onData(@NonNull List<BoxLikeSong> data) {
|
||||
CommonUtils.LogMsg("------ProfileFragment 11data=" + data.size());
|
||||
listener.onLikeSongChange(data);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public static void insertOrUpdateLike(BoxLikeSong boxLikeSong) {
|
||||
Box<BoxLikeSong> objectBoxLike = getObjectBoxLike();
|
||||
String videoId = boxLikeSong.getVideoId();
|
||||
BoxLikeSong first = objectBoxLike.query()
|
||||
.equal(BoxLikeSong_.videoId, videoId, QueryBuilder.StringOrder.CASE_SENSITIVE)
|
||||
.build()
|
||||
.findFirst();
|
||||
if (first == null) {
|
||||
CommonUtils.LogErrorMsg("-----------添加 song=" + boxLikeSong.getSongName() + "---videoId=" + videoId);
|
||||
objectBoxLike.put(boxLikeSong);
|
||||
} else {
|
||||
CommonUtils.LogErrorMsg("-----------已经存在 song=" + boxLikeSong.getSongName() + "---videoId=" + videoId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void deleteLike(BoxLikeSong boxLikeSong) {
|
||||
Box<BoxLikeSong> objectBoxLike = getObjectBoxLike();
|
||||
String videoId = boxLikeSong.getVideoId();
|
||||
List<BoxLikeSong> boxLikeSongs = objectBoxLike.query()
|
||||
.equal(BoxLikeSong_.videoId, videoId, QueryBuilder.StringOrder.CASE_SENSITIVE)
|
||||
.build()
|
||||
.find();
|
||||
for (BoxLikeSong song : boxLikeSongs) {
|
||||
objectBoxLike.remove(song);
|
||||
CommonUtils.LogErrorMsg("-------onLikeSongChange-deleteLike song=" + song.getSongName());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static List<BoxLikeSong> queryAllLike() {
|
||||
return getObjectBoxLike().query()
|
||||
.build()
|
||||
.find();
|
||||
}
|
||||
|
||||
public static boolean queryIsLike(String videoId) {
|
||||
Box<BoxLikeSong> objectBoxLike = getObjectBoxLike();
|
||||
BoxLikeSong first = objectBoxLike.query()
|
||||
.equal(BoxLikeSong_.videoId, videoId, QueryBuilder.StringOrder.CASE_SENSITIVE)
|
||||
.build()
|
||||
.findFirst();
|
||||
if (first == null) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,95 @@
|
||||
package com.hi.music.player.ui.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.hi.music.player.R;
|
||||
import com.hi.music.player.adapter.AdapterLikeSong;
|
||||
import com.hi.music.player.api.HomeItemClickListener;
|
||||
import com.hi.music.player.databinding.ActivityLikeSongBinding;
|
||||
import com.hi.music.player.helper.CommonUtils;
|
||||
import com.hi.music.player.helper.MyValue;
|
||||
import com.hi.music.player.javabean.BoxLikeSong;
|
||||
import com.hi.music.player.javabean.response.ResponsePlayListInfo;
|
||||
import com.hi.music.player.objectbox.ObjectBoxManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class LikeSongActivity extends BaseActivity<ActivityLikeSongBinding> implements HomeItemClickListener {
|
||||
|
||||
|
||||
private List<BoxLikeSong> boxLikeSongs;
|
||||
@Override
|
||||
protected ActivityLikeSongBinding getViewBinding() {
|
||||
return ActivityLikeSongBinding.inflate(getLayoutInflater());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreateInit() {
|
||||
boxLikeSongs = ObjectBoxManager.queryAllLike();
|
||||
AdapterLikeSong adapterLikeSong = new AdapterLikeSong();
|
||||
adapterLikeSong.setHomeItemClickListener(this);
|
||||
adapterLikeSong.setData(boxLikeSongs);
|
||||
vb.recycler.setLayoutManager(new LinearLayoutManager(this));
|
||||
vb.recycler.setAdapter(adapterLikeSong);
|
||||
vb.tvSongSize.setText(String.format(getString(R.string.like_song), boxLikeSongs.size()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onInitClick() {
|
||||
vb.imBack.setOnClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullScreen() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean statusBarLight() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showPanel() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if(v.equals(vb.imBack)){
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickLikeSong(BoxLikeSong boxLikeSong, int index) {
|
||||
List<ResponsePlayListInfo> playList = new ArrayList<>();
|
||||
for(BoxLikeSong song:boxLikeSongs){
|
||||
String videoId1 = song.getVideoId();
|
||||
String songName = song.getSongName();
|
||||
String covert = song.getCovert();
|
||||
String singerName = song.getSingerName();
|
||||
long durationMs = song.getDurationMs();
|
||||
String duration = song.getDuration();
|
||||
|
||||
ResponsePlayListInfo playListInfo = new ResponsePlayListInfo(covert, songName, singerName, durationMs, videoId1,duration);
|
||||
playList.add(playListInfo);
|
||||
}
|
||||
vmApplication.reSetPlayList(playList);
|
||||
|
||||
String videoId = boxLikeSong.getVideoId();
|
||||
CommonUtils.LogMsg("-------------like进入 传值 videoId= "+videoId);
|
||||
Intent intent = new Intent(this, PlayActivity.class);
|
||||
intent.putExtra(MyValue.KEY_PLAY_VIDEO_ID, videoId);
|
||||
intent.putExtra(MyValue.KEY_PLAY_INDEX, index);
|
||||
intent.putExtra(MyValue.KEY_ENTER_SOURCE, MyValue.TYPE_ENTER_LIKE);
|
||||
startActivity(intent);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -32,18 +32,21 @@ import com.bumptech.glide.request.target.Target;
|
||||
import com.hi.music.player.MusicApplication;
|
||||
import com.hi.music.player.R;
|
||||
import com.hi.music.player.adapter.AdapterPlayList;
|
||||
import com.hi.music.player.api.LikeSongListener;
|
||||
import com.hi.music.player.api.MediaControllerListener;
|
||||
import com.hi.music.player.api.onImageColorListener;
|
||||
import com.hi.music.player.api.onPlayNextListener;
|
||||
import com.hi.music.player.databinding.ActivityPlayBinding;
|
||||
import com.hi.music.player.helper.CommonUtils;
|
||||
import com.hi.music.player.helper.MyValue;
|
||||
import com.hi.music.player.javabean.BoxLikeSong;
|
||||
import com.hi.music.player.javabean.CustomerUrlInfo;
|
||||
import com.hi.music.player.javabean.response.ResponsePlayListInfo;
|
||||
import com.hi.music.player.javabean.response.ResponsePlayUrl;
|
||||
import com.hi.music.player.javabean.response.child.ResponseCategory;
|
||||
import com.hi.music.player.javabean.response.child.ResponseSingle;
|
||||
import com.hi.music.player.media3.MyMediaControllerManager;
|
||||
import com.hi.music.player.objectbox.ObjectBoxManager;
|
||||
import com.hi.music.player.ui.activity.viewmodel.VMApplication;
|
||||
import com.hi.music.player.ui.activity.viewmodel.VMPlay;
|
||||
|
||||
@ -168,6 +171,14 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
|
||||
vb.progressBarLoading.setVisibility(View.GONE);
|
||||
vb.btnPlay.setSelected(mediaControllerManager.getIsPlaying());
|
||||
break;
|
||||
|
||||
case MyValue.TYPE_ENTER_LIKE:
|
||||
// 4--从喜爱歌曲进入
|
||||
updateMediaPlayList();
|
||||
videoId = intent.getStringExtra(MyValue.KEY_PLAY_VIDEO_ID);
|
||||
mDefaultPlayStartIndex = intent.getIntExtra(MyValue.KEY_PLAY_INDEX, mDefaultPlayStartIndex);
|
||||
CommonUtils.LogMsg("-------------like进入 videoId= "+videoId+"---mDefaultPlayStartIndex="+mDefaultPlayStartIndex);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -177,7 +188,7 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
|
||||
if (customerUrlInfo.isNeedPlayNow() && customerUrlInfo.getPlayUrl() == null) {
|
||||
// TODO: 2024/9/26 需要马上播放这首歌曲,但是此次网络请求失败
|
||||
CommonUtils.LogErrorMsg("-------------需要马上播放这首歌曲,但是此次网络请求失败");
|
||||
updateErrorLayout(getString(R.string.song_loading_failed),true);
|
||||
updateErrorLayout(getString(R.string.song_loading_failed), true);
|
||||
netError = 1;
|
||||
mCustomerUrlInfo = customerUrlInfo;
|
||||
initShowPlayList(false);
|
||||
@ -193,6 +204,8 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -203,13 +216,13 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
|
||||
if (playList == null) {
|
||||
CommonUtils.LogErrorMsg("--------更新-playList null");
|
||||
netError = 0;
|
||||
updateErrorLayout(getString(R.string.playList_loading_failed),true);
|
||||
updateErrorLayout(getString(R.string.playList_loading_failed), true);
|
||||
vb.progressBarLoading.setVisibility(View.GONE);
|
||||
return;
|
||||
}
|
||||
CommonUtils.LogMsg("--------更新-playList " + playList.size() + "--videoId=" + videoId);
|
||||
if (playList.size() > 0) {
|
||||
updateErrorLayout(null,false);
|
||||
updateErrorLayout(null, false);
|
||||
setPlayListAndGetUrl(playList, videoId, mDefaultPlayStartIndex);
|
||||
}
|
||||
|
||||
@ -222,7 +235,7 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
|
||||
vb.layoutError.linearRetry.setVisibility(View.VISIBLE);
|
||||
else vb.layoutError.linearRetry.setVisibility(View.GONE);
|
||||
|
||||
if(msg!= null&&!msg.isEmpty()){
|
||||
if (msg != null && !msg.isEmpty()) {
|
||||
vb.layoutError.tvErrorMsg.setText(msg);
|
||||
}
|
||||
}
|
||||
@ -249,7 +262,7 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
|
||||
|
||||
private void initMediaController() {
|
||||
int repeatMode = mediaControllerManager.getRepeatMode();
|
||||
CommonUtils.LogMsg("-------------repeatMode="+repeatMode);
|
||||
CommonUtils.LogMsg("-------------repeatMode=" + repeatMode);
|
||||
vb.btnLoop.setImageResource(imageStates[repeatMode]);
|
||||
mediaControllerManager.addListener(vmApplication, new MediaControllerListener() {
|
||||
@Override
|
||||
@ -289,7 +302,7 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
|
||||
|
||||
CommonUtils.LogMsg("------------- 播放ing getCurIndex=" + mediaControllerManager.getCurIndex());
|
||||
vb.progressBarLoading.setVisibility(View.GONE);
|
||||
updateErrorLayout(null,false);
|
||||
updateErrorLayout(null, false);
|
||||
vb.btnPlay.setSelected(true);
|
||||
vb.layoutPlayList.imPlay.setSelected(true);
|
||||
break;
|
||||
@ -332,6 +345,8 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
|
||||
vb.btnMusicList.setOnClickListener(this);
|
||||
vb.layoutError.tvRetry.setOnClickListener(this);
|
||||
vb.btnLoop.setOnClickListener(this);
|
||||
vb.layoutLike.setOnClickListener(this);
|
||||
vb.layoutDownload.setOnClickListener(this);
|
||||
}
|
||||
|
||||
|
||||
@ -367,7 +382,7 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
|
||||
private void loadInfo(MediaItem mediaItem) {
|
||||
|
||||
MediaMetadata mediaMetadata = mediaItem.mediaMetadata;
|
||||
CommonUtils.LogMsg("--------------加载当前播放歌曲信息 ");
|
||||
CommonUtils.LogMsg("--------------加载当前播放歌曲信息 mediaMetadata.description="+mediaMetadata.description);
|
||||
if (mediaMetadata.artworkUri != null) {
|
||||
loadCovert(mediaMetadata.artworkUri.toString());
|
||||
}
|
||||
@ -384,6 +399,10 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
|
||||
updatePlayListUi();
|
||||
}
|
||||
|
||||
//刷新当前歌曲的喜爱状态
|
||||
boolean isLike = ObjectBoxManager.queryIsLike(mediaItem.mediaId);
|
||||
vb.imLike.setSelected(isLike);
|
||||
|
||||
}
|
||||
|
||||
private void loadCovert(String url) {
|
||||
@ -484,6 +503,7 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
|
||||
return false;
|
||||
}
|
||||
|
||||
@OptIn(markerClass = UnstableApi.class)
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v.equals(vb.btnPlay)) {
|
||||
@ -521,7 +541,7 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
|
||||
}
|
||||
} else if (v.equals(vb.layoutError.tvRetry)) {
|
||||
//重试按钮
|
||||
updateErrorLayout(null,false);
|
||||
updateErrorLayout(null, false);
|
||||
switch (netError) {
|
||||
case 0:
|
||||
switch (mEnterType) {
|
||||
@ -557,6 +577,26 @@ public class PlayActivity extends BaseActivity<ActivityPlayBinding> implements S
|
||||
vb.btnLoop.setImageResource(imageStates[currentMode]);
|
||||
CommonUtils.LogMsg("----currentMode=" + currentMode);
|
||||
mediaControllerManager.setMode(currentMode);
|
||||
} else if (v.equals(vb.layoutLike)) {
|
||||
boolean selected = vb.imLike.isSelected();
|
||||
vb.imLike.setSelected(!selected);
|
||||
boolean newSelect = vb.imLike.isSelected();
|
||||
MediaItem curMediaItem = mediaControllerManager.getCurMediaItem();
|
||||
MediaMetadata mediaMetadata = curMediaItem.mediaMetadata;
|
||||
if (mediaMetadata.title != null && mediaMetadata.artist != null&&mediaMetadata.durationMs!= null&&mediaMetadata.description!= null) {
|
||||
BoxLikeSong boxLikeSong = new BoxLikeSong(mediaMetadata.title.toString(),
|
||||
mediaMetadata.artist.toString(),
|
||||
curMediaItem.mediaId,
|
||||
String.valueOf(mediaMetadata.artworkUri),
|
||||
mediaMetadata.durationMs,mediaMetadata.description.toString());
|
||||
if (newSelect) {
|
||||
ObjectBoxManager.insertOrUpdateLike(boxLikeSong);
|
||||
} else {
|
||||
ObjectBoxManager.deleteLike(boxLikeSong);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -161,12 +161,12 @@ public class ResultListActivity extends BaseActivity<ActivityResultListBinding>
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickResultAlbum(ResponseResultListChild child, int index) {
|
||||
Intent intent = new Intent(this, CategoryListActivity.class);
|
||||
// intent.putExtra(MyValue.KEY_CATEGORY_LIST_TYPE, pageType);
|
||||
intent.putExtra(MyValue.KEY_CATEGORY_LIST_SINGER_NAME, child.getSongName());
|
||||
intent.putExtra(MyValue.KEY_CATEGORY_LIST_BROWSER_ID, child.getBrowserId());
|
||||
startActivity(intent);
|
||||
}
|
||||
// @Override
|
||||
// public void onClickResultAlbum(ResponseResultListChild child, int index) {
|
||||
// Intent intent = new Intent(this, CategoryListActivity.class);
|
||||
//// intent.putExtra(MyValue.KEY_CATEGORY_LIST_TYPE, pageType);
|
||||
// intent.putExtra(MyValue.KEY_CATEGORY_LIST_SINGER_NAME, child.getSongName());
|
||||
// intent.putExtra(MyValue.KEY_CATEGORY_LIST_BROWSER_ID, child.getBrowserId());
|
||||
// startActivity(intent);
|
||||
// }
|
||||
}
|
||||
@ -1,18 +1,108 @@
|
||||
package com.hi.music.player.ui.fragmnt;
|
||||
|
||||
import static com.hi.music.player.javabean.BoxLikeSong_.covert;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.engine.GlideException;
|
||||
import com.bumptech.glide.request.RequestListener;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
import com.hi.music.player.MusicApplication;
|
||||
import com.hi.music.player.R;
|
||||
import com.hi.music.player.api.LikeSongListener;
|
||||
import com.hi.music.player.databinding.FragmentProfileBinding;
|
||||
import com.hi.music.player.helper.CommonUtils;
|
||||
import com.hi.music.player.javabean.BoxLikeSong;
|
||||
import com.hi.music.player.objectbox.ObjectBoxManager;
|
||||
import com.hi.music.player.ui.activity.LikeSongActivity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.objectbox.reactive.DataSubscription;
|
||||
|
||||
|
||||
public class ProfileFragment extends BaseFragment<FragmentProfileBinding> {
|
||||
public class ProfileFragment extends BaseFragment<FragmentProfileBinding> implements View.OnClickListener{
|
||||
|
||||
|
||||
private DataSubscription dataSubscription;
|
||||
|
||||
private int likeSongSCount = 0;
|
||||
@Override
|
||||
protected FragmentProfileBinding getFragmentVb() {
|
||||
return FragmentProfileBinding.inflate(getLayoutInflater());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
dataSubscription = ObjectBoxManager.setLikeDataListener(new LikeSongListener() {
|
||||
@Override
|
||||
public void onLikeSongChange(List<BoxLikeSong> data) {
|
||||
CommonUtils.LogMsg("------onLikeSongChange data=" + data.size());
|
||||
int size = data.size();
|
||||
likeSongSCount = size;
|
||||
Vb.tvLikeSize.setText(String.format(getString(R.string.like_song), size));
|
||||
if (size == 0) {
|
||||
Vb.likeCovert.setVisibility(View.GONE);
|
||||
Vb.likeDefault.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
Vb.likeCovert.setVisibility(View.VISIBLE);
|
||||
Vb.likeDefault.setVisibility(View.GONE);
|
||||
BoxLikeSong boxLikeSong = data.get(size - 1);
|
||||
Glide.with(requireContext())
|
||||
.asDrawable()
|
||||
.load(boxLikeSong.getCovert())
|
||||
.placeholder(R.drawable.placeholder)
|
||||
.error(R.drawable.placeholder)
|
||||
.into(Vb.likeCovert);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Vb.relayoutLike.setOnClickListener(this);
|
||||
Vb.relayoutDownload.setOnClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
CommonUtils.LogMsg("------ProfileFragment-onStart");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
if(dataSubscription!= null){
|
||||
dataSubscription.cancel();
|
||||
}
|
||||
CommonUtils.LogMsg("------ProfileFragment-onDestroyView");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
CommonUtils.LogMsg("------ProfileFragment-onDestroy");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if(v.equals(Vb.relayoutLike)){
|
||||
if(likeSongSCount>0){
|
||||
Intent intent = new Intent(requireActivity(), LikeSongActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
7
app/src/main/res/drawable/bg_library.xml
Normal file
7
app/src/main/res/drawable/bg_library.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="16dp" />
|
||||
<solid android:color="@color/library_color" />
|
||||
|
||||
</shape>
|
||||
7
app/src/main/res/drawable/bg_like_layout.xml
Normal file
7
app/src/main/res/drawable/bg_like_layout.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="22dp"/>
|
||||
<solid android:color="@color/bg_color_like"/>
|
||||
|
||||
</shape>
|
||||
12
app/src/main/res/drawable/ic_download.xml
Normal file
12
app/src/main/res/drawable/ic_download.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M925.6,337.9c-22.6,-53.3 -54.8,-101.2 -96,-142.3 -41.1,-41.1 -89,-73.4 -142.3,-96C632.1,76.2 573.5,64.4 513,64.4S393.9,76.2 338.7,99.6c-53.3,22.6 -101.2,54.8 -142.3,96 -41.1,41.1 -73.4,89 -96,142.3C77,393.1 65.2,451.8 65.2,512.2c0,60.4 11.8,119.1 35.2,174.3 22.6,53.3 54.8,101.2 96,142.3 41.1,41.1 89,73.4 142.3,96C393.9,948.2 452.6,960 513,960s119.1,-11.8 174.3,-35.2c53.3,-22.6 101.2,-54.8 142.3,-96 41.1,-41.1 73.4,-89 96,-142.3 23.4,-55.2 35.2,-113.9 35.2,-174.3 0,-60.4 -11.8,-119.1 -35.2,-174.3zM513,879.1c-202.3,0 -366.9,-164.6 -366.9,-366.9S310.7,145.3 513,145.3c202.3,0 366.9,164.6 366.9,366.9S715.4,879.1 513,879.1z"
|
||||
android:fillColor="@color/white" />
|
||||
<path
|
||||
android:pathData="M664.7,520.8c-17.6,-15.6 -44.7,-13.9 -60.3,3.7l-49.2,55.7V368.5c0,-1.3 -0.1,-2.7 -0.2,-4 0.1,-1.4 0.2,-2.9 0.2,-4.4v-30.3c0,-23.2 -19,-42.2 -42.2,-42.2 -23.2,0 -42.2,19 -42.2,42.2v30.3c0,1.6 0.1,3.1 0.3,4.7 -0.1,1.2 -0.2,2.4 -0.2,3.7v211.6l-49.2,-55.6c-15.6,-17.6 -42.7,-19.3 -60.3,-3.7 -17.6,15.6 -19.3,42.7 -3.7,60.3L481,720.5c4.1,4.7 9,8.2 14.4,10.6 0.1,0 0.2,0.1 0.3,0.1l1.5,0.6c0.2,0.1 0.4,0.2 0.6,0.2 0.4,0.2 0.8,0.3 1.2,0.4 0.3,0.1 0.6,0.2 0.8,0.3 0.3,0.1 0.7,0.2 1,0.3s0.7,0.2 1,0.3 0.6,0.2 0.9,0.2c0.4,0.1 0.8,0.2 1.1,0.3 0.3,0.1 0.6,0.1 0.8,0.2 0.4,0.1 0.8,0.2 1.2,0.2 0.3,0 0.5,0.1 0.8,0.1 0.4,0.1 0.8,0.1 1.2,0.2 0.3,0 0.6,0.1 0.8,0.1 0.4,0 0.8,0.1 1.2,0.1 0.3,0 0.6,0 0.9,0.1h4.2c0.3,0 0.6,0 0.9,-0.1 0.4,0 0.8,-0.1 1.2,-0.1 0.3,0 0.6,-0.1 0.8,-0.1 0.4,0 0.8,-0.1 1.2,-0.2 0.3,0 0.5,-0.1 0.8,-0.1 0.4,-0.1 0.8,-0.1 1.2,-0.2 0.3,-0.1 0.6,-0.1 0.8,-0.2 0.4,-0.1 0.8,-0.2 1.1,-0.3s0.6,-0.1 0.9,-0.2c0.3,-0.1 0.7,-0.2 1,-0.3s0.7,-0.2 1,-0.3 0.6,-0.2 0.8,-0.3c0.4,-0.1 0.8,-0.3 1.2,-0.4 0.2,-0.1 0.4,-0.2 0.6,-0.2l1.5,-0.6c0.1,0 0.2,-0.1 0.3,-0.1 5.3,-2.4 10.3,-5.9 14.4,-10.6L668,581.1c16,-17.6 14.3,-44.8 -3.3,-60.3z"
|
||||
android:fillColor="@color/white"/>
|
||||
</vector>
|
||||
19
app/src/main/res/drawable/icon_download.xml
Normal file
19
app/src/main/res/drawable/icon_download.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@color/test"
|
||||
android:pathData="M2.623,8.779C3.339,5.724 5.724,3.339 8.779,2.623C10.898,2.126 13.102,2.126 15.221,2.623C18.276,3.339 20.661,5.724 21.377,8.779C21.874,10.898 21.874,13.102 21.377,15.221C20.661,18.276 18.276,20.661 15.221,21.377C13.102,21.874 10.898,21.874 8.779,21.377C5.724,20.661 3.339,18.276 2.623,15.221C2.126,13.102 2.126,10.898 2.623,8.779L4.083,9.122C3.639,11.015 3.639,12.985 4.083,14.878C4.669,17.378 6.622,19.33 9.122,19.917C11.015,20.361 12.985,20.361 14.878,19.917C17.378,19.33 19.33,17.378 19.917,14.878C20.361,12.985 20.361,11.015 19.917,9.122C19.33,6.622 17.378,4.669 14.878,4.083C12.985,3.639 11.015,3.639 9.122,4.083C6.622,4.669 4.669,6.622 4.083,9.122L2.623,8.779Z"
|
||||
/>
|
||||
|
||||
|
||||
<path
|
||||
android:fillColor="@color/black"
|
||||
android:pathData="M12,8.5V15.5M12,15.5L14.5,13M12,15.5L9.5,13"
|
||||
android:strokeWidth="1.5"
|
||||
android:strokeColor="@color/white"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/icon_liked.xml
Normal file
9
app/src/main/res/drawable/icon_liked.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M15.698,3.065C17.377,2.805 18.953,3.333 20.229,4.577C21.526,5.841 22.147,7.507 21.97,9.254C21.795,10.979 20.879,12.684 19.338,14.186C18.908,14.606 17.752,15.738 16.093,17.365C15.347,18.097 14.553,18.876 13.753,19.662L12.975,20.425L12.666,20.729C12.488,20.903 12.249,21.001 12,21.001C11.75,21.001 11.511,20.903 11.334,20.729L8.648,18.088L8.08,17.532C6.941,16.417 5.801,15.302 4.662,14.186C3.12,12.684 2.205,10.98 2.03,9.254C1.853,7.507 2.474,5.841 3.771,4.577C5.047,3.333 6.623,2.805 8.302,3.065C9.548,3.257 10.812,3.878 12,4.868C13.189,3.878 14.452,3.257 15.698,3.065H15.698Z"
|
||||
android:fillColor="#80F988"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/icon_liked_white.xml
Normal file
9
app/src/main/res/drawable/icon_liked_white.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M15.698,3.065C17.377,2.805 18.953,3.333 20.229,4.577C21.526,5.841 22.147,7.507 21.97,9.254C21.795,10.979 20.879,12.684 19.338,14.186C18.908,14.606 17.752,15.738 16.093,17.365C15.347,18.097 14.553,18.876 13.753,19.662L12.975,20.425L12.666,20.729C12.488,20.903 12.249,21.001 12,21.001C11.75,21.001 11.511,20.903 11.334,20.729L8.648,18.088L8.08,17.532C6.941,16.417 5.801,15.302 4.662,14.186C3.12,12.684 2.205,10.98 2.03,9.254C1.853,7.507 2.474,5.841 3.771,4.577C5.047,3.333 6.623,2.805 8.302,3.065C9.548,3.257 10.812,3.878 12,4.868C13.189,3.878 14.452,3.257 15.698,3.065H15.698Z"
|
||||
android:fillColor="@color/white"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/icon_not_like.xml
Normal file
9
app/src/main/res/drawable/icon_not_like.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M11.995,21C11.775,21.001 11.557,20.959 11.353,20.875C11.15,20.791 10.965,20.668 10.81,20.513L3.9,13.646C2.72,12.505 2.036,10.945 1.997,9.304C1.958,7.663 2.566,6.072 3.69,4.876C4.764,3.777 6.206,3.115 7.739,3.016C9.272,2.917 10.788,3.388 11.995,4.339C13.2,3.388 14.715,2.917 16.247,3.016C17.78,3.115 19.221,3.778 20.295,4.876C21.419,6.072 22.027,7.663 21.987,9.304C21.948,10.945 21.264,12.505 20.085,13.646L13.175,20.513C13.02,20.668 12.836,20.791 12.633,20.874C12.431,20.958 12.214,21.001 11.995,21ZM8.14,4.482H8.095C7.472,4.486 6.857,4.614 6.284,4.858C5.712,5.102 5.193,5.458 4.76,5.905C3.907,6.823 3.45,8.039 3.485,9.291C3.521,10.544 4.047,11.732 4.95,12.601L11.86,19.466C11.875,19.487 11.895,19.504 11.918,19.516C11.941,19.528 11.966,19.534 11.992,19.534C12.018,19.534 12.043,19.528 12.066,19.516C12.089,19.504 12.109,19.487 12.125,19.466L19.035,12.601C19.939,11.733 20.465,10.544 20.501,9.291C20.536,8.039 20.078,6.822 19.225,5.905C18.791,5.457 18.273,5.101 17.701,4.857C17.128,4.612 16.512,4.485 15.89,4.482C15.268,4.477 14.651,4.594 14.074,4.827C13.498,5.061 12.973,5.406 12.53,5.842C12.386,5.98 12.194,6.057 11.995,6.057C11.795,6.057 11.603,5.98 11.46,5.842C10.577,4.966 9.383,4.477 8.14,4.482V4.482Z"
|
||||
android:fillColor="#ffffff"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/im_place.xml
Normal file
9
app/src/main/res/drawable/im_place.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="60dp"
|
||||
android:height="60dp"
|
||||
android:viewportWidth="60"
|
||||
android:viewportHeight="60">
|
||||
<path
|
||||
android:pathData="M30,2.5C45.188,2.5 57.5,14.813 57.5,30C57.5,45.188 45.188,57.5 30,57.5C14.813,57.5 2.5,45.188 2.5,30C2.5,14.813 14.813,2.5 30,2.5ZM15.14,36.89C14.895,36.391 14.464,36.008 13.94,35.822C13.416,35.637 12.84,35.665 12.336,35.899C11.832,36.134 11.44,36.557 11.244,37.077C11.048,37.597 11.063,38.174 11.288,38.682C13.383,43.185 17.027,46.784 21.555,48.822C22.069,49.054 22.654,49.071 23.181,48.871C23.708,48.671 24.134,48.269 24.365,47.755C24.596,47.241 24.613,46.656 24.413,46.129C24.213,45.602 23.812,45.176 23.298,44.945C19.7,43.325 16.805,40.466 15.14,36.89ZM30,21.885C28.934,21.885 27.879,22.095 26.895,22.503C25.91,22.91 25.015,23.508 24.262,24.262C23.508,25.015 22.91,25.91 22.503,26.895C22.095,27.879 21.885,28.934 21.885,30C21.885,31.066 22.095,32.121 22.503,33.105C22.91,34.09 23.508,34.985 24.262,35.738C25.015,36.492 25.91,37.09 26.895,37.497C27.879,37.905 28.934,38.115 30,38.115C32.152,38.115 34.216,37.26 35.738,35.738C37.26,34.216 38.115,32.152 38.115,30C38.115,27.848 37.26,25.784 35.738,24.262C34.216,22.74 32.152,21.885 30,21.885Z"
|
||||
android:fillColor="#333333"/>
|
||||
</vector>
|
||||
8
app/src/main/res/drawable/play_black_gradient.xml
Normal file
8
app/src/main/res/drawable/play_black_gradient.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<gradient android:startColor="@color/black_view"
|
||||
android:endColor="@color/black_view_bottom"
|
||||
android:angle="270"/>
|
||||
</shape>
|
||||
6
app/src/main/res/drawable/selector_like.xml
Normal file
6
app/src/main/res/drawable/selector_like.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_selected="true" android:drawable="@drawable/icon_liked"/>
|
||||
<item android:state_selected="false" android:drawable="@drawable/icon_not_like"/>
|
||||
|
||||
</selector>
|
||||
53
app/src/main/res/layout/activity_like_song.xml
Normal file
53
app/src/main/res/layout/activity_like_song.xml
Normal file
@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/black"
|
||||
tools:context=".ui.activity.LikeSongActivity">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/im_back"
|
||||
android:layout_width="42dp"
|
||||
android:layout_height="42dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="35dp"
|
||||
android:padding="9dp"
|
||||
android:src="@drawable/arrow_bottom"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/text_like_song"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="17sp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/im_back"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/im_back" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_song_size"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="40dp"
|
||||
android:text="@string/like_song"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="17sp"
|
||||
app:layout_constraintLeft_toLeftOf="@id/im_back"
|
||||
app:layout_constraintTop_toBottomOf="@id/im_back" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_song_size" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@ -8,6 +8,11 @@
|
||||
android:background="@color/black"
|
||||
tools:context=".ui.activity.PlayActivity">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/black_gradient" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/content_layout"
|
||||
android:layout_width="match_parent"
|
||||
@ -24,111 +29,113 @@
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<!-- <ImageView-->
|
||||
<!-- 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" />-->
|
||||
<!-- <ImageView-->
|
||||
<!-- 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_height="300dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
app:cardBackgroundColor="@color/black"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
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_shuffle_button="false"
|
||||
app:use_controller="false" />
|
||||
</androidx.cardview.widget.CardView>
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/card_playerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="300dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
app:cardBackgroundColor="@color/black"
|
||||
app:cardCornerRadius="8dp"
|
||||
app:cardElevation="0dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/im_back">
|
||||
|
||||
<androidx.media3.ui.PlayerView
|
||||
android:id="@+id/player_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:resize_mode="zoom"
|
||||
app:show_buffering="when_playing"
|
||||
app:show_shuffle_button="false"
|
||||
app:use_controller="false" />
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBarLoading"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:indeterminateTint="@color/white"
|
||||
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"
|
||||
app:layout_constraintBottom_toBottomOf="@id/card_playerView"
|
||||
android:indeterminateTint="@color/white"
|
||||
android:visibility="gone" />
|
||||
app:layout_constraintTop_toTopOf="@id/card_playerView" />
|
||||
|
||||
<include layout="@layout/layout_error"
|
||||
<include
|
||||
android:id="@+id/layout_error"
|
||||
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">-->
|
||||
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_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" />-->
|
||||
<!-- <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>-->
|
||||
<!-- </LinearLayout>-->
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_song_name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="25dp"
|
||||
android:layout_marginEnd="40dp"
|
||||
android:text=""
|
||||
android:layout_marginStart="10dp"
|
||||
android:textColor="@color/text_color_1"
|
||||
android:textSize="19sp"
|
||||
app:layout_constraintLeft_toLeftOf="@id/card_playerView"
|
||||
@ -142,10 +149,78 @@
|
||||
android:layout_marginTop="7dp"
|
||||
android:text=""
|
||||
android:textColor="@color/white_60_color"
|
||||
android:textSize="13sp"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintLeft_toLeftOf="@id/tv_song_name"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_song_name" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_like"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="34dp"
|
||||
android:layout_marginTop="14dp"
|
||||
android:background="@drawable/bg_like_layout"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="22dp"
|
||||
android:paddingEnd="22dp"
|
||||
app:layout_constraintLeft_toLeftOf="@id/card_playerView"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_singer_name">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/im_like"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@drawable/selector_like" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:text="@string/like"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layout_download"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="34dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:background="@drawable/bg_like_layout"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="22dp"
|
||||
android:paddingEnd="22dp"
|
||||
app:layout_constraintLeft_toRightOf="@id/layout_like"
|
||||
app:layout_constraintTop_toTopOf="@id/layout_like">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/im_download"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@drawable/ic_download" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/download_pb"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:indeterminateTint="@color/panel_bg"
|
||||
android:progressBackgroundTint="@color/panel_bg"
|
||||
android:progressTint="@color/panel_bg"
|
||||
android:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_toEndOf="@id/im_download"
|
||||
android:text="@string/download"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp" />
|
||||
</RelativeLayout>
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/play_progress"
|
||||
@ -162,7 +237,7 @@
|
||||
android:thumb="@drawable/seekbar_thumb"
|
||||
app:layout_constraintLeft_toLeftOf="@id/card_playerView"
|
||||
app:layout_constraintRight_toRightOf="@id/card_playerView"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_singer_name" />
|
||||
app:layout_constraintTop_toBottomOf="@id/layout_like" />
|
||||
|
||||
|
||||
<ProgressBar
|
||||
@ -264,5 +339,4 @@
|
||||
layout="@layout/dialog_play_list" />
|
||||
|
||||
|
||||
|
||||
</FrameLayout>
|
||||
@ -4,7 +4,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#1e2b28"
|
||||
android:background="@color/black"
|
||||
tools:context=".ui.fragmnt.ProfileFragment">
|
||||
|
||||
<!-- 第一行: 左边文字,右边控件 -->
|
||||
@ -13,7 +13,7 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingStart="15dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingBottom="16dp"
|
||||
android:text="@string/library"
|
||||
@ -32,148 +32,128 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<!-- 第二行: 左边和右边矩形区域, 中央图标+两行文字 -->
|
||||
<LinearLayout
|
||||
android:id="@+id/leftSection"
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/like_song"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp"
|
||||
app:layout_constraintEnd_toStartOf="@id/rightSection"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:layout_height="160dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="15dp"
|
||||
app:cardBackgroundColor="@color/library_color"
|
||||
app:cardCornerRadius="16dp"
|
||||
app:layout_constraintHorizontal_weight="1"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@id/view"
|
||||
app:layout_constraintTop_toBottomOf="@id/titleText">
|
||||
|
||||
<!-- 矩形背景 -->
|
||||
<FrameLayout
|
||||
<RelativeLayout
|
||||
android:id="@+id/relayout_like"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="120dp"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/round_rectangle"
|
||||
android:backgroundTint="@android:color/holo_green_light">
|
||||
<!-- 中央图标 -->
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/ic_launcher_background" />
|
||||
</FrameLayout>
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="80dp"
|
||||
android:src="@drawable/im_place"
|
||||
android:layout_centerInParent="true"
|
||||
android:id="@+id/like_default"/>
|
||||
|
||||
<!-- 标题 -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="left"
|
||||
android:text="Title 1"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="16sp" />
|
||||
<ImageView
|
||||
android:id="@+id/like_covert"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop" />
|
||||
|
||||
<!-- 副标题 -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="left"
|
||||
android:text="Subtitle"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="12sp" />
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:id="@+id/im"
|
||||
android:src="@drawable/icon_liked_white"/>
|
||||
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/white"
|
||||
android:text="@string/like_song"
|
||||
android:id="@+id/tv_like_size"
|
||||
android:layout_toEndOf="@id/im"
|
||||
android:layout_alignTop="@id/im"
|
||||
android:layout_alignBottom="@id/im"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:textSize="15sp"/>
|
||||
|
||||
</RelativeLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/rightSection"
|
||||
<View
|
||||
android:id="@+id/view"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
app:layout_constraintLeft_toRightOf="@id/like_song"
|
||||
app:layout_constraintRight_toLeftOf="@id/download_song"
|
||||
app:layout_constraintTop_toTopOf="@id/like_song" />
|
||||
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/download_song"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/leftSection"
|
||||
app:layout_constraintTop_toBottomOf="@id/titleText">
|
||||
android:layout_height="160dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
app:cardBackgroundColor="@color/library_color"
|
||||
app:cardCornerRadius="16dp"
|
||||
app:layout_constraintHorizontal_weight="1"
|
||||
app:layout_constraintLeft_toRightOf="@id/view"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/like_song">
|
||||
|
||||
<!-- 矩形背景和中央图标 -->
|
||||
<FrameLayout
|
||||
<RelativeLayout
|
||||
android:id="@+id/relayout_download"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="120dp"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/round_rectangle"
|
||||
android:backgroundTint="@android:color/holo_red_light">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<!-- 中央图标 -->
|
||||
<ImageView
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/ic_launcher_background" />
|
||||
</FrameLayout>
|
||||
android:id="@+id/download_default"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@drawable/im_place" />
|
||||
|
||||
<!-- 标题 -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="left"
|
||||
android:text="Title 2"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="16sp" />
|
||||
<ImageView
|
||||
android:id="@+id/download_covert"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerInParent="true"
|
||||
android:scaleType="centerCrop" />
|
||||
|
||||
<!-- 副标题 -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="left"
|
||||
android:text="Subtitle"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="12sp" />
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:id="@+id/download_im"
|
||||
android:src="@drawable/ic_download"/>
|
||||
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/white"
|
||||
android:text="@string/download_song"
|
||||
android:layout_toEndOf="@id/download_im"
|
||||
android:layout_alignTop="@id/download_im"
|
||||
android:layout_alignBottom="@id/download_im"
|
||||
android:layout_marginStart="12dp"
|
||||
android:id="@+id/tv_download_size"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:textSize="15sp"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<!-- 第三行: 一行文字 -->
|
||||
<TextView
|
||||
android:id="@+id/singleTextRow"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="left"
|
||||
android:padding="16dp"
|
||||
android:text="This is a single text row"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/rightSection" />
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<!-- 第四行: 左边控件,右边文字 -->
|
||||
<ImageView
|
||||
android:id="@+id/iconLeft"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_margin="16dp"
|
||||
android:src="@drawable/ic_launcher_background"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/singleTextRow" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rightText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="16dp"
|
||||
android:text="This is right-aligned text"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/iconLeft"
|
||||
app:layout_constraintTop_toBottomOf="@id/singleTextRow" />
|
||||
|
||||
<!-- 第五行: RecyclerView -->
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:padding="16dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/iconLeft" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
66
app/src/main/res/layout/item_like_song.xml
Normal file
66
app/src/main/res/layout/item_like_song.xml
Normal file
@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_height="60dp">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/card"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginStart="18dp"
|
||||
app:cardCornerRadius="10dp"
|
||||
app:cardElevation="0dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/im_covert"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="@id/card"
|
||||
app:layout_constraintLeft_toRightOf="@id/card"
|
||||
app:layout_constraintTop_toTopOf="@id/card">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/like_song"
|
||||
android:id="@+id/tv_title"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/like_song"
|
||||
android:id="@+id/tv_singer_name"
|
||||
android:textColor="@color/white_60_color"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="35dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:paddingStart="5dp"
|
||||
android:paddingEnd="5dp"
|
||||
android:id="@+id/im_download"
|
||||
android:src="@drawable/ic_download"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@ -6,6 +6,8 @@
|
||||
<color name="text_color_1">#FFFFFF</color>
|
||||
<color name="text_color_2">#DFD0D0</color>
|
||||
<color name="black_view">#26000000</color>
|
||||
<color name="black_view_bottom">#99000000</color>
|
||||
<color name="bg_color_like">#33FFFFFF</color>
|
||||
<color name="seek_bg_color">#4DFFFFFF</color>
|
||||
<color name="white_60_color">#99FFFFFF</color>
|
||||
<color name="progress_buffer_color">#59FFFFFF</color>
|
||||
@ -14,6 +16,7 @@
|
||||
<color name="dark_music">#FF424242</color>
|
||||
<color name="panel_bg">#80F988</color>
|
||||
<color name="retry_bg">#E03D3D3F</color>
|
||||
<color name="library_color">#242529</color>
|
||||
|
||||
<color name="panel_singer_color">#99000000</color>
|
||||
<color name="retry_layout">#000000</color>
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
<string name="trending_in_shorts">Trending in Shorts</string>
|
||||
<string name="new_releases">New Releases</string>
|
||||
<string name="musicoo">Musicoo</string>
|
||||
<string name="library">Profile</string>
|
||||
<string name="library">Library</string>
|
||||
<string name="listen_music_anytime">Listen Music Anytime</string>
|
||||
<string name="resource_loading">Resource Loading...</string>
|
||||
<string name="ready_to_sleep">Ready to sleep</string>
|
||||
@ -32,4 +32,9 @@
|
||||
<string name="playList_loading_failed">Playlist loading failed</string>
|
||||
<string name="time_format">%d:%02d:%02d</string>
|
||||
<string name="minute_time_format">%d:%02d</string>
|
||||
<string name="like">Like</string>
|
||||
<string name="download">Download</string>
|
||||
<string name="like_song">Songs %d</string>
|
||||
<string name="download_song">Offline %d</string>
|
||||
<string name="text_like_song">Favorite Songs</string>
|
||||
</resources>
|
||||
@ -1,4 +1,11 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
plugins {
|
||||
id("com.android.application") version "8.1.3" apply false
|
||||
// id("org.jetbrains.kotlin.android") version "1.9.22" apply false
|
||||
}
|
||||
|
||||
buildscript {
|
||||
dependencies {
|
||||
classpath("io.objectbox:objectbox-gradle-plugin:4.0.3")
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user