Allow multiple image sharing through linphone
This commit is contained in:
parent
cb34afab14
commit
3a1a1f7102
3 changed files with 38 additions and 13 deletions
|
@ -109,6 +109,14 @@
|
|||
<data android:mimeType="video/*" />
|
||||
<data android:mimeType="application/*" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.SEND_MULTIPLE" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.OPENABLE" />
|
||||
|
||||
<data android:mimeType="image/*" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="org.linphone.intent.action.CallLaunched" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
|
|
|
@ -28,6 +28,7 @@ import android.net.Uri;
|
|||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import java.util.ArrayList;
|
||||
import org.linphone.assistant.RemoteProvisioningActivity;
|
||||
import org.linphone.call.CallActivity;
|
||||
import org.linphone.contacts.ContactsManager;
|
||||
|
@ -129,7 +130,14 @@ public class LinphoneLauncherActivity extends Activity {
|
|||
}
|
||||
} else if (Intent.ACTION_SEND_MULTIPLE.equals(action) && type != null) {
|
||||
if (type.startsWith("image/")) {
|
||||
// TODO : Manage multiple files sharing
|
||||
ArrayList<Uri> imageUris =
|
||||
intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
|
||||
String filePaths = "";
|
||||
for (Uri uri : imageUris) {
|
||||
filePaths += FileUtils.getFilePath(getBaseContext(), uri);
|
||||
filePaths += ":";
|
||||
}
|
||||
newIntent.putExtra("fileShared", filePaths);
|
||||
}
|
||||
} else if (ACTION_CALL_LINPHONE.equals(action)
|
||||
&& (intent.getStringExtra("NumberToCall") != null)) {
|
||||
|
|
|
@ -316,19 +316,13 @@ public class ChatMessagesFragment extends Fragment
|
|||
if (getArguments() != null) {
|
||||
String fileSharedUri = getArguments().getString("fileSharedUri");
|
||||
if (fileSharedUri != null) {
|
||||
if (FileUtils.isExtensionImage(fileSharedUri)) {
|
||||
addImageToPendingList(fileSharedUri);
|
||||
} else {
|
||||
if (fileSharedUri.startsWith("content://")
|
||||
|| fileSharedUri.startsWith("file://")) {
|
||||
fileSharedUri =
|
||||
FileUtils.getFilePath(
|
||||
getActivity().getApplicationContext(),
|
||||
Uri.parse(fileSharedUri));
|
||||
} else if (fileSharedUri.contains("com.android.contacts/contacts/")) {
|
||||
fileSharedUri = FileUtils.getCVSPathFromLookupUri(fileSharedUri).toString();
|
||||
if (fileSharedUri.contains(":")) {
|
||||
String[] files = fileSharedUri.split(":");
|
||||
for (String file : files) {
|
||||
addFileIntoSharingArea(file);
|
||||
}
|
||||
addFileToPendingList(fileSharedUri);
|
||||
} else {
|
||||
addFileIntoSharingArea(fileSharedUri);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -580,6 +574,21 @@ public class ChatMessagesFragment extends Fragment
|
|||
return super.onContextItemSelected(item);
|
||||
}
|
||||
|
||||
private void addFileIntoSharingArea(String fileSharedUri) {
|
||||
if (FileUtils.isExtensionImage(fileSharedUri)) {
|
||||
addImageToPendingList(fileSharedUri);
|
||||
} else {
|
||||
if (fileSharedUri.startsWith("content://") || fileSharedUri.startsWith("file://")) {
|
||||
fileSharedUri =
|
||||
FileUtils.getFilePath(
|
||||
getActivity().getApplicationContext(), Uri.parse(fileSharedUri));
|
||||
} else if (fileSharedUri.contains("com.android.contacts/contacts/")) {
|
||||
fileSharedUri = FileUtils.getCVSPathFromLookupUri(fileSharedUri).toString();
|
||||
}
|
||||
addFileToPendingList(fileSharedUri);
|
||||
}
|
||||
}
|
||||
|
||||
private void loadMoreData(final int totalItemsCount) {
|
||||
mHandler.post(
|
||||
new Runnable() {
|
||||
|
|
Loading…
Reference in a new issue