FileAction.kt 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. * Nextcloud Android client application
  3. *
  4. * @author Álvaro Brey
  5. * Copyright (C) 2022 Álvaro Brey
  6. * Copyright (C) 2022 Nextcloud GmbH
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
  10. * License as published by the Free Software Foundation; either
  11. * version 3 of the License, or any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
  17. *
  18. * You should have received a copy of the GNU Affero General Public
  19. * License along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. package com.nextcloud.ui.fileactions
  23. import androidx.annotation.DrawableRes
  24. import androidx.annotation.IdRes
  25. import androidx.annotation.StringRes
  26. import com.owncloud.android.R
  27. enum class FileAction(@IdRes val id: Int, @StringRes val title: Int, @DrawableRes val icon: Int? = null) {
  28. // selection
  29. SELECT_ALL(R.id.action_select_all_action_menu, R.string.select_all, R.drawable.ic_select_all),
  30. SELECT_NONE(R.id.action_deselect_all_action_menu, R.string.deselect_all, R.drawable.ic_select_none),
  31. // generic file actions
  32. EDIT(R.id.action_edit, R.string.action_edit, R.drawable.ic_edit),
  33. SEE_DETAILS(R.id.action_see_details, R.string.actionbar_see_details, R.drawable.ic_information_outline),
  34. REMOVE_FILE(R.id.action_remove_file, R.string.common_remove, R.drawable.ic_delete),
  35. // File moving
  36. RENAME_FILE(R.id.action_rename_file, R.string.common_rename, R.drawable.ic_rename),
  37. MOVE(R.id.action_move, R.string.actionbar_move, R.drawable.ic_move),
  38. COPY(R.id.action_copy, R.string.actionbar_copy, R.drawable.ic_content_copy),
  39. // favorites
  40. FAVORITE(R.id.action_favorite, R.string.favorite, R.drawable.ic_star),
  41. UNSET_FAVORITE(R.id.action_unset_favorite, R.string.unset_favorite, R.drawable.ic_star_outline),
  42. // Uploads and downloads
  43. DOWNLOAD_FILE(R.id.action_download_file, R.string.filedetails_download, R.drawable.ic_cloud_download),
  44. SYNC_FILE(R.id.action_sync_file, R.string.filedetails_sync_file, R.drawable.ic_cloud_sync_on),
  45. CANCEL_SYNC(R.id.action_cancel_sync, R.string.common_cancel_sync, R.drawable.ic_cloud_sync_off),
  46. // File sharing
  47. EXPORT_FILE(R.id.action_export_file, R.string.filedetails_export, R.drawable.ic_export),
  48. SEND_SHARE_FILE(R.id.action_send_share_file, R.string.action_send_share, R.drawable.ic_share),
  49. SEND_FILE(R.id.action_send_file, R.string.common_send, R.drawable.ic_share),
  50. OPEN_FILE_WITH(R.id.action_open_file_with, R.string.actionbar_open_with, R.drawable.ic_external),
  51. STREAM_MEDIA(R.id.action_stream_media, R.string.stream, R.drawable.ic_play_arrow),
  52. SET_AS_WALLPAPER(R.id.action_set_as_wallpaper, R.string.set_picture_as, R.drawable.ic_wallpaper),
  53. // Encryption
  54. SET_ENCRYPTED(R.id.action_encrypted, R.string.encrypted, R.drawable.ic_encrypt),
  55. UNSET_ENCRYPTED(R.id.action_unset_encrypted, R.string.unset_encrypted, R.drawable.ic_decrypt),
  56. // locks
  57. UNLOCK_FILE(R.id.action_unlock_file, R.string.unlock_file, R.drawable.ic_lock_open_white),
  58. LOCK_FILE(R.id.action_lock_file, R.string.lock_file, R.drawable.ic_lock),
  59. // Shortcuts
  60. PIN_TO_HOMESCREEN(R.id.action_pin_to_homescreen, R.string.pin_home, R.drawable.add_to_home_screen);
  61. companion object {
  62. /**
  63. * All file actions, in the order they should be displayed
  64. */
  65. @JvmField
  66. val SORTED_VALUES = listOf(
  67. UNLOCK_FILE,
  68. EDIT,
  69. FAVORITE,
  70. UNSET_FAVORITE,
  71. SEE_DETAILS,
  72. LOCK_FILE,
  73. RENAME_FILE,
  74. MOVE,
  75. COPY,
  76. DOWNLOAD_FILE,
  77. EXPORT_FILE,
  78. STREAM_MEDIA,
  79. SEND_SHARE_FILE,
  80. SEND_FILE,
  81. OPEN_FILE_WITH,
  82. SYNC_FILE,
  83. CANCEL_SYNC,
  84. SELECT_ALL,
  85. SELECT_NONE,
  86. SET_ENCRYPTED,
  87. UNSET_ENCRYPTED,
  88. SET_AS_WALLPAPER,
  89. REMOVE_FILE,
  90. PIN_TO_HOMESCREEN
  91. )
  92. }
  93. }