搜索列表页面增加重试按钮

This commit is contained in:
litingting 2024-11-08 09:44:29 +08:00
parent bdbf4b0eae
commit 069ea8178c
25 changed files with 881 additions and 360 deletions

View File

@ -1,10 +1,14 @@
import java.util.Date
import java.text.SimpleDateFormat
plugins { plugins {
id("com.android.application") id("com.android.application")
// id("org.jetbrains.kotlin.android") // id("org.jetbrains.kotlin.android")
// id ("kotlin-kapt") // id ("kotlin-kapt")
id("io.objectbox") id("io.objectbox")
id("com.google.gms.google-services")
id("com.google.firebase.crashlytics")
} }
val timestamp = SimpleDateFormat("MM_dd_HH_mm").format(Date())
android { android {
namespace = "com.hi.music.player" namespace = "com.hi.music.player"
compileSdk = 34 compileSdk = 34
@ -16,13 +20,13 @@ android {
targetSdk = 34 targetSdk = 34
versionCode = 1 versionCode = 1
versionName = "1.0.0" versionName = "1.0.0"
setProperty("archivesBaseName", "MusicApp_V" + versionName + "(${versionCode})_$timestamp")
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
} }
buildTypes { buildTypes {
release { release {
isMinifyEnabled = false isMinifyEnabled = true
proguardFiles( proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"), getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro" "proguard-rules.pro"
@ -38,6 +42,7 @@ android {
} }
buildFeatures { buildFeatures {
viewBinding = true viewBinding = true
buildConfig = true
} }
} }
@ -85,4 +90,11 @@ dependencies {
// implementation ("com.geyifeng.immersionbar:immersionbar:3.2.2") // implementation ("com.geyifeng.immersionbar:immersionbar:3.2.2")
// implementation ("com.geyifeng.immersionbar:immersionbar-components:3.2.2") // implementation ("com.geyifeng.immersionbar:immersionbar-components:3.2.2")
//------------------firebase
implementation(platform("com.google.firebase:firebase-bom:33.1.1"))
implementation("com.google.firebase:firebase-crashlytics")
implementation("com.google.firebase:firebase-analytics")
implementation("com.google.firebase:firebase-config")
} }

29
app/google-services.json Normal file
View File

@ -0,0 +1,29 @@
{
"project_info": {
"project_number": "550960818622",
"project_id": "himelody-and",
"storage_bucket": "himelody-and.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:550960818622:android:96fd4141e43410fb24f1ef",
"android_client_info": {
"package_name": "com.hi.music.player.test"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyCp3XR60onMqiGj9pD8ADmrDEOOn__sQDk"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
}
],
"configuration_version": "1"
}

View File

@ -19,3 +19,11 @@
# If you keep the line number information, uncomment this to # If you keep the line number information, uncomment this to
# hide the original source file name. # hide the original source file name.
#-renamesourcefileattribute SourceFile #-renamesourcefileattribute SourceFile
# Retrofit OkHttp 的混淆规则
-dontwarn okhttp3.**
-dontwarn okio.**
-keep class okhttp3.** { *; }
-keep class retrofit2.** { *; }
-dontwarn retrofit2.**
-dontwarn javax.annotation.Nullable

View File

@ -25,18 +25,23 @@
tools:targetApi="31"> tools:targetApi="31">
<activity <activity
android:name=".ui.activity.LikeSongActivity" android:name=".ui.activity.LikeSongActivity"
android:screenOrientation="portrait"
android:exported="false" /> android:exported="false" />
<activity <activity
android:name=".ui.activity.ResultListActivity" android:name=".ui.activity.ResultListActivity"
android:screenOrientation="portrait"
android:exported="false" /> android:exported="false" />
<activity <activity
android:name=".ui.activity.CategoryListActivity" android:name=".ui.activity.CategoryListActivity"
android:screenOrientation="portrait"
android:exported="false" /> android:exported="false" />
<activity <activity
android:name=".ui.activity.A_PlayActivity" android:name=".ui.activity.A_PlayActivity"
android:screenOrientation="portrait"
android:exported="false" /> android:exported="false" />
<activity <activity
android:name=".ui.activity.A_SettingActivity" android:name=".ui.activity.A_SettingActivity"
android:screenOrientation="portrait"
android:exported="false" /> android:exported="false" />
<activity <activity
android:name=".ui.activity.PlayActivity" android:name=".ui.activity.PlayActivity"
@ -48,16 +53,20 @@
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
<activity <activity
android:name=".ui.activity.HomeActivity" android:name=".ui.activity.HomeActivity"
android:exported="true"> android:screenOrientation="portrait"
android:exported="false">
</activity>
<activity
android:name=".ui.activity.A_SplashActivity"
android:screenOrientation="portrait"
android:exported="true" >
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity
android:name=".ui.activity.A_SplashActivity"
android:exported="true" />
<service <service
android:name=".media3.PlaybackService" android:name=".media3.PlaybackService"

View File

@ -7,25 +7,21 @@ import androidx.annotation.OptIn;
import androidx.media3.common.util.UnstableApi; import androidx.media3.common.util.UnstableApi;
import com.hi.music.player.api.MediaControllerStatusListener; import com.hi.music.player.api.MediaControllerStatusListener;
import com.hi.music.player.firebase.RemoteConfigJava;
import com.hi.music.player.firebase.Sp;
import com.hi.music.player.helper.CommonUtils; import com.hi.music.player.helper.CommonUtils;
import com.hi.music.player.javabean.MyObjectBox;
import com.hi.music.player.media3.MyDownloadService;
import com.hi.music.player.media3.MyMediaControllerManager; import com.hi.music.player.media3.MyMediaControllerManager;
import com.hi.music.player.objectbox.ObjectBoxManager; import com.hi.music.player.objectbox.ObjectBoxManager;
import io.objectbox.BoxStore;
public class MusicApplication extends Application { public class MusicApplication extends Application {
public static Context myApplication; public static Context myApplication;
public static String visitorData; public static String visitorData;
public static void setVisitorData(String visitorData) { public static void setVisitorData(String visitorData) {
MusicApplication.visitorData = visitorData; MusicApplication.visitorData = visitorData;
} }
@ -39,8 +35,9 @@ public class MusicApplication extends Application {
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
myApplication = this; myApplication = this;
Sp.init(this);
RemoteConfigJava.getInstance().init(this);
ObjectBoxManager.init(this); ObjectBoxManager.init(this);
// MyDownloadService.init(this);
MyMediaControllerManager.getInstance().init(new MediaControllerStatusListener() { MyMediaControllerManager.getInstance().init(new MediaControllerStatusListener() {
@Override @Override
public void onMediaControllerComplete(boolean isOk) { public void onMediaControllerComplete(boolean isOk) {

View File

@ -38,6 +38,11 @@ public class AdapterDownloadSong extends BaseAdapter<Download, ItemLikeSongBindi
Download download = data.get(position); Download download = data.get(position);
BoxDownloadSong boxDownloadSong = CommonUtils.downloadToBean(download); BoxDownloadSong boxDownloadSong = CommonUtils.downloadToBean(download);
if (position == data.size()-1){
vb.place.setVisibility(View.VISIBLE);
}else {
vb.place.setVisibility(View.GONE);
}
vb.layoutDownload.setVisibility(View.GONE); vb.layoutDownload.setVisibility(View.GONE);
Glide.with(MusicApplication.myApplication) Glide.with(MusicApplication.myApplication)
.asDrawable() .asDrawable()

View File

@ -84,6 +84,12 @@ public class AdapterLikeSong extends BaseAdapter<BoxLikeSong, ItemLikeSongBindin
BoxLikeSong boxLikeSong = data.get(position); BoxLikeSong boxLikeSong = data.get(position);
String videoId = boxLikeSong.getVideoId(); String videoId = boxLikeSong.getVideoId();
if (position == data.size()-1){
vb.place.setVisibility(View.VISIBLE);
}else {
vb.place.setVisibility(View.GONE);
}
for(Pair<Boolean,String> pair:status){ for(Pair<Boolean,String> pair:status){
if(pair.second.equals(videoId)){ if(pair.second.equals(videoId)){

View File

@ -0,0 +1,151 @@
package com.hi.music.player.firebase
import android.annotation.SuppressLint
import android.app.Application
import android.content.Context
import android.os.Handler
import android.os.Looper
import android.os.Message
import android.text.TextUtils
import android.util.Log
import com.google.firebase.remoteconfig.ConfigUpdate
import com.google.firebase.remoteconfig.ConfigUpdateListener
import com.google.firebase.remoteconfig.FirebaseRemoteConfig
import com.google.firebase.remoteconfig.FirebaseRemoteConfigException
import com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings
import com.google.firebase.remoteconfig.FirebaseRemoteConfigValue
import com.hi.music.player.BuildConfig
import com.hi.music.player.helper.CommonUtils
import java.lang.ref.WeakReference
class RemoteConfig {
private var ctx: Context? = null
private var mFirebaseRemoteConfig: FirebaseRemoteConfig? = null
//配置是否初始化成功
private var isInit = false
//上次获取数据的时间
private var lastFetchTime: Long = 0
private val handler = MHandler(this)
companion object {
const val key_open_type = "TYPE"
//进入A面
const val value_open_type_0 = "0"
//进入B面
const val value_open_type_1 = "1"
const val MSG_REFRESH_CONFIG = 1
val instance: RemoteConfig by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
RemoteConfig()
}
}
fun init(ctx: Application) {
this.ctx = ctx
initConfig()
fetchConfig()
onConfigUpdate()
}
private fun initConfig() {
var intervalTime = (60 * 10).toLong()
//如果是开发状态,则将提取时间缩短
if (BuildConfig.DEBUG) {
intervalTime = (60 * 5).toLong()
}
mFirebaseRemoteConfig = FirebaseRemoteConfig.getInstance()
val configSettings =
FirebaseRemoteConfigSettings.Builder() //默认值12小时的最短提取间隔如果在间隔内取值则优先取上次的结果
.setMinimumFetchIntervalInSeconds(intervalTime).build()
mFirebaseRemoteConfig!!.setConfigSettingsAsync(configSettings)
}
private fun onConfigUpdate() {
mFirebaseRemoteConfig!!.addOnConfigUpdateListener(object : ConfigUpdateListener {
override fun onUpdate(configUpdate: ConfigUpdate) {
CommonUtils.LogMsg("Updated keys: " + configUpdate.updatedKeys)
try {
mFirebaseRemoteConfig!!.activate().addOnCompleteListener { task ->
if (task.isSuccessful) {
updateData("onConfigUpdate", mFirebaseRemoteConfig!!.all)
}
}
} catch (ignore: Exception) {
}
}
override fun onError(error: FirebaseRemoteConfigException) {
CommonUtils.LogMsg("Config update error with code: " + error.code)
}
})
}
private fun fetchConfig() {
//这里可能会抛出异常 FirebaseRemoteConfigFetchThrottledException
try {
mFirebaseRemoteConfig!!.fetchAndActivate().addOnCompleteListener { task ->
if (task.isSuccessful) {
isInit = true
lastFetchTime = System.currentTimeMillis()
updateData("fetchAndActivate", mFirebaseRemoteConfig!!.all)
//24小时后重新再去获取
handler.removeMessages(MSG_REFRESH_CONFIG)
handler.sendEmptyMessageDelayed(
MSG_REFRESH_CONFIG, (1000 * 60 * 60 * 24).toLong()
)
} else {
//15分钟后重新再去获取
handler.removeMessages(MSG_REFRESH_CONFIG)
handler.sendEmptyMessageDelayed(MSG_REFRESH_CONFIG, (1000 * 60 * 15).toLong())
}
}
} catch (ignore: Exception) {
}
}
private fun updateData(from: String, all: Map<String, FirebaseRemoteConfigValue>) {
for ((key, value) in all) {
try {
CommonUtils.LogMsg( "from = " + from + "Key = " + key + " Value = " + value.asString()
)
if (TextUtils.equals(key_open_type, key)) {
Sp.getInstance()
.putStringValue(key_open_type, value.asString()).commit()
}
} catch (ignore: Exception) {
}
}
}
private class MHandler(remoteConfig: RemoteConfig) : Handler(Looper.getMainLooper()) {
private val weakReference: WeakReference<RemoteConfig>
init {
weakReference = WeakReference(remoteConfig)
}
override fun handleMessage(msg: Message) {
super.handleMessage(msg)
val remoteConfig = weakReference.get()
if (remoteConfig?.ctx != null) {
if (msg.what == MSG_REFRESH_CONFIG) {
remoteConfig.fetchConfig()
}
}
}
}
}

View File

@ -0,0 +1,167 @@
package com.hi.music.player.firebase;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.BuildConfig;
import com.google.firebase.remoteconfig.ConfigUpdate;
import com.google.firebase.remoteconfig.ConfigUpdateListener;
import com.google.firebase.remoteconfig.FirebaseRemoteConfig;
import com.google.firebase.remoteconfig.FirebaseRemoteConfigException;
import com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings;
import com.google.firebase.remoteconfig.FirebaseRemoteConfigValue;
import com.hi.music.player.helper.CommonUtils;
import java.lang.ref.WeakReference;
import java.util.Map;
public class RemoteConfigJava {
private static RemoteConfigJava remoteConfigJava;
public static String key_open_type = "TYPE";
//进入A面
public static String value_open_type_0 = "0";
//进入B面
public static String value_open_type_1 = "1";
private static int MSG_REFRESH_CONFIG = 1;
private Context ctx;
private FirebaseRemoteConfig mFirebaseRemoteConfig;
//配置是否初始化成功
private boolean isInit = false;
//上次获取数据的时间
private long lastFetchTime = 0;
private MHandler handler = new MHandler(this);
private Context getCtx() {
return ctx;
}
public static RemoteConfigJava getInstance(){
if(remoteConfigJava == null){
remoteConfigJava = new RemoteConfigJava();
}
return remoteConfigJava;
}
private static class MHandler extends Handler {
private WeakReference<RemoteConfigJava> weakReference;
public MHandler(RemoteConfigJava remoteConfig) {
super(Looper.getMainLooper());
weakReference = new WeakReference<>(remoteConfig);
}
@Override
public void handleMessage(@NonNull Message msg) {
super.handleMessage(msg);
RemoteConfigJava remoteConfig1 = weakReference.get();
if (remoteConfig1.getCtx() != null) {
if (msg.what == MSG_REFRESH_CONFIG) {
remoteConfig1.fetchConfig();
}
}
}
}
public void init(Context context) {
this.ctx = context;
initConfig();
fetchConfig();
onConfigUpdate();
}
private void initConfig() {
long intervalTime = 60L * 10L;
//如果是开发状态则将提取时间缩短
if (BuildConfig.DEBUG) {
intervalTime = 60L * 5L;
}
mFirebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder() //默认值12小时的最短提取间隔如果在间隔内取值则优先取上次的结果
.setMinimumFetchIntervalInSeconds(intervalTime).build();
mFirebaseRemoteConfig.setConfigSettingsAsync(configSettings);
}
private void onConfigUpdate() {
mFirebaseRemoteConfig.addOnConfigUpdateListener(new ConfigUpdateListener() {
@Override
public void onUpdate(@NonNull ConfigUpdate configUpdate) {
CommonUtils.LogMsg("Updated keys: " + configUpdate.getUpdatedKeys());
try {
mFirebaseRemoteConfig.activate().addOnCompleteListener(new OnCompleteListener<Boolean>() {
@Override
public void onComplete(@NonNull Task<Boolean> task) {
if (task.isSuccessful()) {
updateData("onConfigUpdate", mFirebaseRemoteConfig.getAll());
}
}
});
} catch (Exception ignore) {
CommonUtils.LogErrorMsg("onConfigUpdate Exception " + ignore.getMessage());
}
}
@Override
public void onError(@NonNull FirebaseRemoteConfigException error) {
CommonUtils.LogErrorMsg("onConfigUpdate onError " + error.getMessage());
}
});
}
private void fetchConfig() {
//这里可能会抛出异常 FirebaseRemoteConfigFetchThrottledException
try {
mFirebaseRemoteConfig.fetchAndActivate().addOnCompleteListener(new OnCompleteListener<Boolean>() {
@Override
public void onComplete(@NonNull Task<Boolean> task) {
if (task.isSuccessful()) {
isInit = true;
lastFetchTime = System.currentTimeMillis();
updateData("fetchAndActivate", mFirebaseRemoteConfig.getAll());
//24小时后重新再去获取
handler.removeMessages(MSG_REFRESH_CONFIG);
handler.sendEmptyMessageDelayed(
MSG_REFRESH_CONFIG, 1000 * 60 * 60 * 24L);
} else {
//15分钟后重新再去获取
handler.removeMessages(MSG_REFRESH_CONFIG);
handler.sendEmptyMessageDelayed(MSG_REFRESH_CONFIG, 1000 * 60 * 15L);
}
}
});
} catch (Exception exception) {
CommonUtils.LogErrorMsg(" exception = " + exception.getMessage());
}
}
private void updateData(String from, Map<String, FirebaseRemoteConfigValue> all) {
for (Map.Entry<String, FirebaseRemoteConfigValue> entry : all.entrySet()) {
FirebaseRemoteConfigValue value = entry.getValue();
String key = entry.getKey();
CommonUtils.LogMsg("from = " + from + "Key = " + key + " Value = " + value.asString());
if (TextUtils.equals(key_open_type, key)) {
Sp.getInstance()
.putStringValue(key_open_type, value.asString()).commit();
}
}
}
}

View File

@ -0,0 +1,44 @@
package com.hi.music.player.firebase;
import android.content.Context;
import android.content.SharedPreferences;
public class Sp {
private static String spName = "AD_SHOW";
private static Sp instance;
private SharedPreferences.Editor editor;
private SharedPreferences preferences;
private Sp(Context context) {
preferences = context.getSharedPreferences(spName, Context.MODE_PRIVATE);
editor = preferences.edit();
}
public static void init(Context context){
instance = new Sp(context);
}
public static Sp getInstance() {
return instance;
}
public Sp putStringValue(String key, String value) {
editor.putString(key, value);
return this;
}
public boolean commit() {
return editor.commit();
}
public String getStringValue(String key) {
return preferences.getString(key, RemoteConfigJava.value_open_type_1);
}
}

View File

@ -496,15 +496,6 @@ public class JsonHelper {
playCount = getJsonTitle(text, 0); playCount = getJsonTitle(text, 0);
} }
// JSONArray runs = text.getJSONArray("runs");
// for (int g = 0; g < runs.length(); g++) {
// JSONObject jsonObject1 = runs.getJSONObject(g);
// String[] browser = getBrowser(jsonObject1);
// if (browser != null) {
// browserId = browser[0];
// pageType = browser[1];
// }
// }
} }
boolean b = videoId == null || videoId.isEmpty(); boolean b = videoId == null || videoId.isEmpty();
@ -716,6 +707,8 @@ public class JsonHelper {
.getJSONObject("musicResponsiveListItemFlexColumnRenderer") .getJSONObject("musicResponsiveListItemFlexColumnRenderer")
.getJSONObject("text"); .getJSONObject("text");
String text = getJsonTitle(jsonObjectText, 0); String text = getJsonTitle(jsonObjectText, 0);
CommonUtils.LogMsg("---------g=" + g + "---text="+text);
if (g == 0) { if (g == 0) {
SongTitle = text; SongTitle = text;
@ -733,8 +726,12 @@ public class JsonHelper {
listInfo.setMusicVideoType(watchEndPoint[3]); listInfo.setMusicVideoType(watchEndPoint[3]);
} }
if (g == 1) SingerName = text; if (g == 1){
if (g == 2) Description = text; SingerName = text;
}
if (g == 2) {
Description = text;
}
} }
listInfo.setDescribe(Description); listInfo.setDescribe(Description);
listInfo.setDuration(textTime); listInfo.setDuration(textTime);
@ -810,7 +807,9 @@ public class JsonHelper {
responseSingle.setMusicVideoType(watchEndPoint[3]); responseSingle.setMusicVideoType(watchEndPoint[3]);
} }
if (g == 1) SingerName = text; if (g == 1) {
SingerName = text;
}
if (g == 2) { if (g == 2) {
//这里应该没有值 //这里应该没有值
Description = text; Description = text;

View File

@ -5,6 +5,8 @@ import android.os.CountDownTimer;
import android.view.View; import android.view.View;
import com.hi.music.player.databinding.ActivityAsplashBinding; import com.hi.music.player.databinding.ActivityAsplashBinding;
import com.hi.music.player.firebase.RemoteConfigJava;
import com.hi.music.player.firebase.Sp;
public class A_SplashActivity extends BaseActivity<ActivityAsplashBinding> { public class A_SplashActivity extends BaseActivity<ActivityAsplashBinding> {
@ -60,9 +62,7 @@ public class A_SplashActivity extends BaseActivity<ActivityAsplashBinding> {
@Override @Override
public void onFinish() { public void onFinish() {
vb.progressBar.setProgress(100); vb.progressBar.setProgress(100);
Intent intent = new Intent(A_SplashActivity.this, A_HomeActivity.class); enterHome();
startActivity(intent);
finish();
} }
}; };
@ -74,4 +74,17 @@ public class A_SplashActivity extends BaseActivity<ActivityAsplashBinding> {
public void onClick(View v) { public void onClick(View v) {
} }
private void enterHome(){
String stringValue = Sp.getInstance().getStringValue(RemoteConfigJava.key_open_type);
Intent intent;
if(stringValue.equals(RemoteConfigJava.value_open_type_0)){
intent = new Intent(A_SplashActivity.this, A_HomeActivity.class);
}else {
intent = new Intent(A_SplashActivity.this, HomeActivity.class);
}
startActivity(intent);
finish();
}
} }

View File

@ -206,7 +206,7 @@ public class CategoryListActivity extends BaseActivity<ActivityCategoryListBindi
Glide.with(MusicApplication.myApplication) Glide.with(MusicApplication.myApplication)
.asDrawable() .asDrawable()
.apply(bitmapTransform(new RoundedCorners(CommonUtils.dpToPx(10)))) // .apply(bitmapTransform(new RoundedCorners(CommonUtils.dpToPx(10))))
.load(url) .load(url)
.placeholder(R.drawable.placeholder) .placeholder(R.drawable.placeholder)
.listener(new RequestListener<Drawable>() { .listener(new RequestListener<Drawable>() {

View File

@ -111,7 +111,7 @@ public class LikeSongActivity extends BaseActivity<ActivityLikeSongBinding> impl
@Override @Override
public boolean showPanel() { public boolean showPanel() {
return false; return true;
} }
@Override @Override

View File

@ -31,6 +31,7 @@ import com.hi.music.player.ui.fragmnt.viewmodel.VMResultList;
public class ResultListActivity extends BaseActivity<ActivityResultListBinding> implements HomeItemClickListener { public class ResultListActivity extends BaseActivity<ActivityResultListBinding> implements HomeItemClickListener {
private VMResultList vm; private VMResultList vm;
private String key;
@Override @Override
protected ActivityResultListBinding getViewBinding() { protected ActivityResultListBinding getViewBinding() {
@ -40,23 +41,25 @@ 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(MyValue.KEY_SEARCH_RESULT_BROWSER_ID); 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>() {
@Override @Override
public void onChanged(ResponseResult responseResult) { public void onChanged(ResponseResult responseResult) {
if(responseResult == null){ vb.pbLoading.setVisibility(View.GONE);
if (responseResult == null) {
vb.layoutError.linearRetry.setVisibility(View.VISIBLE);
return; return;
} }
vb.pbLoading.setVisibility(View.GONE);
loadInfo(responseResult); loadInfo(responseResult);
} }
}); });
} }
private void loadInfo(ResponseResult result){ private void loadInfo(ResponseResult result) {
Glide.with(this) Glide.with(this)
.asDrawable() .asDrawable()
.load(result.getMainCovert()) .load(result.getMainCovert())
@ -86,6 +89,7 @@ public class ResultListActivity extends BaseActivity<ActivityResultListBinding>
@Override @Override
protected void onInitClick() { protected void onInitClick() {
vb.imBack.setOnClickListener(this); vb.imBack.setOnClickListener(this);
vb.layoutError.tvRetry.setOnClickListener(this);
} }
@Override @Override
@ -105,14 +109,16 @@ public class ResultListActivity extends BaseActivity<ActivityResultListBinding>
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if(v.equals(vb.imBack)){ if (v.equals(vb.imBack)) {
finish(); finish();
} else if (v.equals(vb.layoutError.tvRetry)) {
vm.getList(key);
} }
} }
@Override @Override
public void onClickResultSong(ResponseResultListChild child,int index) { public void onClickResultSong(ResponseResultListChild child, int index) {
String videoId = child.getVideoId(); String videoId = child.getVideoId();
String playListId = child.getPlayListId(); String playListId = child.getPlayListId();
String browserId = child.getBrowserId(); String browserId = child.getBrowserId();
@ -121,7 +127,7 @@ public class ResultListActivity extends BaseActivity<ActivityResultListBinding>
String songName = child.getSongName(); String songName = child.getSongName();
String subTitle = child.getSubTitle(); String subTitle = child.getSubTitle();
if(videoId!= null&&!videoId.isEmpty()){ if (videoId != null && !videoId.isEmpty()) {
ResponseSingle responseSingle = new ResponseSingle(); ResponseSingle responseSingle = new ResponseSingle();
responseSingle.setSongTitle(songName); responseSingle.setSongTitle(songName);
responseSingle.setSingerHead(thumbnail); responseSingle.setSingerHead(thumbnail);
@ -129,14 +135,14 @@ public class ResultListActivity extends BaseActivity<ActivityResultListBinding>
responseSingle.setPlaylistId(playListId); responseSingle.setPlaylistId(playListId);
Intent intent = new Intent(this, PlayActivity.class); Intent intent = new Intent(this, PlayActivity.class);
intent.putExtra(MyValue.KEY_PLAY_ACTIVITY_SINGER, responseSingle); intent.putExtra(MyValue.KEY_PLAY_ACTIVITY_SINGER, responseSingle);
intent.putExtra(MyValue.KEY_PLAY_ACTIVITY_CATEGORY_LIST_INDEX,index); intent.putExtra(MyValue.KEY_PLAY_ACTIVITY_CATEGORY_LIST_INDEX, index);
CommonUtils.LogMsg("-------------index="+index); CommonUtils.LogMsg("-------------index=" + index);
startActivity(intent); startActivity(intent);
}else { } else {
switch (pageType){ switch (pageType) {
case "MUSIC_PAGE_TYPE_ALBUM": case "MUSIC_PAGE_TYPE_ALBUM":
//专辑 //专辑
CommonUtils.LogMsg("------------专辑-index="+index+"--subTitle="+subTitle); 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);
@ -158,7 +164,6 @@ public class ResultListActivity extends BaseActivity<ActivityResultListBinding>
} }
} }
} }

View File

@ -38,17 +38,26 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="77dp"> android:layout_marginTop="77dp">
<ImageView <androidx.cardview.widget.CardView
android:id="@+id/imCovert" android:layout_width="wrap_content"
android:layout_width="250dp" android:layout_height="wrap_content"
android:layout_height="220dp" android:id="@+id/card_im"
android:layout_centerHorizontal="true" /> android:layout_centerHorizontal="true"
app:cardCornerRadius="10dp"
app:cardElevation="0dp">
<ImageView
android:id="@+id/imCovert"
android:scaleType="centerCrop"
android:layout_width="250dp"
android:layout_height="220dp" />
</androidx.cardview.widget.CardView>
<TextView <TextView
android:id="@+id/tvTitle" android:id="@+id/tvTitle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/imCovert" android:layout_below="@id/card_im"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginStart="20dp" android:layout_marginStart="20dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
@ -121,10 +130,10 @@
android:src="@drawable/arrow_bottom" /> android:src="@drawable/arrow_bottom" />
<include <include
android:id="@+id/layout_error"
layout="@layout/layout_error" layout="@layout/layout_error"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="80dp" android:layout_gravity="center"
android:id="@+id/layout_error" android:layout_marginBottom="80dp" />
android:layout_gravity="center" />
</FrameLayout> </FrameLayout>

View File

@ -36,7 +36,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="15dp" android:layout_marginStart="15dp"
android:layout_marginTop="40dp" android:layout_marginTop="20dp"
android:text="@string/like_song" android:text="@string/like_song"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="17sp" android:textSize="17sp"
@ -46,8 +46,11 @@
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler" android:id="@+id/recycler"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="0dp"
android:layout_marginTop="5dp" android:layout_marginTop="10dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_song_size" /> app:layout_constraintTop_toBottomOf="@id/tv_song_size" />

View File

@ -1,303 +1,307 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.core.widget.NestedScrollView 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_height="match_parent" android:layout_height="match_parent"
android:background="@color/black" android:background="@color/black"
tools:context=".ui.activity.PlayActivity"> android:fillViewport="true"
android:id="@+id/root_layout"
<View android:layout_width="match_parent" >
<FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@drawable/black_gradient" /> tools:context=".ui.activity.PlayActivity">
<androidx.constraintlayout.widget.ConstraintLayout <View
android:id="@+id/content_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<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" />
<androidx.cardview.widget.CardView
android:id="@+id/card_playerView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="300dp" android:layout_height="match_parent"
android:layout_marginStart="20dp" android:background="@drawable/black_gradient" />
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 <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/player_view" android:id="@+id/content_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="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" />
<ImageView <ImageView
android:id="@+id/im_covert" 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" />
<androidx.cardview.widget.CardView
android:id="@+id/card_playerView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="300dp"
android:scaleType="centerCrop" android:layout_marginStart="20dp"
android:src="@mipmap/ic_launcher" android:layout_marginTop="30dp"
android:visibility="gone" android:layout_marginEnd="20dp"
app:cardBackgroundColor="@color/black"
app:cardCornerRadius="8dp"
app:cardElevation="0dp"
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">
</androidx.cardview.widget.CardView>
<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" />
<ProgressBar <ImageView
android:id="@+id/progressBarLoading" android:id="@+id/im_covert"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:indeterminateTint="@color/white" android:scaleType="centerCrop"
android:visibility="gone" android:src="@mipmap/ic_launcher"
app:layout_constraintBottom_toBottomOf="@id/card_playerView" android:visibility="gone"
app:layout_constraintLeft_toLeftOf="@id/card_playerView" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="@id/card_playerView" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/card_playerView" /> app:layout_constraintTop_toBottomOf="@id/im_back" />
</androidx.cardview.widget.CardView>
<include
android:id="@+id/layout_error"
layout="@layout/layout_error"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
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_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:textColor="@color/text_color_1"
android:textSize="19sp"
app:layout_constraintLeft_toLeftOf="@id/card_playerView"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/card_playerView" />
<TextView
android:id="@+id/tv_singer_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="7dp"
android:text=""
android:textColor="@color/white_60_color"
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/selector_download" />
<ProgressBar <ProgressBar
android:id="@+id/download_pb" android:id="@+id/progressBarLoading"
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="gone" />
<TextView
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: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" />
<include
android:id="@+id/layout_error"
layout="@layout/layout_error"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
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_song_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="25dp"
android:text=""
android:textColor="@color/text_color_1"
android:textSize="19sp"
app:layout_constraintLeft_toLeftOf="@id/card_playerView"
app:layout_constraintRight_toRightOf="@id/card_playerView"
app:layout_constraintTop_toBottomOf="@id/card_playerView" />
<TextView
android:id="@+id/tv_singer_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="7dp"
android:text="9999999999999999999999999999999999999999999999"
android:textColor="@color/white_60_color"
android:textSize="15sp"
app:layout_constraintRight_toRightOf="@id/tv_song_name"
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:layout_marginStart="12dp"
android:layout_toEndOf="@id/im_download" android:background="@drawable/bg_like_layout"
android:text="@string/download" android:orientation="horizontal"
android:textColor="@color/white" android:paddingStart="22dp"
android:textSize="14sp" /> android:paddingEnd="22dp"
</RelativeLayout> app:layout_constraintLeft_toRightOf="@id/layout_like"
app:layout_constraintTop_toTopOf="@id/layout_like">
<SeekBar <ImageView
android:id="@+id/play_progress" android:id="@+id/im_download"
android:layout_width="0dp" android:layout_width="24dp"
android:layout_height="wrap_content" android:layout_height="24dp"
android:layout_marginTop="25dp" android:layout_centerVertical="true"
android:maxHeight="3dp" android:src="@drawable/selector_download" />
android:paddingStart="5dp"
android:paddingLeft="0dp" <ProgressBar
android:paddingEnd="5dp" android:id="@+id/download_pb"
android:paddingRight="0dp" android:layout_width="24dp"
android:progress="3" android:layout_height="24dp"
android:progressDrawable="@drawable/seekbar_progress_drawable" android:layout_centerVertical="true"
android:thumb="@drawable/seekbar_thumb" android:indeterminateTint="@color/panel_bg"
app:layout_constraintLeft_toLeftOf="@id/card_playerView" android:progressBackgroundTint="@color/panel_bg"
app:layout_constraintRight_toRightOf="@id/card_playerView" android:progressTint="@color/panel_bg"
app:layout_constraintTop_toBottomOf="@id/layout_like" /> android:visibility="gone" />
<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"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:maxHeight="3dp"
android:paddingStart="5dp"
android:paddingLeft="0dp"
android:paddingEnd="5dp"
android:paddingRight="0dp"
android:progress="3"
android:progressDrawable="@drawable/seekbar_progress_drawable"
android:thumb="@drawable/seekbar_thumb"
app:layout_constraintLeft_toLeftOf="@id/card_playerView"
app:layout_constraintRight_toRightOf="@id/card_playerView"
app:layout_constraintTop_toBottomOf="@id/layout_like" />
<ProgressBar <ProgressBar
android:id="@+id/progressBar_buffer" android:id="@+id/progressBar_buffer"
style="?android:attr/progressBarStyleHorizontal" style="?android:attr/progressBarStyleHorizontal"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="3dp" android:layout_height="3dp"
android:paddingStart="5dp" android:paddingStart="5dp"
android:paddingEnd="5dp" android:paddingEnd="5dp"
android:progress="10" 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"
app:layout_constraintRight_toRightOf="@id/play_progress" app:layout_constraintRight_toRightOf="@id/play_progress"
app:layout_constraintTop_toTopOf="@id/play_progress" /> app:layout_constraintTop_toTopOf="@id/play_progress" />
<TextView <TextView
android:id="@+id/tv_current" android:id="@+id/tv_current"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:paddingStart="5dp" android:paddingStart="5dp"
android:text="0:00" android:text="0:00"
android:textColor="@color/white_60_color" android:textColor="@color/white_60_color"
app:layout_constraintStart_toStartOf="@id/play_progress" app:layout_constraintStart_toStartOf="@id/play_progress"
app:layout_constraintTop_toBottomOf="@id/play_progress" /> app:layout_constraintTop_toBottomOf="@id/play_progress" />
<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="wrap_content"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:paddingEnd="5dp" android:paddingEnd="5dp"
android:text="0:00" android:text="0:00"
android:textColor="@color/white_60_color" android:textColor="@color/white_60_color"
app:layout_constraintEnd_toEndOf="@id/play_progress" app:layout_constraintEnd_toEndOf="@id/play_progress"
app:layout_constraintTop_toBottomOf="@id/play_progress" /> app:layout_constraintTop_toBottomOf="@id/play_progress" />
<ImageView <ImageView
android:id="@+id/btn_play" android:id="@+id/btn_play"
android:layout_width="66dp" android:layout_width="66dp"
android:layout_height="66dp" android:layout_height="66dp"
android:layout_marginTop="15dp" android:layout_marginTop="15dp"
android:src="@drawable/selector_icon_play" android:src="@drawable/selector_icon_play"
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/tv_duration" /> app:layout_constraintTop_toBottomOf="@id/tv_duration" />
<ImageView <ImageView
android:id="@+id/btn_previous" android:id="@+id/btn_previous"
android:layout_width="45dp" android:layout_width="45dp"
android:layout_height="45dp" android:layout_height="45dp"
android:layout_marginEnd="24dp" android:layout_marginEnd="24dp"
android:padding="12dp" android:padding="12dp"
android:src="@mipmap/icon_previous_true" android:src="@mipmap/icon_previous_true"
app:layout_constraintBottom_toBottomOf="@id/btn_play" app:layout_constraintBottom_toBottomOf="@id/btn_play"
app:layout_constraintEnd_toStartOf="@id/btn_play" app:layout_constraintEnd_toStartOf="@id/btn_play"
app:layout_constraintTop_toTopOf="@id/btn_play" /> app:layout_constraintTop_toTopOf="@id/btn_play" />
<ImageView <ImageView
android:id="@+id/btn_next" android:id="@+id/btn_next"
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:padding="12dp" android:padding="12dp"
android:src="@mipmap/icon_next_true" 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" />
<ImageView <ImageView
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:padding="10dp" android:padding="10dp"
android:src="@mipmap/icon_list" 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"
app:layout_constraintTop_toTopOf="@id/btn_play" /> app:layout_constraintTop_toTopOf="@id/btn_play" />
<ImageView <ImageView
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:padding="10dp" android:padding="10dp"
android:src="@drawable/icon_looper_no" 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"
app:layout_constraintTop_toTopOf="@id/btn_play" /> app:layout_constraintTop_toTopOf="@id/btn_play" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<include <include
android:id="@+id/layout_playList" android:id="@+id/layout_playList"
layout="@layout/dialog_play_list" /> layout="@layout/dialog_play_list" />
</FrameLayout> </FrameLayout>
</androidx.core.widget.NestedScrollView>

View File

@ -3,8 +3,9 @@
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:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:background="@color/black" android:background="@color/black"
android:fillViewport="true"
tools:context=".ui.activity.ResultListActivity"> tools:context=".ui.activity.ResultListActivity">
<RelativeLayout <RelativeLayout
@ -12,42 +13,42 @@
android:layout_height="match_parent"> android:layout_height="match_parent">
<RelativeLayout
<RelativeLayout android:id="@+id/relayout_top"
android:id="@+id/relayout_top"
android:layout_width="match_parent"
android:layout_height="280dp"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/covert"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="280dp"
android:src="@mipmap/ic_launcher" app:layout_constraintTop_toTopOf="parent">
android:scaleType="centerCrop" />
<ImageView <ImageView
android:id="@+id/im_back" android:id="@+id/covert"
android:layout_width="42dp" android:layout_width="match_parent"
android:layout_height="42dp" android:layout_height="match_parent"
android:layout_marginStart="16dp" android:scaleType="centerCrop"
android:layout_marginTop="35dp" android:src="@drawable/placeholder" />
android:padding="9dp"
android:src="@drawable/arrow_bottom" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:background="@drawable/black_gradient"/>
</RelativeLayout> <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" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:background="@drawable/black_gradient" />
</RelativeLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="200dp" android:layout_marginTop="200dp"
android:orientation="vertical"> android:orientation="vertical"
app:layout_constraintTop_toTopOf="parent">
<TextView <TextView
android:id="@+id/main_title" android:id="@+id/main_title"
@ -66,5 +67,21 @@
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/main_title" /> app:layout_constraintTop_toBottomOf="@id/main_title" />
</LinearLayout> </LinearLayout>
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:id="@+id/pb_loading"
android:indeterminateTint="@color/white" />
<include
android:id="@+id/layout_error"
layout="@layout/layout_error"
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout> </RelativeLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>

View File

@ -33,6 +33,7 @@
android:layout_width="40dp" android:layout_width="40dp"
android:layout_height="40dp" android:layout_height="40dp"
android:layout_margin="16dp" android:layout_margin="16dp"
android:visibility="gone"
android:src="@drawable/ic_launcher_background" android:src="@drawable/ic_launcher_background"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
@ -68,6 +69,14 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:scaleType="centerCrop" /> android:scaleType="centerCrop" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/library_view"
android:layout_marginTop="-10dp"
android:layout_alignParentBottom="true"
android:layout_alignTop="@id/im"/>
<ImageView <ImageView
android:layout_width="20dp" android:layout_width="20dp"
android:layout_height="20dp" android:layout_height="20dp"
@ -90,6 +99,8 @@
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:textSize="15sp"/> android:textSize="15sp"/>
</RelativeLayout> </RelativeLayout>
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>
@ -134,6 +145,14 @@
android:layout_centerInParent="true" android:layout_centerInParent="true"
android:scaleType="centerCrop" /> android:scaleType="centerCrop" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/library_view"
android:layout_marginTop="-10dp"
android:layout_alignParentBottom="true"
android:layout_alignTop="@id/download_im"/>
<ImageView <ImageView
android:layout_width="20dp" android:layout_width="20dp"
android:layout_height="20dp" android:layout_height="20dp"

View File

@ -57,6 +57,8 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="6dp" android:layout_marginEnd="6dp"
android:maxLines="1"
android:ellipsize="end"
android:text="9999999999999999" android:text="9999999999999999"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="15sp" /> android:textSize="15sp" />
@ -66,6 +68,8 @@
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="@string/app_name"
android:maxLines="1"
android:ellipsize="end"
android:textColor="@color/white_60_color" android:textColor="@color/white_60_color"
android:textSize="12sp" /> android:textSize="12sp" />
</LinearLayout> </LinearLayout>

View File

@ -2,9 +2,8 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout 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"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="60dp" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:layout_marginTop="16dp">
android:background="@color/black">
<androidx.cardview.widget.CardView <androidx.cardview.widget.CardView
android:id="@+id/card" android:id="@+id/card"
@ -24,11 +23,13 @@
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginStart="12dp" android:layout_marginStart="12dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="vertical" android:orientation="vertical"
android:paddingEnd="5dp"
app:layout_constraintRight_toLeftOf="@id/layout_download"
app:layout_constraintBottom_toBottomOf="@id/card" app:layout_constraintBottom_toBottomOf="@id/card"
app:layout_constraintLeft_toRightOf="@id/card" app:layout_constraintLeft_toRightOf="@id/card"
app:layout_constraintTop_toTopOf="@id/card"> app:layout_constraintTop_toTopOf="@id/card">
@ -37,7 +38,9 @@
android:id="@+id/tv_title" android:id="@+id/tv_title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/like_song" android:text="@string/app_name"
android:maxLines="1"
android:ellipsize="end"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="14sp" /> android:textSize="14sp" />
@ -46,21 +49,23 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:text="@string/like_song" android:text="@string/app_name"
android:maxLines="1"
android:ellipsize="end"
android:textColor="@color/white_60_color" android:textColor="@color/white_60_color"
android:textSize="12sp" /> android:textSize="12sp" />
</LinearLayout> </LinearLayout>
<FrameLayout <FrameLayout
android:id="@+id/layout_download"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="15dp" android:layout_marginEnd="15dp"
android:padding="10dp" android:padding="10dp"
android:id="@+id/layout_download" app:layout_constraintBottom_toBottomOf="@id/card"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="@id/card">
<ImageView <ImageView
android:id="@+id/im_download" android:id="@+id/im_download"
@ -79,4 +84,10 @@
android:visibility="gone" /> android:visibility="gone" />
</FrameLayout> </FrameLayout>
<View
android:id="@+id/place"
android:layout_width="match_parent"
android:layout_height="74dp"
android:visibility="gone"
app:layout_constraintTop_toBottomOf="@id/card" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -51,6 +51,8 @@
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="@string/app_name"
android:ellipsize="end"
android:maxLines="1"
android:textColor="@color/panel_singer_color" android:textColor="@color/panel_singer_color"
android:textSize="12sp" /> android:textSize="12sp" />
</LinearLayout> </LinearLayout>

View File

@ -27,4 +27,6 @@
<color name="home_bg2">#B9D1A6</color> <color name="home_bg2">#B9D1A6</color>
<color name="white_15_color">#26FFFFFF</color> <color name="white_15_color">#26FFFFFF</color>
<color name="home_tab_color">#339ED3A2</color> <color name="home_tab_color">#339ED3A2</color>
<color name="library_view">#B3000000</color>
</resources> </resources>

View File

@ -2,6 +2,11 @@
plugins { plugins {
id("com.android.application") version "8.1.3" apply false id("com.android.application") version "8.1.3" apply false
// id("org.jetbrains.kotlin.android") version "1.9.22" apply false // id("org.jetbrains.kotlin.android") version "1.9.22" apply false
id("com.google.gms.google-services") version "4.3.15" apply false
id ("com.google.firebase.crashlytics") version "2.9.2" apply false
} }
buildscript { buildscript {