Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9612529c69 | ||
|
|
05d7e426b0 |
@ -3,29 +3,31 @@ 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")
|
||||||
|
id("applovin-quality-service")
|
||||||
|
}
|
||||||
|
applovin {
|
||||||
|
apiKey = "4CFHxOfvQvy95EqDxa_eNPe4pmq_KfoZPJeVscTMt2uT3VL2fO3iyZyBFMTOOTRbKw6WelbaDEhNzxOxVrlQTE"
|
||||||
}
|
}
|
||||||
|
|
||||||
val timestamp = SimpleDateFormat("MM_dd_HH_mm").format(Date())
|
val timestamp = SimpleDateFormat("MM_dd_HH_mm").format(Date())
|
||||||
|
|
||||||
android {
|
android {
|
||||||
namespace = "com.offline.music.playermp3"
|
namespace = "com.offline.music.player"
|
||||||
compileSdk = 34
|
compileSdk = 34
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
//com.hi.music.player
|
//com.offline.music.playermp3
|
||||||
applicationId = "com.offline.music.playermp3"
|
applicationId = "com.offline.music.playermp3"
|
||||||
minSdk = 23
|
minSdk = 23
|
||||||
targetSdk = 34
|
targetSdk = 34
|
||||||
versionCode = 1
|
versionCode = 3
|
||||||
versionName = "1.0.0"
|
versionName = "1.0.2"
|
||||||
|
|
||||||
setProperty(
|
setProperty("archivesBaseName", "Offline Music Player" + versionName + "(${versionCode})_$timestamp")
|
||||||
"archivesBaseName",
|
|
||||||
"Offline Music Player" + versionName + "(${versionCode})_$timestamp"
|
|
||||||
)
|
|
||||||
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
@ -40,9 +42,9 @@ android {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// kotlinOptions{
|
kotlinOptions{
|
||||||
// jvmTarget = "1.8"
|
jvmTarget = "1.8"
|
||||||
// }
|
}
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
@ -76,25 +78,36 @@ dependencies {
|
|||||||
implementation("com.github.bumptech.glide:glide:4.16.0")
|
implementation("com.github.bumptech.glide:glide:4.16.0")
|
||||||
// kapt("com.github.bumptech.glide:compiler:4.16.0")
|
// kapt("com.github.bumptech.glide:compiler:4.16.0")
|
||||||
// Glide 的图片变换库,包括高斯模糊
|
// Glide 的图片变换库,包括高斯模糊
|
||||||
implementation("jp.wasabeef:glide-transformations:4.3.0")
|
implementation ("jp.wasabeef:glide-transformations:4.3.0")
|
||||||
|
|
||||||
|
|
||||||
//提取图片主色
|
|
||||||
// implementation ("androidx.palette:palette:1.0.0")
|
|
||||||
|
|
||||||
//动画
|
|
||||||
// implementation ("com.airbnb.android:lottie:6.5.0")
|
|
||||||
|
|
||||||
//----------media3
|
|
||||||
// implementation("androidx.media3:media3-exoplayer:1.4.1")
|
|
||||||
// implementation("androidx.media3:media3-exoplayer-dash:1.4.1")
|
|
||||||
// implementation("androidx.media3:media3-session:1.4.1")
|
|
||||||
// implementation("androidx.media3:media3-ui:1.4.1")
|
|
||||||
// implementation ("androidx.media3:media3-database:1.4.1")
|
|
||||||
//----------media3
|
|
||||||
|
|
||||||
|
|
||||||
// implementation ("com.geyifeng.immersionbar:immersionbar:3.2.2")
|
//------------------firebase
|
||||||
// implementation ("com.geyifeng.immersionbar:immersionbar-components:3.2.2")
|
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")
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------applovin
|
||||||
|
implementation("com.applovin:applovin-sdk:+")
|
||||||
|
implementation("com.applovin.mediation:bigoads-adapter:+")
|
||||||
|
implementation("com.applovin.mediation:chartboost-adapter:+")
|
||||||
|
implementation("com.google.android.gms:play-services-base:16.1.0")
|
||||||
|
implementation("com.applovin.mediation:fyber-adapter:+")
|
||||||
|
|
||||||
|
implementation("com.applovin.mediation:inmobi-adapter:+")
|
||||||
|
implementation("com.squareup.picasso:picasso:2.71828")
|
||||||
|
implementation("androidx.recyclerview:recyclerview:1.1.0")
|
||||||
|
implementation("com.applovin.mediation:ironsource-adapter:+")
|
||||||
|
implementation("com.applovin.mediation:vungle-adapter:+")
|
||||||
|
implementation("com.applovin.mediation:facebook-adapter:+")
|
||||||
|
implementation("com.applovin.mediation:moloco-adapter:+")
|
||||||
|
implementation("com.applovin.mediation:bytedance-adapter:+")
|
||||||
|
implementation("com.applovin.mediation:unityads-adapter:+")
|
||||||
|
|
||||||
|
|
||||||
|
//applovin The SDK collects the Google Advertising ID. This requires the Android Advertising ID (AAID) module (com.google.android.gms:play-services-ads-identifier).
|
||||||
|
implementation("com.google.android.gms:play-services-ads-identifier:18.1.0")
|
||||||
}
|
}
|
||||||
29
app/google-services.json
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"project_info": {
|
||||||
|
"project_number": "764712897094",
|
||||||
|
"project_id": "offline-music-player-176ab",
|
||||||
|
"storage_bucket": "offline-music-player-176ab.firebasestorage.app"
|
||||||
|
},
|
||||||
|
"client": [
|
||||||
|
{
|
||||||
|
"client_info": {
|
||||||
|
"mobilesdk_app_id": "1:764712897094:android:2d533528b5ff4271a45847",
|
||||||
|
"android_client_info": {
|
||||||
|
"package_name": "com.offline.music.playermp3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oauth_client": [],
|
||||||
|
"api_key": [
|
||||||
|
{
|
||||||
|
"current_key": "AIzaSyDohnv8AScCd1A7RTR-6LLLtQcE7EuJmIw"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"services": {
|
||||||
|
"appinvite_service": {
|
||||||
|
"other_platform_oauth_client": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"configuration_version": "1"
|
||||||
|
}
|
||||||
2
app/proguard-rules.pro
vendored
@ -29,7 +29,7 @@
|
|||||||
-dontwarn retrofit2.**
|
-dontwarn retrofit2.**
|
||||||
-dontwarn javax.annotation.Nullable
|
-dontwarn javax.annotation.Nullable
|
||||||
|
|
||||||
-keep class com.offline.music.playermp3.javabean.A_data.AudioItem { *; }
|
-keep class com.offline.music.player.javabean.A_data.AudioItem { *; }
|
||||||
|
|
||||||
# 保持 Context、Intent 和权限相关的公共方法
|
# 保持 Context、Intent 和权限相关的公共方法
|
||||||
-keep class android.content.Context { *; }
|
-keep class android.content.Context { *; }
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package com.offline.music.playermp3;
|
package com.offline.music.player;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
@ -17,9 +17,9 @@
|
|||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||||
android:fullBackupContent="@xml/backup_rules"
|
android:fullBackupContent="@xml/backup_rules"
|
||||||
android:icon="@drawable/music_player_launch"
|
android:icon="@mipmap/music_logo"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:roundIcon="@drawable/music_player_launch"
|
android:roundIcon="@mipmap/music_logo"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/Theme.MusicApp"
|
android:theme="@style/Theme.MusicApp"
|
||||||
tools:targetApi="31">
|
tools:targetApi="31">
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 41 KiB |
@ -0,0 +1,66 @@
|
|||||||
|
package com.offline.music.player;
|
||||||
|
|
||||||
|
import android.app.Application;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
|
||||||
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||||
|
|
||||||
|
import com.applovin.sdk.AppLovinMediationProvider;
|
||||||
|
import com.applovin.sdk.AppLovinSdk;
|
||||||
|
import com.applovin.sdk.AppLovinSdkConfiguration;
|
||||||
|
import com.applovin.sdk.AppLovinSdkInitializationConfiguration;
|
||||||
|
|
||||||
|
public class MusicApplication extends Application {
|
||||||
|
|
||||||
|
public static Context myApplication;
|
||||||
|
|
||||||
|
public static String visitorData;
|
||||||
|
|
||||||
|
|
||||||
|
private String MAx_SDK_key = "tAh5Z8CtFiG05NfRWh9UuOHCp3h3SaFvlh6Phw5ucaxFMCRs2d97F7lywfBKOEKSipdaGq8vZOaDLZkrL1fDDc";
|
||||||
|
|
||||||
|
public static boolean initSDkOK = false;
|
||||||
|
public static String initAction = "MUSIC_ACTION_INIT";
|
||||||
|
|
||||||
|
public static void setVisitorData(String visitorData) {
|
||||||
|
MusicApplication.visitorData = visitorData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getVisitorData() {
|
||||||
|
return visitorData;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate() {
|
||||||
|
super.onCreate();
|
||||||
|
myApplication = this;
|
||||||
|
InitializeMax();
|
||||||
|
// Sp.init(this);
|
||||||
|
// RemoteConfigJava.getInstance().init(this);
|
||||||
|
// ObjectBoxManager.init(this);
|
||||||
|
// MyMediaControllerManager.getInstance().init(new MediaControllerStatusListener() {
|
||||||
|
// @Override
|
||||||
|
// public void onMediaControllerComplete(boolean isOk) {
|
||||||
|
// CommonUtils.LogMsg("=-----mediaController+" + isOk);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitializeMax() {
|
||||||
|
AppLovinSdkInitializationConfiguration initConfig = AppLovinSdkInitializationConfiguration.builder(MAx_SDK_key, this)
|
||||||
|
.setMediationProvider(AppLovinMediationProvider.MAX)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// Initialize the SDK with the configuration
|
||||||
|
AppLovinSdk.getInstance(this).initialize(initConfig, new AppLovinSdk.SdkInitializationListener() {
|
||||||
|
@Override
|
||||||
|
public void onSdkInitialized(final AppLovinSdkConfiguration sdkConfig) {
|
||||||
|
initSDkOK = true;
|
||||||
|
LocalBroadcastManager.getInstance(MusicApplication.this).sendBroadcast(new Intent(initAction));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,12 +1,12 @@
|
|||||||
package com.offline.music.playermp3.adapter;
|
package com.offline.music.player.adapter;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
||||||
|
|
||||||
import com.offline.music.playermp3.ui.fragmnt.A_HomeFragment;
|
import com.offline.music.player.ui.fragmnt.A_HomeFragment;
|
||||||
import com.offline.music.playermp3.ui.fragmnt.A_ImportFragment;
|
import com.offline.music.player.ui.fragmnt.A_ImportFragment;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -1,5 +1,6 @@
|
|||||||
package com.offline.music.playermp3.adapter;
|
package com.offline.music.player.adapter;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@ -12,22 +13,25 @@ import android.widget.TextView;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.offline.music.playermp3.R;
|
import com.offline.music.player.R;
|
||||||
import com.offline.music.playermp3.javabean.A_data.AudioItem;
|
import com.offline.music.player.javabean.A_data.AudioItem;
|
||||||
import com.offline.music.playermp3.ui.activity.A_PlayActivity;
|
import com.offline.music.player.max.MaxManager;
|
||||||
|
import com.offline.music.player.max.onAdAfterAction;
|
||||||
|
import com.offline.music.player.ui.activity.A_PlayActivity;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
public class A_ImportFragmentAdapter extends RecyclerView.Adapter<A_ImportFragmentAdapter.ViewHolder> {
|
public class A_ImportFragmentAdapter extends RecyclerView.Adapter<A_ImportFragmentAdapter.ViewHolder> {
|
||||||
|
|
||||||
private Context context;
|
private Activity context;
|
||||||
private List<AudioItem> audioFiles = new ArrayList<>();
|
private List<AudioItem> audioFiles = new ArrayList<>();
|
||||||
private AudioItem audioItem;
|
private AudioItem audioItem;
|
||||||
private OnOptionClickListener onOptionClickListener;
|
private OnOptionClickListener onOptionClickListener;;
|
||||||
private String newName;
|
private String newName;
|
||||||
|
|
||||||
public A_ImportFragmentAdapter(Context context, String newName) {
|
public A_ImportFragmentAdapter(Activity context, String newName) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.newName = newName;
|
this.newName = newName;
|
||||||
}
|
}
|
||||||
@ -40,31 +44,27 @@ public class A_ImportFragmentAdapter extends RecyclerView.Adapter<A_ImportFragme
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||||
AudioItem audioItem1 = audioFiles.get(position);
|
audioItem = audioFiles.get(position);
|
||||||
|
|
||||||
holder.title.setText(audioItem1.getName());
|
holder.title.setText(audioItem.getName());
|
||||||
holder.time.setText(audioItem1.getDuration());
|
holder.time.setText(audioItem.getDuration());
|
||||||
Log.d("Adapter", "onBindViewHolder: " + audioItem1.getDuration());
|
Log.d("Adapter", "onBindViewHolder: " + audioItem.getDuration());
|
||||||
|
|
||||||
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Intent intent = new Intent(context, A_PlayActivity.class);
|
MaxManager.startShowMaxAd(context, new onAdAfterAction() {
|
||||||
intent.putExtra("Path", audioItem1);
|
|
||||||
intent.putExtra("newName",newName);
|
|
||||||
context.startActivity(intent);
|
|
||||||
}
|
|
||||||
});holder.itemView.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onAction() {
|
||||||
Intent intent = new Intent(context, A_PlayActivity.class);
|
Intent intent = new Intent(context, A_PlayActivity.class);
|
||||||
intent.putExtra("Path", audioItem1);
|
intent.putExtra("Path", audioItem);
|
||||||
intent.putExtra("newName",newName);
|
intent.putExtra("newName",newName);
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
holder.bind(audioItem1); // 通过 bind 方法将 audioItem1 传递到 ViewHolder
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -82,6 +82,7 @@ public class A_ImportFragmentAdapter extends RecyclerView.Adapter<A_ImportFragme
|
|||||||
return audioFiles.get(position); // 返回位置上的 AudioItem 对象
|
return audioFiles.get(position); // 返回位置上的 AudioItem 对象
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void updateTitle(int position, String newTitle) {
|
public void updateTitle(int position, String newTitle) {
|
||||||
if (position >= 0 && position < audioFiles.size()) {
|
if (position >= 0 && position < audioFiles.size()) {
|
||||||
audioFiles.get(position).setName(newTitle); // 假设 AudioItem 有一个 setName 方法
|
audioFiles.get(position).setName(newTitle); // 假设 AudioItem 有一个 setName 方法
|
||||||
@ -102,12 +103,12 @@ public class A_ImportFragmentAdapter extends RecyclerView.Adapter<A_ImportFragme
|
|||||||
void onOptionClick(int position, String filePath, View anchorView);
|
void onOptionClick(int position, String filePath, View anchorView);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class ViewHolder extends RecyclerView.ViewHolder {
|
class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
ImageView option;
|
ImageView option;
|
||||||
TextView title;
|
TextView title;
|
||||||
TextView time;
|
TextView time;
|
||||||
private AudioItem audioItem; // 定义一个 audioItem 字段
|
|
||||||
|
|
||||||
public ViewHolder(@NonNull View itemView) {
|
public ViewHolder(@NonNull View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
@ -118,15 +119,13 @@ public class A_ImportFragmentAdapter extends RecyclerView.Adapter<A_ImportFragme
|
|||||||
|
|
||||||
option.setOnClickListener(v -> {
|
option.setOnClickListener(v -> {
|
||||||
int position = getAdapterPosition();
|
int position = getAdapterPosition();
|
||||||
if (position != RecyclerView.NO_POSITION && onOptionClickListener != null && audioItem != null) {
|
if (position != RecyclerView.NO_POSITION && onOptionClickListener != null) {
|
||||||
onOptionClickListener.onOptionClick(position, audioItem.getFile(), option);
|
onOptionClickListener.onOptionClick(position, audioItem.getFile(), option);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 添加 bind 方法,将 audioItem 传递给 ViewHolder
|
|
||||||
public void bind(AudioItem audioItem) {
|
|
||||||
this.audioItem = audioItem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1,5 +1,6 @@
|
|||||||
package com.offline.music.playermp3.adapter;
|
package com.offline.music.player.adapter;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@ -14,20 +15,22 @@ import androidx.recyclerview.widget.DiffUtil;
|
|||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
import com.offline.music.playermp3.R;
|
import com.offline.music.player.R;
|
||||||
import com.offline.music.playermp3.helper.AudioItemDiffCallback;
|
import com.offline.music.player.helper.AudioItemDiffCallback;
|
||||||
import com.offline.music.playermp3.javabean.A_data.AudioItem;
|
import com.offline.music.player.javabean.A_data.AudioItem;
|
||||||
import com.offline.music.playermp3.ui.activity.A_PlayActivity;
|
import com.offline.music.player.max.MaxManager;
|
||||||
|
import com.offline.music.player.max.onAdAfterAction;
|
||||||
|
import com.offline.music.player.ui.activity.A_PlayActivity;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class A_InstrumentAdapter extends RecyclerView.Adapter<A_InstrumentAdapter.ViewHolder> {
|
public class A_InstrumentAdapter extends RecyclerView.Adapter<A_InstrumentAdapter.ViewHolder> {
|
||||||
|
|
||||||
private Context context;
|
private Activity context;
|
||||||
private List<AudioItem> audioItems = new ArrayList<>();
|
private List<AudioItem> audioItems = new ArrayList<>();
|
||||||
|
|
||||||
public A_InstrumentAdapter(Context context) {
|
public A_InstrumentAdapter(Activity context) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,11 +57,16 @@ public class A_InstrumentAdapter extends RecyclerView.Adapter<A_InstrumentAdapte
|
|||||||
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
MaxManager.startShowMaxAd(context, new onAdAfterAction() {
|
||||||
|
@Override
|
||||||
|
public void onAction() {
|
||||||
Intent intent = new Intent(context, A_PlayActivity.class);
|
Intent intent = new Intent(context, A_PlayActivity.class);
|
||||||
intent.putExtra("Path", audioItem);
|
intent.putExtra("Path", audioItem);
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,5 +1,6 @@
|
|||||||
package com.offline.music.playermp3.adapter;
|
package com.offline.music.player.adapter;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@ -13,20 +14,22 @@ import androidx.recyclerview.widget.DiffUtil;
|
|||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
import com.offline.music.playermp3.R;
|
import com.offline.music.player.R;
|
||||||
import com.offline.music.playermp3.helper.AudioItemDiffCallback;
|
import com.offline.music.player.helper.AudioItemDiffCallback;
|
||||||
import com.offline.music.playermp3.javabean.A_data.AudioItem;
|
import com.offline.music.player.javabean.A_data.AudioItem;
|
||||||
import com.offline.music.playermp3.ui.activity.A_PlayActivity;
|
import com.offline.music.player.max.MaxManager;
|
||||||
|
import com.offline.music.player.max.onAdAfterAction;
|
||||||
|
import com.offline.music.player.ui.activity.A_PlayActivity;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class A_NatureAdapter extends RecyclerView.Adapter<A_NatureAdapter.ViewHolder> {
|
public class A_NatureAdapter extends RecyclerView.Adapter<A_NatureAdapter.ViewHolder> {
|
||||||
|
|
||||||
private Context context;
|
private Activity context;
|
||||||
private List<AudioItem> audioItems = new ArrayList<>();
|
private List<AudioItem> audioItems = new ArrayList<>();
|
||||||
|
|
||||||
public A_NatureAdapter(Context context) {
|
public A_NatureAdapter(Activity context) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,11 +54,16 @@ public class A_NatureAdapter extends RecyclerView.Adapter<A_NatureAdapter.ViewHo
|
|||||||
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
MaxManager.startShowMaxAd(context, new onAdAfterAction() {
|
||||||
|
@Override
|
||||||
|
public void onAction() {
|
||||||
Intent intent = new Intent(context, A_PlayActivity.class);
|
Intent intent = new Intent(context, A_PlayActivity.class);
|
||||||
intent.putExtra("Path", audioItem);
|
intent.putExtra("Path", audioItem);
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1,5 +1,6 @@
|
|||||||
package com.offline.music.playermp3.adapter;
|
package com.offline.music.player.adapter;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@ -14,20 +15,22 @@ import androidx.recyclerview.widget.DiffUtil;
|
|||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
import com.offline.music.playermp3.R;
|
import com.offline.music.player.R;
|
||||||
import com.offline.music.playermp3.helper.AudioItemDiffCallback;
|
import com.offline.music.player.helper.AudioItemDiffCallback;
|
||||||
import com.offline.music.playermp3.javabean.A_data.AudioItem;
|
import com.offline.music.player.javabean.A_data.AudioItem;
|
||||||
import com.offline.music.playermp3.ui.activity.A_PlayActivity;
|
import com.offline.music.player.max.MaxManager;
|
||||||
|
import com.offline.music.player.max.onAdAfterAction;
|
||||||
|
import com.offline.music.player.ui.activity.A_PlayActivity;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class A_WhiteAdapter extends RecyclerView.Adapter<A_WhiteAdapter.ViewHolder> {
|
public class A_WhiteAdapter extends RecyclerView.Adapter<A_WhiteAdapter.ViewHolder> {
|
||||||
|
|
||||||
private Context context;
|
private Activity context;
|
||||||
private List<AudioItem> audioItems = new ArrayList<>();
|
private List<AudioItem> audioItems = new ArrayList<>();
|
||||||
|
|
||||||
public A_WhiteAdapter(Context context) {
|
public A_WhiteAdapter(Activity context) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,11 +58,16 @@ public class A_WhiteAdapter extends RecyclerView.Adapter<A_WhiteAdapter.ViewHold
|
|||||||
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
MaxManager.startShowMaxAd(context, new onAdAfterAction() {
|
||||||
|
@Override
|
||||||
|
public void onAction() {
|
||||||
Intent intent = new Intent(context, A_PlayActivity.class);
|
Intent intent = new Intent(context, A_PlayActivity.class);
|
||||||
intent.putExtra("Path", audioItem);
|
intent.putExtra("Path", audioItem);
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1,8 +1,8 @@
|
|||||||
package com.offline.music.playermp3.helper;
|
package com.offline.music.player.helper;
|
||||||
|
|
||||||
import androidx.recyclerview.widget.DiffUtil;
|
import androidx.recyclerview.widget.DiffUtil;
|
||||||
|
|
||||||
import com.offline.music.playermp3.javabean.A_data.AudioItem;
|
import com.offline.music.player.javabean.A_data.AudioItem;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.offline.music.playermp3.helper;
|
package com.offline.music.player.helper;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.offline.music.playermp3.helper;
|
package com.offline.music.player.helper;
|
||||||
|
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -9,7 +9,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
|||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
|
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
|
||||||
|
|
||||||
import com.offline.music.playermp3.MusicApplication;
|
import com.offline.music.player.MusicApplication;
|
||||||
|
|
||||||
public class ItemDecoration extends RecyclerView.ItemDecoration {
|
public class ItemDecoration extends RecyclerView.ItemDecoration {
|
||||||
|
|
||||||
@ -1,9 +1,9 @@
|
|||||||
package com.offline.music.playermp3.helper;
|
package com.offline.music.player.helper;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
import com.offline.music.playermp3.javabean.A_data.AudioItem;
|
import com.offline.music.player.javabean.A_data.AudioItem;
|
||||||
import com.offline.music.playermp3.javabean.A_data.Category;
|
import com.offline.music.player.javabean.A_data.Category;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.offline.music.playermp3.helper;
|
package com.offline.music.player.helper;
|
||||||
|
|
||||||
import android.content.ActivityNotFoundException;
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.offline.music.playermp3.javabean.A_data;
|
package com.offline.music.player.javabean.A_data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.offline.music.playermp3.javabean.A_data;
|
package com.offline.music.player.javabean.A_data;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
package com.offline.music.player.max;
|
||||||
|
|
||||||
|
import com.applovin.mediation.MaxAd;
|
||||||
|
|
||||||
|
public interface MaxListener {
|
||||||
|
void onFail(MaxAd ad);
|
||||||
|
|
||||||
|
void onShowSuccess(MaxAd ad);
|
||||||
|
|
||||||
|
void onHidden();
|
||||||
|
}
|
||||||
222
app/src/main/java/com/offline/music/player/max/MaxManager.java
Normal file
@ -0,0 +1,222 @@
|
|||||||
|
package com.offline.music.player.max;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.applovin.mediation.MaxAd;
|
||||||
|
import com.applovin.mediation.MaxAdListener;
|
||||||
|
import com.applovin.mediation.MaxError;
|
||||||
|
import com.applovin.mediation.ads.MaxInterstitialAd;
|
||||||
|
import com.applovin.mediation.nativeAds.MaxNativeAdListener;
|
||||||
|
import com.applovin.mediation.nativeAds.MaxNativeAdLoader;
|
||||||
|
import com.applovin.mediation.nativeAds.MaxNativeAdView;
|
||||||
|
import com.offline.music.player.MusicApplication;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class MaxManager {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static final String AD_TAG = "------MAX---------";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 原生广告
|
||||||
|
*/
|
||||||
|
//small
|
||||||
|
public static final String native_Ad1 = "318a8ed92bb2596d";
|
||||||
|
//small
|
||||||
|
public static final String native_Ad2 = "63e3d50c36c627d2";
|
||||||
|
/**
|
||||||
|
* 插页广告
|
||||||
|
*/
|
||||||
|
private static final String one_AD = "6510769676690c4d";
|
||||||
|
private static final String two_Ad = "7c6b55091a9aaf39";
|
||||||
|
private static final String three_ad = "39c6f571b5939dde";
|
||||||
|
|
||||||
|
|
||||||
|
public static final int type_no_cache = 0;
|
||||||
|
public static final int type_has_cache = 1;
|
||||||
|
public static final int type_show_success = 2;
|
||||||
|
public static final int type_show_close = 3;
|
||||||
|
public static final int type_show_fail = 4;
|
||||||
|
|
||||||
|
private static List<MaxInterstitialAd> adList = new ArrayList<>();
|
||||||
|
|
||||||
|
public static MaxInterstitialAd getAd(List<MaxInterstitialAd> list) {
|
||||||
|
Collections.shuffle(list);
|
||||||
|
for (MaxInterstitialAd ad : list) {
|
||||||
|
if (ad.isReady()) {
|
||||||
|
Log.d(AD_TAG, "isReady");
|
||||||
|
return ad;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Log.d(AD_TAG, "no Ready");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void onLoadNativeAd(ViewGroup nativeAdContainer, String adPlace, NativeMaxListener listener) {
|
||||||
|
MaxNativeAdLoader nativeAdLoader;
|
||||||
|
|
||||||
|
nativeAdLoader = new MaxNativeAdLoader(adPlace, MusicApplication.myApplication);
|
||||||
|
nativeAdLoader.setNativeAdListener(new MaxNativeAdListener() {
|
||||||
|
MaxAd nativeAd;
|
||||||
|
@Override
|
||||||
|
public void onNativeAdLoaded(@Nullable MaxNativeAdView maxNativeAdView, @NonNull MaxAd maxAd) {
|
||||||
|
// Clean up any pre-existing native ad to prevent memory leaks.
|
||||||
|
if (nativeAd != null) {
|
||||||
|
nativeAdLoader.destroy(nativeAd);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save ad for cleanup.
|
||||||
|
nativeAd = maxAd;
|
||||||
|
|
||||||
|
// Add ad view to view.
|
||||||
|
nativeAdContainer.removeAllViews();
|
||||||
|
nativeAdContainer.addView(maxNativeAdView);
|
||||||
|
nativeAdContainer.setVisibility(View.VISIBLE);
|
||||||
|
listener.onLoaded(maxAd,nativeAdLoader);
|
||||||
|
Log.d(AD_TAG, "-------onNativeAdLoaded-----maxAd=" + maxAd.getAdUnitId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNativeAdLoadFailed(@NonNull String s, @NonNull MaxError maxError) {
|
||||||
|
super.onNativeAdLoadFailed(s, maxError);
|
||||||
|
Log.d(AD_TAG, "-------onNativeAdLoadFailed-----maxAd=" + maxError.getMessage());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
nativeAdLoader.loadAd();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void clearNativeAd(MaxAd nativeAd, MaxNativeAdLoader nativeAdLoader) {
|
||||||
|
if (nativeAd != null) {
|
||||||
|
nativeAdLoader.destroy(nativeAd);
|
||||||
|
}
|
||||||
|
nativeAdLoader.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static List<MaxInterstitialAd> onLoadAd() {
|
||||||
|
if (adList.isEmpty()) {
|
||||||
|
MaxInterstitialAd AdT = new MaxInterstitialAd(two_Ad, MusicApplication.myApplication);
|
||||||
|
MaxInterstitialAd AdOne = new MaxInterstitialAd(one_AD, MusicApplication.myApplication);
|
||||||
|
MaxInterstitialAd AdThree = new MaxInterstitialAd(three_ad, MusicApplication.myApplication);
|
||||||
|
adList.add(AdOne);
|
||||||
|
adList.add(AdT);
|
||||||
|
adList.add(AdThree);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (MaxInterstitialAd ad : adList) {
|
||||||
|
if (!ad.isReady()) {
|
||||||
|
setMyListener(ad, new MaxListener() {
|
||||||
|
@Override
|
||||||
|
public void onFail(MaxAd ad) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onShowSuccess(MaxAd ad) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onHidden() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ad.loadAd();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return adList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setMyListener(MaxInterstitialAd ad, MaxListener maxListener) {
|
||||||
|
ad.setListener(new MaxAdListener() {
|
||||||
|
@Override
|
||||||
|
public void onAdLoaded(@NonNull MaxAd maxAd) {
|
||||||
|
Log.d(AD_TAG, "-------onAdLoaded-----maxAd=" + maxAd.getAdUnitId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAdDisplayed(@NonNull MaxAd maxAd) {
|
||||||
|
Log.d(AD_TAG, "-------onAdDisplayed-----maxAd=" + maxAd.getAdUnitId());
|
||||||
|
maxListener.onShowSuccess(maxAd);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAdHidden(@NonNull MaxAd maxAd) {
|
||||||
|
Log.d(AD_TAG, "-------onAdHidden-----maxAd=" + maxAd.getAdUnitId());
|
||||||
|
maxListener.onHidden();
|
||||||
|
ad.loadAd();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAdClicked(@NonNull MaxAd maxAd) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAdLoadFailed(@NonNull String s, @NonNull MaxError maxError) {
|
||||||
|
Log.d(AD_TAG, "-------onAdLoadFailed-----s=" + s + "----maxError=" + maxError.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAdDisplayFailed(@NonNull MaxAd maxAd, @NonNull MaxError maxError) {
|
||||||
|
maxListener.onFail(maxAd);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static void ShowAd(Activity activity, onAdStatusListener listener) {
|
||||||
|
MaxInterstitialAd ad = MaxManager.getAd(adList);
|
||||||
|
if (ad == null) {
|
||||||
|
listener.onAdStatus(type_no_cache);
|
||||||
|
} else {
|
||||||
|
listener.onAdStatus(type_has_cache);
|
||||||
|
MaxManager.setMyListener(ad, new MaxListener() {
|
||||||
|
@Override
|
||||||
|
public void onFail(MaxAd ad) {
|
||||||
|
listener.onAdStatus(type_show_fail);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onShowSuccess(MaxAd ad) {
|
||||||
|
listener.onAdStatus(type_show_success);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onHidden() {
|
||||||
|
listener.onAdStatus(type_show_close);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ad.showAd(activity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void startShowMaxAd(Activity activity, onAdAfterAction listener) {
|
||||||
|
MaxManager.ShowAd(activity, new onAdStatusListener() {
|
||||||
|
@Override
|
||||||
|
public void onAdStatus(int type) {
|
||||||
|
if (type == MaxManager.type_show_close || type == MaxManager.type_show_fail || type == MaxManager.type_no_cache) {
|
||||||
|
if (listener != null)
|
||||||
|
listener.onAction();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
package com.offline.music.player.max;
|
||||||
|
|
||||||
|
import com.applovin.mediation.MaxAd;
|
||||||
|
import com.applovin.mediation.nativeAds.MaxNativeAdLoader;
|
||||||
|
|
||||||
|
public interface NativeMaxListener {
|
||||||
|
void onLoaded(MaxAd ad, MaxNativeAdLoader maxNativeAdLoader);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,80 @@
|
|||||||
|
package com.offline.music.player.max
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.content.BroadcastReceiver
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import android.content.IntentFilter
|
||||||
|
import android.os.CountDownTimer
|
||||||
|
import android.util.Log
|
||||||
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
||||||
|
|
||||||
|
import com.applovin.mediation.ads.MaxInterstitialAd
|
||||||
|
import com.offline.music.player.MusicApplication
|
||||||
|
|
||||||
|
|
||||||
|
object WelComManager {
|
||||||
|
|
||||||
|
private lateinit var timer: CountDownTimer
|
||||||
|
|
||||||
|
private var need_Show = true
|
||||||
|
|
||||||
|
private lateinit var lists: List<MaxInterstitialAd>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun initTimer(activity: Activity, countTime: Long,countAction: (Long) -> Unit, goMainAction: () -> Unit): CountDownTimer {
|
||||||
|
need_Show = true
|
||||||
|
timer = object : CountDownTimer(countTime, 100) {
|
||||||
|
override fun onTick(millisUntilFinished: Long) {
|
||||||
|
countAction.invoke(millisUntilFinished)
|
||||||
|
if (need_Show) {
|
||||||
|
MaxManager.ShowAd(activity) {
|
||||||
|
Log.d(MaxManager.AD_TAG, "--onTick----------it=$it")
|
||||||
|
if (it == MaxManager.type_has_cache) {
|
||||||
|
need_Show = false
|
||||||
|
}
|
||||||
|
if (it == MaxManager.type_show_close || it == MaxManager.type_show_fail) {
|
||||||
|
Log.d(MaxManager.AD_TAG, "--onTick---------enter")
|
||||||
|
goMainAction.invoke()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onFinish() {
|
||||||
|
if (need_Show) {
|
||||||
|
MaxManager.ShowAd(activity) {
|
||||||
|
if (it == MaxManager.type_show_close || it == MaxManager.type_show_fail || it == MaxManager.type_no_cache) {
|
||||||
|
Log.d(MaxManager.AD_TAG, "--onFinish---------enter")
|
||||||
|
goMainAction.invoke()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
startAd(activity)
|
||||||
|
return timer
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun startAd(activity: Activity) {
|
||||||
|
if (!MusicApplication.initSDkOK) {
|
||||||
|
timer.start()
|
||||||
|
LocalBroadcastManager.getInstance(activity)
|
||||||
|
.registerReceiver(object : BroadcastReceiver() {
|
||||||
|
override fun onReceive(context: Context?, intent: Intent?) {
|
||||||
|
lists = MaxManager.onLoadAd()
|
||||||
|
|
||||||
|
Log.d(MaxManager.AD_TAG, "------------1sucess")
|
||||||
|
}
|
||||||
|
}, IntentFilter(MusicApplication.initAction))
|
||||||
|
} else {
|
||||||
|
lists = MaxManager.onLoadAd()
|
||||||
|
timer.start()
|
||||||
|
Log.d(MaxManager.AD_TAG, "------------2sucess")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
package com.offline.music.player.max;
|
||||||
|
|
||||||
|
public interface onAdAfterAction {
|
||||||
|
|
||||||
|
void onAction();
|
||||||
|
}
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
package com.offline.music.player.max;
|
||||||
|
|
||||||
|
public interface onAdStatusListener {
|
||||||
|
|
||||||
|
void onAdStatus(int type);
|
||||||
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.offline.music.playermp3.service;
|
package com.offline.music.player.service;
|
||||||
|
|
||||||
import android.app.Notification;
|
import android.app.Notification;
|
||||||
import android.app.NotificationChannel;
|
import android.app.NotificationChannel;
|
||||||
@ -24,9 +24,9 @@ import androidx.core.app.NotificationCompat;
|
|||||||
import androidx.lifecycle.LiveData;
|
import androidx.lifecycle.LiveData;
|
||||||
import androidx.lifecycle.MutableLiveData;
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
import com.offline.music.playermp3.R;
|
import com.offline.music.player.R;
|
||||||
import com.offline.music.playermp3.javabean.A_data.AudioItem;
|
import com.offline.music.player.javabean.A_data.AudioItem;
|
||||||
import com.offline.music.playermp3.ui.activity.A_PlayActivity;
|
import com.offline.music.player.ui.activity.A_PlayActivity;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -101,8 +101,8 @@ public class MusicPlayerForegroundService extends Service {
|
|||||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.S ? PendingIntent.FLAG_IMMUTABLE : 0); // 适配Android 12
|
Build.VERSION.SDK_INT >= Build.VERSION_CODES.S ? PendingIntent.FLAG_IMMUTABLE : 0); // 适配Android 12
|
||||||
|
|
||||||
return new NotificationCompat.Builder(this, CHANNEL_ID)
|
return new NotificationCompat.Builder(this, CHANNEL_ID)
|
||||||
.setContentTitle("Playing audio") // 通知标题
|
.setContentTitle("正在播放音频") // 通知标题
|
||||||
.setContentText("Your audio is playing") // 通知内容
|
.setContentText("您的音频正在播放") // 通知内容
|
||||||
.setSmallIcon(R.drawable.home_select) // 小图标
|
.setSmallIcon(R.drawable.home_select) // 小图标
|
||||||
.setContentIntent(pendingIntent) // 点击通知的Intent
|
.setContentIntent(pendingIntent) // 点击通知的Intent
|
||||||
.setPriority(NotificationCompat.PRIORITY_LOW) // 低优先级
|
.setPriority(NotificationCompat.PRIORITY_LOW) // 低优先级
|
||||||
@ -113,7 +113,7 @@ public class MusicPlayerForegroundService extends Service {
|
|||||||
private void createNotificationChannel() {
|
private void createNotificationChannel() {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
NotificationChannel serviceChannel = new NotificationChannel(
|
NotificationChannel serviceChannel = new NotificationChannel(
|
||||||
CHANNEL_ID, "Music player channel", NotificationManager.IMPORTANCE_LOW);
|
CHANNEL_ID, "音乐播放器频道", NotificationManager.IMPORTANCE_LOW);
|
||||||
NotificationManager manager = getSystemService(NotificationManager.class);
|
NotificationManager manager = getSystemService(NotificationManager.class);
|
||||||
if (manager != null) {
|
if (manager != null) {
|
||||||
manager.createNotificationChannel(serviceChannel); // 创建渠道
|
manager.createNotificationChannel(serviceChannel); // 创建渠道
|
||||||
@ -190,7 +190,7 @@ public class MusicPlayerForegroundService extends Service {
|
|||||||
if (afd != null) {
|
if (afd != null) {
|
||||||
mediaPlayer.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength()); // 设置数据源
|
mediaPlayer.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength()); // 设置数据源
|
||||||
} else {
|
} else {
|
||||||
throw new IOException("Unable to open the content URI: " + path);
|
throw new IOException("无法打开内容URI: " + path);
|
||||||
}
|
}
|
||||||
} catch (SecurityException e) {
|
} catch (SecurityException e) {
|
||||||
Log.e("MusicPlayerService", "权限被拒绝,无法访问内容URI: " + path, e);
|
Log.e("MusicPlayerService", "权限被拒绝,无法访问内容URI: " + path, e);
|
||||||
@ -208,7 +208,7 @@ public class MusicPlayerForegroundService extends Service {
|
|||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
mediaPlayer.setDataSource(file.getAbsolutePath()); // 从文件加载
|
mediaPlayer.setDataSource(file.getAbsolutePath()); // 从文件加载
|
||||||
} else {
|
} else {
|
||||||
throw new IOException("File not found: " + path);
|
throw new IOException("文件未找到: " + path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -225,7 +225,7 @@ public class MusicPlayerForegroundService extends Service {
|
|||||||
return (dotIndex > 0) ? fileName.substring(0, dotIndex) : fileName;
|
return (dotIndex > 0) ? fileName.substring(0, dotIndex) : fileName;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e("MusicPlayerService", "获取文件名失败", e);
|
Log.e("MusicPlayerService", "获取文件名失败", e);
|
||||||
return "Unknown file"; // 默认文件名
|
return "未知文件"; // 默认文件名
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,7 +249,7 @@ public class MusicPlayerForegroundService extends Service {
|
|||||||
} else {
|
} else {
|
||||||
pauseAudio(); // 时间到,暂停音乐
|
pauseAudio(); // 时间到,暂停音乐
|
||||||
isPlaying.postValue(false); // 更新播放状态
|
isPlaying.postValue(false); // 更新播放状态
|
||||||
Toast.makeText(getApplicationContext(), "Timer end", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getApplicationContext(), "定时器结束", Toast.LENGTH_SHORT).show();
|
||||||
stopTimer(); // 时间到,结束计时器
|
stopTimer(); // 时间到,结束计时器
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.offline.music.playermp3.ui.activity;
|
package com.offline.music.player.ui.activity;
|
||||||
|
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -11,12 +11,14 @@ import android.view.View;
|
|||||||
|
|
||||||
import com.google.android.material.tabs.TabLayout;
|
import com.google.android.material.tabs.TabLayout;
|
||||||
import com.google.android.material.tabs.TabLayoutMediator;
|
import com.google.android.material.tabs.TabLayoutMediator;
|
||||||
import com.offline.music.playermp3.R;
|
import com.offline.music.player.R;
|
||||||
import com.offline.music.playermp3.adapter.A_HomeViewPagerAdapter;
|
import com.offline.music.player.adapter.A_HomeViewPagerAdapter;
|
||||||
import com.offline.music.playermp3.databinding.ActivityAhomeBinding;
|
import com.offline.music.player.databinding.ActivityAhomeBinding;
|
||||||
import com.offline.music.playermp3.databinding.HomeTabCustomBinding;
|
import com.offline.music.player.databinding.HomeTabCustomBinding;
|
||||||
import com.offline.music.playermp3.javabean.A_data.AudioItem;
|
import com.offline.music.player.javabean.A_data.AudioItem;
|
||||||
import com.offline.music.playermp3.service.MusicPlayerForegroundService;
|
import com.offline.music.player.max.MaxManager;
|
||||||
|
import com.offline.music.player.max.onAdAfterAction;
|
||||||
|
import com.offline.music.player.service.MusicPlayerForegroundService;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
@ -38,7 +40,6 @@ public class A_HomeActivity extends BaseActivity<ActivityAhomeBinding> {
|
|||||||
public void onServiceConnected(ComponentName name, IBinder service) {
|
public void onServiceConnected(ComponentName name, IBinder service) {
|
||||||
musicService = ((MusicPlayerForegroundService.MusicBinder) service).getService(); // 获取服务实例
|
musicService = ((MusicPlayerForegroundService.MusicBinder) service).getService(); // 获取服务实例
|
||||||
isBound = true; // 服务已绑定
|
isBound = true; // 服务已绑定
|
||||||
Log.d("A_HomeActivity", "isBound");
|
|
||||||
updatePlayButtonState(); // 更新播放按钮状态
|
updatePlayButtonState(); // 更新播放按钮状态
|
||||||
updateProgress(); // 启动进度更新
|
updateProgress(); // 启动进度更新
|
||||||
observeIsPlaying(); // 观察播放状态变化
|
observeIsPlaying(); // 观察播放状态变化
|
||||||
@ -54,6 +55,8 @@ public class A_HomeActivity extends BaseActivity<ActivityAhomeBinding> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreateInit() {
|
protected void onCreateInit() {
|
||||||
|
|
||||||
|
MaxManager.onLoadAd();
|
||||||
Intent serviceIntent = new Intent(this, MusicPlayerForegroundService.class);
|
Intent serviceIntent = new Intent(this, MusicPlayerForegroundService.class);
|
||||||
startService(serviceIntent); // 启动音乐播放服务
|
startService(serviceIntent); // 启动音乐播放服务
|
||||||
bindService(serviceIntent, serviceConnection, Context.BIND_AUTO_CREATE); // 绑定服务
|
bindService(serviceIntent, serviceConnection, Context.BIND_AUTO_CREATE); // 绑定服务
|
||||||
@ -64,12 +67,17 @@ public class A_HomeActivity extends BaseActivity<ActivityAhomeBinding> {
|
|||||||
vb.homeContainer.setOnClickListener(new View.OnClickListener() {
|
vb.homeContainer.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
MaxManager.startShowMaxAd(A_HomeActivity.this, new onAdAfterAction() {
|
||||||
|
@Override
|
||||||
|
public void onAction() {
|
||||||
AudioItem audioItem = musicService.getAudioItem();
|
AudioItem audioItem = musicService.getAudioItem();
|
||||||
Intent intent = new Intent(A_HomeActivity.this, A_PlayActivity.class);
|
Intent intent = new Intent(A_HomeActivity.this, A_PlayActivity.class);
|
||||||
intent.putExtra("Path", audioItem);
|
intent.putExtra("Path", audioItem);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
setupProgressBar(); // 设置进度条
|
setupProgressBar(); // 设置进度条
|
||||||
setupViewPager(); // 设置ViewPager
|
setupViewPager(); // 设置ViewPager
|
||||||
setupTabLayout(); // 设置TabLayout
|
setupTabLayout(); // 设置TabLayout
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.offline.music.playermp3.ui.activity;
|
package com.offline.music.player.ui.activity;
|
||||||
|
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -30,10 +30,12 @@ import com.bumptech.glide.Glide;
|
|||||||
import com.bumptech.glide.request.target.CustomTarget;
|
import com.bumptech.glide.request.target.CustomTarget;
|
||||||
import com.bumptech.glide.request.transition.Transition;
|
import com.bumptech.glide.request.transition.Transition;
|
||||||
import com.google.android.material.bottomsheet.BottomSheetDialog;
|
import com.google.android.material.bottomsheet.BottomSheetDialog;
|
||||||
import com.offline.music.playermp3.R;
|
import com.offline.music.player.R;
|
||||||
import com.offline.music.playermp3.databinding.ActivityAplayBinding;
|
import com.offline.music.player.databinding.ActivityAplayBinding;
|
||||||
import com.offline.music.playermp3.javabean.A_data.AudioItem;
|
import com.offline.music.player.javabean.A_data.AudioItem;
|
||||||
import com.offline.music.playermp3.service.MusicPlayerForegroundService;
|
import com.offline.music.player.max.MaxManager;
|
||||||
|
import com.offline.music.player.max.onAdAfterAction;
|
||||||
|
import com.offline.music.player.service.MusicPlayerForegroundService;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -91,6 +93,7 @@ public class A_PlayActivity extends BaseActivity<ActivityAplayBinding> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreateInit() {
|
protected void onCreateInit() {
|
||||||
|
MaxManager.onLoadAd();
|
||||||
textViews.add(vb.songTitle);
|
textViews.add(vb.songTitle);
|
||||||
textViews.add(vb.artistAlbumText);
|
textViews.add(vb.artistAlbumText);
|
||||||
textViews.add(vb.current);
|
textViews.add(vb.current);
|
||||||
@ -111,8 +114,6 @@ public class A_PlayActivity extends BaseActivity<ActivityAplayBinding> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.d("paly","-----" +audioItem.getName());
|
|
||||||
|
|
||||||
Glide.with(this)
|
Glide.with(this)
|
||||||
.load("file:///android_asset/" + audioItem.getImage())
|
.load("file:///android_asset/" + audioItem.getImage())
|
||||||
.placeholder(R.mipmap.playing_background) // 默认图片
|
.placeholder(R.mipmap.playing_background) // 默认图片
|
||||||
@ -179,7 +180,14 @@ public class A_PlayActivity extends BaseActivity<ActivityAplayBinding> {
|
|||||||
@Override
|
@Override
|
||||||
protected void onInitClick() {
|
protected void onInitClick() {
|
||||||
vb.songSeekbar.setOnSeekBarChangeListener(new SeekBarListener()); // 设置进度条监听
|
vb.songSeekbar.setOnSeekBarChangeListener(new SeekBarListener()); // 设置进度条监听
|
||||||
vb.repeatButton.setOnClickListener(v -> showTimerDialog()); // 设置定时器按钮的点击事件
|
vb.repeatButton.setOnClickListener(v -> {
|
||||||
|
MaxManager.startShowMaxAd(A_PlayActivity.this, new onAdAfterAction() {
|
||||||
|
@Override
|
||||||
|
public void onAction() {
|
||||||
|
showTimerDialog();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}); // 设置定时器按钮的点击事件
|
||||||
vb.prevButton.setOnClickListener(v -> toggleBackground()); // 设置切换背景按钮的点击事件
|
vb.prevButton.setOnClickListener(v -> toggleBackground()); // 设置切换背景按钮的点击事件
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,6 +203,9 @@ public class A_PlayActivity extends BaseActivity<ActivityAplayBinding> {
|
|||||||
// 设置播放按钮的点击事件
|
// 设置播放按钮的点击事件
|
||||||
private void setupPlayButtonClickListener() {
|
private void setupPlayButtonClickListener() {
|
||||||
vb.playButton.setOnClickListener(v -> {
|
vb.playButton.setOnClickListener(v -> {
|
||||||
|
MaxManager.startShowMaxAd(A_PlayActivity.this, new onAdAfterAction() {
|
||||||
|
@Override
|
||||||
|
public void onAction() {
|
||||||
if (isBound && musicService != null) {
|
if (isBound && musicService != null) {
|
||||||
// 根据播放状态切换播放/暂停
|
// 根据播放状态切换播放/暂停
|
||||||
if (Boolean.TRUE.equals(musicService.getIsPlaying().getValue())) {
|
if (Boolean.TRUE.equals(musicService.getIsPlaying().getValue())) {
|
||||||
@ -206,9 +217,16 @@ public class A_PlayActivity extends BaseActivity<ActivityAplayBinding> {
|
|||||||
if (musicService != null) {
|
if (musicService != null) {
|
||||||
musicService.startUpdatingProgress();
|
musicService.startUpdatingProgress();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
vb.backButton.setOnClickListener(v -> finish()); // 返回按钮点击事件
|
vb.backButton.setOnClickListener(v -> MaxManager.startShowMaxAd(this, new onAdAfterAction() {
|
||||||
|
@Override
|
||||||
|
public void onAction() {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
})); // 返回按钮点击事件
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1,9 +1,10 @@
|
|||||||
package com.offline.music.playermp3.ui.activity;
|
package com.offline.music.player.ui.activity;
|
||||||
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import com.offline.music.playermp3.databinding.ActivityAsettingBinding;
|
import com.offline.music.player.databinding.ActivityAsettingBinding;
|
||||||
import com.offline.music.playermp3.helper.SettingUtil;
|
import com.offline.music.player.helper.SettingUtil;
|
||||||
|
import com.offline.music.player.max.MaxManager;
|
||||||
|
|
||||||
public class A_SettingActivity extends BaseActivity<ActivityAsettingBinding> {
|
public class A_SettingActivity extends BaseActivity<ActivityAsettingBinding> {
|
||||||
|
|
||||||
@ -15,7 +16,7 @@ public class A_SettingActivity extends BaseActivity<ActivityAsettingBinding> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreateInit() {
|
protected void onCreateInit() {
|
||||||
|
MaxManager.onLoadAd();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1,15 +1,21 @@
|
|||||||
package com.offline.music.playermp3.ui.activity;
|
package com.offline.music.player.ui.activity;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.CountDownTimer;
|
import android.os.CountDownTimer;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import com.offline.music.playermp3.databinding.ActivityAsplashBinding;
|
import com.offline.music.player.databinding.ActivityAsplashBinding;
|
||||||
|
import com.offline.music.player.max.WelComManager;
|
||||||
|
|
||||||
|
|
||||||
|
import kotlin.Unit;
|
||||||
|
import kotlin.jvm.functions.Function0;
|
||||||
|
import kotlin.jvm.functions.Function1;
|
||||||
|
|
||||||
|
|
||||||
public class A_SplashActivity extends BaseActivity<ActivityAsplashBinding> {
|
public class A_SplashActivity extends BaseActivity<ActivityAsplashBinding> {
|
||||||
|
|
||||||
private static final int SPLASH_TIME_OUT = 1500;
|
private static final int SPLASH_TIME_OUT = 15000;
|
||||||
private CountDownTimer countDownTimer;
|
private CountDownTimer countDownTimer;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -46,25 +52,24 @@ public class A_SplashActivity extends BaseActivity<ActivityAsplashBinding> {
|
|||||||
|
|
||||||
public void intData() {
|
public void intData() {
|
||||||
|
|
||||||
countDownTimer = new CountDownTimer(SPLASH_TIME_OUT, 100) {
|
countDownTimer = WelComManager.initTimer(this, SPLASH_TIME_OUT, new Function1<Long, Unit>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTick(long millisUntilFinished) {
|
public Unit invoke(Long aLong) {
|
||||||
|
float v = 100 - (float) aLong / SPLASH_TIME_OUT * 100;
|
||||||
float v = 100 - (float) millisUntilFinished / SPLASH_TIME_OUT * 100;
|
|
||||||
int v1 = (int) v;
|
int v1 = (int) v;
|
||||||
vb.progressBar.setProgress(v1);
|
vb.progressBar.setProgress(v1);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
}, new Function0<Unit>() {
|
||||||
@Override
|
@Override
|
||||||
public void onFinish() {
|
public Unit invoke() {
|
||||||
vb.progressBar.setProgress(100);
|
vb.progressBar.setProgress(100);
|
||||||
enterHome();
|
enterHome();
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
|
|
||||||
countDownTimer.start();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,4 +84,13 @@ public class A_SplashActivity extends BaseActivity<ActivityAsplashBinding> {
|
|||||||
finish();
|
finish();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
if (countDownTimer != null) {
|
||||||
|
countDownTimer.cancel();
|
||||||
|
countDownTimer = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.offline.music.playermp3.ui.activity;
|
package com.offline.music.player.ui.activity;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
@ -11,7 +11,7 @@ import androidx.core.view.WindowCompat;
|
|||||||
import androidx.core.view.WindowInsetsControllerCompat;
|
import androidx.core.view.WindowInsetsControllerCompat;
|
||||||
import androidx.viewbinding.ViewBinding;
|
import androidx.viewbinding.ViewBinding;
|
||||||
|
|
||||||
import com.offline.music.playermp3.databinding.ActivityBaseBinding;
|
import com.offline.music.player.databinding.ActivityBaseBinding;
|
||||||
|
|
||||||
public abstract class BaseActivity<T extends ViewBinding> extends AppCompatActivity implements View.OnClickListener {
|
public abstract class BaseActivity<T extends ViewBinding> extends AppCompatActivity implements View.OnClickListener {
|
||||||
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.offline.music.playermp3.ui.activity.viewmodel;
|
package com.offline.music.player.ui.activity.viewmodel;
|
||||||
|
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.offline.music.playermp3.ui.activity.viewmodel;
|
package com.offline.music.player.ui.activity.viewmodel;
|
||||||
|
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
|
|
||||||
@ -1,14 +1,14 @@
|
|||||||
package com.offline.music.playermp3.ui.fragmnt;
|
package com.offline.music.player.ui.fragmnt;
|
||||||
|
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
import com.offline.music.playermp3.adapter.A_InstrumentAdapter;
|
import com.offline.music.player.adapter.A_InstrumentAdapter;
|
||||||
import com.offline.music.playermp3.adapter.A_NatureAdapter;
|
import com.offline.music.player.adapter.A_NatureAdapter;
|
||||||
import com.offline.music.playermp3.adapter.A_WhiteAdapter;
|
import com.offline.music.player.adapter.A_WhiteAdapter;
|
||||||
import com.offline.music.playermp3.databinding.FragmentAHomeBinding;
|
import com.offline.music.player.databinding.FragmentAHomeBinding;
|
||||||
import com.offline.music.playermp3.helper.ItemDecoration;
|
import com.offline.music.player.helper.ItemDecoration;
|
||||||
import com.offline.music.playermp3.ui.fragmnt.viewmodel.A_VMHome;
|
import com.offline.music.player.ui.fragmnt.viewmodel.A_VMHome;
|
||||||
|
|
||||||
|
|
||||||
public class A_HomeFragment extends BaseFragment<FragmentAHomeBinding> {
|
public class A_HomeFragment extends BaseFragment<FragmentAHomeBinding> {
|
||||||
@ -38,9 +38,9 @@ public class A_HomeFragment extends BaseFragment<FragmentAHomeBinding> {
|
|||||||
Vb.recyclerViewThird.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
|
Vb.recyclerViewThird.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
|
||||||
|
|
||||||
// 初始化适配器
|
// 初始化适配器
|
||||||
instrumentAdapter = new A_InstrumentAdapter(requireContext());
|
instrumentAdapter = new A_InstrumentAdapter(requireActivity());
|
||||||
whiteAdapter = new A_WhiteAdapter(requireContext());
|
whiteAdapter = new A_WhiteAdapter(requireActivity());
|
||||||
natureAdapter = new A_NatureAdapter(requireContext());
|
natureAdapter = new A_NatureAdapter(requireActivity());
|
||||||
|
|
||||||
// 设置适配器到 RecyclerView
|
// 设置适配器到 RecyclerView
|
||||||
Vb.recyclerViewFirst.setAdapter(instrumentAdapter);
|
Vb.recyclerViewFirst.setAdapter(instrumentAdapter);
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.offline.music.playermp3.ui.fragmnt;
|
package com.offline.music.player.ui.fragmnt;
|
||||||
|
|
||||||
import static android.app.Activity.RESULT_OK;
|
import static android.app.Activity.RESULT_OK;
|
||||||
|
|
||||||
@ -9,7 +9,6 @@ import android.content.UriPermission;
|
|||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.media.MediaMetadataRetriever;
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
@ -29,12 +28,12 @@ import androidx.core.content.ContextCompat;
|
|||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
import com.offline.music.playermp3.R;
|
import com.offline.music.player.R;
|
||||||
import com.offline.music.playermp3.adapter.A_ImportFragmentAdapter;
|
import com.offline.music.player.adapter.A_ImportFragmentAdapter;
|
||||||
import com.offline.music.playermp3.databinding.FragmentAImportBinding;
|
import com.offline.music.player.databinding.FragmentAImportBinding;
|
||||||
import com.offline.music.playermp3.javabean.A_data.AudioItem;
|
import com.offline.music.player.javabean.A_data.AudioItem;
|
||||||
import com.offline.music.playermp3.ui.activity.A_SettingActivity;
|
import com.offline.music.player.ui.activity.A_SettingActivity;
|
||||||
import com.offline.music.playermp3.ui.fragmnt.viewmodel.A_VMImport;
|
import com.offline.music.player.ui.fragmnt.viewmodel.A_VMImport;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -58,7 +57,7 @@ public class A_ImportFragment extends BaseFragment<FragmentAImportBinding> {
|
|||||||
@Override
|
@Override
|
||||||
protected void initView() {
|
protected void initView() {
|
||||||
viewModel = new ViewModelProvider(this).get(A_VMImport.class);
|
viewModel = new ViewModelProvider(this).get(A_VMImport.class);
|
||||||
adapter = new A_ImportFragmentAdapter(requireContext(),newName);
|
adapter = new A_ImportFragmentAdapter(requireActivity(),newName);
|
||||||
|
|
||||||
setupRecyclerView();
|
setupRecyclerView();
|
||||||
// observeAudioFiles();
|
// observeAudioFiles();
|
||||||
@ -213,6 +212,7 @@ public class A_ImportFragment extends BaseFragment<FragmentAImportBinding> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void openAudioPicker() {
|
private void openAudioPicker() {
|
||||||
if (!Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
|
if (!Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
|
||||||
Toast.makeText(getContext(), "The external storage is unavailable", Toast.LENGTH_LONG).show();
|
Toast.makeText(getContext(), "The external storage is unavailable", Toast.LENGTH_LONG).show();
|
||||||
@ -237,38 +237,14 @@ public class A_ImportFragment extends BaseFragment<FragmentAImportBinding> {
|
|||||||
requireActivity().getContentResolver().takePersistableUriPermission(
|
requireActivity().getContentResolver().takePersistableUriPermission(
|
||||||
selectedAudioUri, Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
selectedAudioUri, Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||||
|
|
||||||
// 检查音频时长
|
|
||||||
long duration = 0;
|
|
||||||
try {
|
try {
|
||||||
duration = getAudioDuration(selectedAudioUri);
|
viewModel.addAudioFile(selectedAudioUri);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (duration < 4000) {
|
|
||||||
Toast.makeText(requireContext(), "The audio duration cannot be less than 4 seconds", Toast.LENGTH_SHORT).show();
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
viewModel.addAudioFile(selectedAudioUri); // 如果时长符合条件,添加音频文件
|
|
||||||
} catch (IOException e) {
|
|
||||||
Log.e("A_ImportFragment", "IOException while adding audio file", e);
|
|
||||||
Toast.makeText(requireContext(), "An error occurred while adding the audio file", Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private long getAudioDuration(Uri uri) throws IOException {
|
|
||||||
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
|
|
||||||
try {
|
|
||||||
retriever.setDataSource(requireContext(), uri);
|
|
||||||
String durationStr = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION);
|
|
||||||
return Long.parseLong(durationStr); // 返回音频时长(毫秒)
|
|
||||||
} finally {
|
|
||||||
retriever.release(); // 释放资源
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.offline.music.playermp3.ui.fragmnt;
|
package com.offline.music.player.ui.fragmnt;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -1,13 +1,13 @@
|
|||||||
package com.offline.music.playermp3.ui.fragmnt.viewmodel;
|
package com.offline.music.player.ui.fragmnt.viewmodel;
|
||||||
|
|
||||||
import androidx.lifecycle.LiveData;
|
import androidx.lifecycle.LiveData;
|
||||||
import androidx.lifecycle.MutableLiveData;
|
import androidx.lifecycle.MutableLiveData;
|
||||||
import androidx.lifecycle.ViewModel;
|
import androidx.lifecycle.ViewModel;
|
||||||
|
|
||||||
import com.offline.music.playermp3.MusicApplication;
|
import com.offline.music.player.MusicApplication;
|
||||||
import com.offline.music.playermp3.helper.JsonUtils;
|
import com.offline.music.player.helper.JsonUtils;
|
||||||
import com.offline.music.playermp3.javabean.A_data.AudioItem;
|
import com.offline.music.player.javabean.A_data.AudioItem;
|
||||||
import com.offline.music.playermp3.javabean.A_data.Category;
|
import com.offline.music.player.javabean.A_data.Category;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.offline.music.playermp3.ui.fragmnt.viewmodel;
|
package com.offline.music.player.ui.fragmnt.viewmodel;
|
||||||
|
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -13,7 +13,7 @@ import androidx.lifecycle.MutableLiveData;
|
|||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
import com.offline.music.playermp3.javabean.A_data.AudioItem;
|
import com.offline.music.player.javabean.A_data.AudioItem;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
@ -1,40 +0,0 @@
|
|||||||
package com.offline.music.playermp3;
|
|
||||||
|
|
||||||
import android.app.Application;
|
|
||||||
import android.content.Context;
|
|
||||||
|
|
||||||
public class MusicApplication extends Application {
|
|
||||||
|
|
||||||
public static Context myApplication;
|
|
||||||
|
|
||||||
public static String visitorData;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static void setVisitorData(String visitorData) {
|
|
||||||
MusicApplication.visitorData = visitorData;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getVisitorData() {
|
|
||||||
return visitorData;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreate() {
|
|
||||||
super.onCreate();
|
|
||||||
myApplication = this;
|
|
||||||
// Sp.init(this);
|
|
||||||
// RemoteConfigJava.getInstance().init(this);
|
|
||||||
// ObjectBoxManager.init(this);
|
|
||||||
// MyMediaControllerManager.getInstance().init(new MediaControllerStatusListener() {
|
|
||||||
// @Override
|
|
||||||
// public void onMediaControllerComplete(boolean isOk) {
|
|
||||||
// CommonUtils.LogMsg("=-----mediaController+" + isOk);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 16 KiB |
@ -1,74 +1,170 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<vector
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:height="108dp"
|
|
||||||
android:width="108dp"
|
android:width="108dp"
|
||||||
android:viewportHeight="108"
|
android:height="108dp"
|
||||||
android:viewportWidth="108"
|
android:viewportWidth="108"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
android:viewportHeight="108">
|
||||||
<path android:fillColor="#3DDC84"
|
<path
|
||||||
android:pathData="M0,0h108v108h-108z"/>
|
android:fillColor="#3DDC84"
|
||||||
<path android:fillColor="#00000000" android:pathData="M9,0L9,108"
|
android:pathData="M0,0h108v108h-108z" />
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
<path
|
||||||
<path android:fillColor="#00000000" android:pathData="M19,0L19,108"
|
android:fillColor="#00000000"
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:pathData="M9,0L9,108"
|
||||||
<path android:fillColor="#00000000" android:pathData="M29,0L29,108"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path android:fillColor="#00000000" android:pathData="M39,0L39,108"
|
<path
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:fillColor="#00000000"
|
||||||
<path android:fillColor="#00000000" android:pathData="M49,0L49,108"
|
android:pathData="M19,0L19,108"
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:strokeWidth="0.8"
|
||||||
<path android:fillColor="#00000000" android:pathData="M59,0L59,108"
|
android:strokeColor="#33FFFFFF" />
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
<path
|
||||||
<path android:fillColor="#00000000" android:pathData="M69,0L69,108"
|
android:fillColor="#00000000"
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:pathData="M29,0L29,108"
|
||||||
<path android:fillColor="#00000000" android:pathData="M79,0L79,108"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path android:fillColor="#00000000" android:pathData="M89,0L89,108"
|
<path
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:fillColor="#00000000"
|
||||||
<path android:fillColor="#00000000" android:pathData="M99,0L99,108"
|
android:pathData="M39,0L39,108"
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:strokeWidth="0.8"
|
||||||
<path android:fillColor="#00000000" android:pathData="M0,9L108,9"
|
android:strokeColor="#33FFFFFF" />
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
<path
|
||||||
<path android:fillColor="#00000000" android:pathData="M0,19L108,19"
|
android:fillColor="#00000000"
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:pathData="M49,0L49,108"
|
||||||
<path android:fillColor="#00000000" android:pathData="M0,29L108,29"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path android:fillColor="#00000000" android:pathData="M0,39L108,39"
|
<path
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:fillColor="#00000000"
|
||||||
<path android:fillColor="#00000000" android:pathData="M0,49L108,49"
|
android:pathData="M59,0L59,108"
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:strokeWidth="0.8"
|
||||||
<path android:fillColor="#00000000" android:pathData="M0,59L108,59"
|
android:strokeColor="#33FFFFFF" />
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
<path
|
||||||
<path android:fillColor="#00000000" android:pathData="M0,69L108,69"
|
android:fillColor="#00000000"
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:pathData="M69,0L69,108"
|
||||||
<path android:fillColor="#00000000" android:pathData="M0,79L108,79"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path android:fillColor="#00000000" android:pathData="M0,89L108,89"
|
<path
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:fillColor="#00000000"
|
||||||
<path android:fillColor="#00000000" android:pathData="M0,99L108,99"
|
android:pathData="M79,0L79,108"
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:strokeWidth="0.8"
|
||||||
<path android:fillColor="#00000000" android:pathData="M19,29L89,29"
|
android:strokeColor="#33FFFFFF" />
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
<path
|
||||||
<path android:fillColor="#00000000" android:pathData="M19,39L89,39"
|
android:fillColor="#00000000"
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:pathData="M89,0L89,108"
|
||||||
<path android:fillColor="#00000000" android:pathData="M19,49L89,49"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path android:fillColor="#00000000" android:pathData="M19,59L89,59"
|
<path
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:fillColor="#00000000"
|
||||||
<path android:fillColor="#00000000" android:pathData="M19,69L89,69"
|
android:pathData="M99,0L99,108"
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:strokeWidth="0.8"
|
||||||
<path android:fillColor="#00000000" android:pathData="M19,79L89,79"
|
android:strokeColor="#33FFFFFF" />
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
<path
|
||||||
<path android:fillColor="#00000000" android:pathData="M29,19L29,89"
|
android:fillColor="#00000000"
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:pathData="M0,9L108,9"
|
||||||
<path android:fillColor="#00000000" android:pathData="M39,19L39,89"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path android:fillColor="#00000000" android:pathData="M49,19L49,89"
|
<path
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:fillColor="#00000000"
|
||||||
<path android:fillColor="#00000000" android:pathData="M59,19L59,89"
|
android:pathData="M0,19L108,19"
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:strokeWidth="0.8"
|
||||||
<path android:fillColor="#00000000" android:pathData="M69,19L69,89"
|
android:strokeColor="#33FFFFFF" />
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
<path
|
||||||
<path android:fillColor="#00000000" android:pathData="M79,19L79,89"
|
android:fillColor="#00000000"
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:pathData="M0,29L108,29"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,39L108,39"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,49L108,49"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,59L108,59"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,69L108,69"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,79L108,79"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,89L108,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,99L108,99"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,29L89,29"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,39L89,39"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,49L89,49"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,59L89,59"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,69L89,69"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,79L89,79"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M29,19L29,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M39,19L39,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M49,19L49,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M59,19L59,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M69,19L69,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M79,19L79,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@ -49,7 +49,7 @@
|
|||||||
app:layout_constraintTop_toTopOf="parent">
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
<!-- 自定义圆形进度条 -->
|
<!-- 自定义圆形进度条 -->
|
||||||
<com.offline.music.playermp3.helper.CircularProgressBar
|
<com.offline.music.player.helper.CircularProgressBar
|
||||||
android:id="@+id/circular_progress_bar"
|
android:id="@+id/circular_progress_bar"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<background android:drawable="@drawable/ic_launcher_background"/>
|
<background android:drawable="@drawable/ic_launcher_background" />
|
||||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||||
|
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||||
</adaptive-icon>
|
</adaptive-icon>
|
||||||
@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<background android:drawable="@drawable/ic_launcher_background"/>
|
|
||||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
|
||||||
</adaptive-icon>
|
|
||||||
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 982 B |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 7.2 KiB |
|
Before Width: | Height: | Size: 6.8 KiB |
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 9.3 KiB |
|
Before Width: | Height: | Size: 9.4 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
@ -1,4 +1,4 @@
|
|||||||
package com.offline.music.playermp3;
|
package com.offline.music.player;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
@ -1,12 +1,17 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
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 {
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath("io.objectbox:objectbox-gradle-plugin:4.0.3")
|
classpath("io.objectbox:objectbox-gradle-plugin:4.0.3")
|
||||||
|
classpath ("com.applovin.quality:AppLovinQualityServiceGradlePlugin:+")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6,7 +6,7 @@
|
|||||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||||
# Specifies the JVM arguments used for the daemon process.
|
# Specifies the JVM arguments used for the daemon process.
|
||||||
# The setting is particularly useful for tweaking memory settings.
|
# The setting is particularly useful for tweaking memory settings.
|
||||||
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
org.gradle.jvmargs=-Xmx4096m -Dfile.encoding=UTF-8
|
||||||
# When configured, Gradle will run in incubating parallel mode.
|
# When configured, Gradle will run in incubating parallel mode.
|
||||||
# This option should only be used with decoupled projects. More details, visit
|
# This option should only be used with decoupled projects. More details, visit
|
||||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||||
|
|||||||
@ -3,6 +3,7 @@ pluginManagement {
|
|||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
|
maven { url = uri("https://artifacts.applovin.com/android") }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dependencyResolutionManagement {
|
dependencyResolutionManagement {
|
||||||
@ -10,6 +11,9 @@ dependencyResolutionManagement {
|
|||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
maven { url = uri("https://cboost.jfrog.io/artifactory/chartboost-ads/") }
|
||||||
|
maven { url = uri("https://android-sdk.is.com") }
|
||||||
|
maven { url = uri("https://artifact.bytedance.com/repository/pangle") }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||