mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-22 20:48:00 +01:00
finish the Edit activity if the image uri is invalid
This commit is contained in:
parent
acf539ee93
commit
c433c897b5
9 changed files with 16 additions and 0 deletions
|
@ -13,9 +13,16 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
|||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_edit)
|
||||
|
||||
if (intent.data == null) {
|
||||
toast(R.string.invalid_image_path)
|
||||
finish()
|
||||
return
|
||||
}
|
||||
|
||||
crop_image_view.apply {
|
||||
guidelines = CropImageView.Guidelines.OFF
|
||||
setOnCropImageCompleteListener(this@EditActivity)
|
||||
setImageUriAsync(intent.data)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,3 +4,5 @@ import android.content.Context
|
|||
import android.widget.Toast
|
||||
|
||||
fun Context.toast(msg: String, duration: Int = Toast.LENGTH_SHORT) = Toast.makeText(this, msg, duration).show()
|
||||
|
||||
fun Context.toast(msgId: Int, duration: Int = Toast.LENGTH_SHORT) = Toast.makeText(this, resources.getString(msgId), duration).show()
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
<string name="save">Save</string>
|
||||
<string name="rotate">Rotate</string>
|
||||
<string name="image_croping_failed">Image croping failed:</string>
|
||||
<string name="invalid_image_path">Invalid image path</string>
|
||||
|
||||
<!-- About -->
|
||||
<string name="about">Über</string>
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
<string name="save">Save</string>
|
||||
<string name="rotate">Rotate</string>
|
||||
<string name="image_croping_failed">Image croping failed:</string>
|
||||
<string name="invalid_image_path">Invalid image path</string>
|
||||
|
||||
<!-- About -->
|
||||
<string name="about">Acerca de</string>
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
<string name="save">Save</string>
|
||||
<string name="rotate">Rotate</string>
|
||||
<string name="image_croping_failed">Image croping failed:</string>
|
||||
<string name="invalid_image_path">Invalid image path</string>
|
||||
|
||||
<!-- About -->
|
||||
<string name="about">Informazioni</string>
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
<string name="save">Save</string>
|
||||
<string name="rotate">Rotate</string>
|
||||
<string name="image_croping_failed">Image croping failed:</string>
|
||||
<string name="invalid_image_path">Invalid image path</string>
|
||||
|
||||
<!-- About -->
|
||||
<string name="about">アプリについて</string>
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
<string name="save">Save</string>
|
||||
<string name="rotate">Rotate</string>
|
||||
<string name="image_croping_failed">Image croping failed:</string>
|
||||
<string name="invalid_image_path">Invalid image path</string>
|
||||
|
||||
<!-- About -->
|
||||
<string name="about">Sobre</string>
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
<string name="save">Save</string>
|
||||
<string name="rotate">Rotate</string>
|
||||
<string name="image_croping_failed">Image croping failed:</string>
|
||||
<string name="invalid_image_path">Invalid image path</string>
|
||||
|
||||
<!-- About -->
|
||||
<string name="about">Om</string>
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
<string name="save">Save</string>
|
||||
<string name="rotate">Rotate</string>
|
||||
<string name="image_croping_failed">Image croping failed:</string>
|
||||
<string name="invalid_image_path">Invalid image path</string>
|
||||
|
||||
<!-- About -->
|
||||
<string name="about">About</string>
|
||||
|
|
Loading…
Reference in a new issue