|
@@ -73,7 +73,9 @@ open class FolderPickerActivity :
|
|
var isDoNotEnterEncryptedFolder = false
|
|
var isDoNotEnterEncryptedFolder = false
|
|
private set
|
|
private set
|
|
private var mCancelBtn: MaterialButton? = null
|
|
private var mCancelBtn: MaterialButton? = null
|
|
- private var mChooseBtn: MaterialButton? = null
|
|
|
|
|
|
+ private var mCopyBtn: MaterialButton? = null
|
|
|
|
+ private var mMoveBtn: MaterialButton? = null
|
|
|
|
+
|
|
private var caption: String? = null
|
|
private var caption: String? = null
|
|
|
|
|
|
private var mAction: String? = null
|
|
private var mAction: String? = null
|
|
@@ -85,6 +87,7 @@ open class FolderPickerActivity :
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
Log_OC.d(TAG, "onCreate() start")
|
|
Log_OC.d(TAG, "onCreate() start")
|
|
super.onCreate(savedInstanceState)
|
|
super.onCreate(savedInstanceState)
|
|
|
|
+
|
|
if (this is FilePickerActivity) {
|
|
if (this is FilePickerActivity) {
|
|
setContentView(R.layout.files_picker)
|
|
setContentView(R.layout.files_picker)
|
|
} else {
|
|
} else {
|
|
@@ -101,29 +104,15 @@ open class FolderPickerActivity :
|
|
findViewById<View>(R.id.switch_grid_view_button).visibility =
|
|
findViewById<View>(R.id.switch_grid_view_button).visibility =
|
|
View.GONE
|
|
View.GONE
|
|
mAction = intent.getStringExtra(EXTRA_ACTION)
|
|
mAction = intent.getStringExtra(EXTRA_ACTION)
|
|
|
|
+
|
|
if (mAction != null) {
|
|
if (mAction != null) {
|
|
- when (mAction) {
|
|
|
|
- MOVE -> {
|
|
|
|
- caption = resources.getText(R.string.move_to).toString()
|
|
|
|
- mSearchOnlyFolders = true
|
|
|
|
- isDoNotEnterEncryptedFolder = true
|
|
|
|
- }
|
|
|
|
- COPY -> {
|
|
|
|
- caption = resources.getText(R.string.copy_to).toString()
|
|
|
|
- mSearchOnlyFolders = true
|
|
|
|
- isDoNotEnterEncryptedFolder = true
|
|
|
|
- }
|
|
|
|
- CHOOSE_LOCATION -> {
|
|
|
|
- caption = resources.getText(R.string.choose_location).toString()
|
|
|
|
- mSearchOnlyFolders = true
|
|
|
|
- isDoNotEnterEncryptedFolder = true
|
|
|
|
- mChooseBtn!!.text = resources.getString(R.string.common_select)
|
|
|
|
- }
|
|
|
|
- else -> caption = themeUtils.getDefaultDisplayNameForRootFolder(this)
|
|
|
|
- }
|
|
|
|
|
|
+ caption = resources.getText(R.string.folder_picker_choose_caption_text).toString()
|
|
|
|
+ mSearchOnlyFolders = true
|
|
|
|
+ isDoNotEnterEncryptedFolder = true
|
|
} else {
|
|
} else {
|
|
caption = themeUtils.getDefaultDisplayNameForRootFolder(this)
|
|
caption = themeUtils.getDefaultDisplayNameForRootFolder(this)
|
|
}
|
|
}
|
|
|
|
+
|
|
mTargetFilePaths = intent.getStringArrayListExtra(EXTRA_FILE_PATHS)
|
|
mTargetFilePaths = intent.getStringArrayListExtra(EXTRA_FILE_PATHS)
|
|
|
|
|
|
if (savedInstanceState == null) {
|
|
if (savedInstanceState == null) {
|
|
@@ -351,7 +340,8 @@ open class FolderPickerActivity :
|
|
}
|
|
}
|
|
|
|
|
|
private fun toggleChooseEnabled() {
|
|
private fun toggleChooseEnabled() {
|
|
- mChooseBtn?.isEnabled = checkFolderSelectable()
|
|
|
|
|
|
+ mCopyBtn?.isEnabled = checkFolderSelectable()
|
|
|
|
+ mMoveBtn?.isEnabled = checkFolderSelectable()
|
|
}
|
|
}
|
|
|
|
|
|
// for copy and move, disable selecting parent folder of target files
|
|
// for copy and move, disable selecting parent folder of target files
|
|
@@ -385,10 +375,16 @@ open class FolderPickerActivity :
|
|
*/
|
|
*/
|
|
private fun initControls() {
|
|
private fun initControls() {
|
|
mCancelBtn = findViewById(R.id.folder_picker_btn_cancel)
|
|
mCancelBtn = findViewById(R.id.folder_picker_btn_cancel)
|
|
- mChooseBtn = findViewById(R.id.folder_picker_btn_choose)
|
|
|
|
- if (mChooseBtn != null) {
|
|
|
|
- viewThemeUtils.material.colorMaterialButtonPrimaryFilled(mChooseBtn!!)
|
|
|
|
- mChooseBtn!!.setOnClickListener(this)
|
|
|
|
|
|
+ mCopyBtn = findViewById(R.id.btnCopy)
|
|
|
|
+ mMoveBtn = findViewById(R.id.btnMove)
|
|
|
|
+
|
|
|
|
+ if (mCopyBtn != null) {
|
|
|
|
+ viewThemeUtils.material.colorMaterialButtonPrimaryFilled(mCopyBtn!!)
|
|
|
|
+ mCopyBtn!!.setOnClickListener(this)
|
|
|
|
+ }
|
|
|
|
+ if (mMoveBtn != null) {
|
|
|
|
+ viewThemeUtils.material.colorMaterialButtonPrimaryFilled(mMoveBtn!!)
|
|
|
|
+ mMoveBtn!!.setOnClickListener(this)
|
|
}
|
|
}
|
|
if (mCancelBtn != null) {
|
|
if (mCancelBtn != null) {
|
|
if (this is FilePickerActivity) {
|
|
if (this is FilePickerActivity) {
|
|
@@ -403,7 +399,7 @@ open class FolderPickerActivity :
|
|
override fun onClick(v: View) {
|
|
override fun onClick(v: View) {
|
|
if (v == mCancelBtn) {
|
|
if (v == mCancelBtn) {
|
|
finish()
|
|
finish()
|
|
- } else if (v == mChooseBtn) {
|
|
|
|
|
|
+ } else if (v == mCopyBtn || v == mMoveBtn) {
|
|
val i = intent
|
|
val i = intent
|
|
val resultData = Intent()
|
|
val resultData = Intent()
|
|
resultData.putExtra(EXTRA_FOLDER, listOfFilesFragment!!.currentFile)
|
|
resultData.putExtra(EXTRA_FOLDER, listOfFilesFragment!!.currentFile)
|