Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import com.owncloud.android.utils.PreferenceUtils

class SpacesListAdapter(
private val listener: SpacesListAdapterListener,
private val isPickerMode: Boolean
) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {

private val spacesList = mutableListOf<OCSpace>()
Expand Down Expand Up @@ -98,6 +99,10 @@ class SpacesListAdapter(
}
}

if (isPickerMode) {
spacesThreeDotMenu.visibility = View.GONE
}

spacesThreeDotMenu.setOnClickListener {
listener.onThreeDotButtonClick(space)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class SpacesListFragment :
private fun initViews() {
setHasOptionsMenu(true)
setSpacesLayout(resources.configuration)
spacesListAdapter = SpacesListAdapter(this)
spacesListAdapter = SpacesListAdapter(this, isPickerMode())
binding.recyclerSpacesList.adapter = spacesListAdapter

binding.swipeRefreshSpacesList.setOnRefreshListener {
Expand Down Expand Up @@ -220,7 +220,7 @@ class SpacesListFragment :
is UIResult.Success -> {
Timber.d("The permissions for $accountName are: ${uiResult.data}")
uiResult.data?.let {
binding.fabCreateSpace.isVisible = it.contains(DRIVES_CREATE_ALL_PERMISSION)
binding.fabCreateSpace.isVisible = it.contains(DRIVES_CREATE_ALL_PERMISSION) && !isPickerMode()
if(it.contains(DRIVES_READ_WRITE_ALL_PERMISSION)) userPermissions.add(UserPermissions.CAN_EDIT_SPACES)
editQuotaPermission = it.contains(DRIVES_READ_WRITE_PROJECT_QUOTA_ALL_PERMISSION)
if(it.contains(DRIVES_DELETE_PROJECT_ALL_PERMISSION)) userPermissions.add(UserPermissions.CAN_DELETE_SPACES)
Expand Down Expand Up @@ -452,10 +452,13 @@ class SpacesListFragment :

private fun shouldShowDisabledSpace(space: OCSpace): Boolean = !space.isDisabled || spacesListViewModel.showDisabledSpaces

private fun isPickerMode(): Boolean = requireArguments().getBoolean(BUNDLE_IS_PICKER_MODE, false)

companion object {
const val REQUEST_KEY_CLICK_SPACE = "REQUEST_KEY_CLICK_SPACE"
const val BUNDLE_KEY_CLICK_SPACE = "BUNDLE_KEY_CLICK_SPACE"
const val BUNDLE_SHOW_PERSONAL_SPACE = "showPersonalSpace"
const val BUNDLE_IS_PICKER_MODE = "isPickerMode"
const val BUNDLE_ACCOUNT_NAME = "accountName"
const val DRIVES_CREATE_ALL_PERMISSION = "Drives.Create.all"
const val DRIVES_READ_WRITE_ALL_PERMISSION = "Drives.ReadWrite.all"
Expand All @@ -467,10 +470,12 @@ class SpacesListFragment :

fun newInstance(
showPersonalSpace: Boolean,
isPickerMode: Boolean,
accountName: String
): SpacesListFragment {
val args = Bundle().apply {
putBoolean(BUNDLE_SHOW_PERSONAL_SPACE, showPersonalSpace)
putBoolean(BUNDLE_IS_PICKER_MODE, isPickerMode)
putString(BUNDLE_ACCOUNT_NAME, accountName)
}
return SpacesListFragment().apply { arguments = args }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ class FileDisplayActivity : FileActivity(),
private fun initAndShowListOfSpaces() {
val listOfSpaces = SpacesListFragment.newInstance(
showPersonalSpace = false,
isPickerMode = false,
accountName = com.owncloud.android.presentation.authentication.AccountUtils.getCurrentOwnCloudAccount(applicationContext).name
).apply {
setSearchListener(findViewById(R.id.root_toolbar_search_view))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
* @author Abel García de Prada
* @author Juan Carlos Garrote Gascón
* @author Aitor Ballesteros Pavón
* @author Jorge Aguado Recio
*
* Copyright (C) 2023 ownCloud GmbH.
* Copyright (C) 2025 ownCloud GmbH.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
Expand Down Expand Up @@ -272,7 +273,7 @@ open class FolderPickerActivity : FileActivity(),
val accountNameIntent = intent.getStringExtra(KEY_ACCOUNT_NAME)
val accountName = accountNameIntent ?: AccountUtils.getCurrentOwnCloudAccount(applicationContext).name

val listOfSpaces = SpacesListFragment.newInstance(showPersonalSpace = true, accountName = accountName)
val listOfSpaces = SpacesListFragment.newInstance(showPersonalSpace = true, isPickerMode = true, accountName = accountName)
val transaction = supportFragmentManager.beginTransaction()
transaction.replace(R.id.fragment_container, listOfSpaces)
transaction.commit()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ private void showRetainerFragment() {
}

private void initAndShowListOfSpaces() {
SpacesListFragment listOfSpaces = SpacesListFragment.Companion.newInstance(true, getAccount().name);
SpacesListFragment listOfSpaces = SpacesListFragment.Companion.newInstance(true, true, getAccount().name);
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.fragment_container, listOfSpaces, TAG_SPACE_LIST_FRAGMENT);
transaction.commit();
Expand Down
Loading