Skip to content

Commit

Permalink
fix album media not reload with appcompat 1.3.x by zhihu#851
Browse files Browse the repository at this point in the history
  • Loading branch information
GreenSkinMonster committed Aug 24, 2021
1 parent 21591ae commit 97e9a80
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion matisse/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation "androidx.appcompat:appcompat:1.1.0"
implementation "androidx.appcompat:appcompat:1.3.1"
implementation "androidx.annotation:annotation:1.1.0"
implementation "androidx.recyclerview:recyclerview:1.0.0"
implementation 'it.sephiroth.android.library.imagezoom:library:1.0.4'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.loader.app.LoaderManager;
import androidx.loader.content.Loader;
Expand Down Expand Up @@ -76,7 +77,13 @@ public void onLoaderReset(Loader<Cursor> loader) {

public void onCreate(@NonNull FragmentActivity context, @NonNull AlbumMediaCallbacks callbacks) {
mContext = new WeakReference<Context>(context);
mLoaderManager = context.getSupportLoaderManager();
mLoaderManager = LoaderManager.getInstance(context);
mCallbacks = callbacks;
}

public void onCreate(@NonNull Fragment fragment, @NonNull AlbumMediaCallbacks callbacks) {
mContext = new WeakReference<>(fragment.getContext());
mLoaderManager = LoaderManager.getInstance(fragment);
mCallbacks = callbacks;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public void onActivityCreated(@Nullable Bundle savedInstanceState) {
int spacing = getResources().getDimensionPixelSize(R.dimen.media_grid_spacing);
mRecyclerView.addItemDecoration(new MediaGridInset(spanCount, spacing, false));
mRecyclerView.setAdapter(mAdapter);
mAlbumMediaCollection.onCreate(getActivity(), this);
mAlbumMediaCollection.onCreate(this, this);
mAlbumMediaCollection.load(album, selectionSpec.capture);
}

Expand Down
2 changes: 1 addition & 1 deletion sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ dependencies {
// implementation 'com.zhihu.android:matisse:0.5.2'
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation "androidx.appcompat:appcompat:1.1.0"
implementation "androidx.appcompat:appcompat:1.3.1"
implementation "androidx.recyclerview:recyclerview:1.0.0"
implementation 'com.tbruyelle.rxpermissions2:rxpermissions:0.9.5@aar'
implementation 'io.reactivex.rxjava2:rxjava:2.2.12'
Expand Down

0 comments on commit 97e9a80

Please sign in to comment.