fix #6, allow sharing files

This commit is contained in:
tibbi 2016-08-22 22:12:55 +02:00
parent 81433c670c
commit ca7c6c886c
5 changed files with 33 additions and 3 deletions

View file

@ -318,6 +318,8 @@ public class ItemsFragment extends android.support.v4.app.Fragment
mode.finish();
return true;
case R.id.cab_share:
shareFiles();
mode.finish();
return true;
case R.id.cab_copy:
displayCopyDialog();
@ -332,6 +334,26 @@ public class ItemsFragment extends android.support.v4.app.Fragment
}
}
private void shareFiles() {
final List<Integer> itemIndexes = getSelectedItemIndexes();
if (itemIndexes.isEmpty())
return;
final ArrayList<Uri> uris = new ArrayList<>(itemIndexes.size());
for (int i : itemIndexes) {
final File file = new File(mItems.get(i).getPath());
uris.add(Uri.fromFile(file));
}
final String shareTitle = getResources().getString(R.string.share_via);
final Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND_MULTIPLE);
sendIntent.putExtra(Intent.EXTRA_SUBJECT, getResources().getString(R.string.shared_files));
sendIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
sendIntent.setType("*/*");
startActivity(Intent.createChooser(sendIntent, shareTitle));
}
private void displayRenameDialog() {
final List<Integer> itemIndexes = getSelectedItemIndexes();
if (itemIndexes.isEmpty())

View file

@ -1,5 +1,6 @@
<resources>
<string name="app_name">Simple File Manager</string>
<string name="share_via">Condividi via</string>
<string name="no_permissions">Serve l\'autorizzazione per accedere all\'archiviazione</string>
<string name="no_app_found">Nessuna app disponibile per aprire questo tipo di file</string>
<string name="create_new">Crea nuovo elemento</string>
@ -14,7 +15,8 @@
<string name="undo">Annulla</string>
<string name="rename">Rinomina</string>
<string name="copy">Copia</string>
<string name="share">Share</string>
<string name="share">Condividi</string>
<string name="shared_files">Files shared via Simple File Manager</string>
<string name="copy_item">Copia elemento</string>
<string name="copy_items">Copia elementi</string>
<string name="move">Sposta</string>

View file

@ -1,5 +1,6 @@
<resources>
<string name="app_name">シンプル ファイル マネージャー</string>
<string name="share_via">共有</string>
<string name="no_permissions">ストレージにアクセスするアクセス許可が必要です</string>
<string name="no_app_found">この種類のファイルを開くことができるアプリがありません</string>
<string name="create_new">新しいアイテムを作成</string>
@ -14,7 +15,8 @@
<string name="undo">元に戻す</string>
<string name="rename">名前を変更</string>
<string name="copy">コピー</string>
<string name="share">Share</string>
<string name="share">Dela</string>
<string name="shared_files">Files shared via Simple File Manager</string>
<string name="copy_item">アイテムをコピー</string>
<string name="copy_items">アイテムをコピー</string>
<string name="move">移動</string>

View file

@ -1,5 +1,6 @@
<resources>
<string name="app_name">Simple File Manager</string>
<string name="share_via">Dela via</string>
<string name="no_permissions">Vi behöver tillgång till ditt lagringsutrymme</string>
<string name="no_app_found">Det finns ingen app tillgänglig för att öppna denna typ av fil</string>
<string name="create_new">Skapa nytt objektm</string>
@ -14,7 +15,8 @@
<string name="undo">Ångra</string>
<string name="rename">Döp om</string>
<string name="copy">Kopiera</string>
<string name="share">Share</string>
<string name="share">Dela</string>
<string name="shared_files">Files shared via Simple File Manager</string>
<string name="copy_item">Kopiera objekt</string>
<string name="copy_items">Kopiera objekt</string>
<string name="move">Flytta</string>

View file

@ -1,5 +1,6 @@
<resources>
<string name="app_name">Simple File Manager</string>
<string name="share_via">Share via</string>
<string name="no_permissions">We need the permission to access your storage</string>
<string name="no_app_found">No app for opening this type of files is available</string>
<string name="create_new">Create new item</string>
@ -15,6 +16,7 @@
<string name="rename">Rename</string>
<string name="copy">Copy</string>
<string name="share">Share</string>
<string name="shared_files">Files shared via Simple File Manager</string>
<string name="copy_item">Copy item</string>
<string name="copy_items">Copy items</string>
<string name="move">Move</string>