2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-31 14:15:14 +00:00

Payload sizes are now longs instead of ints

This commit is contained in:
Albert Vaca
2015-01-22 21:24:01 -08:00
parent e4f9c15b36
commit 83a22cab9d
3 changed files with 9 additions and 9 deletions

View File

@@ -66,7 +66,7 @@ public class NetworkPackage {
private JSONObject mBody;
private InputStream mPayload;
private JSONObject mPayloadTransferInfo;
private int mPayloadSize;
private long mPayloadSize;
private NetworkPackage() {
@@ -171,7 +171,7 @@ public class NetworkPackage {
np.mBody = jo.getJSONObject("body");
if (jo.has("payloadSize")) {
np.mPayloadTransferInfo = jo.getJSONObject("payloadTransferInfo");
np.mPayloadSize = jo.getInt("payloadSize");
np.mPayloadSize = jo.getLong("payloadSize");
} else {
np.mPayloadTransferInfo = new JSONObject();
np.mPayloadSize = 0;
@@ -277,7 +277,7 @@ public class NetworkPackage {
setPayload(new ByteArrayInputStream(data), data.length);
}
public void setPayload(InputStream stream, int size) {
public void setPayload(InputStream stream, long size) {
mPayload = stream;
mPayloadSize = size;
}
@@ -290,7 +290,7 @@ public class NetworkPackage {
return mPayload;
}
public int getPayloadSize() {
public long getPayloadSize() {
return mPayloadSize;
}

View File

@@ -106,7 +106,7 @@ public class SharePlugin extends Plugin {
Log.e("SharePlugin", "hasPayload");
final InputStream input = np.getPayload();
final int fileLength = np.getPayloadSize();
final long fileLength = np.getPayloadSize();
final String filename = np.getString("filename", new Long(System.currentTimeMillis()).toString());
String deviceDir = FilesHelper.toFileSystemSafeName(device.getName());

View File

@@ -211,7 +211,7 @@ public class ShareToReceiver extends ActionBarActivity {
InputStream inputStream = cr.openInputStream(uri);
NetworkPackage np = new NetworkPackage(NetworkPackage.PACKAGE_TYPE_SHARE);
int size = -1;
long size = -1;
final NotificationManager notificationManager = (NotificationManager)getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE);
final int notificationId = (int)System.currentTimeMillis();
@@ -234,7 +234,7 @@ public class ShareToReceiver extends ActionBarActivity {
np.set("filename", uri.getLastPathSegment());
try {
size = (int)new File(uri.getPath()).length();
size = new File(uri.getPath()).length();
np.setPayload(inputStream, size);
} catch(Exception e) {
e.printStackTrace();
@@ -252,7 +252,7 @@ public class ShareToReceiver extends ActionBarActivity {
cursor.moveToFirst();
String path = cursor.getString(column_index);
np.set("filename", Uri.parse(path).getLastPathSegment());
size = (int)new File(path).length();
size = new File(path).length();
} catch(Exception unused) {
Log.e("ShareToReceiver", "Could not resolve media to a file, trying to get info as media");
@@ -284,7 +284,7 @@ public class ShareToReceiver extends ActionBarActivity {
}
final long filesize = size;
final long fileSize = size;
final String filename = np.getString("filename");
builder.setContentText(res.getString(R.string.outgoing_file_text,filename));