@@ -29,8 +29,6 @@ import android.view.Menu
2929import android.view.MenuInflater
3030import android.view.View
3131import android.view.ViewGroup
32- import android.widget.ImageView
33- import android.widget.TextView
3432import androidx.appcompat.widget.SearchView
3533import androidx.core.os.bundleOf
3634import androidx.core.view.isVisible
@@ -40,6 +38,7 @@ import androidx.recyclerview.widget.GridLayoutManager
4038import com.google.android.material.bottomsheet.BottomSheetBehavior
4139import com.google.android.material.bottomsheet.BottomSheetDialog
4240import com.owncloud.android.R
41+ import com.owncloud.android.databinding.FileOptionsBottomSheetFragmentBinding
4342import com.owncloud.android.databinding.SpacesListFragmentBinding
4443import com.owncloud.android.domain.files.model.FileListOption
4544import com.owncloud.android.domain.spaces.model.OCSpace
@@ -171,27 +170,27 @@ class SpacesListFragment : SpacesListAdapter.SpacesListAdapterListener, Fragment
171170 }
172171
173172 override fun onThreeDotButtonClick (ocSpace : OCSpace ) {
174- val spaceOptionsBottomSheet = layoutInflater .inflate(R .layout.file_options_bottom_sheet_fragment, null )
173+ val spaceOptionsBottomSheetBinding = FileOptionsBottomSheetFragmentBinding .inflate(layoutInflater )
175174 val dialog = BottomSheetDialog (requireContext())
176- dialog.setContentView(spaceOptionsBottomSheet )
175+ dialog.setContentView(spaceOptionsBottomSheetBinding.root )
177176
178- val fileOptionsBottomSheetSingleFileBehavior: BottomSheetBehavior <* > = BottomSheetBehavior .from(spaceOptionsBottomSheet.parent as View )
179- val closeBottomSheetButton = spaceOptionsBottomSheet.findViewById<ImageView >(R .id.close_bottom_sheet)
177+ val fileOptionsBottomSheetSingleFileBehavior: BottomSheetBehavior <* > = BottomSheetBehavior .from(
178+ spaceOptionsBottomSheetBinding.root.parent as View )
179+ val closeBottomSheetButton = spaceOptionsBottomSheetBinding.closeBottomSheet
180180 closeBottomSheetButton.setOnClickListener {
181- dialog.hide()
182181 dialog.dismiss()
183182 }
184183
185- val thumbnailBottomSheet = spaceOptionsBottomSheet.findViewById< ImageView >( R .id.thumbnail_bottom_sheet)
184+ val thumbnailBottomSheet = spaceOptionsBottomSheetBinding.thumbnailBottomSheet
186185 thumbnailBottomSheet.setImageResource(R .drawable.ic_menu_space)
187186
188- val spaceNameBottomSheet = spaceOptionsBottomSheet.findViewById< TextView >( R .id.file_name_bottom_sheet)
187+ val spaceNameBottomSheet = spaceOptionsBottomSheetBinding.fileNameBottomSheet
189188 spaceNameBottomSheet.text = ocSpace.name
190189
191- val spaceSizeBottomSheet = spaceOptionsBottomSheet.findViewById< TextView >( R .id.file_size_bottom_sheet)
190+ val spaceSizeBottomSheet = spaceOptionsBottomSheetBinding.fileSizeBottomSheet
192191 spaceSizeBottomSheet.text = DisplayUtils .bytesToHumanReadable(ocSpace.quota?.used ? : 0L , requireContext(), true )
193192
194- val spaceSeparatorBottomSheet = spaceOptionsBottomSheet.findViewById< TextView >( R .id.file_separator_bottom_sheet)
193+ val spaceSeparatorBottomSheet = spaceOptionsBottomSheetBinding.fileSeparatorBottomSheet
195194 spaceSeparatorBottomSheet.visibility = View .GONE
196195
197196 fileOptionsBottomSheetSingleFileBehavior.addBottomSheetCallback(object : BottomSheetBehavior .BottomSheetCallback () {
@@ -203,7 +202,7 @@ class SpacesListFragment : SpacesListAdapter.SpacesListAdapterListener, Fragment
203202 override fun onSlide (bottomSheet : View , slideOffset : Float ) {}
204203 })
205204
206- dialog.setOnShowListener { fileOptionsBottomSheetSingleFileBehavior.peekHeight = spaceOptionsBottomSheet .measuredHeight }
205+ dialog.setOnShowListener { fileOptionsBottomSheetSingleFileBehavior.peekHeight = spaceOptionsBottomSheetBinding.root .measuredHeight }
207206 dialog.show()
208207 }
209208
0 commit comments