Add module for file picker for camera and gallery uploads (#2375)

* Use easy image for image picker

* Do not use harcoded mime type

* Use uploadable file for image uploads

* Add picker files in filepicker module

* Remove redundant checks for file

* Make usage of file extensions consistent

* Add javadocs

* Fix tests

* Enable image upload using bookmark activity

* Fix multiple uploads

* Fix external image uploads

* Fix chooser intents

* Fix image quality checks

* Segregate internal and external upload intents

* Invoke all error messages from one place

* Minor changes

* Fix tests

* Add image processing service tests
This commit is contained in:
Vivek Maskara 2019-02-04 02:10:31 +05:30 committed by neslihanturan
parent fb5a40bba5
commit 52ab39381e
39 changed files with 1553 additions and 574 deletions

View file

@ -176,7 +176,7 @@ class ContributionDaoTest {
@Test
fun saveNewContribution_nullableImageUrlUsesFileAsBackup() {
whenever(client.insert(isA(), isA())).thenReturn(contentUri)
val contribution = createContribution(true, null, null, null, "file")
val contribution = createContribution(true, null, null, null, "filePath")
testObject.save(contribution)
@ -186,7 +186,7 @@ class ContributionDaoTest {
// Nullable fields are absent if null
assertFalse(it.containsKey(Table.COLUMN_LOCAL_URI))
assertFalse(it.containsKey(Table.COLUMN_UPLOADED))
assertEquals(Utils.makeThumbBaseUrl("file"), it.getAsString(Table.COLUMN_IMAGE_URL))
assertEquals(Utils.makeThumbBaseUrl("filePath"), it.getAsString(Table.COLUMN_IMAGE_URL))
}
}
@ -285,7 +285,7 @@ class ContributionDaoTest {
createCursor(created, uploaded, false, localUri).let { mc ->
testObject.fromCursor(mc).let {
assertEquals(uriForId(111), it.contentUri)
assertEquals("file", it.filename)
assertEquals("filePath", it.filename)
assertEquals(localUri, it.localUri.toString())
assertEquals("image", it.imageUrl)
assertEquals(created, it.dateCreated.time)
@ -335,7 +335,7 @@ class ContributionDaoTest {
private fun createCursor(created: Long, uploaded: Long, multiple: Boolean, localUri: String) =
MatrixCursor(Table.ALL_FIELDS, 1).apply {
addRow(listOf("111", "file", localUri, "image",
addRow(listOf("111", "filePath", localUri, "image",
created, STATE_QUEUED, 222L, uploaded, 88L, SOURCE_GALLERY, "desc",
"create", if (multiple) 1 else 0, 640, 480, "007", "Q1"))
moveToFirst()