fixed share with activity to account for http file upload
This commit is contained in:
parent
e4d1bd415d
commit
c745fbb562
|
@ -1046,13 +1046,14 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
|
|||
populateWithOrderedConversations(list, true);
|
||||
}
|
||||
|
||||
public void populateWithOrderedConversations(final List<Conversation> list, boolean includeConferences) {
|
||||
public void populateWithOrderedConversations(final List<Conversation> list, boolean includeNoFileUpload) {
|
||||
list.clear();
|
||||
if (includeConferences) {
|
||||
if (includeNoFileUpload) {
|
||||
list.addAll(getConversations());
|
||||
} else {
|
||||
for (Conversation conversation : getConversations()) {
|
||||
if (conversation.getMode() == Conversation.MODE_SINGLE) {
|
||||
if (conversation.getMode() == Conversation.MODE_SINGLE
|
||||
|| conversation.getAccount().httpUploadAvailable()) {
|
||||
list.add(conversation);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import android.app.PendingIntent;
|
|||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
|
@ -13,10 +12,7 @@ import android.widget.AdapterView.OnItemClickListener;
|
|||
import android.widget.ListView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLConnection;
|
||||
import java.net.URLDecoder;
|
||||
import java.nio.charset.UnsupportedCharsetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
@ -66,18 +62,17 @@ public class ShareWithActivity extends XmppActivity {
|
|||
}
|
||||
};
|
||||
|
||||
protected void onActivityResult(int requestCode, int resultCode,
|
||||
final Intent data) {
|
||||
protected void onActivityResult(int requestCode, int resultCode, final Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == REQUEST_START_NEW_CONVERSATION
|
||||
&& resultCode == RESULT_OK) {
|
||||
share.contact = data.getStringExtra("contact");
|
||||
share.account = data.getStringExtra("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();
|
||||
}
|
||||
}
|
||||
|
@ -101,14 +96,9 @@ public class ShareWithActivity extends XmppActivity {
|
|||
mListView.setOnItemClickListener(new OnItemClickListener() {
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> arg0, View arg1,
|
||||
int position, long arg3) {
|
||||
Conversation conversation = mConversations.get(position);
|
||||
if (conversation.getMode() == Conversation.MODE_SINGLE
|
||||
|| share.uris.size() == 0) {
|
||||
public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
|
||||
share(mConversations.get(position));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.share = new Share();
|
||||
|
@ -124,8 +114,7 @@ public class ShareWithActivity extends XmppActivity {
|
|||
public boolean onOptionsItemSelected(final MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_add:
|
||||
final Intent intent = new Intent(getApplicationContext(),
|
||||
ChooseContactActivity.class);
|
||||
final Intent intent = new Intent(getApplicationContext(), ChooseContactActivity.class);
|
||||
startActivityForResult(intent, REQUEST_START_NEW_CONVERSATION);
|
||||
return true;
|
||||
}
|
||||
|
@ -157,7 +146,7 @@ public class ShareWithActivity extends XmppActivity {
|
|||
this.share.uris = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
|
||||
}
|
||||
if (xmppConnectionServiceBound) {
|
||||
xmppConnectionService.populateWithOrderedConversations(mConversations, this.share.image);
|
||||
xmppConnectionService.populateWithOrderedConversations(mConversations, this.share.uris.size() == 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -204,7 +193,7 @@ public class ShareWithActivity extends XmppActivity {
|
|||
|
||||
private void share(final Conversation conversation) {
|
||||
if (share.uris.size() != 0) {
|
||||
selectPresence(conversation, new OnPresenceSelected() {
|
||||
OnPresenceSelected callback = new OnPresenceSelected() {
|
||||
@Override
|
||||
public void onPresenceSelected() {
|
||||
if (share.image) {
|
||||
|
@ -227,7 +216,12 @@ public class ShareWithActivity extends XmppActivity {
|
|||
switchToConversation(conversation, null, true);
|
||||
finish();
|
||||
}
|
||||
});
|
||||
};
|
||||
if (conversation.getAccount().httpUploadAvailable()) {
|
||||
callback.onPresenceSelected();
|
||||
} else {
|
||||
selectPresence(conversation, callback);
|
||||
}
|
||||
} else {
|
||||
switchToConversation(conversation, this.share.text, true);
|
||||
finish();
|
||||
|
|
Loading…
Reference in New Issue