Changeset View
Changeset View
Standalone View
Standalone View
src/org/kde/kdeconnect/Plugins/SharePlugin/ShareActivity.java
Show All 19 Lines | |||||
20 | 20 | | |||
21 | package org.kde.kdeconnect.Plugins.SharePlugin; | 21 | package org.kde.kdeconnect.Plugins.SharePlugin; | ||
22 | 22 | | |||
23 | import android.content.Intent; | 23 | import android.content.Intent; | ||
24 | import android.os.Bundle; | 24 | import android.os.Bundle; | ||
25 | import android.support.v4.widget.SwipeRefreshLayout; | 25 | import android.support.v4.widget.SwipeRefreshLayout; | ||
26 | import android.support.v7.app.ActionBar; | 26 | import android.support.v7.app.ActionBar; | ||
27 | import android.support.v7.app.AppCompatActivity; | 27 | import android.support.v7.app.AppCompatActivity; | ||
28 | import android.util.Log; | | |||
29 | import android.view.Menu; | 28 | import android.view.Menu; | ||
30 | import android.view.MenuInflater; | 29 | import android.view.MenuInflater; | ||
31 | import android.view.MenuItem; | 30 | import android.view.MenuItem; | ||
32 | import android.widget.ListView; | 31 | import android.widget.ListView; | ||
33 | 32 | | |||
34 | import org.kde.kdeconnect.BackgroundService; | 33 | import org.kde.kdeconnect.BackgroundService; | ||
35 | import org.kde.kdeconnect.Device; | 34 | import org.kde.kdeconnect.Device; | ||
36 | import org.kde.kdeconnect.UserInterface.List.EntryItem; | 35 | import org.kde.kdeconnect.UserInterface.List.EntryItem; | ||
▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Line(s) | 92 | BackgroundService.RunCommand(this, service -> { | |||
108 | } | 107 | } | ||
109 | 108 | | |||
110 | runOnUiThread(() -> { | 109 | runOnUiThread(() -> { | ||
111 | ListView list = findViewById(R.id.devices_list); | 110 | ListView list = findViewById(R.id.devices_list); | ||
112 | list.setAdapter(new ListAdapter(ShareActivity.this, items)); | 111 | list.setAdapter(new ListAdapter(ShareActivity.this, items)); | ||
113 | list.setOnItemClickListener((adapterView, view, i, l) -> { | 112 | list.setOnItemClickListener((adapterView, view, i, l) -> { | ||
114 | 113 | | |||
115 | Device device = devicesList.get(i - 1); //NOTE: -1 because of the title! | 114 | Device device = devicesList.get(i - 1); //NOTE: -1 because of the title! | ||
116 | SharePlugin.share(intent, device); | 115 | BackgroundService.runWithPlugin(this, device.getDeviceId(), SharePlugin.class, plugin -> plugin.share(intent)); | ||
117 | finish(); | 116 | finish(); | ||
118 | }); | 117 | }); | ||
119 | }); | 118 | }); | ||
120 | 119 | | |||
121 | }); | 120 | }); | ||
122 | } | 121 | } | ||
123 | 122 | | |||
124 | @Override | 123 | @Override | ||
Show All 18 Lines | |||||
143 | protected void onStart() { | 142 | protected void onStart() { | ||
144 | super.onStart(); | 143 | super.onStart(); | ||
145 | 144 | | |||
146 | final Intent intent = getIntent(); | 145 | final Intent intent = getIntent(); | ||
147 | final String deviceId = intent.getStringExtra("deviceId"); | 146 | final String deviceId = intent.getStringExtra("deviceId"); | ||
148 | 147 | | |||
149 | if (deviceId != null) { | 148 | if (deviceId != null) { | ||
150 | 149 | | |||
151 | BackgroundService.RunCommand(this, service -> { | 150 | BackgroundService.runWithPlugin(this, deviceId, SharePlugin.class, plugin -> { | ||
152 | Log.d("DirectShare", "sharing to " + service.getDevice(deviceId).getName()); | 151 | plugin.share(intent); | ||
153 | Device device = service.getDevice(deviceId); | | |||
154 | if (device.isReachable() && device.isPaired()) { | | |||
albertvaka: This check got removed. I guess it's intended, but just making sure you are aware of the change. | |||||
155 | SharePlugin.share(intent, device); | | |||
156 | } | | |||
157 | finish(); | 152 | finish(); | ||
158 | }); | 153 | }); | ||
159 | } else { | 154 | } else { | ||
160 | 155 | | |||
161 | BackgroundService.addGuiInUseCounter(this); | 156 | BackgroundService.addGuiInUseCounter(this); | ||
162 | BackgroundService.RunCommand(this, service -> { | 157 | BackgroundService.RunCommand(this, service -> { | ||
163 | service.onNetworkChange(); | 158 | service.onNetworkChange(); | ||
164 | service.addDeviceListChangedCallback("ShareActivity", this::updateComputerList); | 159 | service.addDeviceListChangedCallback("ShareActivity", this::updateComputerList); | ||
Show All 14 Lines |
This check got removed. I guess it's intended, but just making sure you are aware of the change.