Fixed a bug in WriteEntry

If the timeout of Entry/Day expired when the Activity was paused and then a
modification was saved after resuming, the app crashed.
Fixed a bug in PhotoActivity

It's the same bug fixed in the previous commit 33d9bb8110c0b96e7e5b2a62cb3d8e591383935e
for the WriteEntry Activity.
Shortened all the Toasts in MainActivity

From Toast.LENGTH_LONG to TOAST.LENGTH_SHORT
Readded the InvalidOperationError in DB.deleteEntry

I was forced to add a new parameter, the sharedPreferences file.
Removed unused stuff from MainActivity