修复json存储播放状态的类型转换错误问题

升级依赖库
This commit is contained in:
Yutousama 2021-11-14 11:05:58 +08:00
parent 6d2426d35c
commit 643c51b2ff
6 changed files with 59 additions and 16 deletions

View File

@ -20,7 +20,7 @@ android {
minSdkVersion 23
targetSdkVersion 30
versionCode 1
versionName "1.0"
versionName "1.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
@ -45,23 +45,23 @@ android {
}
dependencies {
implementation 'com.google.android.material:material:1.2.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
def room_version = "2.2.5"
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.work:work-runtime:2.4.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
testImplementation 'junit:junit:4.13.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
implementation 'androidx.work:work-runtime:2.5.0'
implementation 'androidx.recyclerview:recyclerview:1.2.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.github.bumptech.glide:glide:4.11.0'
implementation 'jp.wasabeef:glide-transformations:4.3.0'
implementation 'jp.co.cyberagent.android:gpuimage:2.1.0'
implementation 'com.alibaba:fastjson:1.2.68'
implementation 'com.alibaba:fastjson:1.2.78'
//noinspection GradleCompatible
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'androidx.palette:palette:1.0.0'
@ -74,7 +74,7 @@ dependencies {
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"
implementation "androidx.room:room-runtime:2.2.6"
annotationProcessor "androidx.room:room-compiler:2.2.6"
}

View File

@ -14,6 +14,7 @@
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true">
<activity
android:screenOrientation="portrait"
android:name=".views.OpenActivity"
android:theme="@style/Theme.AppCompat.DayNight.NoActionBar">
<intent-filter>

View File

@ -17,6 +17,7 @@ import com.yutou.nas_music_player.tools.AppTools;
import com.yutou.nas_music_player.tools.NetworkTool;
import com.yutou.nas_music_player.tools.StringUtil;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.palette.graphics.Palette;
import androidx.room.ColumnInfo;
@ -81,6 +82,14 @@ public class MusicData {
public MusicData() {
}
public void setImg(Bitmap img) {
this.img = img;
}
public void setDownloadImg(boolean downloadImg) {
isDownloadImg = downloadImg;
}
public String getArtist() {
return artist;
}
@ -459,4 +468,34 @@ public class MusicData {
", md5='" + md5 + '\'' +
'}';
}
@NonNull
@Override
public MusicData clone() {
MusicData data=new MusicData();
data.setId(id);
data.setArtist(artist);
data.setAlbum(album);
data.setTitle(title);
data.setComment(comment);
data.setYear(year);
data.setTrack(track);
data.setDisc_no(disc_no);
data.setComposer(composer);
data.setArtist_sort(artist_sort);
data.setLastDir(lastDir);
data.setFile(file);
data.setDir(isDir);
data.setImg(img);
data.setBitRate(bitRate);
data.setSampleRate(sampleRate);
data.setNoOfSamples(noOfSamples);
data.setChannelCount(channelCount);
data.setEncodingType(encodingType);
data.setDurationAsDouble(durationAsDouble);
data.setLossless(lossless);
data.setVariableBitRate(variableBitRate);
data.setMd5(md5);
return data;
}
}

View File

@ -250,11 +250,14 @@ public class MusicContainer {
}
}, 0, 1000);
}
ConfigTools.getPreferences().edit().putString(ConfigTools.previous_music, JSONObject.toJSONString(data)).apply();
MusicData tmp=data.clone();
tmp.setImg(null);
ConfigTools.getPreferences().edit().putString(ConfigTools.previous_music, JSONObject.toJSONString(tmp)).apply();
MediaNotificationManager manager=MediaNotificationManager.getInstance();
if(manager!=null){
manager.getService().updateNotification();
}
tmp=null;
} catch (IOException e) {
e.printStackTrace();
}

View File

@ -7,7 +7,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.1'
classpath 'com.android.tools.build:gradle:7.0.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

View File

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip