aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt16
1 files changed, 6 insertions, 10 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt
index 509ac2cb..487f3a9d 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt
@@ -85,7 +85,7 @@ class ImageActivity : AppCompatActivity() {
setContentView(if (!text.isNullOrBlank()) R.layout.activity_image else R.layout.activity_image_textless)
container.setBackgroundColor(Prefs.bgColor.withMinAlpha(222))
caption?.setTextColor(Prefs.textColor)
- caption?.setBackgroundColor(Prefs.bgColor.colorToForeground(0.1f).withAlpha(255))
+ caption?.setBackgroundColor(Prefs.bgColor.colorToForeground(0.2f).withAlpha(255))
caption?.text = text
progress.tint(Prefs.accentColor)
panel?.addPanelSlideListener(object : SlidingUpPanelLayout.SimplePanelSlideListener() {
@@ -174,16 +174,13 @@ class ImageActivity : AppCompatActivity() {
val timeStamp = SimpleDateFormat("yyyyMMdd_HHmmss").format(Date())
val imageFileName = "Frost_" + timeStamp + "_"
val storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES)
- return File.createTempFile(
- imageFileName, /* prefix */
- ".png", /* suffix */
- storageDir /* directory */
- )
+ return File.createTempFile(imageFileName, ".png", storageDir)
}
internal fun downloadImage() {
kauRequestPermissions(PERMISSION_WRITE_EXTERNAL_STORAGE) {
granted, _ ->
+ L.d("Download image callback granted: $granted")
if (granted) {
doAsync {
val timeStamp = SimpleDateFormat("yyyyMMdd_HHmmss").format(Date())
@@ -199,6 +196,7 @@ class ImageActivity : AppCompatActivity() {
} catch (e: Exception) {
success = false
} finally {
+ L.d("Download image async finished: $success")
uiThread {
snackbar(if (success) R.string.image_download_success else R.string.image_download_fail)
if (success) {
@@ -230,7 +228,7 @@ class ImageActivity : AppCompatActivity() {
}
}
-internal enum class FabStates(val iicon: IIcon, val iconColor: Int = Prefs.textColor, val backgroundTint: Int = Prefs.accentBackgroundColor.withAlpha(255)) {
+internal enum class FabStates(val iicon: IIcon, val iconColor: Int = Prefs.iconColor, val backgroundTint: Int = Prefs.iconBackgroundColor.withAlpha(255)) {
ERROR(GoogleMaterial.Icon.gmd_error, Color.WHITE, Color.RED) {
override fun onClick(activity: ImageActivity) {
//todo add something
@@ -240,9 +238,7 @@ internal enum class FabStates(val iicon: IIcon, val iconColor: Int = Prefs.textC
override fun onClick(activity: ImageActivity) {}
},
DOWNLOAD(GoogleMaterial.Icon.gmd_file_download) {
- override fun onClick(activity: ImageActivity) {
- activity.downloadImage()
- }
+ override fun onClick(activity: ImageActivity) = activity.downloadImage()
},
SHARE(GoogleMaterial.Icon.gmd_share) {
override fun onClick(activity: ImageActivity) {