fix #89, allow copying file/folder path to clipboard
This commit is contained in:
parent
0ec24fd67b
commit
68f975aa8c
19 changed files with 51 additions and 0 deletions
|
@ -1,5 +1,8 @@
|
||||||
package com.simplemobiletools.filemanager.adapters
|
package com.simplemobiletools.filemanager.adapters
|
||||||
|
|
||||||
|
import android.content.ClipData
|
||||||
|
import android.content.ClipboardManager
|
||||||
|
import android.content.Context
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
|
@ -107,6 +110,7 @@ class ItemsAdapter(val activity: SimpleActivity, var mItems: MutableList<FileDir
|
||||||
R.id.cab_rename -> displayRenameDialog()
|
R.id.cab_rename -> displayRenameDialog()
|
||||||
R.id.cab_properties -> showProperties()
|
R.id.cab_properties -> showProperties()
|
||||||
R.id.cab_share -> shareFiles()
|
R.id.cab_share -> shareFiles()
|
||||||
|
R.id.cab_copy_path -> copyPath()
|
||||||
R.id.cab_copy_to -> copyMoveTo(true)
|
R.id.cab_copy_to -> copyMoveTo(true)
|
||||||
R.id.cab_move_to -> copyMoveTo(false)
|
R.id.cab_move_to -> copyMoveTo(false)
|
||||||
R.id.cab_compress -> compressSelection()
|
R.id.cab_compress -> compressSelection()
|
||||||
|
@ -129,6 +133,7 @@ class ItemsAdapter(val activity: SimpleActivity, var mItems: MutableList<FileDir
|
||||||
menu.findItem(R.id.cab_rename).isVisible = selectedPositions.size <= 1
|
menu.findItem(R.id.cab_rename).isVisible = selectedPositions.size <= 1
|
||||||
menu.findItem(R.id.cab_decompress).isVisible = getSelectedMedia().map { it.path }.any { it.isZipFile() }
|
menu.findItem(R.id.cab_decompress).isVisible = getSelectedMedia().map { it.path }.any { it.isZipFile() }
|
||||||
menu.findItem(R.id.cab_confirm_selection).isVisible = isPickMultipleIntent
|
menu.findItem(R.id.cab_confirm_selection).isVisible = isPickMultipleIntent
|
||||||
|
menu.findItem(R.id.cab_copy_path).isVisible = selectedPositions.size <= 1
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,6 +190,14 @@ class ItemsAdapter(val activity: SimpleActivity, var mItems: MutableList<FileDir
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun copyPath() {
|
||||||
|
val path = getSelectedMedia().first().path
|
||||||
|
val clip = ClipData.newPlainText(activity.getString(R.string.app_name), path)
|
||||||
|
(activity.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager).primaryClip = clip
|
||||||
|
actMode?.finish()
|
||||||
|
activity.toast(R.string.path_copied)
|
||||||
|
}
|
||||||
|
|
||||||
private fun copyMoveTo(isCopyOperation: Boolean) {
|
private fun copyMoveTo(isCopyOperation: Boolean) {
|
||||||
val files = ArrayList<File>()
|
val files = ArrayList<File>()
|
||||||
selectedPositions.forEach { files.add(File(mItems[it].path)) }
|
selectedPositions.forEach { files.add(File(mItems[it].path)) }
|
||||||
|
|
|
@ -21,6 +21,10 @@
|
||||||
android:icon="@drawable/ic_share"
|
android:icon="@drawable/ic_share"
|
||||||
android:title="@string/share"
|
android:title="@string/share"
|
||||||
app:showAsAction="ifRoom"/>
|
app:showAsAction="ifRoom"/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/cab_copy_path"
|
||||||
|
android:title="@string/copy_path"
|
||||||
|
app:showAsAction="never"/>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/cab_copy_to"
|
android:id="@+id/cab_copy_to"
|
||||||
android:title="@string/copy_to"
|
android:title="@string/copy_to"
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
<string name="go_to_home_folder">Jít do domovské složky</string>
|
<string name="go_to_home_folder">Jít do domovské složky</string>
|
||||||
<string name="set_as_home_folder">Nastavit jako domovskou složku</string>
|
<string name="set_as_home_folder">Nastavit jako domovskou složku</string>
|
||||||
<string name="home_folder_updated">Domovská složka aktualizována</string>
|
<string name="home_folder_updated">Domovská složka aktualizována</string>
|
||||||
|
<string name="copy_path">Copy path to clipboard</string>
|
||||||
|
<string name="path_copied">Path copied</string>
|
||||||
|
|
||||||
<!-- Compression -->
|
<!-- Compression -->
|
||||||
<string name="compress">Compress</string>
|
<string name="compress">Compress</string>
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
<string name="go_to_home_folder">Gehe zum Home Ordner</string>
|
<string name="go_to_home_folder">Gehe zum Home Ordner</string>
|
||||||
<string name="set_as_home_folder">Als Home Ordner setzen</string>
|
<string name="set_as_home_folder">Als Home Ordner setzen</string>
|
||||||
<string name="home_folder_updated">Home Ordner geupdated</string>
|
<string name="home_folder_updated">Home Ordner geupdated</string>
|
||||||
|
<string name="copy_path">Copy path to clipboard</string>
|
||||||
|
<string name="path_copied">Path copied</string>
|
||||||
|
|
||||||
<!-- Compression -->
|
<!-- Compression -->
|
||||||
<string name="compress">Komprimieren</string>
|
<string name="compress">Komprimieren</string>
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
<string name="go_to_home_folder">Ir a carpeta principal</string>
|
<string name="go_to_home_folder">Ir a carpeta principal</string>
|
||||||
<string name="set_as_home_folder">Establecer como carpeta principal</string>
|
<string name="set_as_home_folder">Establecer como carpeta principal</string>
|
||||||
<string name="home_folder_updated">Carpeta principal actualizada</string>
|
<string name="home_folder_updated">Carpeta principal actualizada</string>
|
||||||
|
<string name="copy_path">Copy path to clipboard</string>
|
||||||
|
<string name="path_copied">Path copied</string>
|
||||||
|
|
||||||
<!-- Compression -->
|
<!-- Compression -->
|
||||||
<string name="compress">Compress</string>
|
<string name="compress">Compress</string>
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
<string name="go_to_home_folder">Aller au dossier par défaut</string>
|
<string name="go_to_home_folder">Aller au dossier par défaut</string>
|
||||||
<string name="set_as_home_folder">Définir en tant que dossier par défaut</string>
|
<string name="set_as_home_folder">Définir en tant que dossier par défaut</string>
|
||||||
<string name="home_folder_updated">Dossier par défaut mis à jour</string>
|
<string name="home_folder_updated">Dossier par défaut mis à jour</string>
|
||||||
|
<string name="copy_path">Copy path to clipboard</string>
|
||||||
|
<string name="path_copied">Path copied</string>
|
||||||
|
|
||||||
<!-- Compression -->
|
<!-- Compression -->
|
||||||
<string name="compress">Compresser</string>
|
<string name="compress">Compresser</string>
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
<string name="go_to_home_folder">Ugrás a kezdőmappára</string>
|
<string name="go_to_home_folder">Ugrás a kezdőmappára</string>
|
||||||
<string name="set_as_home_folder">Beállítás kezdőmappának</string>
|
<string name="set_as_home_folder">Beállítás kezdőmappának</string>
|
||||||
<string name="home_folder_updated">Kezdőmappa frissítve</string>
|
<string name="home_folder_updated">Kezdőmappa frissítve</string>
|
||||||
|
<string name="copy_path">Copy path to clipboard</string>
|
||||||
|
<string name="path_copied">Path copied</string>
|
||||||
|
|
||||||
<!-- Compression -->
|
<!-- Compression -->
|
||||||
<string name="compress">Compress</string>
|
<string name="compress">Compress</string>
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
<string name="go_to_home_folder">Vai alla cartella home</string>
|
<string name="go_to_home_folder">Vai alla cartella home</string>
|
||||||
<string name="set_as_home_folder">Imposta come cartella home</string>
|
<string name="set_as_home_folder">Imposta come cartella home</string>
|
||||||
<string name="home_folder_updated">Cartella home aggiornata</string>
|
<string name="home_folder_updated">Cartella home aggiornata</string>
|
||||||
|
<string name="copy_path">Copy path to clipboard</string>
|
||||||
|
<string name="path_copied">Path copied</string>
|
||||||
|
|
||||||
<!-- Compression -->
|
<!-- Compression -->
|
||||||
<string name="compress">Comprimi</string>
|
<string name="compress">Comprimi</string>
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
<string name="go_to_home_folder">Go to home folder</string>
|
<string name="go_to_home_folder">Go to home folder</string>
|
||||||
<string name="set_as_home_folder">Set as home folder</string>
|
<string name="set_as_home_folder">Set as home folder</string>
|
||||||
<string name="home_folder_updated">Home folder updated</string>
|
<string name="home_folder_updated">Home folder updated</string>
|
||||||
|
<string name="copy_path">Copy path to clipboard</string>
|
||||||
|
<string name="path_copied">Path copied</string>
|
||||||
|
|
||||||
<!-- Compression -->
|
<!-- Compression -->
|
||||||
<string name="compress">Compress</string>
|
<string name="compress">Compress</string>
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
<string name="go_to_home_folder">홈 폴더 이동</string>
|
<string name="go_to_home_folder">홈 폴더 이동</string>
|
||||||
<string name="set_as_home_folder">홈 폴더 설정</string>
|
<string name="set_as_home_folder">홈 폴더 설정</string>
|
||||||
<string name="home_folder_updated">홈 폴더 설정완료</string>
|
<string name="home_folder_updated">홈 폴더 설정완료</string>
|
||||||
|
<string name="copy_path">Copy path to clipboard</string>
|
||||||
|
<string name="path_copied">Path copied</string>
|
||||||
|
|
||||||
<!-- Compression -->
|
<!-- Compression -->
|
||||||
<string name="compress">Compress</string>
|
<string name="compress">Compress</string>
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
<string name="go_to_home_folder">Go to home folder</string>
|
<string name="go_to_home_folder">Go to home folder</string>
|
||||||
<string name="set_as_home_folder">Set as home folder</string>
|
<string name="set_as_home_folder">Set as home folder</string>
|
||||||
<string name="home_folder_updated">Home folder updated</string>
|
<string name="home_folder_updated">Home folder updated</string>
|
||||||
|
<string name="copy_path">Copy path to clipboard</string>
|
||||||
|
<string name="path_copied">Path copied</string>
|
||||||
|
|
||||||
<!-- Compression -->
|
<!-- Compression -->
|
||||||
<string name="compress">Compress</string>
|
<string name="compress">Compress</string>
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
<string name="go_to_home_folder">Przejdź do folderu głównego</string>
|
<string name="go_to_home_folder">Przejdź do folderu głównego</string>
|
||||||
<string name="set_as_home_folder">Ustaw jako folder główny</string>
|
<string name="set_as_home_folder">Ustaw jako folder główny</string>
|
||||||
<string name="home_folder_updated">Folder główny został zaktulizowany</string>
|
<string name="home_folder_updated">Folder główny został zaktulizowany</string>
|
||||||
|
<string name="copy_path">Copy path to clipboard</string>
|
||||||
|
<string name="path_copied">Path copied</string>
|
||||||
|
|
||||||
<!-- Compression -->
|
<!-- Compression -->
|
||||||
<string name="compress">Compress</string>
|
<string name="compress">Compress</string>
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
<string name="go_to_home_folder">Ir para a pasta pessoal</string>
|
<string name="go_to_home_folder">Ir para a pasta pessoal</string>
|
||||||
<string name="set_as_home_folder">Definir como pasta pessoal</string>
|
<string name="set_as_home_folder">Definir como pasta pessoal</string>
|
||||||
<string name="home_folder_updated">Pasta pessoal atualizada</string>
|
<string name="home_folder_updated">Pasta pessoal atualizada</string>
|
||||||
|
<string name="copy_path">Copy path to clipboard</string>
|
||||||
|
<string name="path_copied">Path copied</string>
|
||||||
|
|
||||||
<!-- Compression -->
|
<!-- Compression -->
|
||||||
<string name="compress">Compress</string>
|
<string name="compress">Compress</string>
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
<string name="go_to_home_folder">Ir para a pasta pessoal</string>
|
<string name="go_to_home_folder">Ir para a pasta pessoal</string>
|
||||||
<string name="set_as_home_folder">Definir como pasta pessoal</string>
|
<string name="set_as_home_folder">Definir como pasta pessoal</string>
|
||||||
<string name="home_folder_updated">Pasta pessoal atualizada</string>
|
<string name="home_folder_updated">Pasta pessoal atualizada</string>
|
||||||
|
<string name="copy_path">Copy path to clipboard</string>
|
||||||
|
<string name="path_copied">Path copied</string>
|
||||||
|
|
||||||
<!-- Compression -->
|
<!-- Compression -->
|
||||||
<string name="compress">Comprimir</string>
|
<string name="compress">Comprimir</string>
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
<string name="go_to_home_folder">Открыть домашнюю папку</string>
|
<string name="go_to_home_folder">Открыть домашнюю папку</string>
|
||||||
<string name="set_as_home_folder">Сделать домашней</string>
|
<string name="set_as_home_folder">Сделать домашней</string>
|
||||||
<string name="home_folder_updated">Домашняя папка установлена</string>
|
<string name="home_folder_updated">Домашняя папка установлена</string>
|
||||||
|
<string name="copy_path">Copy path to clipboard</string>
|
||||||
|
<string name="path_copied">Path copied</string>
|
||||||
|
|
||||||
<!-- Compression -->
|
<!-- Compression -->
|
||||||
<string name="compress">Сжать</string>
|
<string name="compress">Сжать</string>
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
<string name="go_to_home_folder">Ísť do domovského priečinka</string>
|
<string name="go_to_home_folder">Ísť do domovského priečinka</string>
|
||||||
<string name="set_as_home_folder">Nastaviť ako domovský priečinok</string>
|
<string name="set_as_home_folder">Nastaviť ako domovský priečinok</string>
|
||||||
<string name="home_folder_updated">Domovský priečinok bol nastavený</string>
|
<string name="home_folder_updated">Domovský priečinok bol nastavený</string>
|
||||||
|
<string name="copy_path">Kopírovať cestu do schránky</string>
|
||||||
|
<string name="path_copied">Cesta skopírovaná</string>
|
||||||
|
|
||||||
<!-- Compression -->
|
<!-- Compression -->
|
||||||
<string name="compress">Komprimovať</string>
|
<string name="compress">Komprimovať</string>
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
<string name="go_to_home_folder">Gå till hemmappen</string>
|
<string name="go_to_home_folder">Gå till hemmappen</string>
|
||||||
<string name="set_as_home_folder">Ange som hemmapp</string>
|
<string name="set_as_home_folder">Ange som hemmapp</string>
|
||||||
<string name="home_folder_updated">Hemmappen har uppdaterats</string>
|
<string name="home_folder_updated">Hemmappen har uppdaterats</string>
|
||||||
|
<string name="copy_path">Copy path to clipboard</string>
|
||||||
|
<string name="path_copied">Path copied</string>
|
||||||
|
|
||||||
<!-- Compression -->
|
<!-- Compression -->
|
||||||
<string name="compress">Komprimera</string>
|
<string name="compress">Komprimera</string>
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
<string name="go_to_home_folder">Go to home folder</string>
|
<string name="go_to_home_folder">Go to home folder</string>
|
||||||
<string name="set_as_home_folder">Set as home folder</string>
|
<string name="set_as_home_folder">Set as home folder</string>
|
||||||
<string name="home_folder_updated">Home folder updated</string>
|
<string name="home_folder_updated">Home folder updated</string>
|
||||||
|
<string name="copy_path">Copy path to clipboard</string>
|
||||||
|
<string name="path_copied">Path copied</string>
|
||||||
|
|
||||||
<!-- Compression -->
|
<!-- Compression -->
|
||||||
<string name="compress">Compress</string>
|
<string name="compress">Compress</string>
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
<string name="go_to_home_folder">Go to home folder</string>
|
<string name="go_to_home_folder">Go to home folder</string>
|
||||||
<string name="set_as_home_folder">Set as home folder</string>
|
<string name="set_as_home_folder">Set as home folder</string>
|
||||||
<string name="home_folder_updated">Home folder updated</string>
|
<string name="home_folder_updated">Home folder updated</string>
|
||||||
|
<string name="copy_path">Copy path to clipboard</string>
|
||||||
|
<string name="path_copied">Path copied</string>
|
||||||
|
|
||||||
<!-- Compression -->
|
<!-- Compression -->
|
||||||
<string name="compress">Compress</string>
|
<string name="compress">Compress</string>
|
||||||
|
|
Loading…
Reference in a new issue