mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-03-18 22:01:45 +01:00
Removes contract of the old image picker
This commit is contained in:
parent
b01f46b2ee
commit
83235dab69
@ -20,9 +20,6 @@
|
|||||||
*/
|
*/
|
||||||
package com.vitorpamplona.amethyst.ui
|
package com.vitorpamplona.amethyst.ui
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.Intent
|
|
||||||
import android.net.ConnectivityManager
|
import android.net.ConnectivityManager
|
||||||
import android.net.Network
|
import android.net.Network
|
||||||
import android.net.NetworkCapabilities
|
import android.net.NetworkCapabilities
|
||||||
@ -31,7 +28,6 @@ import android.os.Bundle
|
|||||||
import android.util.Log
|
import android.util.Log
|
||||||
import androidx.activity.compose.setContent
|
import androidx.activity.compose.setContent
|
||||||
import androidx.activity.enableEdgeToEdge
|
import androidx.activity.enableEdgeToEdge
|
||||||
import androidx.activity.result.contract.ActivityResultContracts
|
|
||||||
import androidx.annotation.RequiresApi
|
import androidx.annotation.RequiresApi
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
@ -259,24 +255,6 @@ class MainActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class GetMediaActivityResultContract : ActivityResultContracts.GetContent() {
|
|
||||||
@SuppressLint("MissingSuperCall")
|
|
||||||
override fun createIntent(
|
|
||||||
context: Context,
|
|
||||||
input: String,
|
|
||||||
): Intent {
|
|
||||||
// Force only images and videos to be selectable
|
|
||||||
// Force OPEN Document because of the resulting URI must be passed to the
|
|
||||||
// Playback service and the picker's permissions only allow the activity to read the URI
|
|
||||||
return Intent(Intent.ACTION_OPEN_DOCUMENT).apply {
|
|
||||||
addCategory(Intent.CATEGORY_OPENABLE)
|
|
||||||
// Force only images and videos to be selectable
|
|
||||||
type = "*/*"
|
|
||||||
putExtra(Intent.EXTRA_MIME_TYPES, arrayOf("image/*", "video/*"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun uriToRoute(uri: String?): String? =
|
fun uriToRoute(uri: String?): String? =
|
||||||
if (uri.equals("nostr:Notifications", true)) {
|
if (uri.equals("nostr:Notifications", true)) {
|
||||||
Route.Notification.route.replace("{scrollToTop}", "true")
|
Route.Notification.route.replace("{scrollToTop}", "true")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user