Skip to content

Commit

Permalink
1. 统一Android sdk为30
Browse files Browse the repository at this point in the history
2. 兼容Android Q版本,修复选择图片闪退的问题。
  • Loading branch information
你的名称 committed Sep 9, 2020
1 parent 404fac8 commit 1123fe6
Show file tree
Hide file tree
Showing 12 changed files with 241 additions and 45 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
/.idea/caches/*.ser
/.idea/codeStyles/*.xml
/.idea/*.xml
/app/release
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ dependencies {
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

implementation "androidx.appcompat:appcompat:$rootProject.ext.androidSupportSdkVersion"
implementation "androidx.appcompat:appcompat:$rootProject.ext.appcompatSdkVersion"
implementation project(path: ':multilibrary')
implementation project(path: ':progresslibrary')
implementation project(':albumCameraRecorderCommon')
Expand Down
Binary file removed app/release/app-release.apk
Binary file not shown.
1 change: 0 additions & 1 deletion app/release/output.json

This file was deleted.

9 changes: 6 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,14 @@ ext {
versionCode = 1016
versionName = '1.0.16'

androidCompileSdkVersion = 28
androidCompileSdkVersion = 30
androidBuildToolsVersion = '26.0.2'
androidSupportSdkVersion = '1.0.0'
recyclerviewSdkVersion = '1.1.0'
appcompatSdkVersion = '1.2.0'
constraintlayoutSdkVersion = '2.0.1'
androidMaterialSdkVersion = '1.2.1'
minSdkVersion = 16
targetSdkVersion = 28
targetSdkVersion = 30

junitVersion = '4.12'

Expand Down
2 changes: 1 addition & 1 deletion common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

api "androidx.appcompat:appcompat:$rootProject.ext.androidSupportSdkVersion"
api "androidx.appcompat:appcompat:$rootProject.ext.appcompatSdkVersion"

}
15 changes: 15 additions & 0 deletions common/src/main/java/gaode/zhongjh/com/common/enums/MimeType.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,21 @@ public static Set<MimeType> ofVideo() {
return EnumSet.of(MPEG, MP4, QUICKTIME, THREEGPP, THREEGPP2, MKV, WEBM, TS, AVI);
}

public static boolean isImage(String mimeType) {
if (mimeType == null) return false;
return mimeType.startsWith("image");
}

public static boolean isVideo(String mimeType) {
if (mimeType == null) return false;
return mimeType.startsWith("video");
}

public static boolean isGif(String mimeType) {
if (mimeType == null) return false;
return mimeType.equals(MimeType.GIF.toString());
}

private static Set<String> arraySetOf(String... suffixes) {
return new ArraySet<>(Arrays.asList(suffixes));
}
Expand Down
8 changes: 4 additions & 4 deletions multilibrary/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

api "androidx.recyclerview:recyclerview:$rootProject.ext.androidSupportSdkVersion"
api "androidx.appcompat:appcompat:$rootProject.ext.androidSupportSdkVersion"
api 'androidx.constraintlayout:constraintlayout:1.1.3'
api "com.google.android.material:material:$rootProject.ext.androidSupportSdkVersion"
api "androidx.recyclerview:recyclerview:$rootProject.ext.recyclerviewSdkVersion"
api "androidx.appcompat:appcompat:$rootProject.ext.appcompatSdkVersion"
api "androidx.constraintlayout:constraintlayout:$rootProject.ext.constraintlayoutSdkVersion"
api "com.google.android.material:material:$rootProject.ext.androidMaterialSdkVersion"
implementation 'it.sephiroth.android.library.imagezoom:library:1.0.4'
// 图片
compileOnly 'com.github.bumptech.glide:glide:3.7.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ public void bindView(View view, Context context, Cursor cursor) {
// do not need to load animated Gif
GlobalSpec.getInstance().imageEngine.loadThumbnail(context, context.getResources().getDimensionPixelSize(R
.dimen.media_grid_size), mPlaceholder,
view.findViewById(R.id.album_cover), Uri.fromFile(new File(album.getCoverPath())));
view.findViewById(R.id.album_cover), album.getCoverUri());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
import android.provider.MediaStore;
Expand Down Expand Up @@ -46,20 +47,20 @@ public Album[] newArray(int size) {
public static final String ALBUM_NAME_ALL = "All";

private final String mId;
private final String mCoverPath;
private final Uri mCoverUri;
private final String mDisplayName;
private long mCount;

Album(String id, String coverPath, String albumName, long count) {
Album(String id, Uri coverUri, String albumName, long count) {
mId = id;
mCoverPath = coverPath;
mCoverUri = coverUri;
mDisplayName = albumName;
mCount = count;
}

Album(Parcel source) {
mId = source.readString();
mCoverPath = source.readString();
mCoverUri = source.readParcelable(Uri.class.getClassLoader());
mDisplayName = source.readString();
mCount = source.readLong();
}
Expand All @@ -69,9 +70,10 @@ public Album[] newArray(int size) {
* 此方法不负责管理光标资源,如关闭、迭代等。
*/
public static Album valueOf(Cursor cursor) {
String clumn = cursor.getString(cursor.getColumnIndex(AlbumLoader.COLUMN_URI));
return new Album(
cursor.getString(cursor.getColumnIndex("bucket_id")),
cursor.getString(cursor.getColumnIndex(MediaStore.MediaColumns.DATA)),
Uri.parse(clumn != null ? clumn : ""),
cursor.getString(cursor.getColumnIndex("bucket_display_name")),
cursor.getLong(cursor.getColumnIndex(AlbumLoader.COLUMN_COUNT)));
}
Expand All @@ -84,7 +86,7 @@ public int describeContents() {
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(mId);
dest.writeString(mCoverPath);
dest.writeParcelable(mCoverUri, 0);
dest.writeString(mDisplayName);
dest.writeLong(mCount);
}
Expand All @@ -93,8 +95,8 @@ public String getId() {
return mId;
}

public String getCoverPath() {
return mCoverPath;
public Uri getCoverUri() {
return mCoverUri;
}

public long getCount() {
Expand Down
Loading

0 comments on commit 1123fe6

Please sign in to comment.