@@ -80,14 +80,16 @@ class FileDetailsSharingProcessFragment :
8080 shareType : ShareType ,
8181 secureShare : Boolean
8282 ): FileDetailsSharingProcessFragment {
83- val args = Bundle ()
84- args.putParcelable(ARG_OCFILE , file)
85- args.putSerializable(ARG_SHARE_TYPE , shareType)
86- args.putString(ARG_SHAREE_NAME , shareeName)
87- args.putBoolean(ARG_SECURE_SHARE , secureShare)
88- val fragment = FileDetailsSharingProcessFragment ()
89- fragment.arguments = args
90- return fragment
83+ val bundle = Bundle ().apply {
84+ putParcelable(ARG_OCFILE , file)
85+ putSerializable(ARG_SHARE_TYPE , shareType)
86+ putString(ARG_SHAREE_NAME , shareeName)
87+ putBoolean(ARG_SECURE_SHARE , secureShare)
88+ }
89+
90+ return FileDetailsSharingProcessFragment ().apply {
91+ arguments = bundle
92+ }
9193 }
9294
9395 /* *
@@ -100,14 +102,16 @@ class FileDetailsSharingProcessFragment :
100102 isReshareShown : Boolean ,
101103 isExpirationDateShown : Boolean
102104 ): FileDetailsSharingProcessFragment {
103- val args = Bundle ()
104- args.putParcelable(ARG_OCSHARE , share)
105- args.putInt(ARG_SCREEN_TYPE , screenType)
106- args.putBoolean(ARG_RESHARE_SHOWN , isReshareShown)
107- args.putBoolean(ARG_EXP_DATE_SHOWN , isExpirationDateShown)
108- val fragment = FileDetailsSharingProcessFragment ()
109- fragment.arguments = args
110- return fragment
105+ val bundle = Bundle ().apply {
106+ putParcelable(ARG_OCSHARE , share)
107+ putInt(ARG_SCREEN_TYPE , screenType)
108+ putBoolean(ARG_RESHARE_SHOWN , isReshareShown)
109+ putBoolean(ARG_EXP_DATE_SHOWN , isExpirationDateShown)
110+ }
111+
112+ return FileDetailsSharingProcessFragment ().apply {
113+ arguments = bundle
114+ }
111115 }
112116 }
113117
@@ -190,28 +194,44 @@ class FileDetailsSharingProcessFragment :
190194 }
191195
192196 private fun themeView () {
193- viewThemeUtils.platform.colorTextView(binding.shareProcessEditShareLink)
194- viewThemeUtils.platform.colorTextView(binding.shareProcessAdvancePermissionTitle)
195-
196- viewThemeUtils.platform.themeRadioButton(binding.shareProcessPermissionReadOnly)
197- viewThemeUtils.platform.themeRadioButton(binding.shareProcessPermissionUploadEditing)
198- viewThemeUtils.platform.themeRadioButton(binding.shareProcessPermissionFileDrop)
199-
200- viewThemeUtils.platform.themeCheckbox(binding.shareProcessAllowResharingCheckbox)
201-
202- viewThemeUtils.androidx.colorSwitchCompat(binding.shareProcessSetPasswordSwitch)
203- viewThemeUtils.androidx.colorSwitchCompat(binding.shareProcessSetExpDateSwitch)
204- viewThemeUtils.androidx.colorSwitchCompat(binding.shareProcessSetDownloadLimitSwitch)
205- viewThemeUtils.androidx.colorSwitchCompat(binding.shareProcessHideDownloadCheckbox)
206- viewThemeUtils.androidx.colorSwitchCompat(binding.shareProcessChangeNameSwitch)
197+ viewThemeUtils.platform.run {
198+ binding.run {
199+ colorTextView(shareProcessEditShareLink)
200+ colorTextView(shareProcessAdvancePermissionTitle)
201+
202+ themeRadioButton(shareProcessPermissionReadOnly)
203+ themeRadioButton(shareProcessPermissionUploadEditing)
204+ themeRadioButton(shareProcessPermissionFileDrop)
205+
206+ themeCheckbox(shareCustomCheckbox)
207+ themeCheckbox(shareReadCheckbox)
208+ themeCheckbox(shareCreateCheckbox)
209+ themeCheckbox(shareEditCheckbox)
210+ themeCheckbox(shareProcessAllowResharingCheckbox)
211+ themeCheckbox(shareDeleteCheckbox)
212+ }
213+ }
207214
208- viewThemeUtils.material.colorTextInputLayout(binding.shareProcessEnterPasswordContainer)
209- viewThemeUtils.material.colorTextInputLayout(binding.shareProcessSetDownloadLimitInputContainer)
210- viewThemeUtils.material.colorTextInputLayout(binding.shareProcessChangeNameContainer)
211- viewThemeUtils.material.colorTextInputLayout(binding.noteContainer)
215+ viewThemeUtils.androidx.run {
216+ binding.run {
217+ colorSwitchCompat(shareProcessSetPasswordSwitch)
218+ colorSwitchCompat(shareProcessSetExpDateSwitch)
219+ colorSwitchCompat(shareProcessSetDownloadLimitSwitch)
220+ colorSwitchCompat(shareProcessHideDownloadCheckbox)
221+ colorSwitchCompat(shareProcessChangeNameSwitch)
222+ }
223+ }
212224
213- viewThemeUtils.material.colorMaterialButtonPrimaryFilled(binding.shareProcessBtnNext)
214- viewThemeUtils.material.colorMaterialButtonPrimaryOutlined(binding.shareProcessBtnCancel)
225+ viewThemeUtils.material.run {
226+ binding.run {
227+ colorTextInputLayout(shareProcessEnterPasswordContainer)
228+ colorTextInputLayout(shareProcessSetDownloadLimitInputContainer)
229+ colorTextInputLayout(shareProcessChangeNameContainer)
230+ colorTextInputLayout(noteContainer)
231+ colorMaterialButtonPrimaryFilled(shareProcessBtnNext)
232+ colorMaterialButtonPrimaryOutlined(shareProcessBtnCancel)
233+ }
234+ }
215235 }
216236
217237 override fun onConfigurationChanged (newConfig : Configuration ) {
@@ -243,11 +263,7 @@ class FileDetailsSharingProcessFragment :
243263 }
244264
245265 // show or hide expiry date
246- if (isExpDateShown && ! isSecureShare) {
247- binding.shareProcessSetExpDateSwitch.visibility = View .VISIBLE
248- } else {
249- binding.shareProcessSetExpDateSwitch.visibility = View .GONE
250- }
266+ binding.shareProcessSetExpDateSwitch.setVisibleIf(isExpDateShown && ! isSecureShare)
251267 shareProcessStep = SCREEN_TYPE_PERMISSION
252268 }
253269
@@ -430,30 +446,39 @@ class FileDetailsSharingProcessFragment :
430446 }
431447
432448 private fun implementClickEvents () {
433- binding.shareProcessBtnCancel.setOnClickListener {
434- onCancelClick()
435- }
436- binding.shareProcessBtnNext.setOnClickListener {
437- if (shareProcessStep == SCREEN_TYPE_PERMISSION ) {
438- validateShareProcessFirst()
439- } else {
440- validateShareProcessSecond()
449+ binding.run {
450+ shareProcessBtnCancel.setOnClickListener {
451+ onCancelClick()
452+ }
453+ shareProcessBtnNext.setOnClickListener {
454+ if (shareProcessStep == SCREEN_TYPE_PERMISSION ) {
455+ validateShareProcessFirst()
456+ } else {
457+ validateShareProcessSecond()
458+ }
459+ }
460+ shareProcessSetPasswordSwitch.setOnCheckedChangeListener { _, isChecked ->
461+ showPasswordInput(isChecked)
462+ }
463+ shareProcessSetExpDateSwitch.setOnCheckedChangeListener { _, isChecked ->
464+ showExpirationDateInput(isChecked)
465+ }
466+ shareProcessSetDownloadLimitSwitch.setOnCheckedChangeListener { _, isChecked ->
467+ showFileDownloadLimitInput(isChecked)
468+ }
469+ shareProcessChangeNameSwitch.setOnCheckedChangeListener { _, isChecked ->
470+ showChangeNameInput(isChecked)
471+ }
472+ shareProcessSelectExpDate.setOnClickListener {
473+ showExpirationDateDialog()
474+ }
475+ shareCustomCheckbox.setOnCheckedChangeListener { _, isChecked ->
476+ shareReadCheckbox.isChecked = isChecked
477+ shareCreateCheckbox.isChecked = isChecked
478+ shareEditCheckbox.isChecked = isChecked
479+ shareProcessAllowResharingCheckbox.isChecked = isChecked
480+ shareDeleteCheckbox.isChecked = isChecked
441481 }
442- }
443- binding.shareProcessSetPasswordSwitch.setOnCheckedChangeListener { _, isChecked ->
444- showPasswordInput(isChecked)
445- }
446- binding.shareProcessSetExpDateSwitch.setOnCheckedChangeListener { _, isChecked ->
447- showExpirationDateInput(isChecked)
448- }
449- binding.shareProcessSetDownloadLimitSwitch.setOnCheckedChangeListener { _, isChecked ->
450- showFileDownloadLimitInput(isChecked)
451- }
452- binding.shareProcessChangeNameSwitch.setOnCheckedChangeListener { _, isChecked ->
453- showChangeNameInput(isChecked)
454- }
455- binding.shareProcessSelectExpDate.setOnClickListener {
456- showExpirationDateDialog()
457482 }
458483 }
459484
@@ -493,8 +518,8 @@ class FileDetailsSharingProcessFragment :
493518 }
494519
495520 private fun showExpirationDateInput (isChecked : Boolean ) {
496- binding.shareProcessSelectExpDate.visibility = if (isChecked) View . VISIBLE else View . GONE
497- binding.shareProcessExpDateDivider.visibility = if (isChecked) View . VISIBLE else View . GONE
521+ binding.shareProcessSelectExpDate.setVisibleIf (isChecked)
522+ binding.shareProcessExpDateDivider.setVisibleIf (isChecked)
498523
499524 // reset the expiration date if switch is unchecked
500525 if (! isChecked) {
@@ -527,9 +552,9 @@ class FileDetailsSharingProcessFragment :
527552 }
528553
529554 private fun getReSharePermission (): Int {
530- val spb = SharePermissionsBuilder ()
531- spb. setSharePermission(true )
532- return spb .build()
555+ return SharePermissionsBuilder (). apply {
556+ setSharePermission(true )
557+ } .build()
533558 }
534559
535560 /* *
0 commit comments