Changeset View
Changeset View
Standalone View
Standalone View
src/org/kde/kdeconnect/Plugins/SharePlugin/SendFileActivity.java
Show All 25 Lines | |||||
26 | import android.net.Uri; | 26 | import android.net.Uri; | ||
27 | import android.os.Build; | 27 | import android.os.Build; | ||
28 | import android.os.Bundle; | 28 | import android.os.Bundle; | ||
29 | import android.support.v7.app.AppCompatActivity; | 29 | import android.support.v7.app.AppCompatActivity; | ||
30 | import android.util.Log; | 30 | import android.util.Log; | ||
31 | import android.widget.Toast; | 31 | import android.widget.Toast; | ||
32 | 32 | | |||
33 | import org.kde.kdeconnect.BackgroundService; | 33 | import org.kde.kdeconnect.BackgroundService; | ||
34 | import org.kde.kdeconnect.Device; | | |||
35 | import org.kde.kdeconnect.UserInterface.ThemeUtil; | 34 | import org.kde.kdeconnect.UserInterface.ThemeUtil; | ||
36 | import org.kde.kdeconnect_tp.R; | 35 | import org.kde.kdeconnect_tp.R; | ||
37 | 36 | | |||
38 | import java.util.ArrayList; | 37 | import java.util.ArrayList; | ||
39 | 38 | | |||
40 | 39 | | |||
41 | public class SendFileActivity extends AppCompatActivity { | 40 | public class SendFileActivity extends AppCompatActivity { | ||
42 | 41 | | |||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Line(s) | 82 | for (int i = 0; i < clipdata.getItemCount(); i++) { | |||
84 | uris.add(clipdata.getItemAt(i).getUri()); | 83 | uris.add(clipdata.getItemAt(i).getUri()); | ||
85 | } | 84 | } | ||
86 | } | 85 | } | ||
87 | } | 86 | } | ||
88 | 87 | | |||
89 | if (uris.isEmpty()) { | 88 | if (uris.isEmpty()) { | ||
90 | Log.w("SendFileActivity", "No files to send?"); | 89 | Log.w("SendFileActivity", "No files to send?"); | ||
91 | } else { | 90 | } else { | ||
92 | BackgroundService.RunCommand(this, service -> { | 91 | BackgroundService.runWithPlugin(this, mDeviceId, SharePlugin.class, plugin -> plugin.queuedSendUriList(uris)); | ||
93 | Device device = service.getDevice(mDeviceId); | | |||
94 | if (device == null) { | | |||
95 | Log.e("SendFileActivity", "Device is null"); | | |||
96 | finish(); | | |||
97 | return; | | |||
98 | } | | |||
99 | SharePlugin.queuedSendUriList(getApplicationContext(), device, uris); | | |||
100 | }); | | |||
101 | } | 92 | } | ||
102 | } | 93 | } | ||
103 | finish(); | 94 | finish(); | ||
104 | break; | 95 | break; | ||
105 | default: | 96 | default: | ||
106 | super.onActivityResult(requestCode, resultCode, data); | 97 | super.onActivityResult(requestCode, resultCode, data); | ||
107 | } | 98 | } | ||
108 | } | 99 | } | ||
109 | 100 | | |||
110 | } | 101 | } |