mirror of
https://github.com/nextcloud/android.git
synced 2024-12-18 23:11:58 +03:00
spotless
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
parent
f5b5f8fab6
commit
175a2421dd
4 changed files with 12 additions and 18 deletions
|
@ -26,7 +26,7 @@ enum class TrashbinFileAction(@IdRes val id: Int, @StringRes val title: Int, @Dr
|
|||
DELETE_PERMANENTLY,
|
||||
RESTORE,
|
||||
SELECT_ALL,
|
||||
SELECT_NONE,
|
||||
SELECT_NONE
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -220,14 +220,11 @@ class TrashbinFileActionsBottomSheet : BottomSheetDialogFragment(), Injectable {
|
|||
private const val RESULT_KEY_ACTION_ID = "RESULT_KEY_ACTION_ID"
|
||||
|
||||
@JvmStatic
|
||||
fun newInstance(
|
||||
numberOfAllFiles: Int,
|
||||
files: Collection<TrashbinFile>,
|
||||
): TrashbinFileActionsBottomSheet {
|
||||
fun newInstance(numberOfAllFiles: Int, files: Collection<TrashbinFile>): TrashbinFileActionsBottomSheet {
|
||||
return TrashbinFileActionsBottomSheet().apply {
|
||||
val argsBundle = bundleOf(
|
||||
TrashbinFileActionsViewModel.ARG_ALL_FILES_COUNT to numberOfAllFiles,
|
||||
TrashbinFileActionsViewModel.ARG_FILES to ArrayList<TrashbinFile>(files),
|
||||
TrashbinFileActionsViewModel.ARG_FILES to ArrayList<TrashbinFile>(files)
|
||||
)
|
||||
arguments = argsBundle
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ class TrashbinFileActionsViewModel @Inject constructor(
|
|||
data object Error : UiState
|
||||
data class LoadedForSingleFile(
|
||||
val actions: List<TrashbinFileAction>,
|
||||
val titleFile: TrashbinFile?,
|
||||
val titleFile: TrashbinFile?
|
||||
) : UiState
|
||||
|
||||
data class LoadedForMultipleFiles(val actions: List<TrashbinFileAction>, val fileCount: Int) : UiState
|
||||
|
@ -56,10 +56,7 @@ class TrashbinFileActionsViewModel @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
private fun load(
|
||||
files: Collection<TrashbinFile>,
|
||||
numberOfAllFiles: Int?,
|
||||
) {
|
||||
private fun load(files: Collection<TrashbinFile>, numberOfAllFiles: Int?) {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
val toHide = getHiddenActions(numberOfAllFiles, files)
|
||||
val availableActions = getActionsToShow(toHide)
|
||||
|
@ -67,10 +64,7 @@ class TrashbinFileActionsViewModel @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
private fun getHiddenActions(
|
||||
numberOfAllFiles: Int?,
|
||||
files: Collection<TrashbinFile>,
|
||||
): List<Int> {
|
||||
private fun getHiddenActions(numberOfAllFiles: Int?, files: Collection<TrashbinFile>): List<Int> {
|
||||
numberOfAllFiles?.let {
|
||||
if (files.size >= it) {
|
||||
return listOf(R.id.action_select_all_action_menu)
|
||||
|
|
|
@ -178,7 +178,9 @@ class TrashbinActivity :
|
|||
handleOnBackPressed()
|
||||
|
||||
mMultiChoiceModeListener = MultiChoiceModeListener(
|
||||
this, trashbinListAdapter, viewThemeUtils,
|
||||
this,
|
||||
trashbinListAdapter,
|
||||
viewThemeUtils
|
||||
) { filesCount, checkedFiles -> openActionsMenu(filesCount, checkedFiles) }
|
||||
addDrawerListener(mMultiChoiceModeListener)
|
||||
}
|
||||
|
@ -373,7 +375,8 @@ class TrashbinActivity :
|
|||
|
||||
TrashbinFileActionsBottomSheet.newInstance(filesCount, checkedFiles)
|
||||
.setResultListener(
|
||||
supportFragmentManager, this
|
||||
supportFragmentManager,
|
||||
this
|
||||
) { id: Int ->
|
||||
onFileActionChosen(
|
||||
id,
|
||||
|
@ -533,7 +536,7 @@ class TrashbinActivity :
|
|||
val inflater: MenuInflater = activity.menuInflater
|
||||
inflater.inflate(R.menu.custom_menu_placeholder, menu)
|
||||
val item = menu.findItem(R.id.custom_menu_placeholder_item)
|
||||
item.icon?.let{
|
||||
item.icon?.let {
|
||||
item.setIcon(
|
||||
viewThemeUtils.platform.colorDrawable(
|
||||
it,
|
||||
|
|
Loading…
Reference in a new issue