commit
00edde45b5
28 changed files with 69 additions and 2 deletions
|
@ -88,6 +88,7 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList<FileD
|
|||
R.id.cab_copy_path -> copyPath()
|
||||
R.id.cab_set_as -> setAs()
|
||||
R.id.cab_open_with -> openWith()
|
||||
R.id.cab_open_as_text -> openAsText()
|
||||
R.id.cab_copy_to -> copyMoveTo(true)
|
||||
R.id.cab_move_to -> copyMoveTo(false)
|
||||
R.id.cab_compress -> compressSelection()
|
||||
|
@ -192,6 +193,10 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList<FileD
|
|||
activity.tryOpenPathIntent(getSelectedMedia().first().path, true)
|
||||
}
|
||||
|
||||
private fun openAsText() {
|
||||
activity.tryOpenPathIntent(getSelectedMedia().first().path, false, true)
|
||||
}
|
||||
|
||||
private fun copyMoveTo(isCopyOperation: Boolean) {
|
||||
val files = ArrayList<FileDirItem>()
|
||||
selectedPositions.forEach {
|
||||
|
|
|
@ -15,8 +15,41 @@ fun Activity.sharePaths(paths: ArrayList<String>) {
|
|||
sharePathsIntent(paths, BuildConfig.APPLICATION_ID)
|
||||
}
|
||||
|
||||
fun Activity.tryOpenPathIntent(path: String, forceChooser: Boolean) {
|
||||
if (!forceChooser && path.endsWith(".apk", true)) {
|
||||
fun Activity.tryOpenPathIntent(path: String, forceChooser: Boolean, asText: Boolean = false) {
|
||||
if (asText) {
|
||||
|
||||
//TODO: Improve
|
||||
|
||||
val uri = if (isNougatPlus()) {
|
||||
FileProvider.getUriForFile(this, "${BuildConfig.APPLICATION_ID}.provider", File(path))
|
||||
} else {
|
||||
Uri.fromFile(File(path))
|
||||
}
|
||||
|
||||
Intent().apply {
|
||||
action = Intent.ACTION_VIEW
|
||||
|
||||
val mimeType = "text/plain"
|
||||
setDataAndType(uri, mimeType)
|
||||
|
||||
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
||||
|
||||
if (resolveActivity(packageManager) != null) {
|
||||
val chooser = Intent.createChooser(this, getString(R.string.open_with))
|
||||
try {
|
||||
startActivity(if (forceChooser) chooser else this)
|
||||
} catch (e: NullPointerException) {
|
||||
showErrorToast(e)
|
||||
}
|
||||
} else {
|
||||
if (!tryGenericMimeType(this, mimeType, uri)) {
|
||||
toast(R.string.no_app_found)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else if (!forceChooser && path.endsWith(".apk", true)) {
|
||||
val uri = if (isNougatPlus()) {
|
||||
FileProvider.getUriForFile(this, "${BuildConfig.APPLICATION_ID}.provider", File(path))
|
||||
} else {
|
||||
|
|
|
@ -33,6 +33,10 @@
|
|||
android:id="@+id/cab_open_with"
|
||||
android:title="@string/open_with"
|
||||
app:showAsAction="never"/>
|
||||
<item
|
||||
android:id="@+id/cab_open_as_text"
|
||||
android:title="@string/open_as_text"
|
||||
app:showAsAction="never"/>
|
||||
<item
|
||||
android:id="@+id/cab_copy_to"
|
||||
android:title="@string/copy_to"
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<string name="go_to_home_folder">الذهاب الى الرئيسية</string>
|
||||
<string name="set_as_home_folder">تعيين كمجلد رئيسي</string>
|
||||
<string name="home_folder_updated">تم تحديث المجلد الرئيسي</string>
|
||||
<string name="open_as_text">Open as Plain Text</string>
|
||||
<string name="copy_path">نسخ المسار الى الحافظة</string>
|
||||
<string name="path_copied">تم نسخ المسار</string>
|
||||
<string name="select_audio_file">الرجاء تحديد ملف صوتي</string>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<string name="go_to_home_folder">Əsas qovluğa qayıt</string>
|
||||
<string name="set_as_home_folder">Əsas qovluq kimi təyin et</string>
|
||||
<string name="home_folder_updated">Əsas qovluq yeniləndi</string>
|
||||
<string name="open_as_text">Open as Plain Text</string>
|
||||
<string name="copy_path">Məkanı kopyala</string>
|
||||
<string name="path_copied">Məkan kopyalandı</string>
|
||||
<string name="select_audio_file">Xahiş olunur səs faylı seçin</string>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<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="home_folder_updated">Domovská složka aktualizována</string>
|
||||
<string name="open_as_text">Open as Plain Text</string>
|
||||
<string name="copy_path">Copy path to clipboard</string>
|
||||
<string name="path_copied">Path copied</string>
|
||||
<string name="select_audio_file">Please select an audio file</string>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<string name="go_to_home_folder">Gå til hjemmemappen</string>
|
||||
<string name="set_as_home_folder">Sæt som hjemmemappe</string>
|
||||
<string name="home_folder_updated">Hjemmemappe opdateret</string>
|
||||
<string name="open_as_text">Open as Plain Text</string>
|
||||
<string name="copy_path">Kopier sti til udklipsholderen</string>
|
||||
<string name="path_copied">Sti kopieret</string>
|
||||
<string name="select_audio_file">Vælg en lydfil</string>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<string name="go_to_home_folder">Gehe zum Home-Ordner</string>
|
||||
<string name="set_as_home_folder">Als Home-Ordner setzen</string>
|
||||
<string name="home_folder_updated">Home-Ordner aktualisiert</string>
|
||||
<string name="open_as_text">Open as Plain Text</string>
|
||||
<string name="copy_path">Kopiere Pfad in die Zwischenablage</string>
|
||||
<string name="path_copied">Pfad kopiert</string>
|
||||
<string name="select_audio_file">Bitte wähle eine Audiodatei aus</string>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<string name="go_to_home_folder">Ir a 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="open_as_text">Open as Plain Text</string>
|
||||
<string name="copy_path">Copy path to clipboard</string>
|
||||
<string name="path_copied">Path copied</string>
|
||||
<string name="select_audio_file">Please select an audio file</string>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<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="home_folder_updated">Dossier par défaut mis à jour</string>
|
||||
<string name="open_as_text">Open as Plain Text</string>
|
||||
<string name="copy_path">Copier le chemin du fichier dans le presse-papiers</string>
|
||||
<string name="path_copied">Chemin du fichier copié</string>
|
||||
<string name="select_audio_file">Veuillez sélectionner un fichier audio</string>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<string name="go_to_home_folder">Idi na početnu mapu</string>
|
||||
<string name="set_as_home_folder">Postavi kao početnu mapu</string>
|
||||
<string name="home_folder_updated">Početna mapa ažurirana</string>
|
||||
<string name="open_as_text">Open as Plain Text</string>
|
||||
<string name="copy_path">Kopiraj putanju u međuspremnik</string>
|
||||
<string name="path_copied">Putanja kopirana</string>
|
||||
<string name="select_audio_file">Odaberite audio datoteku</string>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<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="home_folder_updated">Kezdőmappa frissítve</string>
|
||||
<string name="open_as_text">Open as Plain Text</string>
|
||||
<string name="copy_path">Copy path to clipboard</string>
|
||||
<string name="path_copied">Path copied</string>
|
||||
<string name="select_audio_file">Please select an audio file</string>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<string name="go_to_home_folder">Kembali Ke Folder Home</string>
|
||||
<string name="set_as_home_folder">Set Sebagai Folder Home</string>
|
||||
<string name="home_folder_updated">Folder Home Update</string>
|
||||
<string name="open_as_text">Open as Plain Text</string>
|
||||
<string name="copy_path">Copy path ke clipboard</string>
|
||||
<string name="path_copied">Path Di Copy</string>
|
||||
<string name="select_audio_file">Pilih File Audio</string>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<string name="go_to_home_folder">Vai alla 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="open_as_text">Open as Plain Text</string>
|
||||
<string name="copy_path">Copia percorso negli appunti</string>
|
||||
<string name="path_copied">Percorso copiato</string>
|
||||
<string name="select_audio_file">Seleziona un file audio</string>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<string name="go_to_home_folder">ホームフォルダを開く</string>
|
||||
<string name="set_as_home_folder">ホームフォルダに設定</string>
|
||||
<string name="home_folder_updated">ホームフォルダを更新しました</string>
|
||||
<string name="open_as_text">Open as Plain Text</string>
|
||||
<string name="copy_path">パスをクリップボードにコピー</string>
|
||||
<string name="path_copied">パスをコピーしました</string>
|
||||
<string name="select_audio_file">オーディオファイルを選択してください</string>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<string name="go_to_home_folder">홈 폴더 이동</string>
|
||||
<string name="set_as_home_folder">홈 폴더 설정</string>
|
||||
<string name="home_folder_updated">홈 폴더 설정완료</string>
|
||||
<string name="open_as_text">Open as Plain Text</string>
|
||||
<string name="copy_path">클립보드에 경로 복사</string>
|
||||
<string name="path_copied">클립보드에 복사됨</string>
|
||||
<string name="select_audio_file">오디도 파일을 선택하세요.</string>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<string name="go_to_home_folder">Eiti į namų aplanką</string>
|
||||
<string name="set_as_home_folder">Nustatyti kaip namų aplanką</string>
|
||||
<string name="home_folder_updated">Namų aplankas atnaujintas</string>
|
||||
<string name="open_as_text">Open as Plain Text</string>
|
||||
<string name="copy_path">Kopijuoti kelią į iškarpinę</string>
|
||||
<string name="path_copied">Kelias nukopijuotas</string>
|
||||
<string name="select_audio_file">Prašome pasirinkti garso bylą</string>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<string name="go_to_home_folder">Gå til hjemmemappen</string>
|
||||
<string name="set_as_home_folder">Velg som hjemmemappen</string>
|
||||
<string name="home_folder_updated">Hjemmemappen er oppdatert</string>
|
||||
<string name="open_as_text">Open as Plain Text</string>
|
||||
<string name="copy_path">Kopier filbanen til utklippstavlen</string>
|
||||
<string name="path_copied">Filbanen er kopiert</string>
|
||||
<string name="select_audio_file">Vennligst velg en lydfil</string>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<string name="go_to_home_folder">Naar beginmap</string>
|
||||
<string name="set_as_home_folder">Als beginmap instellen</string>
|
||||
<string name="home_folder_updated">Beginmap ingesteld</string>
|
||||
<string name="open_as_text">Open as Plain Text</string>
|
||||
<string name="copy_path">Pad naar klembord kopiëren</string>
|
||||
<string name="path_copied">Pad gekopieerd</string>
|
||||
<string name="select_audio_file">Selecteer een geluidsbestand</string>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<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="home_folder_updated">Folder główny został zaktulizowany</string>
|
||||
<string name="open_as_text">Open as Plain Text</string>
|
||||
<string name="copy_path">Kopiuj ścieżkę do schowka</string>
|
||||
<string name="path_copied">Ścieżka została skopiowana</string>
|
||||
<string name="select_audio_file">Wybierz plik audio</string>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<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="home_folder_updated">Pasta pessoal atualizada</string>
|
||||
<string name="open_as_text">Open as Plain Text</string>
|
||||
<string name="copy_path">Copy path to clipboard</string>
|
||||
<string name="path_copied">Path copied</string>
|
||||
<string name="select_audio_file">Please select an audio file</string>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<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="home_folder_updated">Pasta pessoal atualizada</string>
|
||||
<string name="open_as_text">Open as Plain Text</string>
|
||||
<string name="copy_path">Copiar caminho para a área de transferência</string>
|
||||
<string name="path_copied">Caminho copiado</string>
|
||||
<string name="select_audio_file">Selecione um ficheiro de áudio</string>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<string name="go_to_home_folder">Открыть домашнюю папку</string>
|
||||
<string name="set_as_home_folder">Сделать домашней</string>
|
||||
<string name="home_folder_updated">Домашняя папка установлена</string>
|
||||
<string name="open_as_text">Открыть как текстовый файл</string>
|
||||
<string name="copy_path">Скопировать путь в буфер обмена</string>
|
||||
<string name="path_copied">Путь скопирован</string>
|
||||
<string name="select_audio_file">Пожалуйста, выберите аудиофайл</string>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<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="home_folder_updated">Domovský priečinok bol nastavený</string>
|
||||
<string name="open_as_text">Open as Plain Text</string>
|
||||
<string name="copy_path">Kopírovať cestu do schránky</string>
|
||||
<string name="path_copied">Cesta skopírovaná</string>
|
||||
<string name="select_audio_file">Prosím zvoľte audio súbor</string>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<string name="go_to_home_folder">Gå till hemmappen</string>
|
||||
<string name="set_as_home_folder">Ange som hemmapp</string>
|
||||
<string name="home_folder_updated">Hemmappen har uppdaterats</string>
|
||||
<string name="open_as_text">Open as Plain Text</string>
|
||||
<string name="copy_path">Kopiera sökväg till urklipp</string>
|
||||
<string name="path_copied">Sökvägen har kopierats</string>
|
||||
<string name="select_audio_file">Välj en ljudfil</string>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<string name="go_to_home_folder">Ana klasöre git</string>
|
||||
<string name="set_as_home_folder">Ana klasör olarak ayarla</string>
|
||||
<string name="home_folder_updated">Ana klasör güncellendi</string>
|
||||
<string name="open_as_text">Open as Plain Text</string>
|
||||
<string name="copy_path">Yolu panoya kopyala</string>
|
||||
<string name="path_copied">Yol kopyalandı</string>
|
||||
<string name="select_audio_file">Lütfen bir ses dosyası seçin</string>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<string name="go_to_home_folder">前往主資料夾</string>
|
||||
<string name="set_as_home_folder">設為主資料夾</string>
|
||||
<string name="home_folder_updated">主資料夾已更新</string>
|
||||
<string name="open_as_text">Open as Plain Text</string>
|
||||
<string name="copy_path">路徑複製到剪貼簿</string>
|
||||
<string name="path_copied">路徑已複製</string>
|
||||
<string name="select_audio_file">請選擇一個音訊檔案</string>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<string name="go_to_home_folder">Go to 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="open_as_text">Open as Plain Text</string>
|
||||
<string name="copy_path">Copy path to clipboard</string>
|
||||
<string name="path_copied">Path copied</string>
|
||||
<string name="select_audio_file">Please select an audio file</string>
|
||||
|
|
Loading…
Reference in a new issue