made shareing text with conferences possible again
This commit is contained in:
parent
b334ebd0fa
commit
d9990e6cd8
|
@ -23,14 +23,14 @@ import android.widget.ListView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
public class ShareWithActivity extends XmppActivity {
|
public class ShareWithActivity extends XmppActivity {
|
||||||
|
|
||||||
private class Share {
|
private class Share {
|
||||||
public Uri uri;
|
public Uri uri;
|
||||||
public String account;
|
public String account;
|
||||||
public String contact;
|
public String contact;
|
||||||
public String text;
|
public String text;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Share share;
|
private Share share;
|
||||||
|
|
||||||
private static final int REQUEST_START_NEW_CONVERSATION = 0x0501;
|
private static final int REQUEST_START_NEW_CONVERSATION = 0x0501;
|
||||||
|
@ -56,7 +56,7 @@ public class ShareWithActivity extends XmppActivity {
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
protected void onActivityResult(int requestCode, int resultCode,
|
protected void onActivityResult(int requestCode, int resultCode,
|
||||||
final Intent data) {
|
final Intent data) {
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
@ -64,9 +64,11 @@ public class ShareWithActivity extends XmppActivity {
|
||||||
&& resultCode == RESULT_OK) {
|
&& resultCode == RESULT_OK) {
|
||||||
share.contact = data.getStringExtra("contact");
|
share.contact = data.getStringExtra("contact");
|
||||||
share.account = data.getStringExtra("account");
|
share.account = data.getStringExtra("account");
|
||||||
Log.d(Config.LOGTAG,"contact: "+share.contact+" account:"+share.account);
|
Log.d(Config.LOGTAG, "contact: " + share.contact + " account:"
|
||||||
|
+ share.account);
|
||||||
}
|
}
|
||||||
if (xmppConnectionServiceBound && share != null && share.contact != null && share.account != null) {
|
if (xmppConnectionServiceBound && share != null
|
||||||
|
&& share.contact != null && share.account != null) {
|
||||||
share();
|
share();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,15 +94,16 @@ public class ShareWithActivity extends XmppActivity {
|
||||||
public void onItemClick(AdapterView<?> arg0, View arg1,
|
public void onItemClick(AdapterView<?> arg0, View arg1,
|
||||||
int position, long arg3) {
|
int position, long arg3) {
|
||||||
Conversation conversation = mConversations.get(position);
|
Conversation conversation = mConversations.get(position);
|
||||||
if (conversation.getMode() == Conversation.MODE_SINGLE) {
|
if (conversation.getMode() == Conversation.MODE_SINGLE
|
||||||
|
|| share.uri == null) {
|
||||||
share(mConversations.get(position));
|
share(mConversations.get(position));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.share = new Share();
|
this.share = new Share();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
getMenuInflater().inflate(R.menu.share_with, menu);
|
getMenuInflater().inflate(R.menu.share_with, menu);
|
||||||
|
@ -118,40 +121,41 @@ public class ShareWithActivity extends XmppActivity {
|
||||||
}
|
}
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
super.onStart();
|
if (getIntent().getType() != null
|
||||||
if (getIntent().getType() != null && getIntent().getType()
|
&& getIntent().getType().startsWith("image/")) {
|
||||||
.startsWith("image/")) {
|
|
||||||
this.share.uri = (Uri) getIntent().getParcelableExtra(
|
this.share.uri = (Uri) getIntent().getParcelableExtra(
|
||||||
Intent.EXTRA_STREAM);
|
Intent.EXTRA_STREAM);
|
||||||
} else {
|
} else {
|
||||||
this.share.text = getIntent().getStringExtra(Intent.EXTRA_TEXT);
|
this.share.text = getIntent().getStringExtra(Intent.EXTRA_TEXT);
|
||||||
}
|
}
|
||||||
|
if (xmppConnectionServiceBound) {
|
||||||
|
xmppConnectionService.populateWithOrderedConversations(
|
||||||
|
mConversations, this.share.uri == null);
|
||||||
|
}
|
||||||
|
super.onStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void onBackendConnected() {
|
void onBackendConnected() {
|
||||||
if (xmppConnectionServiceBound && share != null && share.contact != null && share.account != null) {
|
if (xmppConnectionServiceBound && share != null
|
||||||
|
&& share.contact != null && share.account != null) {
|
||||||
share();
|
share();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
xmppConnectionService.populateWithOrderedConversations(mConversations,
|
xmppConnectionService.populateWithOrderedConversations(mConversations,
|
||||||
false);
|
this.share != null && this.share.uri == null);
|
||||||
for (Conversation conversation : mConversations) {
|
|
||||||
if (conversation.getMode() == Conversation.MODE_MULTI) {
|
|
||||||
mConversations.remove(conversation);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void share() {
|
private void share() {
|
||||||
Account account = xmppConnectionService.findAccountByJid(share.account);
|
Account account = xmppConnectionService.findAccountByJid(share.account);
|
||||||
if (account==null) {
|
if (account == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Conversation conversation = xmppConnectionService.findOrCreateConversation(account, share.contact, false);
|
Conversation conversation = xmppConnectionService
|
||||||
|
.findOrCreateConversation(account, share.contact, false);
|
||||||
share(conversation);
|
share(conversation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,7 +176,7 @@ public class ShareWithActivity extends XmppActivity {
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
switchToConversation(conversation,this.share.text, true);
|
switchToConversation(conversation, this.share.text, true);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue