diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt index 986bf6870..b87e27bc6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt @@ -12,8 +12,6 @@ import android.os.Build import android.os.Bundle import android.os.Handler import android.provider.MediaStore -import android.view.Menu -import android.view.MenuItem import android.widget.RelativeLayout import androidx.exifinterface.media.ExifInterface import androidx.recyclerview.widget.LinearLayoutManager @@ -28,10 +26,7 @@ import com.bumptech.glide.request.target.Target import com.simplemobiletools.commons.dialogs.ColorPickerDialog import com.simplemobiletools.commons.dialogs.ConfirmationDialog import com.simplemobiletools.commons.extensions.* -import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE -import com.simplemobiletools.commons.helpers.REAL_FILE_PATH -import com.simplemobiletools.commons.helpers.ensureBackgroundThread -import com.simplemobiletools.commons.helpers.isNougatPlus +import com.simplemobiletools.commons.helpers.* import com.simplemobiletools.commons.models.FileDirItem import com.simplemobiletools.gallery.pro.BuildConfig import com.simplemobiletools.gallery.pro.R @@ -102,6 +97,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener return } + setupOptionsMenu() handlePermission(PERMISSION_WRITE_STORAGE) { if (!it) { toast(R.string.no_storage_permissions) @@ -115,6 +111,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener super.onResume() isEditingWithThirdParty = false bottom_draw_width.setColors(getProperTextColor(), getProperPrimaryColor(), getProperBackgroundColor()) + setupToolbar(editor_toolbar, NavigationIcon.Arrow) } override fun onStop() { @@ -124,20 +121,16 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener } } - override fun onCreateOptionsMenu(menu: Menu): Boolean { - menuInflater.inflate(R.menu.menu_editor, menu) - updateMenuItemColors(menu) - return true - } - - override fun onOptionsItemSelected(item: MenuItem): Boolean { - when (item.itemId) { - R.id.save_as -> saveImage() - R.id.edit -> editWith() - R.id.share -> shareImage() - else -> return super.onOptionsItemSelected(item) + private fun setupOptionsMenu() { + editor_toolbar.setOnMenuItemClickListener { menuItem -> + when (menuItem.itemId) { + R.id.save_as -> saveImage() + R.id.edit -> editWith() + R.id.share -> shareImage() + else -> return@setOnMenuItemClickListener false + } + return@setOnMenuItemClickListener true } - return true } private fun initEditActivity() { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/SaveAsDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/SaveAsDialog.kt index 01829dc16..74617af07 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/SaveAsDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/SaveAsDialog.kt @@ -21,7 +21,7 @@ class SaveAsDialog( } val view = activity.layoutInflater.inflate(R.layout.dialog_save_as, null).apply { - save_as_path.text = "${activity.humanizePath(realPath).trimEnd('/')}/" + folder_value.setText("${activity.humanizePath(realPath).trimEnd('/')}/") val fullName = path.getFilenameFromPath() val dotAt = fullName.lastIndexOf(".") @@ -30,18 +30,18 @@ class SaveAsDialog( if (dotAt > 0) { name = fullName.substring(0, dotAt) val extension = fullName.substring(dotAt + 1) - save_as_extension.setText(extension) + extension_value.setText(extension) } if (appendFilename) { name += "_1" } - save_as_name.setText(name) - save_as_path.setOnClickListener { - activity.hideKeyboard(save_as_path) + filename_value.setText(name) + folder_value.setOnClickListener { + activity.hideKeyboard(folder_value) FilePickerDialog(activity, realPath, false, false, true, true) { - save_as_path.text = activity.humanizePath(it) + folder_value.setText(activity.humanizePath(it)) realPath = it } } @@ -53,10 +53,10 @@ class SaveAsDialog( .setOnCancelListener { cancelCallback?.invoke() } .apply { activity.setupDialogStuff(view, this, R.string.save_as) { alertDialog -> - alertDialog.showKeyboard(view.save_as_name) + alertDialog.showKeyboard(view.filename_value) alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener { - val filename = view.save_as_name.value - val extension = view.save_as_extension.value + val filename = view.filename_value.value + val extension = view.extension_value.value if (filename.isEmpty()) { activity.toast(R.string.filename_cannot_be_empty) diff --git a/app/src/main/res/layout/activity_edit.xml b/app/src/main/res/layout/activity_edit.xml index 3dffbf1bf..43c67c799 100644 --- a/app/src/main/res/layout/activity_edit.xml +++ b/app/src/main/res/layout/activity_edit.xml @@ -1,77 +1,99 @@ - - + android:layout_height="wrap_content"> - + - + + android:layout_height="match_parent" + app:layout_behavior="@string/appbar_scrolling_view_behavior"> - + - + - + - + - + - + + + + + + + + + + diff --git a/app/src/main/res/layout/dialog_save_as.xml b/app/src/main/res/layout/dialog_save_as.xml index 49cf31e6c..6f441d44a 100644 --- a/app/src/main/res/layout/dialog_save_as.xml +++ b/app/src/main/res/layout/dialog_save_as.xml @@ -1,53 +1,57 @@ - - - - - + android:hint="@string/path"> - + - + + + android:hint="@string/filename"> + + + + + + + + +