94 lines
3.4 KiB
Java
94 lines
3.4 KiB
Java
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 HPAudio extends HPMedia implements Serializable {
|
|
private String album;
|
|
private String artist;
|
|
private long duration;
|
|
|
|
public HPAudio() {
|
|
this.mediaType = 2;
|
|
}
|
|
|
|
public static List<HPAudio> getAudios(Context context) {
|
|
ArrayList arrayList = new ArrayList();
|
|
if (context == null) {
|
|
return arrayList;
|
|
}
|
|
Cursor query = context.getContentResolver().query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, new String[]{FileDownloadModel.ID, "title", "_data", "_display_name", "mime_type", "_size", "album", "artist", "duration", "date_modified"}, null, null, "date_modified DESC");
|
|
if (query != 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("album");
|
|
int columnIndex8 = query.getColumnIndex("artist");
|
|
int columnIndex9 = query.getColumnIndex("duration");
|
|
int columnIndex10 = query.getColumnIndex("date_modified");
|
|
while (query.moveToNext()) {
|
|
int i = query.getInt(columnIndex);
|
|
String string = query.getString(columnIndex2);
|
|
String string2 = query.getString(columnIndex3);
|
|
String string3 = query.getString(columnIndex4);
|
|
String string4 = query.getString(columnIndex5);
|
|
long j = query.getLong(columnIndex6);
|
|
String string5 = query.getString(columnIndex7);
|
|
String string6 = query.getString(columnIndex8);
|
|
int i2 = columnIndex;
|
|
long j2 = query.getInt(columnIndex9);
|
|
int i3 = columnIndex3;
|
|
HPAudio hPAudio = new HPAudio(i, string, string2, string3, string4, j, "", query.getString(columnIndex10));
|
|
hPAudio.setAlbum(string5);
|
|
hPAudio.setArtist(string6);
|
|
hPAudio.setDuration(j2);
|
|
arrayList.add(hPAudio);
|
|
columnIndex = i2;
|
|
columnIndex2 = columnIndex2;
|
|
columnIndex3 = i3;
|
|
columnIndex4 = columnIndex4;
|
|
}
|
|
query.close();
|
|
}
|
|
return arrayList;
|
|
}
|
|
|
|
public String getAlbum() {
|
|
return this.album;
|
|
}
|
|
|
|
public String getArtist() {
|
|
return this.artist;
|
|
}
|
|
|
|
public long getDuration() {
|
|
return this.duration;
|
|
}
|
|
|
|
public void setAlbum(String str) {
|
|
this.album = str;
|
|
}
|
|
|
|
public void setArtist(String str) {
|
|
this.artist = str;
|
|
}
|
|
|
|
public void setDuration(long j) {
|
|
this.duration = j;
|
|
}
|
|
|
|
public HPAudio(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 = 2;
|
|
}
|
|
}
|