Skip to content

Commit b48213f

Browse files
authored
Merge pull request #1281 from DimensionDev/feature/status_media_zoom
update status media double tab zoom
2 parents b93ea9c + 6e48f3a commit b48213f

File tree

3 files changed

+29
-17
lines changed

3 files changed

+29
-17
lines changed

app/src/main/java/dev/dimension/flare/ui/screen/media/StatusMediaScreen.kt

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ import kotlinx.coroutines.android.awaitFrame
117117
import kotlinx.coroutines.launch
118118
import kotlinx.coroutines.withContext
119119
import me.saket.telephoto.ExperimentalTelephotoApi
120+
import me.saket.telephoto.zoomable.DoubleClickToZoomListener
120121
import me.saket.telephoto.zoomable.Viewport
121122
import me.saket.telephoto.zoomable.ZoomSpec
122123
import me.saket.telephoto.zoomable.coil3.ZoomableAsyncImage
@@ -782,6 +783,7 @@ private fun ImageItem(
782783
onLongClick = {
783784
onLongClick.invoke()
784785
},
786+
onDoubleClick = DoubleClickToZoomListener.cycle(2f),
785787
)
786788
}
787789

@@ -901,6 +903,15 @@ private fun statusMediaPresenter(
901903
context.getString(R.string.media_menu_share_image),
902904
),
903905
)
906+
} ?: run {
907+
withContext(Dispatchers.Main) {
908+
Toast
909+
.makeText(
910+
context,
911+
context.getString(R.string.media_is_downloading),
912+
Toast.LENGTH_SHORT,
913+
).show()
914+
}
904915
}
905916
}
906917
}
@@ -952,23 +963,23 @@ private fun statusMediaPresenter(
952963
val byteArray = it.data.toFile().readBytes()
953964
val fileName = uri.substringAfterLast("/")
954965
saveByteArrayToDownloads(context, byteArray, fileName)
955-
}
956-
withContext(Dispatchers.Main) {
966+
withContext(Dispatchers.Main) {
967+
Toast
968+
.makeText(
969+
context,
970+
context.getString(R.string.media_save_success),
971+
Toast.LENGTH_SHORT,
972+
).show()
973+
}
974+
} ?: withContext(Dispatchers.Main) {
957975
Toast
958976
.makeText(
959977
context,
960-
context.getString(R.string.media_save_success),
978+
context.getString(R.string.media_is_downloading),
961979
Toast.LENGTH_SHORT,
962980
).show()
963981
}
964982
}
965983
}
966984
}
967985
}
968-
969-
// suspend fun copyFile(
970-
// sourceFile: File,
971-
// destinationFile: File,
972-
// ) = withContext(Dispatchers.IO) {
973-
// sourceFile.copyTo(destinationFile, overwrite = true)
974-
// }

app/src/main/java/dev/dimension/flare/ui/theme/Theme.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ private fun ColorScheme.withPureColorLightMode(): ColorScheme =
5353

5454
private fun ColorScheme.withPureColorDarkMode(): ColorScheme =
5555
copy(
56-
background = MoreColors.Gray900,
57-
surface = Color.Black,
56+
background = Color.Black,
57+
surface = MoreColors.Gray900,
5858
onBackground = Color.White,
5959
onSurface = Color.White,
60-
surfaceContainer = Color.Black,
61-
surfaceContainerLow = MoreColors.Gray900,
62-
surfaceContainerHigh = Color.Black,
63-
surfaceContainerLowest = Color.Black,
64-
surfaceContainerHighest = Color.Black,
60+
surfaceContainer = MoreColors.Gray900,
61+
surfaceContainerLow = Color.Black,
62+
surfaceContainerHigh = MoreColors.Gray900,
63+
surfaceContainerLowest = MoreColors.Gray900,
64+
surfaceContainerHighest = MoreColors.Gray900,
6565
onSurfaceVariant = MoreColors.Gray400,
6666
outlineVariant = MoreColors.Gray800,
6767
)

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@
189189
<string name="media_save_success">Saved to Downloads</string>
190190
<string name="media_save_fail">Failed to save</string>
191191
<string name="media_alt_text">Alt text</string>
192+
<string name="media_is_downloading">The media is downloading, please try again later</string>
192193

193194
<string name="settings_side_panel_empty">Default will display side panel depends on the account platform.</string>
194195
<string name="tab_settings_add">Add</string>

0 commit comments

Comments
 (0)