diff --git a/app/src/main/java/net/gsantner/markor/activity/DocumentEditFragment.java b/app/src/main/java/net/gsantner/markor/activity/DocumentEditFragment.java index a342619693..3f01bb06ba 100644 --- a/app/src/main/java/net/gsantner/markor/activity/DocumentEditFragment.java +++ b/app/src/main/java/net/gsantner/markor/activity/DocumentEditFragment.java @@ -14,7 +14,6 @@ import android.appwidget.AppWidgetManager; import android.content.ComponentName; import android.content.Context; -import android.graphics.Bitmap; import android.graphics.Color; import android.graphics.Typeface; import android.graphics.drawable.Drawable; @@ -24,6 +23,7 @@ import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; +import android.text.TextUtils; import android.util.TypedValue; import android.view.Gravity; import android.view.Menu; @@ -421,8 +421,9 @@ public boolean onOptionsItemSelected(final MenuItem item) { return true; } case android.R.id.home: { - if (saveDocument() && getActivity() != null) { - getActivity().onBackPressed(); + final Activity activity = getActivity(); + if ((saveDocument() || (_hlEditor.length() < 10 && TextUtils.getTrimmedLength(_hlEditor.getEditableText()) == 0)) && activity != null) { + activity.onBackPressed(); } return true; }