mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 14:37:59 +01:00
allow opening the image with a different editor from our editor
This commit is contained in:
parent
47ec461139
commit
1d04e60dff
23 changed files with 39 additions and 7 deletions
|
@ -18,6 +18,7 @@ import com.simplemobiletools.gallery.R
|
|||
import com.simplemobiletools.gallery.dialogs.ResizeDialog
|
||||
import com.simplemobiletools.gallery.dialogs.SaveAsDialog
|
||||
import com.simplemobiletools.gallery.extensions.getRealPathFromURI
|
||||
import com.simplemobiletools.gallery.extensions.openEditor
|
||||
import com.theartofdev.edmodo.cropper.CropImageView
|
||||
import kotlinx.android.synthetic.main.view_crop_image.*
|
||||
import java.io.*
|
||||
|
@ -75,6 +76,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
|||
R.id.resize -> resizeImage()
|
||||
R.id.flip_horizontally -> flipImage(true)
|
||||
R.id.flip_vertically -> flipImage(false)
|
||||
R.id.edit -> editWith()
|
||||
else -> return super.onOptionsItemSelected(item)
|
||||
}
|
||||
return true
|
||||
|
@ -189,6 +191,11 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
|||
crop_image_view.flipImageVertically()
|
||||
}
|
||||
|
||||
private fun editWith() {
|
||||
openEditor(uri, true)
|
||||
finish()
|
||||
}
|
||||
|
||||
private fun scanFinalPath(path: String) {
|
||||
scanPath(path) {
|
||||
setResult(Activity.RESULT_OK, intent)
|
||||
|
|
|
@ -143,7 +143,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
|||
R.id.menu_set_as -> trySetAs(File(mMedium!!.path))
|
||||
R.id.menu_open_with -> openWith(File(mMedium!!.path))
|
||||
R.id.menu_share -> shareUri(mMedium!!, mUri)
|
||||
R.id.menu_edit -> openEditor(File(mMedium!!.path))
|
||||
R.id.menu_edit -> openFileEditor(File(mMedium!!.path))
|
||||
else -> return super.onOptionsItemSelected(item)
|
||||
}
|
||||
return true
|
||||
|
|
|
@ -208,7 +208,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
R.id.menu_share -> shareMedium(getCurrentMedium()!!)
|
||||
R.id.menu_delete -> askConfirmDelete()
|
||||
R.id.menu_rename -> renameFile()
|
||||
R.id.menu_edit -> openEditor(getCurrentFile())
|
||||
R.id.menu_edit -> openFileEditor(getCurrentFile())
|
||||
R.id.menu_properties -> showProperties()
|
||||
R.id.menu_save_as -> saveImageAs()
|
||||
R.id.show_on_map -> showOnMap()
|
||||
|
|
|
@ -172,7 +172,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList<Medium>,
|
|||
}
|
||||
|
||||
private fun editFile() {
|
||||
activity.openEditor(getCurrentFile())
|
||||
activity.openFileEditor(getCurrentFile())
|
||||
actMode?.finish()
|
||||
}
|
||||
|
||||
|
|
|
@ -130,9 +130,9 @@ fun Activity.openWith(file: File, forceChooser: Boolean = true) {
|
|||
action = Intent.ACTION_VIEW
|
||||
setDataAndType(uri, file.getMimeType())
|
||||
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
||||
val chooser = Intent.createChooser(this, getString(R.string.open_with))
|
||||
|
||||
if (resolveActivity(packageManager) != null) {
|
||||
val chooser = Intent.createChooser(this, getString(R.string.open_with))
|
||||
startActivity(if (forceChooser) chooser else this)
|
||||
} else {
|
||||
toast(R.string.no_app_found)
|
||||
|
@ -140,15 +140,19 @@ fun Activity.openWith(file: File, forceChooser: Boolean = true) {
|
|||
}
|
||||
}
|
||||
|
||||
fun Activity.openEditor(file: File) {
|
||||
val uri = Uri.fromFile(file)
|
||||
fun Activity.openFileEditor(file: File) {
|
||||
openEditor(Uri.fromFile(file))
|
||||
}
|
||||
|
||||
fun Activity.openEditor(uri: Uri, forceChooser: Boolean = false) {
|
||||
Intent().apply {
|
||||
action = Intent.ACTION_EDIT
|
||||
setDataAndType(uri, "image/*")
|
||||
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
||||
|
||||
if (resolveActivity(packageManager) != null) {
|
||||
startActivityForResult(this, REQUEST_EDIT_IMAGE)
|
||||
val chooser = Intent.createChooser(this, getString(R.string.edit_image_with))
|
||||
startActivityForResult(if (forceChooser) chooser else this, REQUEST_EDIT_IMAGE)
|
||||
} else {
|
||||
toast(R.string.no_editor_found)
|
||||
}
|
||||
|
|
|
@ -30,4 +30,8 @@
|
|||
android:title="@string/flip_vertically"/>
|
||||
</menu>
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/edit"
|
||||
android:title="@string/edit_with"
|
||||
app:showAsAction="never"/>
|
||||
</menu>
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
<string name="flip_horizontally">Překlopit vodorovně</string>
|
||||
<string name="flip_vertically">Překlopit svisle</string>
|
||||
<string name="out_of_memory_error">Zařízení nemá dostatek paměti</string>
|
||||
<string name="edit_with">Edit with</string>
|
||||
|
||||
<!-- Set wallpaper -->
|
||||
<string name="simple_wallpaper">Jednoduchá tapeta</string>
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
<string name="flip_horizontally">Horizontal spiegeln</string>
|
||||
<string name="flip_vertically">Vertikal spiegeln</string>
|
||||
<string name="out_of_memory_error">Fehler: Zuwenig Speicher</string>
|
||||
<string name="edit_with">Edit with</string>
|
||||
|
||||
<!-- Set wallpaper -->
|
||||
<string name="simple_wallpaper">Schlichter Hintergrund</string>
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
<string name="flip_horizontally">Horizontalmente</string>
|
||||
<string name="flip_vertically">Verticalmente</string>
|
||||
<string name="out_of_memory_error">Error: sin memoria</string>
|
||||
<string name="edit_with">Edit with</string>
|
||||
|
||||
<!-- Set wallpaper -->
|
||||
<string name="simple_wallpaper">Fondos de pantalla Simple Gallery</string>
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
<string name="flip_horizontally">Retourner horizontalement</string>
|
||||
<string name="flip_vertically">Retourner verticallement</string>
|
||||
<string name="out_of_memory_error">Erreur excès de mémoire</string>
|
||||
<string name="edit_with">Edit with</string>
|
||||
|
||||
<!-- Set wallpaper -->
|
||||
<string name="simple_wallpaper">Simple fond d\'écran</string>
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
<string name="flip_horizontally">Flip horizontally</string>
|
||||
<string name="flip_vertically">Flip vertically</string>
|
||||
<string name="out_of_memory_error">Out of memory error</string>
|
||||
<string name="edit_with">Edit with</string>
|
||||
|
||||
<!-- Set wallpaper -->
|
||||
<string name="simple_wallpaper">Simple Wallpaper</string>
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
<string name="flip_horizontally">Capovolgi orizzontalmente</string>
|
||||
<string name="flip_vertically">Capovolgi verticalmente</string>
|
||||
<string name="out_of_memory_error">Errore memoria esaurita</string>
|
||||
<string name="edit_with">Edit with</string>
|
||||
|
||||
<!-- Set wallpaper -->
|
||||
<string name="simple_wallpaper">Sfondo semplice</string>
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
<string name="flip_horizontally">Flip horizontally</string>
|
||||
<string name="flip_vertically">Flip vertically</string>
|
||||
<string name="out_of_memory_error">Out of memory error</string>
|
||||
<string name="edit_with">Edit with</string>
|
||||
|
||||
<!-- Set wallpaper -->
|
||||
<string name="simple_wallpaper">シンプル壁紙</string>
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
<string name="flip_horizontally">Flip poziomo</string>
|
||||
<string name="flip_vertically">Flip pionowo</string>
|
||||
<string name="out_of_memory_error">Błąd pamięci</string>
|
||||
<string name="edit_with">Edit with</string>
|
||||
|
||||
<!-- Set wallpaper -->
|
||||
<string name="simple_wallpaper">Tapeta</string>
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
<string name="flip_horizontally">Horizontalmente</string>
|
||||
<string name="flip_vertically">Verticalmente</string>
|
||||
<string name="out_of_memory_error">Memória insuficiente</string>
|
||||
<string name="edit_with">Edit with</string>
|
||||
|
||||
<!-- Set wallpaper -->
|
||||
<string name="simple_wallpaper">Simple Wallpaper</string>
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
<string name="flip_horizontally">Horizontalmente</string>
|
||||
<string name="flip_vertically">Verticalmente</string>
|
||||
<string name="out_of_memory_error">Memória insuficiente</string>
|
||||
<string name="edit_with">Edit with</string>
|
||||
|
||||
<!-- Set wallpaper -->
|
||||
<string name="simple_wallpaper">Simple Wallpaper</string>
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
<string name="flip_horizontally">По горизонтали</string>
|
||||
<string name="flip_vertically">По вертикали</string>
|
||||
<string name="out_of_memory_error">Память переполнена</string>
|
||||
<string name="edit_with">Edit with</string>
|
||||
|
||||
<!-- Set wallpaper -->
|
||||
<string name="simple_wallpaper">Простые обои</string>
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
<string name="flip_horizontally">Preklopiť vodorovne</string>
|
||||
<string name="flip_vertically">Preklopiť zvisle</string>
|
||||
<string name="out_of_memory_error">Došlo k chybe s nedostatkom pamäte</string>
|
||||
<string name="edit_with">Upraviť s</string>
|
||||
|
||||
<!-- Set wallpaper -->
|
||||
<string name="simple_wallpaper">Jednoduchá tapeta</string>
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
<string name="flip_horizontally">Flip horizontally</string>
|
||||
<string name="flip_vertically">Flip vertically</string>
|
||||
<string name="out_of_memory_error">Out of memory error</string>
|
||||
<string name="edit_with">Edit with</string>
|
||||
|
||||
<!-- Set wallpaper -->
|
||||
<string name="simple_wallpaper">Bakgrundsbild</string>
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
<string name="flip_horizontally">Yatay</string>
|
||||
<string name="flip_vertically">Dikey</string>
|
||||
<string name="out_of_memory_error">Yetersiz bellek hatası</string>
|
||||
<string name="edit_with">Edit with</string>
|
||||
|
||||
<!-- Set wallpaper -->
|
||||
<string name="simple_wallpaper">Basit Duvar Kağıdı</string>
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
<string name="flip_horizontally">水平翻转</string>
|
||||
<string name="flip_vertically">垂直翻转</string>
|
||||
<string name="out_of_memory_error">内存不足</string>
|
||||
<string name="edit_with">Edit with</string>
|
||||
|
||||
<!-- Set wallpaper -->
|
||||
<string name="simple_wallpaper">Simple Wallpaper</string>
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
<string name="flip_horizontally">Flip horizontally</string>
|
||||
<string name="flip_vertically">Flip vertically</string>
|
||||
<string name="out_of_memory_error">Out of memory error</string>
|
||||
<string name="edit_with">Edit with</string>
|
||||
|
||||
<!-- Set wallpaper -->
|
||||
<string name="simple_wallpaper">簡易桌布</string>
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
<string name="flip_horizontally">Flip horizontally</string>
|
||||
<string name="flip_vertically">Flip vertically</string>
|
||||
<string name="out_of_memory_error">Out of memory error</string>
|
||||
<string name="edit_with">Edit with</string>
|
||||
|
||||
<!-- Set wallpaper -->
|
||||
<string name="simple_wallpaper">Simple Wallpaper</string>
|
||||
|
|
Loading…
Reference in a new issue