@@ -106,7 +106,8 @@ class NoteShareDetailActivity : BrandedActivity(),
106106 }
107107
108108 lifecycleScope.launch(Dispatchers .IO ) {
109- val ssoAcc = SingleAccountHelper .getCurrentSingleSignOnAccount(this @NoteShareDetailActivity)
109+ val ssoAcc =
110+ SingleAccountHelper .getCurrentSingleSignOnAccount(this @NoteShareDetailActivity)
110111 repository = ShareRepository (this @NoteShareDetailActivity, ssoAcc)
111112
112113 withContext(Dispatchers .Main ) {
@@ -124,27 +125,34 @@ class NoteShareDetailActivity : BrandedActivity(),
124125 override fun applyBrand (color : Int ) {
125126 val util = BrandingUtil .of(color, this )
126127
127- util.platform.themeRadioButton(binding.shareProcessPermissionReadOnly)
128- util.platform.themeRadioButton(binding.shareProcessPermissionUploadEditing)
129- util.platform.themeRadioButton(binding.shareProcessPermissionFileDrop)
128+ binding.run {
129+ util.platform.run {
130+ themeRadioButton(shareProcessPermissionReadOnly)
131+ themeRadioButton(shareProcessPermissionUploadEditing)
132+ themeRadioButton(shareProcessPermissionFileDrop)
130133
131- util.platform.colorTextView(binding.shareProcessEditShareLink)
132- util.platform.colorTextView(binding.shareProcessAdvancePermissionTitle)
133-
134- util.platform.themeCheckbox(binding.shareProcessAllowResharingCheckbox)
134+ colorTextView(shareProcessEditShareLink)
135+ colorTextView(shareProcessAdvancePermissionTitle)
135136
137+ themeCheckbox(shareProcessAllowResharingCheckbox)
138+ }
136139
137- util.androidx.colorSwitchCompat(binding.shareProcessSetPasswordSwitch)
138- util.androidx.colorSwitchCompat(binding.shareProcessSetExpDateSwitch)
139- util.androidx.colorSwitchCompat(binding.shareProcessHideDownloadCheckbox)
140- util.androidx.colorSwitchCompat(binding.shareProcessChangeNameSwitch)
140+ util.androidx.run {
141+ colorSwitchCompat(shareProcessSetPasswordSwitch)
142+ colorSwitchCompat(shareProcessSetExpDateSwitch)
143+ colorSwitchCompat(shareProcessHideDownloadCheckbox)
144+ colorSwitchCompat(shareProcessChangeNameSwitch)
145+ }
141146
142- util.material.colorTextInputLayout(binding.shareProcessEnterPasswordContainer)
143- util.material.colorTextInputLayout(binding.shareProcessChangeNameContainer)
144- util.material.colorTextInputLayout(binding.noteContainer)
147+ util.material.run {
148+ colorTextInputLayout(shareProcessEnterPasswordContainer)
149+ colorTextInputLayout(shareProcessChangeNameContainer)
150+ colorTextInputLayout(noteContainer)
145151
146- util.material.colorMaterialButtonPrimaryFilled(binding.shareProcessBtnNext)
147- util.material.colorMaterialButtonPrimaryOutlined(binding.shareProcessBtnCancel)
152+ colorMaterialButtonPrimaryFilled(shareProcessBtnNext)
153+ colorMaterialButtonPrimaryOutlined(shareProcessBtnCancel)
154+ }
155+ }
148156 }
149157
150158 override fun onConfigurationChanged (newConfig : Configuration ) {
@@ -259,40 +267,44 @@ class NoteShareDetailActivity : BrandedActivity(),
259267 }
260268
261269 private fun updateViewForInternalShare () {
262- binding.shareProcessChangeNameSwitch.visibility = View .GONE
263- binding.shareProcessChangeNameContainer.visibility = View .GONE
264- binding.shareProcessHideDownloadCheckbox.visibility = View .GONE
265- if (isSecureShare) {
266- binding.shareProcessAllowResharingCheckbox.visibility = View .GONE
267- } else {
268- binding.shareProcessAllowResharingCheckbox.visibility = View .VISIBLE
269- }
270- binding.shareProcessSetPasswordSwitch.visibility = View .GONE
270+ binding.run {
271+ shareProcessChangeNameSwitch.visibility = View .GONE
272+ shareProcessChangeNameContainer.visibility = View .GONE
273+ shareProcessHideDownloadCheckbox.visibility = View .GONE
274+ if (isSecureShare) {
275+ shareProcessAllowResharingCheckbox.visibility = View .GONE
276+ } else {
277+ shareProcessAllowResharingCheckbox.visibility = View .VISIBLE
278+ }
279+ shareProcessSetPasswordSwitch.visibility = View .GONE
271280
272- if (share != null ) {
273- if (! isReShareShown) {
274- binding.shareProcessAllowResharingCheckbox.visibility = View .GONE
281+ if (share != null ) {
282+ if (! isReShareShown) {
283+ shareProcessAllowResharingCheckbox.visibility = View .GONE
284+ }
285+ shareProcessAllowResharingCheckbox.isChecked =
286+ SharingMenuHelper .canReshare(share)
275287 }
276- binding.shareProcessAllowResharingCheckbox.isChecked =
277- SharingMenuHelper .canReshare(share)
278288 }
279289 }
280290
281291 /* *
282292 * update views where share type external or link share
283293 */
284294 private fun updateViewForExternalAndLinkShare () {
285- binding.shareProcessHideDownloadCheckbox.visibility = View .VISIBLE
286- binding.shareProcessAllowResharingCheckbox.visibility = View .GONE
287- binding.shareProcessSetPasswordSwitch.visibility = View .VISIBLE
288-
289- if (share != null ) {
290- if (SharingMenuHelper .isFileDrop(share)) {
291- binding.shareProcessHideDownloadCheckbox.visibility = View .GONE
292- } else {
293- binding.shareProcessHideDownloadCheckbox.visibility = View .VISIBLE
294- binding.shareProcessHideDownloadCheckbox.isChecked =
295- share?.isHideFileDownload == true
295+ binding.run {
296+ shareProcessHideDownloadCheckbox.visibility = View .VISIBLE
297+ shareProcessAllowResharingCheckbox.visibility = View .GONE
298+ shareProcessSetPasswordSwitch.visibility = View .VISIBLE
299+
300+ if (share != null ) {
301+ if (SharingMenuHelper .isFileDrop(share)) {
302+ shareProcessHideDownloadCheckbox.visibility = View .GONE
303+ } else {
304+ shareProcessHideDownloadCheckbox.visibility = View .VISIBLE
305+ shareProcessHideDownloadCheckbox.isChecked =
306+ share?.isHideFileDownload == true
307+ }
296308 }
297309 }
298310 }
@@ -319,58 +331,64 @@ class NoteShareDetailActivity : BrandedActivity(),
319331 }
320332
321333 private fun updateViewForFolder () {
322- binding.shareProcessPermissionUploadEditing.text =
323- getString(R .string.link_share_allow_upload_and_editing)
324- binding.shareProcessPermissionFileDrop.visibility = View .VISIBLE
325- if (isSecureShare) {
326- binding.shareProcessPermissionFileDrop.visibility = View .GONE
327- binding.shareProcessAllowResharingCheckbox.visibility = View .GONE
328- binding.shareProcessSetExpDateSwitch.visibility = View .GONE
334+ binding.run {
335+ shareProcessPermissionUploadEditing.text =
336+ getString(R .string.link_share_allow_upload_and_editing)
337+ shareProcessPermissionFileDrop.visibility = View .VISIBLE
338+ if (isSecureShare) {
339+ shareProcessPermissionFileDrop.visibility = View .GONE
340+ shareProcessAllowResharingCheckbox.visibility = View .GONE
341+ shareProcessSetExpDateSwitch.visibility = View .GONE
342+ }
329343 }
330344 }
331345
332346 /* *
333347 * update views for screen type Note
334348 */
335349 private fun showShareProcessSecond () {
336- binding.shareProcessGroupOne.visibility = View .GONE
337- binding.shareProcessEditShareLink.visibility = View .GONE
338- binding.shareProcessGroupTwo.visibility = View .VISIBLE
339- if (share != null ) {
340- binding.shareProcessBtnNext.text =
341- getString(R .string.note_share_detail_activity_set_note)
342- binding.noteText.setText(share?.note)
343- } else {
344- binding.shareProcessBtnNext.text =
345- getString(R .string.note_share_detail_activity_send_share)
346- binding.noteText.setText(R .string.empty)
350+ binding.run {
351+ shareProcessGroupOne.visibility = View .GONE
352+ shareProcessEditShareLink.visibility = View .GONE
353+ shareProcessGroupTwo.visibility = View .VISIBLE
354+ if (share != null ) {
355+ shareProcessBtnNext.text =
356+ getString(R .string.note_share_detail_activity_set_note)
357+ noteText.setText(share?.note)
358+ } else {
359+ shareProcessBtnNext.text =
360+ getString(R .string.note_share_detail_activity_send_share)
361+ noteText.setText(R .string.empty)
362+ }
363+ shareProcessStep = SCREEN_TYPE_NOTE
364+ shareProcessBtnNext.performClick()
347365 }
348- shareProcessStep = SCREEN_TYPE_NOTE
349- binding.shareProcessBtnNext.performClick()
350366 }
351367
352368 private fun implementClickEvents () {
353- binding.shareProcessBtnCancel.setOnClickListener {
354- onCancelClick()
355- }
356- binding.shareProcessBtnNext.setOnClickListener {
357- if (shareProcessStep == SCREEN_TYPE_PERMISSION ) {
358- validateShareProcessFirst()
359- } else {
360- createOrUpdateShare()
369+ binding.run {
370+ shareProcessBtnCancel.setOnClickListener {
371+ onCancelClick()
372+ }
373+ shareProcessBtnNext.setOnClickListener {
374+ if (shareProcessStep == SCREEN_TYPE_PERMISSION ) {
375+ validateShareProcessFirst()
376+ } else {
377+ createOrUpdateShare()
378+ }
379+ }
380+ shareProcessSetPasswordSwitch.setOnCheckedChangeListener { _, isChecked ->
381+ showPasswordInput(isChecked)
382+ }
383+ shareProcessSetExpDateSwitch.setOnCheckedChangeListener { _, isChecked ->
384+ showExpirationDateInput(isChecked)
385+ }
386+ shareProcessChangeNameSwitch.setOnCheckedChangeListener { _, isChecked ->
387+ showChangeNameInput(isChecked)
388+ }
389+ shareProcessSelectExpDate.setOnClickListener {
390+ showExpirationDateDialog()
361391 }
362- }
363- binding.shareProcessSetPasswordSwitch.setOnCheckedChangeListener { _, isChecked ->
364- showPasswordInput(isChecked)
365- }
366- binding.shareProcessSetExpDateSwitch.setOnCheckedChangeListener { _, isChecked ->
367- showExpirationDateInput(isChecked)
368- }
369- binding.shareProcessChangeNameSwitch.setOnCheckedChangeListener { _, isChecked ->
370- showChangeNameInput(isChecked)
371- }
372- binding.shareProcessSelectExpDate.setOnClickListener {
373- showExpirationDateDialog()
374392 }
375393 }
376394
@@ -429,9 +447,9 @@ class NoteShareDetailActivity : BrandedActivity(),
429447
430448
431449 private fun getReSharePermission (): Int {
432- val spb = SharePermissionsBuilder ()
433- spb. setSharePermission(true )
434- return spb .build()
450+ return SharePermissionsBuilder (). apply {
451+ setSharePermission(true )
452+ } .build()
435453 }
436454
437455 /* *
0 commit comments