Skip to content

Commit

Permalink
fix zhihu#863
Browse files Browse the repository at this point in the history
  • Loading branch information
Merpyzf committed Feb 19, 2023
1 parent c96253f commit 82af9c3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion matisse/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,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 @@ -74,9 +75,16 @@ public void onLoaderReset(Loader<Cursor> loader) {
mCallbacks.onAlbumMediaReset();
}


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<Context>(fragment.getContext());
mLoaderManager = LoaderManager.getInstance(fragment);
mCallbacks = callbacks;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
Album album = getArguments().getParcelable(EXTRA_ALBUM);

mAdapter = new AlbumMediaAdapter(getContext(),
mSelectionProvider.provideSelectedItemCollection(), mRecyclerView);
mAdapter.registerCheckStateListener(this);
Expand All @@ -109,7 +108,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 82af9c3

Please sign in to comment.