mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +01:00
allow adding Resize at the bottom actions
This commit is contained in:
parent
bd7ae6b182
commit
c681f62c30
6 changed files with 37 additions and 4 deletions
|
@ -307,7 +307,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, bottom_move).forEach {
|
||||
bottom_toggle_file_visibility, bottom_rename, bottom_copy, bottom_move, bottom_resize).forEach {
|
||||
it.beGone()
|
||||
}
|
||||
|
||||
|
|
|
@ -177,7 +177,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
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_print).isVisible = currentMedium.isImage() || currentMedium.isRaw()
|
||||
findItem(R.id.menu_resize).isVisible = currentMedium.isImage()
|
||||
findItem(R.id.menu_resize).isVisible = visibleBottomActions and BOTTOM_ACTION_RESIZE == 0 && currentMedium.isImage()
|
||||
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()
|
||||
findItem(R.id.menu_add_to_favorites).isVisible = !currentMedium.isFavorite && visibleBottomActions and BOTTOM_ACTION_TOGGLE_FAVORITE == 0 && !currentMedium.getIsInRecycleBin()
|
||||
|
@ -832,6 +832,11 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
bottom_move.setOnClickListener {
|
||||
moveFileTo()
|
||||
}
|
||||
|
||||
bottom_resize.beVisibleIf(visibleBottomActions and BOTTOM_ACTION_RESIZE != 0 && currentMedium?.isImage() == true)
|
||||
bottom_resize.setOnClickListener {
|
||||
resizeImage()
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateBottomActionIcons(medium: Medium?) {
|
||||
|
@ -1230,7 +1235,8 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
if (bottom_actions.isVisible()) {
|
||||
bottom_actions.animate().alpha(newAlpha).start()
|
||||
arrayOf(bottom_favorite, bottom_edit, bottom_share, bottom_delete, bottom_rotate, bottom_properties, bottom_change_orientation,
|
||||
bottom_slideshow, bottom_show_on_map, bottom_toggle_file_visibility, bottom_rename).forEach {
|
||||
bottom_slideshow, bottom_show_on_map, bottom_toggle_file_visibility, bottom_rename, bottom_set_as, bottom_copy, bottom_move,
|
||||
bottom_resize).forEach {
|
||||
it.isClickable = !mIsFullScreen
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ class ManageBottomActionsDialog(val activity: BaseSimpleActivity, val callback:
|
|||
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
|
||||
manage_bottom_actions_resize.isChecked = actions and BOTTOM_ACTION_RESIZE != 0
|
||||
}
|
||||
|
||||
AlertDialog.Builder(activity)
|
||||
|
@ -69,6 +70,8 @@ class ManageBottomActionsDialog(val activity: BaseSimpleActivity, val callback:
|
|||
result += BOTTOM_ACTION_COPY
|
||||
if (manage_bottom_actions_move.isChecked)
|
||||
result += BOTTOM_ACTION_MOVE
|
||||
if (manage_bottom_actions_resize.isChecked)
|
||||
result += BOTTOM_ACTION_RESIZE
|
||||
}
|
||||
|
||||
activity.config.visibleBottomActions = result
|
||||
|
|
|
@ -195,6 +195,7 @@ 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 BOTTOM_ACTION_RESIZE = 16384
|
||||
|
||||
const val DEFAULT_BOTTOM_ACTIONS = BOTTOM_ACTION_TOGGLE_FAVORITE or BOTTOM_ACTION_EDIT or BOTTOM_ACTION_SHARE or BOTTOM_ACTION_DELETE
|
||||
|
||||
|
|
|
@ -213,10 +213,25 @@
|
|||
android:padding="@dimen/medium_margin"
|
||||
android:src="@drawable/ic_move"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/bottom_resize"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/bottom_copy"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.0"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bottom_resize"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/resize"
|
||||
android:padding="@dimen/medium_margin"
|
||||
android:src="@drawable/ic_minimize"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/bottom_move"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.0"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
|
|
@ -126,5 +126,13 @@
|
|||
android:paddingBottom="@dimen/activity_margin"
|
||||
android:text="@string/move"/>
|
||||
|
||||
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
|
||||
android:id="@+id/manage_bottom_actions_resize"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/activity_margin"
|
||||
android:paddingBottom="@dimen/activity_margin"
|
||||
android:text="@string/resize"/>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
|
Loading…
Reference in a new issue