[File sharing] update sharing contact + navigation issue
This commit is contained in:
parent
6594c2b624
commit
b6f642a518
3 changed files with 37 additions and 6 deletions
|
@ -112,7 +112,7 @@
|
|||
<action android:name="android.intent.action.SEND" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.OPENABLE"/>
|
||||
<data android:mimeType="text/plain"/>
|
||||
<data android:mimeType="text/*"/>
|
||||
<data android:mimeType="image/*"/>
|
||||
<data android:mimeType="audio/*"/>
|
||||
<data android:mimeType="video/*"/>
|
||||
|
|
|
@ -683,10 +683,23 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
LinphoneActivity.instance().setAddresGoToDialerAndCall(sipUri, LinphoneUtils.getUsernameFromAddress(sipUri), null);
|
||||
}
|
||||
if (id == R.id.back) {
|
||||
cleanIntentAndFiles();
|
||||
getFragmentManager().popBackStackImmediate();
|
||||
}
|
||||
}
|
||||
|
||||
private void cleanIntentAndFiles() {
|
||||
if (getArguments().getString("fileSharedUri") != null){
|
||||
getArguments().remove("fileSharedUri");
|
||||
fileSharedUri = null;
|
||||
}
|
||||
message.setText("");
|
||||
if (getArguments().getString("messageDraft") != null)
|
||||
getArguments().remove("messageDraft");
|
||||
|
||||
this.getArguments().clear();
|
||||
}
|
||||
|
||||
private void sendTextMessage() {
|
||||
if (!LinphoneManager.isInstanciated() || LinphoneManager.getLc() == null)
|
||||
return;
|
||||
|
@ -774,6 +787,11 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
private void sendFileSharingMessage(String path, int size ) {
|
||||
if(path.contains("file://")) {
|
||||
path = path.substring(7);
|
||||
}else if(path.contains("com.android.contacts/contacts/")){
|
||||
Log.e("===>>> ChatFragment - sendFileSharingMessage : path = "+path);
|
||||
path = getCVSPathFromLookupUri(path).toString();
|
||||
}else if(path.contains(".vcf")){
|
||||
//TODO : do something
|
||||
}
|
||||
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
|
@ -926,7 +944,11 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
}
|
||||
|
||||
public Uri getCVSPathFromLookupUri(Uri contentUri) {
|
||||
String contactId = LinphoneUtils.getNameFromFilePath(contentUri.getPath());
|
||||
return getCVSPathFromLookupUri(contentUri.getPath());
|
||||
}
|
||||
|
||||
public Uri getCVSPathFromLookupUri(String content) {
|
||||
String contactId = LinphoneUtils.getNameFromFilePath(content);
|
||||
LinphoneFriend[] friendList = LinphoneManager.getLc().getFriendList();
|
||||
for(LinphoneFriend friend : friendList){
|
||||
if(friend.getRefKey().toString().equals(contactId)) {
|
||||
|
@ -953,7 +975,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
|
||||
@Override
|
||||
public void onContactsUpdated() {
|
||||
if(fileSharedUri != null){
|
||||
if(fileSharedUri != null || message.getText() != null){
|
||||
initNewChatConversation();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -116,9 +116,18 @@ public class LinphoneLauncherActivity extends Activity {
|
|||
String type = intent.getType();
|
||||
newIntent.setData(intent.getData());
|
||||
if (Intent.ACTION_SEND.equals(action) && type != null) {
|
||||
if ("text/plain".equals(type) && intent.getStringExtra(Intent.EXTRA_TEXT) != null) {
|
||||
Log.e("====>>> LinphoneLauncherActivity : onServiceReady - type = "+type);
|
||||
if (type.contains("text/")){ //&& intent.getStringExtra(Intent.EXTRA_TEXT) != null) {
|
||||
|
||||
if(("text/plain").equals(type) && intent.getStringExtra(Intent.EXTRA_TEXT)!= null) {
|
||||
stringFileShared = intent.getStringExtra(Intent.EXTRA_TEXT);
|
||||
Log.e("====>>> LinphoneLauncherActivity : onServiceReady - stringText = "+stringFileShared);
|
||||
newIntent.putExtra("msgShared", stringFileShared);
|
||||
} else if(((Uri) intent.getExtras().get(Intent.EXTRA_STREAM)) != null){
|
||||
stringFileShared = ((Uri) intent.getExtras().get(Intent.EXTRA_STREAM)).getPath();
|
||||
Log.e("====>>> LinphoneLauncherActivity : onServiceReady - stringFileShared = "+stringFileShared);
|
||||
newIntent.putExtra("fileShared", stringFileShared);
|
||||
}
|
||||
}else {
|
||||
if(intent.getStringExtra(Intent.EXTRA_STREAM) != null){
|
||||
stringFileShared = intent.getStringExtra(Intent.EXTRA_STREAM);
|
||||
|
|
Loading…
Reference in a new issue