From e584b23fb4dddd52f694019a700a0b244ef5a0c2 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 21 Feb 2019 12:16:46 +0100 Subject: [PATCH] adding Move to the bottom actions --- app/build.gradle | 2 +- .../gallery/pro/activities/PhotoVideoActivity.kt | 2 +- .../gallery/pro/activities/ViewPagerActivity.kt | 6 ++++++ .../pro/dialogs/ManageBottomActionsDialog.kt | 3 +++ .../gallery/pro/helpers/Constants.kt | 1 + app/src/main/res/layout/bottom_actions.xml | 13 ++++++++++++- .../res/layout/dialog_manage_bottom_actions.xml | 8 ++++++++ build.gradle | 1 + 8 files changed, 33 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 29fce13b4..1b6dbd732 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -61,7 +61,7 @@ android { } dependencies { - implementation 'com.simplemobiletools:commons:5.8.7' + implementation 'com.simplemobiletools:commons:5.9.0' implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0' implementation 'androidx.multidex:multidex:2.0.1' implementation 'it.sephiroth.android.exif:library:1.0.1' diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PhotoVideoActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PhotoVideoActivity.kt index 7c5338857..ef96f5afa 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PhotoVideoActivity.kt @@ -251,7 +251,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList private fun initBottomActionButtons() { arrayListOf(bottom_favorite, bottom_delete, bottom_rotate, bottom_properties, bottom_change_orientation, bottom_slideshow, bottom_show_on_map, - bottom_toggle_file_visibility, bottom_rename, bottom_copy).forEach { + bottom_toggle_file_visibility, bottom_rename, bottom_copy, bottom_move).forEach { it.beGone() } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt index bdaab98c1..0588987c3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt @@ -153,6 +153,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View findItem(R.id.menu_rotate).isVisible = currentMedium.isImage() && visibleBottomActions and BOTTOM_ACTION_ROTATE == 0 findItem(R.id.menu_set_as).isVisible = visibleBottomActions and BOTTOM_ACTION_SET_AS == 0 findItem(R.id.menu_copy_to).isVisible = visibleBottomActions and BOTTOM_ACTION_COPY == 0 + findItem(R.id.menu_move_to).isVisible = visibleBottomActions and BOTTOM_ACTION_MOVE == 0 findItem(R.id.menu_save_as).isVisible = rotationDegrees != 0 findItem(R.id.menu_hide).isVisible = !currentMedium.isHidden() && visibleBottomActions and BOTTOM_ACTION_TOGGLE_VISIBILITY == 0 && !currentMedium.getIsInRecycleBin() findItem(R.id.menu_unhide).isVisible = currentMedium.isHidden() && visibleBottomActions and BOTTOM_ACTION_TOGGLE_VISIBILITY == 0 && !currentMedium.getIsInRecycleBin() @@ -777,6 +778,11 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View bottom_copy.setOnClickListener { copyMoveTo(true) } + + bottom_move.beVisibleIf(visibleBottomActions and BOTTOM_ACTION_MOVE != 0) + bottom_move.setOnClickListener { + moveFileTo() + } } private fun updateBottomActionIcons(medium: Medium?) { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/ManageBottomActionsDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/ManageBottomActionsDialog.kt index 760f51be2..217559e73 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/ManageBottomActionsDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/ManageBottomActionsDialog.kt @@ -27,6 +27,7 @@ class ManageBottomActionsDialog(val activity: BaseSimpleActivity, val callback: manage_bottom_actions_rename.isChecked = actions and BOTTOM_ACTION_RENAME != 0 manage_bottom_actions_set_as.isChecked = actions and BOTTOM_ACTION_SET_AS != 0 manage_bottom_actions_copy.isChecked = actions and BOTTOM_ACTION_COPY != 0 + manage_bottom_actions_move.isChecked = actions and BOTTOM_ACTION_MOVE != 0 } AlertDialog.Builder(activity) @@ -66,6 +67,8 @@ class ManageBottomActionsDialog(val activity: BaseSimpleActivity, val callback: result += BOTTOM_ACTION_SET_AS if (manage_bottom_actions_copy.isChecked) result += BOTTOM_ACTION_COPY + if (manage_bottom_actions_move.isChecked) + result += BOTTOM_ACTION_MOVE } activity.config.visibleBottomActions = result diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt index 21bcd12d1..ecdccaf65 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt @@ -176,6 +176,7 @@ const val BOTTOM_ACTION_TOGGLE_VISIBILITY = 512 const val BOTTOM_ACTION_RENAME = 1024 const val BOTTOM_ACTION_SET_AS = 2048 const val BOTTOM_ACTION_COPY = 4096 +const val BOTTOM_ACTION_MOVE = 8192 const val DEFAULT_BOTTOM_ACTIONS = BOTTOM_ACTION_TOGGLE_FAVORITE or BOTTOM_ACTION_EDIT or BOTTOM_ACTION_SHARE or BOTTOM_ACTION_DELETE diff --git a/app/src/main/res/layout/bottom_actions.xml b/app/src/main/res/layout/bottom_actions.xml index 48bacf38d..9e8cf713a 100644 --- a/app/src/main/res/layout/bottom_actions.xml +++ b/app/src/main/res/layout/bottom_actions.xml @@ -148,8 +148,19 @@ android:background="?attr/selectableItemBackgroundBorderless" android:padding="@dimen/medium_margin" android:src="@drawable/ic_copy" - app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintEnd_toEndOf="@+id/bottom_move" app:layout_constraintHorizontal_bias="0.5" app:layout_constraintStart_toEndOf="@+id/bottom_set_as"/> + + diff --git a/app/src/main/res/layout/dialog_manage_bottom_actions.xml b/app/src/main/res/layout/dialog_manage_bottom_actions.xml index 39fc8555d..fb76d7666 100644 --- a/app/src/main/res/layout/dialog_manage_bottom_actions.xml +++ b/app/src/main/res/layout/dialog_manage_bottom_actions.xml @@ -118,5 +118,13 @@ android:paddingBottom="@dimen/activity_margin" android:text="@string/copy"/> + + diff --git a/build.gradle b/build.gradle index 0be76662a..68efeae58 100644 --- a/build.gradle +++ b/build.gradle @@ -22,6 +22,7 @@ allprojects { google() jcenter() maven { url "https://jitpack.io" } + maven { url "https://dl.bintray.com/simplelibraries/commons" } } }