Loading android/app/src/com/android/bluetooth/opp/BluetoothOppLauncherActivity.java +36 −17 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ import android.os.Bundle; import android.provider.Settings; import android.util.Log; import android.util.Patterns; import android.widget.Toast; /** * This class is designed to act as the entry point of handling the share intent Loading Loading @@ -109,11 +110,7 @@ public class BluetoothOppLauncherActivity extends Activity { // session to DB. Thread t = new Thread(new Runnable() { public void run() { BluetoothOppManager.getInstance(BluetoothOppLauncherActivity.this) .saveSendingFileInfo(type,stream.toString(), false); //Done getting file info..Launch device picker and finish this activity launchDevicePicker(); finish(); sendFileInfo(type, stream.toString(), false); } }); t.start(); Loading @@ -125,12 +122,7 @@ public class BluetoothOppLauncherActivity extends Activity { if (fileUri != null) { Thread t = new Thread(new Runnable() { public void run() { BluetoothOppManager.getInstance(BluetoothOppLauncherActivity.this) .saveSendingFileInfo(type,fileUri.toString(), false); //Done getting file info..Launch device picker //and finish this activity launchDevicePicker(); finish(); sendFileInfo(type, fileUri.toString(), false); } }); t.start(); Loading @@ -153,12 +145,17 @@ public class BluetoothOppLauncherActivity extends Activity { + mimeType); Thread t = new Thread(new Runnable() { public void run() { try { BluetoothOppManager.getInstance(BluetoothOppLauncherActivity.this) .saveSendingFileInfo(mimeType, uris, false); //Done getting file info..Launch device picker //and finish this activity launchDevicePicker(); finish(); } catch (IllegalArgumentException exception) { showToast(exception.getMessage()); finish(); } } }); t.start(); Loading Loading @@ -377,4 +374,26 @@ public class BluetoothOppLauncherActivity extends Activity { } return text; } private void sendFileInfo(String mimeType, String uriString, boolean isHandover) { BluetoothOppManager manager = BluetoothOppManager.getInstance(getApplicationContext()); try { manager.saveSendingFileInfo(mimeType, uriString, isHandover); launchDevicePicker(); finish(); } catch (IllegalArgumentException exception) { showToast(exception.getMessage()); finish(); } } private void showToast(final String msg) { BluetoothOppLauncherActivity.this.runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_SHORT).show(); } }); } } android/app/src/com/android/bluetooth/opp/BluetoothOppManager.java +4 −2 Original line number Diff line number Diff line Loading @@ -246,7 +246,8 @@ public class BluetoothOppManager { if (V) Log.v(TAG, "Application data stored to SharedPreference! "); } public void saveSendingFileInfo(String mimeType, String uriString, boolean isHandover) { public void saveSendingFileInfo(String mimeType, String uriString, boolean isHandover) throws IllegalArgumentException { synchronized (BluetoothOppManager.this) { mMultipleFlag = false; mMimeTypeOfSendingFile = mimeType; Loading @@ -259,7 +260,8 @@ public class BluetoothOppManager { } } public void saveSendingFileInfo(String mimeType, ArrayList<Uri> uris, boolean isHandover) { public void saveSendingFileInfo(String mimeType, ArrayList<Uri> uris, boolean isHandover) throws IllegalArgumentException { synchronized (BluetoothOppManager.this) { mMultipleFlag = true; mMimeTypeOfSendingFiles = mimeType; Loading android/app/src/com/android/bluetooth/opp/BluetoothOppSendFileInfo.java +4 −0 Original line number Diff line number Diff line Loading @@ -212,6 +212,10 @@ public class BluetoothOppSendFileInfo { if (length == 0) { Log.e(TAG, "Could not determine size of file"); return SEND_FILE_INFO_ERROR; } else if (length > 0xffffffffL) { String msg = "Files bigger than 4GB can't be transferred"; Log.e(TAG, msg); throw new IllegalArgumentException(msg); } return new BluetoothOppSendFileInfo(fileName, contentType, length, is, 0); Loading Loading
android/app/src/com/android/bluetooth/opp/BluetoothOppLauncherActivity.java +36 −17 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ import android.os.Bundle; import android.provider.Settings; import android.util.Log; import android.util.Patterns; import android.widget.Toast; /** * This class is designed to act as the entry point of handling the share intent Loading Loading @@ -109,11 +110,7 @@ public class BluetoothOppLauncherActivity extends Activity { // session to DB. Thread t = new Thread(new Runnable() { public void run() { BluetoothOppManager.getInstance(BluetoothOppLauncherActivity.this) .saveSendingFileInfo(type,stream.toString(), false); //Done getting file info..Launch device picker and finish this activity launchDevicePicker(); finish(); sendFileInfo(type, stream.toString(), false); } }); t.start(); Loading @@ -125,12 +122,7 @@ public class BluetoothOppLauncherActivity extends Activity { if (fileUri != null) { Thread t = new Thread(new Runnable() { public void run() { BluetoothOppManager.getInstance(BluetoothOppLauncherActivity.this) .saveSendingFileInfo(type,fileUri.toString(), false); //Done getting file info..Launch device picker //and finish this activity launchDevicePicker(); finish(); sendFileInfo(type, fileUri.toString(), false); } }); t.start(); Loading @@ -153,12 +145,17 @@ public class BluetoothOppLauncherActivity extends Activity { + mimeType); Thread t = new Thread(new Runnable() { public void run() { try { BluetoothOppManager.getInstance(BluetoothOppLauncherActivity.this) .saveSendingFileInfo(mimeType, uris, false); //Done getting file info..Launch device picker //and finish this activity launchDevicePicker(); finish(); } catch (IllegalArgumentException exception) { showToast(exception.getMessage()); finish(); } } }); t.start(); Loading Loading @@ -377,4 +374,26 @@ public class BluetoothOppLauncherActivity extends Activity { } return text; } private void sendFileInfo(String mimeType, String uriString, boolean isHandover) { BluetoothOppManager manager = BluetoothOppManager.getInstance(getApplicationContext()); try { manager.saveSendingFileInfo(mimeType, uriString, isHandover); launchDevicePicker(); finish(); } catch (IllegalArgumentException exception) { showToast(exception.getMessage()); finish(); } } private void showToast(final String msg) { BluetoothOppLauncherActivity.this.runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_SHORT).show(); } }); } }
android/app/src/com/android/bluetooth/opp/BluetoothOppManager.java +4 −2 Original line number Diff line number Diff line Loading @@ -246,7 +246,8 @@ public class BluetoothOppManager { if (V) Log.v(TAG, "Application data stored to SharedPreference! "); } public void saveSendingFileInfo(String mimeType, String uriString, boolean isHandover) { public void saveSendingFileInfo(String mimeType, String uriString, boolean isHandover) throws IllegalArgumentException { synchronized (BluetoothOppManager.this) { mMultipleFlag = false; mMimeTypeOfSendingFile = mimeType; Loading @@ -259,7 +260,8 @@ public class BluetoothOppManager { } } public void saveSendingFileInfo(String mimeType, ArrayList<Uri> uris, boolean isHandover) { public void saveSendingFileInfo(String mimeType, ArrayList<Uri> uris, boolean isHandover) throws IllegalArgumentException { synchronized (BluetoothOppManager.this) { mMultipleFlag = true; mMimeTypeOfSendingFiles = mimeType; Loading
android/app/src/com/android/bluetooth/opp/BluetoothOppSendFileInfo.java +4 −0 Original line number Diff line number Diff line Loading @@ -212,6 +212,10 @@ public class BluetoothOppSendFileInfo { if (length == 0) { Log.e(TAG, "Could not determine size of file"); return SEND_FILE_INFO_ERROR; } else if (length > 0xffffffffL) { String msg = "Files bigger than 4GB can't be transferred"; Log.e(TAG, msg); throw new IllegalArgumentException(msg); } return new BluetoothOppSendFileInfo(fileName, contentType, length, is, 0); Loading