Skip to content

Commit e6610e0

Browse files
committed
feat: show dialog when set icon option is clicked
1 parent 4ff5e34 commit e6610e0

File tree

3 files changed

+116
-1
lines changed

3 files changed

+116
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ import com.owncloud.android.utils.DisplayUtils
7373
import com.owncloud.android.presentation.common.UIResult
7474
import com.owncloud.android.presentation.spaces.createspace.CreateSpaceDialogFragment
7575
import com.owncloud.android.presentation.transfers.TransfersViewModel
76+
import com.owncloud.android.presentation.spaces.setspaceicon.SetSpaceIconDialogFragment
7677
import kotlinx.coroutines.flow.SharedFlow
7778
import org.koin.androidx.viewmodel.ext.android.viewModel
7879
import org.koin.core.parameter.parametersOf
@@ -444,7 +445,10 @@ class SpacesListFragment :
444445
}
445446
editSpaceImageLauncher.launch(action)
446447
}
447-
SpaceMenuOption.SET_ICON -> { }
448+
SpaceMenuOption.SET_ICON -> {
449+
val setIconDialog = SetSpaceIconDialogFragment.newInstance()
450+
setIconDialog.show(requireActivity().supportFragmentManager, DIALOG_SET_ICON)
451+
}
448452
}
449453
}
450454
}
@@ -468,6 +472,7 @@ class SpacesListFragment :
468472
const val SPACE_CONFIG_DIR = "/.space/"
469473

470474
private const val DIALOG_CREATE_SPACE = "DIALOG_CREATE_SPACE"
475+
private const val DIALOG_SET_ICON = "DIALOG_SET_ICON"
471476

472477
fun newInstance(
473478
showPersonalSpace: Boolean,
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/**
2+
* ownCloud Android client application
3+
*
4+
* @author Jorge Aguado Recio
5+
*
6+
* Copyright (C) 2025 ownCloud GmbH.
7+
*
8+
* This program is free software: you can redistribute it and/or modify
9+
* it under the terms of the GNU General Public License version 2,
10+
* as published by the Free Software Foundation.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19+
*/
20+
21+
package com.owncloud.android.presentation.spaces.setspaceicon
22+
23+
import android.os.Bundle
24+
import android.view.LayoutInflater
25+
import android.view.View
26+
import android.view.ViewGroup
27+
import androidx.fragment.app.DialogFragment
28+
import com.owncloud.android.databinding.SetSpaceIconDialogBinding
29+
30+
class SetSpaceIconDialogFragment : DialogFragment() {
31+
private var _binding: SetSpaceIconDialogBinding? = null
32+
private val binding get() = _binding!!
33+
34+
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
35+
_binding = SetSpaceIconDialogBinding.inflate(inflater, container, false)
36+
return binding.root
37+
}
38+
39+
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
40+
super.onViewCreated(view, savedInstanceState)
41+
binding.cancelCreateSpaceButton.setOnClickListener { dialog?.dismiss() }
42+
}
43+
44+
companion object {
45+
46+
fun newInstance(): SetSpaceIconDialogFragment {
47+
val args = Bundle().apply { }
48+
return SetSpaceIconDialogFragment().apply {
49+
arguments = args
50+
}
51+
}
52+
}
53+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
~ ownCloud Android client application
4+
~
5+
~ @author Jorge Aguado Recio
6+
~
7+
~ Copyright (C) 2025 ownCloud GmbH.
8+
~
9+
~ This program is free software: you can redistribute it and/or modify
10+
~ it under the terms of the GNU General Public License version 2,
11+
~ as published by the Free Software Foundation.
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 General Public License for more details.
17+
~
18+
~ You should have received a copy of the GNU General Public License
19+
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
20+
~
21+
-->
22+
23+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
24+
xmlns:app="http://schemas.android.com/apk/res-auto"
25+
android:layout_width="match_parent"
26+
android:layout_height="match_parent"
27+
android:orientation="vertical"
28+
android:padding="@dimen/standard_half_margin">
29+
30+
<TextView
31+
android:id="@+id/create_space_dialog_title"
32+
android:layout_width="match_parent"
33+
android:layout_height="wrap_content"
34+
android:layout_marginBottom="@dimen/standard_half_margin"
35+
android:padding="@dimen/standard_half_padding"
36+
android:text="@string/set_space_icon"
37+
android:textAppearance="@android:style/TextAppearance.Material.DialogWindowTitle" />
38+
39+
<androidx.emoji2.emojipicker.EmojiPickerView
40+
android:id="@+id/emoji_picker"
41+
android:layout_width="350dp"
42+
android:layout_height="235dp"
43+
android:clipToPadding="false"
44+
android:layout_gravity="center"
45+
app:emojiGridColumns="8" />
46+
47+
<androidx.appcompat.widget.AppCompatButton
48+
android:id="@+id/cancel_create_space_button"
49+
android:layout_width="match_parent"
50+
android:layout_height="wrap_content"
51+
android:layout_marginTop="@dimen/standard_half_margin"
52+
android:text="@android:string/cancel"
53+
android:textColor="@color/primary_button_background_color"
54+
android:contentDescription="@string/content_description_cancel_button"
55+
style="?android:attr/borderlessButtonStyle" />
56+
57+
</LinearLayout>

0 commit comments

Comments
 (0)