|
23 | 23 | package com.owncloud.android.presentation.spaces |
24 | 24 |
|
25 | 25 | import android.content.DialogInterface |
| 26 | +import android.content.Intent |
26 | 27 | import android.content.res.Configuration |
27 | 28 | import android.os.Bundle |
28 | 29 | import android.view.LayoutInflater |
29 | 30 | import android.view.Menu |
30 | 31 | import android.view.MenuInflater |
31 | 32 | import android.view.View |
32 | 33 | import android.view.ViewGroup |
| 34 | +import androidx.activity.result.contract.ActivityResultContracts |
33 | 35 | import androidx.appcompat.widget.SearchView |
34 | 36 | import androidx.core.content.res.ResourcesCompat |
35 | 37 | import androidx.core.os.bundleOf |
@@ -92,6 +94,9 @@ class SpacesListFragment : |
92 | 94 | ) |
93 | 95 | } |
94 | 96 |
|
| 97 | + private val editSpaceImageLauncher = |
| 98 | + registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { } |
| 99 | + |
95 | 100 | private lateinit var spacesListAdapter: SpacesListAdapter |
96 | 101 |
|
97 | 102 | override fun onCreateView( |
@@ -382,7 +387,14 @@ class SpacesListFragment : |
382 | 387 | negativeButtonText = getString(R.string.common_no) |
383 | 388 | ) |
384 | 389 | } |
385 | | - SpaceMenuOption.EDIT_IMAGE -> { } |
| 390 | + SpaceMenuOption.EDIT_IMAGE -> { |
| 391 | + val action = Intent(Intent.ACTION_OPEN_DOCUMENT).apply { |
| 392 | + addCategory(Intent.CATEGORY_OPENABLE) |
| 393 | + type = "image/*" |
| 394 | + putExtra(Intent.EXTRA_MIME_TYPES, arrayOf("image/jpeg", "image/png", "image/bmp", "image/x-ms-bmp", "image/gif")) |
| 395 | + } |
| 396 | + editSpaceImageLauncher.launch(action) |
| 397 | + } |
386 | 398 | } |
387 | 399 | } |
388 | 400 | } |
|
0 commit comments