Skip to content

Commit 1ed0aad

Browse files
committed
feat: show the corresponding quota value in the dialog
1 parent 6cb74dc commit 1ed0aad

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

‎owncloudApp/src/main/java/com/owncloud/android/presentation/spaces/SpacesListDiffUtil.kt‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
* ownCloud Android client application
33
*
44
* @author Juan Carlos Garrote Gascón
5+
* @author Jorge Aguado Recio
56
*
6-
* Copyright (C) 2023 ownCloud GmbH.
7+
* Copyright (C) 2025 ownCloud GmbH.
78
*
89
* This program is free software: you can redistribute it and/or modify
910
* it under the terms of the GNU General Public License version 2,
@@ -42,7 +43,7 @@ class SpacesListDiffUtil(
4243
val oldItem = oldList[oldItemPosition]
4344
val newItem = newList[newItemPosition]
4445

45-
if ((oldItem.name != newItem.name) || (oldItem.description != newItem.description) ||
46+
if ((oldItem.name != newItem.name) || (oldItem.description != newItem.description) || (oldItem.quota != newItem.quota) ||
4647
(oldItem.getSpaceSpecialImage()?.id != newItem.getSpaceSpecialImage()?.id)) {
4748
return false
4849
}

‎owncloudApp/src/main/java/com/owncloud/android/presentation/spaces/createspace/CreateSpaceDialogFragment.kt‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class CreateSpaceDialogFragment : DialogFragment() {
6363
currentSpace?.let {
6464
createSpaceDialogNameValue.setText(it.name)
6565
createSpaceDialogSubtitleValue.setText(it.description)
66+
createSpaceDialogQuotaUnit.setSelection(getQuotaValueForSpinner(it.quota!!.total))
6667
}
6768

6869
createSpaceButton.apply {
@@ -122,6 +123,20 @@ class CreateSpaceDialogFragment : DialogFragment() {
122123
return quotaNumber * 1_000_000_000L
123124
}
124125

126+
private fun getQuotaValueForSpinner(spaceQuota: Long): Int {
127+
val totalGB = spaceQuota / 1_000_000_000.0
128+
return when (totalGB) {
129+
1.0 -> 0
130+
2.0-> 1
131+
5.0 -> 2
132+
10.0 -> 3
133+
50.0 -> 4
134+
100.0 -> 5
135+
0.0 -> 6
136+
else -> 0
137+
}
138+
}
139+
125140
interface CreateSpaceListener {
126141
fun createSpace(spaceName: String, spaceSubtitle: String, spaceQuota: Long)
127142
fun editSpace(spaceId: String, spaceName: String, spaceSubtitle: String, spaceQuota: Long?)

0 commit comments

Comments
 (0)