This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ExtUtil { | |
private ExtUtil() { | |
} | |
public static boolean isVideo(String filePath) { | |
String ext = filePath.toLowerCase(); | |
return ext.endsWith(".mp4") || ext.endsWith(".avi") || ext.endsWith(".wmv") || ext.endsWith(".rmvb") || ext.endsWith(".mpg") || ext.endsWith(".mpeg") || ext.endsWith(".3gp"); | |
} | |
public static boolean isImage(String filePath) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MediaScanner { | |
private static String AUDIO_PATH = MediaStore.Audio.AudioColumns.DATA; | |
private static String AUDIO_DISPLAYHNAME = MediaStore.Audio.AudioColumns.DISPLAY_NAME; | |
private static String AUDIO_COLUMN_STRS[] = { AUDIO_PATH, AUDIO_DISPLAYHNAME }; | |
private static String VIDEO_PATH = MediaStore.Video.VideoColumns.DATA; | |
private static String VIDEO_DISPLAYHNAME = MediaStore.Video.VideoColumns.DISPLAY_NAME; | |
private static String VIDEO_COLUMN_STRS[] = { VIDEO_PATH, VIDEO_DISPLAYHNAME }; | |
private static String IMAGE_PATH = MediaStore.Images.ImageColumns.DATA; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ByteUtil { | |
private ByteUtil() { | |
} | |
public static byte[] intToBytes(int number) { | |
return new byte[] { (byte) ((number >> 24) & 0xFF), (byte) ((number >> 16) & 0xFF), (byte) ((number >> 8) & 0xFF), (byte) (number & 0xFF) }; | |
} | |
public static int bytesToInt(byte[] bytes) { | |
return bytes[3] & 0xFF | (bytes[2] & 0xFF) << 8 | (bytes[1] & 0xFF) << 16 | (bytes[0] & 0xFF) << 24; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class StorageUtil { | |
private StorageUtil() { | |
} | |
public static Context mContext; | |
public static void init(Context context) { | |
mContext = context; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class IntentUtil { | |
private IntentUtil() { | |
} | |
public static Intent openFile(String filePath) { | |
if (ExtUtil.isAudio(filePath)) { | |
return getAudioFileIntent(filePath); | |
} else if (ExtUtil.isVideo(filePath)) { | |
return getVideoFileIntent(filePath); | |
} else if (ExtUtil.isImage(filePath)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ExtUtil { | |
private ExtUtil() { | |
} | |
public static boolean isVideo(String filePath) { | |
String ext = filePath.toLowerCase(); | |
return ext.endsWith(".mp4") || ext.endsWith(".avi") || ext.endsWith(".wmv") || ext.endsWith(".rmvb") || ext.endsWith(".mpg") || ext.endsWith(".mpeg") || ext.endsWith(".3gp"); | |
} | |
public static boolean isImage(String filePath) { |