@Test public void shouldGetMedia() throws Exception { List<WhatsAppMessage> messages = whassup.getMessages(); WhatsAppMessage msg = null; for (WhatsAppMessage message : messages) { if (message.getId() == 82) { msg = message; break; } } assertThat(msg).isNotNull(); assertThat(msg.getMedia()).isNotNull(); Media mediaData = msg.getMedia(); assertThat(mediaData).isNotNull(); assertThat(mediaData.getFileSize()).isEqualTo(67731L); assertThat(mediaData.getFile().getAbsolutePath()).isEqualTo("/storage/emulated/0/WhatsApp/Media/WhatsApp Images/IMG-20130526-WA0000.jpg"); }
public List<WhatsAppMessage> getMessages(long timestamp, int max) throws IOException { Cursor cursor = queryMessages(timestamp, max); try { if (cursor != null) { List<WhatsAppMessage> messages = new ArrayList<WhatsAppMessage>(cursor.getCount()); while (cursor.moveToNext()) { messages.add(new WhatsAppMessage(cursor)); } return messages; } else { return Collections.emptyList(); } } finally { if (cursor != null) { cursor.close(); } } }
Whassup { public List<WhatsAppMessage> getMessages(long timestamp, int max) throws IOException { Cursor cursor = queryMessages(timestamp, max); try { if (cursor != null) { List<WhatsAppMessage> messages = new ArrayList<WhatsAppMessage>(cursor.getCount()); while (cursor.moveToNext()) { messages.add(new WhatsAppMessage(cursor)); } return messages; } else { return Collections.emptyList(); } } finally { if (cursor != null) { cursor.close(); } } } }
Whassup { public List<WhatsAppMessage> getMessages(long timestamp, int max) throws IOException { Cursor cursor = queryMessages(timestamp, max); try { if (cursor != null) { List<WhatsAppMessage> messages = new ArrayList<WhatsAppMessage>(cursor.getCount()); while (cursor.moveToNext()) { messages.add(new WhatsAppMessage(cursor)); } return messages; } else { return Collections.emptyList(); } } finally { if (cursor != null) { cursor.close(); } } } Whassup(Context context);   Whassup(DecryptorFactory decryptorFactory, DBProvider dbProvider, DBOpener dbOpener); }
Whassup { public List<WhatsAppMessage> getMessages(long timestamp, int max) throws IOException { Cursor cursor = queryMessages(timestamp, max); try { if (cursor != null) { List<WhatsAppMessage> messages = new ArrayList<WhatsAppMessage>(cursor.getCount()); while (cursor.moveToNext()) { messages.add(new WhatsAppMessage(cursor)); } return messages; } else { return Collections.emptyList(); } } finally { if (cursor != null) { cursor.close(); } } } Whassup(Context context);   Whassup(DecryptorFactory decryptorFactory, DBProvider dbProvider, DBOpener dbOpener); Cursor queryMessages(); Cursor queryMessages(long timestamp, int max); long getMostRecentTimestamp(boolean ignoreGroups); List<WhatsAppMessage> getMessages(long timestamp, int max); List<WhatsAppMessage> getMessages(); boolean hasBackupDB(); }
Whassup { public List<WhatsAppMessage> getMessages(long timestamp, int max) throws IOException { Cursor cursor = queryMessages(timestamp, max); try { if (cursor != null) { List<WhatsAppMessage> messages = new ArrayList<WhatsAppMessage>(cursor.getCount()); while (cursor.moveToNext()) { messages.add(new WhatsAppMessage(cursor)); } return messages; } else { return Collections.emptyList(); } } finally { if (cursor != null) { cursor.close(); } } } Whassup(Context context);   Whassup(DecryptorFactory decryptorFactory, DBProvider dbProvider, DBOpener dbOpener); Cursor queryMessages(); Cursor queryMessages(long timestamp, int max); long getMostRecentTimestamp(boolean ignoreGroups); List<WhatsAppMessage> getMessages(long timestamp, int max); List<WhatsAppMessage> getMessages(); boolean hasBackupDB();  }