Share image with long click
This commit is contained in:
@@ -20,7 +20,7 @@ android {
|
|||||||
minSdk = 21
|
minSdk = 21
|
||||||
targetSdk = 31
|
targetSdk = 31
|
||||||
versionCode = 600
|
versionCode = 600
|
||||||
versionName = "6.0.0-alpha2"
|
versionName = "6.0.0-alpha1"
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
tools:ignore="UnusedAttribute">
|
tools:ignore="UnusedAttribute">
|
||||||
|
|
||||||
<provider
|
<provider
|
||||||
android:authorities="${applicationId}.provider"
|
android:authorities="xyz.quaver.pupil.fileprovider"
|
||||||
android:name="androidx.core.content.FileProvider"
|
android:name="androidx.core.content.FileProvider"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:grantUriPermissions="true">
|
android:grantUriPermissions="true">
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
package xyz.quaver.pupil.ui
|
package xyz.quaver.pupil.ui
|
||||||
|
|
||||||
|
import android.content.ClipData
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
@@ -47,6 +48,7 @@ import androidx.compose.ui.res.painterResource
|
|||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.core.content.FileProvider
|
||||||
import androidx.core.view.WindowInsetsCompat
|
import androidx.core.view.WindowInsetsCompat
|
||||||
import androidx.core.view.WindowInsetsControllerCompat
|
import androidx.core.view.WindowInsetsControllerCompat
|
||||||
import coil.annotation.ExperimentalCoilApi
|
import coil.annotation.ExperimentalCoilApi
|
||||||
@@ -221,6 +223,13 @@ class ReaderActivity : ComponentActivity(), DIAware {
|
|||||||
combinedClickable(
|
combinedClickable(
|
||||||
onLongClick = {
|
onLongClick = {
|
||||||
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
|
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
|
||||||
|
|
||||||
|
val uri = FileProvider.getUriForFile(this@ReaderActivity, "xyz.quaver.pupil.fileprovider", (imageSource as FileXImageSource).file)
|
||||||
|
startActivity(Intent.createChooser(Intent(Intent.ACTION_SEND).apply {
|
||||||
|
type = "image/*"
|
||||||
|
putExtra(Intent.EXTRA_STREAM, uri)
|
||||||
|
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
||||||
|
}, "Share image"))
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
model.isFullscreen = true
|
model.isFullscreen = true
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ class NetworkCache(context: Context) : DIAware {
|
|||||||
private val client: HttpClient by instance()
|
private val client: HttpClient by instance()
|
||||||
private val networkScope = CoroutineScope(Executors.newFixedThreadPool(4).asCoroutineDispatcher())
|
private val networkScope = CoroutineScope(Executors.newFixedThreadPool(4).asCoroutineDispatcher())
|
||||||
|
|
||||||
private val cacheDir = context.cacheDir
|
private val cacheDir = File(context.cacheDir, "networkcache")
|
||||||
|
|
||||||
private val channel = ConcurrentHashMap<String, Channel<Float>>()
|
private val channel = ConcurrentHashMap<String, Channel<Float>>()
|
||||||
private val requests = ConcurrentHashMap<String, Job>()
|
private val requests = ConcurrentHashMap<String, Job>()
|
||||||
@@ -103,6 +103,7 @@ class NetworkCache(context: Context) : DIAware {
|
|||||||
else
|
else
|
||||||
requests[url] = networkScope.launch {
|
requests[url] = networkScope.launch {
|
||||||
kotlin.runCatching {
|
kotlin.runCatching {
|
||||||
|
cacheDir.mkdirs()
|
||||||
file.createNewFile()
|
file.createNewFile()
|
||||||
|
|
||||||
client.request<HttpStatement>(request).execute { httpResponse ->
|
client.request<HttpStatement>(request).execute { httpResponse ->
|
||||||
|
|||||||
@@ -18,6 +18,5 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<paths>
|
<paths>
|
||||||
<external-path name="external" path="/"/>
|
<cache-path name="cached_image" path="networkcache/" />
|
||||||
<external-files-path name="files" path="/"/>
|
|
||||||
</paths>
|
</paths>
|
||||||
Reference in New Issue
Block a user