Skip to content

Commit

Permalink
CR suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
fesave committed Apr 28, 2022
1 parent 0cf0697 commit 2f7e5fd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import com.owncloud.android.R
import com.owncloud.android.databinding.PreviewImageFragmentBinding
import com.owncloud.android.databinding.TopProgressBarBinding
import com.owncloud.android.datamodel.OCFile
import com.owncloud.android.domain.files.MIME_SVG
import com.owncloud.android.files.FileMenuFilter
import com.owncloud.android.ui.controller.TransferProgressController
import com.owncloud.android.ui.dialog.ConfirmationDialogFragment
Expand Down Expand Up @@ -327,21 +328,21 @@ class PreviewImageFragment : FileFragment() {
return false
}

override fun onResourceReady(
resource: Drawable?, model: Any, target: Target<Drawable?>,
dataSource: DataSource, isFirstResource: Boolean
): Boolean {
Timber.d("Loading image %s", file.fileName)
binding.progressWheel.isVisible = false
return false
}
})
.into(binding.photoView)
override fun onResourceReady(
resource: Drawable?, model: Any, target: Target<Drawable?>,
dataSource: DataSource, isFirstResource: Boolean
): Boolean {
Timber.d("Loading image %s", file.fileName)
binding.progressWheel.isVisible = false
return false
}
})
.into(binding.photoView)

binding.photoView.isVisible = true
}

private fun isSVGFile(file: OCFile): Boolean = file.mimetype == SVG_MIMETYPE
private fun isSVGFile(file: OCFile): Boolean = file.mimetype == MIME_SVG

private fun getBackgroundColor(file: OCFile): Int {
return if (isSVGFile(file)) Color.WHITE else Color.BLACK
Expand All @@ -358,7 +359,6 @@ class PreviewImageFragment : FileFragment() {
private const val ARG_FILE = "FILE"
private const val ARG_ACCOUNT = "ACCOUNT"
private const val ARG_IGNORE_FIRST = "IGNORE_FIRST"
private const val SVG_MIMETYPE = "image/svg+xml"

/**
* Public factory method to create a new fragment that previews an image.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ package com.owncloud.android.domain.files

const val MIME_DIR = "DIR"
const val MIME_DIR_UNIX = "httpd/unix-directory"
const val MIME_SVG = "image/svg+xml"
val LIST_MIME_DIR = listOf(MIME_DIR, MIME_DIR_UNIX)

0 comments on commit 2f7e5fd

Please sign in to comment.