-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4138 from owncloud/feature/apply_to_all_when_many…
…_name_conflicts_arise [FEATURE REQUEST] "Apply to all" when many name conflicts arise
- Loading branch information
Showing
7 changed files
with
347 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Enhancement: "Apply to all" when many name conflicts arise | ||
|
||
A new dialog has been created where a checkbox has been added to be able to select all the folders or files that have conflicts. | ||
|
||
https://github.com/owncloud/android/issues/4078 | ||
https://github.com/owncloud/android/pull/4138 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
owncloudApp/src/main/java/com/owncloud/android/ui/dialog/FileAlreadyExistsDialog.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package com.owncloud.android.ui.dialog | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.fragment.app.DialogFragment | ||
import com.owncloud.android.databinding.DialogFileAlreadyExistsBinding | ||
|
||
class FileAlreadyExistsDialog : DialogFragment() { | ||
|
||
private lateinit var binding: DialogFileAlreadyExistsBinding | ||
internal var isCheckBoxChecked: Boolean = false | ||
|
||
interface DialogButtonClickListener { | ||
fun onKeepBothButtonClick() | ||
fun onSkipButtonClick() | ||
fun onReplaceButtonClick() | ||
} | ||
|
||
companion object { | ||
var mListener: DialogButtonClickListener? = null | ||
|
||
const val TITLE_TEXT = "titleText" | ||
const val DESCRIPTION_TEXT = "descriptionText" | ||
const val CHECKBOX_TEXT = "checkboxText" | ||
private const val CHECKBOX_VISIBLE = "checkboxVisible" | ||
|
||
fun newInstance( | ||
titleText: String?, | ||
descriptionText: String?, | ||
checkboxText: String?, | ||
checkboxVisible: Boolean, | ||
dialogClickListener: DialogButtonClickListener? = null, | ||
): FileAlreadyExistsDialog { | ||
val fragment = FileAlreadyExistsDialog() | ||
val args = Bundle() | ||
args.putString(TITLE_TEXT, titleText) | ||
args.putString(DESCRIPTION_TEXT, descriptionText) | ||
args.putString(CHECKBOX_TEXT, checkboxText) | ||
args.putBoolean(CHECKBOX_VISIBLE, checkboxVisible) | ||
|
||
mListener = dialogClickListener | ||
fragment.arguments = args | ||
return fragment | ||
} | ||
} | ||
|
||
fun setDialogButtonClickListener(listener: DialogButtonClickListener) = apply { mListener = listener } | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle?, | ||
): View? { | ||
binding = DialogFileAlreadyExistsBinding.inflate(inflater, container, false) | ||
|
||
return binding.root | ||
} | ||
|
||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
val titleText = arguments?.getString(TITLE_TEXT) | ||
val descriptionText = arguments?.getString(DESCRIPTION_TEXT) | ||
val checkboxText = arguments?.getString(CHECKBOX_TEXT) | ||
val checkboxVisible = arguments?.getBoolean(CHECKBOX_VISIBLE) | ||
|
||
binding.dialogFileAlreadyExistsTitle.text = titleText | ||
binding.dialogFileAlreadyExistsInformation.text = descriptionText | ||
binding.dialogFileAlreadyExistsCheckbox.text = checkboxText | ||
|
||
binding.dialogFileAlreadyExistsKeepBoth.setOnClickListener { mListener?.onKeepBothButtonClick() } | ||
binding.dialogFileAlreadyExistsCheckbox.setOnCheckedChangeListener { _, isChecked -> | ||
isCheckBoxChecked = isChecked | ||
} | ||
binding.dialogFileAlreadyExistsReplace.setOnClickListener { mListener?.onReplaceButtonClick() } | ||
binding.dialogFileAlreadyExistsSkip.setOnClickListener { mListener?.onSkipButtonClick() } | ||
|
||
binding.dialogFileAlreadyExistsCheckbox.visibility = if (checkboxVisible == true) { View.VISIBLE } else { View.GONE } | ||
} | ||
|
||
} |
Oops, something went wrong.