Skip to content

Commit

Permalink
#1 Implement usage of the ImageContentProvider
Browse files Browse the repository at this point in the history
- Added imageFormat to the converter
  • Loading branch information
Nya Elimu committed Apr 6, 2020
1 parent db95e9b commit 7685866
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/src/main/java/ai/elimu/vitabu/ui/StoryBooksActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ protected void onStart() {
coverImageCursor.close();
Log.i(getClass().getName(), "cursor.isClosed(): " + coverImageCursor.isClosed());

// String coverImageFilename = coverImageGson.getId() + "_" + coverImageGson.getRevisionNumber() + "." + coverImageGson.getImageFormat().toString().toLowerCase();
// Log.i(getClass().getName(), "coverImageFilename: " + coverImageFilename);
String coverImageFilename = coverImageGson.getId() + "_" + coverImageGson.getRevisionNumber() + "." + coverImageGson.getImageFormat().toString().toLowerCase();
Log.i(getClass().getName(), "coverImageFilename: " + coverImageFilename);

// File storyBookCoverFile = MultimediaHelper.getFile(storyBook.getCoverImage());
// Log.i(getClass().getName(), "storyBookCoverFile: " + storyBookCoverFile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import java.util.Arrays;

import ai.elimu.model.enums.content.ImageFormat;
import ai.elimu.model.gson.content.multimedia.ImageGson;

public class CursorToImageGsonConverter {
Expand All @@ -26,10 +27,17 @@ public static ImageGson getImage(Cursor cursor) {
String title = cursor.getString(columnTitle);
Log.i(CursorToImageGsonConverter.class.getName(), "title: \"" + title + "\"");

int columnImageFormat = cursor.getColumnIndex("imageFormat");
String imageFormatAsString = cursor.getString(columnImageFormat);
Log.i(CursorToImageGsonConverter.class.getName(), "imageFormatAsString: " + imageFormatAsString);
ImageFormat imageFormat = ImageFormat.valueOf(imageFormatAsString);
Log.i(CursorToImageGsonConverter.class.getName(), "imageFormat: " + imageFormat);

ImageGson image = new ImageGson();
image.setId(id);
image.setRevisionNumber(revisionNumber);
image.setTitle(title);
image.setImageFormat(imageFormat);

return image;
}
Expand Down

0 comments on commit 7685866

Please sign in to comment.