Skip to content

Commit

Permalink
remove ai module
Browse files Browse the repository at this point in the history
  • Loading branch information
REBOOTERS committed Oct 14, 2024
1 parent 0939f51 commit 080cab4
Show file tree
Hide file tree
Showing 12 changed files with 12 additions and 325 deletions.
1 change: 0 additions & 1 deletion matisse/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ dependencies {
implementation 'com.github.bumptech.glide:glide:4.15.1'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation "com.google.android.material:material:1.10.0"
implementation project(path: ':ai')
}

task javadoc(type: Javadoc) {
Expand Down
2 changes: 0 additions & 2 deletions matisse/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,5 @@
<activity android:name="com.zhihu.matisse.ui.MatisseActivity"/>
<activity android:name="com.zhihu.matisse.internal.ui.AlbumPreviewActivity"/>
<activity android:name="com.zhihu.matisse.internal.ui.SelectedPreviewActivity"/>
<activity android:name=".ui.labels.LabelCategoryActivity" />
<activity android:name=".ui.labels.LabelListActivity" />
</application>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,20 @@
*/
package com.zhihu.matisse.internal.model;

import android.content.ContentUris;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentActivity;
import androidx.loader.app.LoaderManager;
import androidx.loader.content.Loader;

import com.engineer.ai.util.ImageLabelHelper;
import com.zhihu.matisse.MimeType;
import com.zhihu.matisse.internal.entity.Album;
import com.zhihu.matisse.internal.loader.AlbumMediaLoader;

import java.lang.ref.WeakReference;
import java.util.ArrayList;

import kotlin.Unit;
import kotlin.jvm.functions.Function0;

public class AlbumMediaCollection implements LoaderManager.LoaderCallbacks<Cursor> {
private static final String ARGS_ALBUM = "args_album";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,17 @@
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.provider.MediaStore;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.engineer.ai.util.ImageLabelHelper;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.zhihu.matisse.MimeType;
import com.zhihu.matisse.R;
import com.zhihu.matisse.internal.entity.Album;
Expand All @@ -46,11 +45,7 @@

import java.util.ArrayList;

import kotlin.Unit;

public class MediaSelectionFragment extends Fragment implements
AlbumMediaCollection.AlbumMediaCallbacks, AlbumMediaAdapter.CheckStateListener,
AlbumMediaAdapter.OnMediaClickListener {
public class MediaSelectionFragment extends Fragment implements AlbumMediaCollection.AlbumMediaCallbacks, AlbumMediaAdapter.CheckStateListener, AlbumMediaAdapter.OnMediaClickListener {

public static final String EXTRA_ALBUM = "extra_album";

Expand Down Expand Up @@ -89,8 +84,7 @@ public void onAttach(Context context) {

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_media_selection, container, false);
}

Expand All @@ -100,8 +94,7 @@ public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
mRecyclerView = (RecyclerView) view.findViewById(R.id.recyclerview);
Album album = getArguments().getParcelable(EXTRA_ALBUM);

mAdapter = new AlbumMediaAdapter(getContext(),
mSelectionProvider.provideSelectedItemCollection(), mRecyclerView);
mAdapter = new AlbumMediaAdapter(getContext(), mSelectionProvider.provideSelectedItemCollection(), mRecyclerView);
mAdapter.registerCheckStateListener(this);
mAdapter.registerOnMediaClickListener(this);
mRecyclerView.setHasFixedSize(true);
Expand Down Expand Up @@ -143,7 +136,7 @@ public void onAlbumMediaLoad(Cursor cursor) {
}

public void triggerImageLabelProcess(Cursor cursor) {
Log.i("trigger","triggerImageLabelProcess");
Log.i("trigger", "triggerImageLabelProcess");
Cursor copy = cursor;
ArrayList<Uri> uriList = new ArrayList<>();
if (copy.moveToFirst()) {
Expand All @@ -154,13 +147,6 @@ public void triggerImageLabelProcess(Cursor cursor) {

} while (copy.moveToNext());
}
ImageLabelHelper.INSTANCE.getLabel(getContext(), uriList, () -> {
if (mLabelLoadCallback != null) {
mLabelLoadCallback.onLabelLoad();
}
return Unit.INSTANCE;
});

}

@Override
Expand All @@ -179,8 +165,7 @@ public void onUpdate() {
@Override
public void onMediaClick(Album album, Item item, int adapterPosition) {
if (mOnMediaClickListener != null) {
mOnMediaClickListener.onMediaClick((Album) getArguments().getParcelable(EXTRA_ALBUM),
item, adapterPosition);
mOnMediaClickListener.onMediaClick((Album) getArguments().getParcelable(EXTRA_ALBUM), item, adapterPosition);
}
}

Expand All @@ -195,8 +180,7 @@ public void setLabelLoadCallback(AlbumMediaCollection.LabelLoadCallback labelLoa
@SuppressLint("Range")
private static Uri getUri(Cursor cursor) {
long id = cursor.getLong(cursor.getColumnIndex(MediaStore.Files.FileColumns._ID));
String mimeType = cursor.getString(
cursor.getColumnIndex(MediaStore.MediaColumns.MIME_TYPE));
String mimeType = cursor.getString(cursor.getColumnIndex(MediaStore.MediaColumns.MIME_TYPE));
Uri contentUri;

if (MimeType.isImage(mimeType)) {
Expand Down
12 changes: 0 additions & 12 deletions matisse/src/main/java/com/zhihu/matisse/ui/MatisseActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.Fragment;

import com.engineer.ai.util.ImageLabelHelper;
import com.zhihu.matisse.R;
import com.zhihu.matisse.internal.entity.Album;
import com.zhihu.matisse.internal.entity.Item;
Expand All @@ -61,7 +60,6 @@
import com.zhihu.matisse.internal.utils.PathUtils;
import com.zhihu.matisse.internal.utils.PhotoMetadataUtils;
import com.zhihu.matisse.internal.utils.SingleMediaScanner;
import com.zhihu.matisse.ui.labels.LabelCategoryActivity;

import java.util.ArrayList;

Expand Down Expand Up @@ -337,8 +335,6 @@ public void onClick(View v) {
if (mSpec.onCheckedListener != null) {
mSpec.onCheckedListener.onCheck(mOriginalEnable);
}
} else if (v.getId() == R.id.label_entrance) {
startActivity(new Intent(v.getContext(), LabelCategoryActivity.class));
}
}

Expand Down Expand Up @@ -398,14 +394,6 @@ public void onLabelLoad() {
}
});
getSupportFragmentManager().beginTransaction().replace(R.id.container, fragment, MediaSelectionFragment.class.getSimpleName()).commitAllowingStateLoss();
ImageLabelHelper.INSTANCE.addLabelReadyListener(() -> {
if (isFinishing()) {
return;
}
if (!ImageLabelHelper.INSTANCE.getLabelList().isEmpty()) {
labelEntrance.post(() -> labelEntrance.setVisibility(View.VISIBLE));
}
});
}
}

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 080cab4

Please sign in to comment.