Initial commit
This commit is contained in:
70
sources/com/bottle/hp/album/media/HPImage.java
Normal file
70
sources/com/bottle/hp/album/media/HPImage.java
Normal file
@@ -0,0 +1,70 @@
|
||||
package com.bottle.hp.album.media;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.provider.MediaStore;
|
||||
import com.liulishuo.filedownloader.model.FileDownloadModel;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class HPImage extends HPMedia implements Serializable {
|
||||
private static final String TAG = HPMedia.class.getSimpleName();
|
||||
private static String[] thumbColumns = {FileDownloadModel.ID, "image_id", "_data"};
|
||||
private static String[] projection = {FileDownloadModel.ID, "title", "_data", "_display_name", "mime_type", "_size", "date_modified"};
|
||||
|
||||
public HPImage() {
|
||||
this.mediaType = 0;
|
||||
}
|
||||
|
||||
public static List<HPMedia> getImages(Context context) {
|
||||
Cursor query;
|
||||
ArrayList arrayList = new ArrayList();
|
||||
if (context != null && (query = context.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, projection, null, null, "date_modified DESC")) != null) {
|
||||
int columnIndex = query.getColumnIndex(FileDownloadModel.ID);
|
||||
int columnIndex2 = query.getColumnIndex("title");
|
||||
int columnIndex3 = query.getColumnIndex("_data");
|
||||
int columnIndex4 = query.getColumnIndex("_display_name");
|
||||
int columnIndex5 = query.getColumnIndex("mime_type");
|
||||
int columnIndex6 = query.getColumnIndex("_size");
|
||||
int columnIndex7 = query.getColumnIndex("date_modified");
|
||||
while (query.moveToNext()) {
|
||||
int i = query.getInt(columnIndex);
|
||||
String string = query.getString(columnIndex2);
|
||||
String string2 = query.getString(columnIndex3);
|
||||
arrayList.add(new HPImage(i, string, query.getString(columnIndex4), query.getString(columnIndex5), string2, query.getLong(columnIndex6), string2, query.getString(columnIndex7)));
|
||||
}
|
||||
query.close();
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public static HPMedia searchImageByName(Context context, String str) {
|
||||
Cursor query = context.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, projection, "_data=?", new String[]{str + ""}, null);
|
||||
HPImage hPImage = null;
|
||||
if (query == null) {
|
||||
return null;
|
||||
}
|
||||
int columnIndex = query.getColumnIndex(FileDownloadModel.ID);
|
||||
int columnIndex2 = query.getColumnIndex("title");
|
||||
int columnIndex3 = query.getColumnIndex("_data");
|
||||
int columnIndex4 = query.getColumnIndex("_display_name");
|
||||
int columnIndex5 = query.getColumnIndex("mime_type");
|
||||
int columnIndex6 = query.getColumnIndex("_size");
|
||||
int columnIndex7 = query.getColumnIndex("date_modified");
|
||||
if (query.moveToNext()) {
|
||||
int i = query.getInt(columnIndex);
|
||||
String string = query.getString(columnIndex2);
|
||||
String string2 = query.getString(columnIndex3);
|
||||
hPImage = new HPImage(i, string, query.getString(columnIndex4), query.getString(columnIndex5), string2, query.getLong(columnIndex6), string2, query.getString(columnIndex7));
|
||||
}
|
||||
query.close();
|
||||
return hPImage;
|
||||
}
|
||||
|
||||
public HPImage(int i, String str, String str2, String str3, String str4, long j, String str5, String str6) {
|
||||
super(i, str, str2, str3, str4, j, str5, str6);
|
||||
this.mediaType = 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user