2014-10-22 16:38:44 +00:00
|
|
|
package eu.siacs.conversations.ui;
|
|
|
|
|
|
|
|
import android.app.PendingIntent;
|
|
|
|
import android.content.Intent;
|
2017-10-27 15:25:01 +00:00
|
|
|
import android.content.pm.PackageManager;
|
2014-10-22 16:38:44 +00:00
|
|
|
import android.net.Uri;
|
|
|
|
import android.os.Bundle;
|
2018-04-06 11:49:50 +00:00
|
|
|
import android.support.v7.widget.LinearLayoutManager;
|
|
|
|
import android.support.v7.widget.RecyclerView;
|
2015-12-06 10:55:37 +00:00
|
|
|
import android.util.Log;
|
2014-10-22 16:38:44 +00:00
|
|
|
import android.view.Menu;
|
|
|
|
import android.view.MenuItem;
|
|
|
|
import android.widget.Toast;
|
|
|
|
|
2014-12-16 03:31:55 +00:00
|
|
|
import java.net.URLConnection;
|
|
|
|
import java.util.ArrayList;
|
2015-04-11 12:53:10 +00:00
|
|
|
import java.util.Iterator;
|
2014-12-16 03:31:55 +00:00
|
|
|
import java.util.List;
|
2016-03-16 09:46:33 +00:00
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
2014-12-16 03:31:55 +00:00
|
|
|
|
2015-12-06 10:55:37 +00:00
|
|
|
import eu.siacs.conversations.Config;
|
2014-12-16 03:31:55 +00:00
|
|
|
import eu.siacs.conversations.R;
|
|
|
|
import eu.siacs.conversations.entities.Account;
|
|
|
|
import eu.siacs.conversations.entities.Conversation;
|
|
|
|
import eu.siacs.conversations.entities.Message;
|
2016-03-31 22:03:14 +00:00
|
|
|
import eu.siacs.conversations.persistance.FileBackend;
|
2016-03-16 09:46:33 +00:00
|
|
|
import eu.siacs.conversations.services.XmppConnectionService;
|
2014-12-16 03:31:55 +00:00
|
|
|
import eu.siacs.conversations.ui.adapter.ConversationAdapter;
|
2017-11-06 11:16:55 +00:00
|
|
|
import eu.siacs.conversations.ui.service.EmojiService;
|
2018-02-20 13:54:32 +00:00
|
|
|
import eu.siacs.conversations.ui.util.PresenceSelector;
|
2016-04-29 11:24:26 +00:00
|
|
|
import eu.siacs.conversations.xmpp.XmppConnection;
|
2018-03-05 17:30:40 +00:00
|
|
|
import rocks.xmpp.addr.Jid;
|
2014-12-16 03:31:55 +00:00
|
|
|
|
2016-03-16 09:46:33 +00:00
|
|
|
public class ShareWithActivity extends XmppActivity implements XmppConnectionService.OnConversationUpdate {
|
|
|
|
|
2017-10-27 15:25:01 +00:00
|
|
|
private static final int REQUEST_STORAGE_PERMISSION = 0x733f32;
|
2016-04-14 19:12:44 +00:00
|
|
|
private boolean mReturnToPrevious = false;
|
2017-10-27 15:25:01 +00:00
|
|
|
private Conversation mPendingConversation = null;
|
2016-04-14 19:12:44 +00:00
|
|
|
|
2016-03-16 09:46:33 +00:00
|
|
|
@Override
|
|
|
|
public void onConversationUpdate() {
|
|
|
|
refreshUi();
|
|
|
|
}
|
2014-10-22 16:38:44 +00:00
|
|
|
|
|
|
|
private class Share {
|
2015-04-11 12:53:10 +00:00
|
|
|
public List<Uri> uris = new ArrayList<>();
|
2014-12-17 06:12:38 +00:00
|
|
|
public boolean image;
|
2014-10-22 16:38:44 +00:00
|
|
|
public String account;
|
|
|
|
public String contact;
|
|
|
|
public String text;
|
2015-12-06 10:55:37 +00:00
|
|
|
public String uuid;
|
2016-03-16 09:46:33 +00:00
|
|
|
public boolean multiple = false;
|
2018-03-03 15:58:04 +00:00
|
|
|
public String type;
|
2014-10-22 16:38:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private Share share;
|
|
|
|
|
|
|
|
private static final int REQUEST_START_NEW_CONVERSATION = 0x0501;
|
2018-04-06 11:49:50 +00:00
|
|
|
private RecyclerView mListView;
|
2016-03-16 09:46:33 +00:00
|
|
|
private ConversationAdapter mAdapter;
|
2014-12-16 03:31:55 +00:00
|
|
|
private List<Conversation> mConversations = new ArrayList<>();
|
2015-12-06 10:55:37 +00:00
|
|
|
private Toast mToast;
|
2016-03-16 09:46:33 +00:00
|
|
|
private AtomicInteger attachmentCounter = new AtomicInteger(0);
|
2014-10-22 16:38:44 +00:00
|
|
|
|
2017-01-24 19:17:36 +00:00
|
|
|
private UiInformableCallback<Message> attachFileCallback = new UiInformableCallback<Message>() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void inform(final String text) {
|
2018-02-27 10:44:23 +00:00
|
|
|
runOnUiThread(() -> replaceToast(text));
|
2017-01-24 19:17:36 +00:00
|
|
|
}
|
2014-10-22 16:38:44 +00:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void userInputRequried(PendingIntent pi, Message object) {
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-12-06 10:55:37 +00:00
|
|
|
public void success(final Message message) {
|
2018-02-27 10:44:23 +00:00
|
|
|
runOnUiThread(() -> {
|
|
|
|
if (attachmentCounter.decrementAndGet() <=0 ) {
|
|
|
|
int resId;
|
|
|
|
if (share.image && share.multiple) {
|
|
|
|
resId = R.string.shared_images_with_x;
|
|
|
|
} else if (share.image) {
|
|
|
|
resId = R.string.shared_image_with_x;
|
|
|
|
} else {
|
|
|
|
resId = R.string.shared_file_with_x;
|
|
|
|
}
|
2018-04-26 11:22:31 +00:00
|
|
|
Conversation conversation = (Conversation) message.getConversation();
|
|
|
|
replaceToast(getString(resId, conversation.getName()));
|
2018-02-27 10:44:23 +00:00
|
|
|
if (mReturnToPrevious) {
|
|
|
|
finish();
|
|
|
|
} else {
|
2018-04-26 11:22:31 +00:00
|
|
|
switchToConversation(conversation);
|
2015-12-06 10:55:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2014-10-22 16:38:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-03-16 09:46:33 +00:00
|
|
|
public void error(final int errorCode, Message object) {
|
2018-02-27 10:44:23 +00:00
|
|
|
runOnUiThread(() -> {
|
|
|
|
replaceToast(getString(errorCode));
|
|
|
|
if (attachmentCounter.decrementAndGet() <=0 ) {
|
|
|
|
finish();
|
2016-03-16 09:46:33 +00:00
|
|
|
}
|
|
|
|
});
|
2014-10-22 16:38:44 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-03-16 09:46:33 +00:00
|
|
|
protected void hideToast() {
|
|
|
|
if (mToast != null) {
|
|
|
|
mToast.cancel();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void replaceToast(String msg) {
|
|
|
|
hideToast();
|
|
|
|
mToast = Toast.makeText(this, msg ,Toast.LENGTH_LONG);
|
|
|
|
mToast.show();
|
|
|
|
}
|
|
|
|
|
2015-07-02 21:51:59 +00:00
|
|
|
protected void onActivityResult(int requestCode, int resultCode, final Intent data) {
|
2014-10-22 16:38:44 +00:00
|
|
|
super.onActivityResult(requestCode, resultCode, data);
|
|
|
|
if (requestCode == REQUEST_START_NEW_CONVERSATION
|
|
|
|
&& resultCode == RESULT_OK) {
|
|
|
|
share.contact = data.getStringExtra("contact");
|
2016-01-22 19:46:24 +00:00
|
|
|
share.account = data.getStringExtra(EXTRA_ACCOUNT);
|
2014-10-22 16:38:44 +00:00
|
|
|
}
|
2015-07-02 21:51:59 +00:00
|
|
|
if (xmppConnectionServiceBound
|
|
|
|
&& share != null
|
|
|
|
&& share.contact != null
|
|
|
|
&& share.account != null) {
|
2014-10-22 16:38:44 +00:00
|
|
|
share();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-10-27 15:25:01 +00:00
|
|
|
@Override
|
|
|
|
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
|
|
|
|
if (grantResults.length > 0)
|
|
|
|
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
|
|
|
if (requestCode == REQUEST_STORAGE_PERMISSION) {
|
|
|
|
if (this.mPendingConversation != null) {
|
|
|
|
share(this.mPendingConversation);
|
|
|
|
} else {
|
|
|
|
Log.d(Config.LOGTAG,"unable to find stored conversation");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
Toast.makeText(this, R.string.no_storage_permission, Toast.LENGTH_SHORT).show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-10-22 16:38:44 +00:00
|
|
|
@Override
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
super.onCreate(savedInstanceState);
|
2017-11-06 11:16:55 +00:00
|
|
|
new EmojiService(this).init();
|
2018-03-18 08:30:22 +00:00
|
|
|
|
|
|
|
setContentView(R.layout.activity_share_with);
|
|
|
|
|
|
|
|
setSupportActionBar(findViewById(R.id.toolbar));
|
2018-02-16 11:30:46 +00:00
|
|
|
if (getSupportActionBar() != null) {
|
|
|
|
getSupportActionBar().setDisplayHomeAsUpEnabled(false);
|
|
|
|
getSupportActionBar().setHomeButtonEnabled(false);
|
2014-12-16 03:31:55 +00:00
|
|
|
}
|
2014-10-22 16:38:44 +00:00
|
|
|
|
|
|
|
setTitle(getString(R.string.title_activity_sharewith));
|
|
|
|
|
2017-10-27 15:25:01 +00:00
|
|
|
mListView = findViewById(R.id.choose_conversation_list);
|
2016-03-16 09:46:33 +00:00
|
|
|
mAdapter = new ConversationAdapter(this, this.mConversations);
|
2018-04-06 11:49:50 +00:00
|
|
|
mListView.setLayoutManager(new LinearLayoutManager(this,LinearLayoutManager.VERTICAL,false));
|
2014-10-22 16:38:44 +00:00
|
|
|
mListView.setAdapter(mAdapter);
|
2018-04-06 11:49:50 +00:00
|
|
|
mAdapter.setConversationClickListener((view, conversation) -> share(conversation));
|
2014-10-22 16:38:44 +00:00
|
|
|
this.share = new Share();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean onCreateOptionsMenu(Menu menu) {
|
|
|
|
getMenuInflater().inflate(R.menu.share_with, menu);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2014-12-21 20:43:58 +00:00
|
|
|
public boolean onOptionsItemSelected(final MenuItem item) {
|
2014-10-22 16:38:44 +00:00
|
|
|
switch (item.getItemId()) {
|
2015-07-02 21:51:59 +00:00
|
|
|
case R.id.action_add:
|
|
|
|
final Intent intent = new Intent(getApplicationContext(), ChooseContactActivity.class);
|
|
|
|
startActivityForResult(intent, REQUEST_START_NEW_CONVERSATION);
|
|
|
|
return true;
|
2014-10-22 16:38:44 +00:00
|
|
|
}
|
|
|
|
return super.onOptionsItemSelected(item);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onStart() {
|
2015-04-11 12:53:10 +00:00
|
|
|
super.onStart();
|
|
|
|
Intent intent = getIntent();
|
|
|
|
if (intent == null) {
|
|
|
|
return;
|
|
|
|
}
|
2017-06-30 19:22:35 +00:00
|
|
|
this.mReturnToPrevious = getPreferences().getBoolean("return_to_previous", getResources().getBoolean(R.bool.return_to_previous));
|
2015-04-11 12:53:10 +00:00
|
|
|
final String type = intent.getType();
|
2016-03-16 17:09:19 +00:00
|
|
|
final String action = intent.getAction();
|
|
|
|
Log.d(Config.LOGTAG, "action: "+action+ ", type:"+type);
|
2015-12-06 10:55:37 +00:00
|
|
|
share.uuid = intent.getStringExtra("uuid");
|
2016-03-16 17:09:19 +00:00
|
|
|
if (Intent.ACTION_SEND.equals(action)) {
|
|
|
|
final String text = intent.getStringExtra(Intent.EXTRA_TEXT);
|
|
|
|
final Uri uri = intent.getParcelableExtra(Intent.EXTRA_STREAM);
|
2016-03-20 16:25:16 +00:00
|
|
|
if (type != null && uri != null && (text == null || !type.equals("text/plain"))) {
|
2015-09-02 19:57:52 +00:00
|
|
|
this.share.uris.clear();
|
2015-04-11 12:53:10 +00:00
|
|
|
this.share.uris.add(uri);
|
|
|
|
this.share.image = type.startsWith("image/") || isImage(uri);
|
2018-03-03 15:58:04 +00:00
|
|
|
this.share.type = type;
|
2015-04-11 12:53:10 +00:00
|
|
|
} else {
|
2016-03-16 17:09:19 +00:00
|
|
|
this.share.text = text;
|
2015-04-11 12:53:10 +00:00
|
|
|
}
|
2016-03-16 17:09:19 +00:00
|
|
|
} else if (Intent.ACTION_SEND_MULTIPLE.equals(action)) {
|
2015-04-11 12:53:10 +00:00
|
|
|
this.share.image = type != null && type.startsWith("image/");
|
|
|
|
if (!this.share.image) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
this.share.uris = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
|
2014-10-22 16:38:44 +00:00
|
|
|
}
|
|
|
|
if (xmppConnectionServiceBound) {
|
2015-12-06 10:55:37 +00:00
|
|
|
if (share.uuid != null) {
|
|
|
|
share();
|
|
|
|
} else {
|
|
|
|
xmppConnectionService.populateWithOrderedConversations(mConversations, this.share.uris.size() == 0);
|
|
|
|
}
|
2014-10-22 16:38:44 +00:00
|
|
|
}
|
2015-04-11 12:53:10 +00:00
|
|
|
|
2014-10-22 16:38:44 +00:00
|
|
|
}
|
|
|
|
|
2015-01-18 19:27:16 +00:00
|
|
|
protected boolean isImage(Uri uri) {
|
|
|
|
try {
|
|
|
|
String guess = URLConnection.guessContentTypeFromName(uri.toString());
|
|
|
|
return (guess != null && guess.startsWith("image/"));
|
|
|
|
} catch (final StringIndexOutOfBoundsException ignored) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-10-22 16:38:44 +00:00
|
|
|
@Override
|
|
|
|
void onBackendConnected() {
|
|
|
|
if (xmppConnectionServiceBound && share != null
|
2015-12-06 10:55:37 +00:00
|
|
|
&& ((share.contact != null && share.account != null) || share.uuid != null)) {
|
2014-10-22 16:38:44 +00:00
|
|
|
share();
|
|
|
|
return;
|
|
|
|
}
|
2016-03-16 09:46:33 +00:00
|
|
|
refreshUiReal();
|
2014-10-22 16:38:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private void share() {
|
2015-07-02 21:51:59 +00:00
|
|
|
final Conversation conversation;
|
2015-12-06 10:55:37 +00:00
|
|
|
if (share.uuid != null) {
|
|
|
|
conversation = xmppConnectionService.findConversationByUuid(share.uuid);
|
|
|
|
if (conversation == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
Account account;
|
|
|
|
try {
|
2018-03-05 17:30:40 +00:00
|
|
|
account = xmppConnectionService.findAccountByJid(Jid.of(share.account));
|
|
|
|
} catch (final IllegalArgumentException e) {
|
2015-12-06 10:55:37 +00:00
|
|
|
account = null;
|
|
|
|
}
|
|
|
|
if (account == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
conversation = xmppConnectionService
|
2018-03-05 17:30:40 +00:00
|
|
|
.findOrCreateConversation(account, Jid.of(share.contact), false,true);
|
|
|
|
} catch (final IllegalArgumentException e) {
|
2015-12-06 10:55:37 +00:00
|
|
|
return;
|
|
|
|
}
|
2015-07-02 21:51:59 +00:00
|
|
|
}
|
|
|
|
share(conversation);
|
2014-10-22 16:38:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private void share(final Conversation conversation) {
|
2017-10-27 15:25:01 +00:00
|
|
|
if (share.uris.size() != 0 && !hasStoragePermission(REQUEST_STORAGE_PERMISSION)) {
|
|
|
|
mPendingConversation = conversation;
|
|
|
|
return;
|
|
|
|
}
|
2016-03-31 22:03:14 +00:00
|
|
|
final Account account = conversation.getAccount();
|
2016-04-29 11:24:26 +00:00
|
|
|
final XmppConnection connection = account.getXmppConnection();
|
|
|
|
final long max = connection == null ? -1 : connection.getFeatures().getMaxHttpUploadSize();
|
2016-03-16 09:46:33 +00:00
|
|
|
mListView.setEnabled(false);
|
2015-12-05 18:03:17 +00:00
|
|
|
if (conversation.getNextEncryption() == Message.ENCRYPTION_PGP && !hasPgp()) {
|
2015-12-06 10:55:37 +00:00
|
|
|
if (share.uuid == null) {
|
|
|
|
showInstallPgpDialog();
|
|
|
|
} else {
|
|
|
|
Toast.makeText(this,R.string.openkeychain_not_installed,Toast.LENGTH_SHORT).show();
|
|
|
|
finish();
|
|
|
|
}
|
2015-12-05 18:03:17 +00:00
|
|
|
return;
|
|
|
|
}
|
2015-04-11 12:53:10 +00:00
|
|
|
if (share.uris.size() != 0) {
|
2018-02-20 13:54:32 +00:00
|
|
|
PresenceSelector.OnPresenceSelected callback = () -> {
|
2018-01-01 10:56:31 +00:00
|
|
|
attachmentCounter.set(share.uris.size());
|
|
|
|
if (share.image) {
|
|
|
|
share.multiple = share.uris.size() > 1;
|
|
|
|
replaceToast(getString(share.multiple ? R.string.preparing_images : R.string.preparing_image));
|
|
|
|
for (Iterator<Uri> i = share.uris.iterator(); i.hasNext(); i.remove()) {
|
2018-01-23 21:02:28 +00:00
|
|
|
final Uri uri = i.next();
|
|
|
|
delegateUriPermissionsToService(uri);
|
2018-01-25 11:48:04 +00:00
|
|
|
xmppConnectionService.attachImageToConversation(conversation, uri, attachFileCallback);
|
2014-12-16 03:31:55 +00:00
|
|
|
}
|
2018-01-01 10:56:31 +00:00
|
|
|
} else {
|
|
|
|
replaceToast(getString(R.string.preparing_file));
|
2018-01-23 21:02:28 +00:00
|
|
|
final Uri uri = share.uris.get(0);
|
|
|
|
delegateUriPermissionsToService(uri);
|
2018-03-03 15:58:04 +00:00
|
|
|
xmppConnectionService.attachFileToConversation(conversation, uri, share.type, attachFileCallback);
|
2014-10-22 16:38:44 +00:00
|
|
|
}
|
2015-07-02 21:51:59 +00:00
|
|
|
};
|
2016-03-31 22:03:14 +00:00
|
|
|
if (account.httpUploadAvailable()
|
2016-04-02 16:07:38 +00:00
|
|
|
&& ((share.image && !neverCompressPictures())
|
2016-03-31 22:03:14 +00:00
|
|
|
|| conversation.getMode() == Conversation.MODE_MULTI
|
2018-02-19 12:55:48 +00:00
|
|
|
|| FileBackend.allFilesUnderSize(this, share.uris, max))) {
|
2015-07-02 21:51:59 +00:00
|
|
|
callback.onPresenceSelected();
|
|
|
|
} else {
|
|
|
|
selectPresence(conversation, callback);
|
|
|
|
}
|
2014-10-22 16:38:44 +00:00
|
|
|
} else {
|
2016-04-14 19:12:44 +00:00
|
|
|
if (mReturnToPrevious && this.share.text != null && !this.share.text.isEmpty() ) {
|
2018-02-20 13:54:32 +00:00
|
|
|
final PresenceSelector.OnPresenceSelected callback = new PresenceSelector.OnPresenceSelected() {
|
2017-01-17 14:56:21 +00:00
|
|
|
|
|
|
|
private void finishAndSend(Message message) {
|
|
|
|
replaceToast(getString(R.string.shared_text_with_x, conversation.getName()));
|
|
|
|
finish();
|
|
|
|
}
|
|
|
|
|
|
|
|
private UiCallback<Message> messageEncryptionCallback = new UiCallback<Message>() {
|
|
|
|
@Override
|
|
|
|
public void success(final Message message) {
|
2018-02-27 10:44:23 +00:00
|
|
|
runOnUiThread(() -> finishAndSend(message));
|
2017-01-17 14:56:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void error(final int errorCode, Message object) {
|
2018-02-27 10:44:23 +00:00
|
|
|
runOnUiThread(() -> {
|
|
|
|
replaceToast(getString(errorCode));
|
|
|
|
finish();
|
2017-01-17 14:56:21 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void userInputRequried(PendingIntent pi, Message object) {
|
|
|
|
finish();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-04-14 19:12:44 +00:00
|
|
|
@Override
|
|
|
|
public void onPresenceSelected() {
|
2017-01-17 14:56:21 +00:00
|
|
|
|
|
|
|
final int encryption = conversation.getNextEncryption();
|
|
|
|
|
|
|
|
Message message = new Message(conversation,share.text, encryption);
|
|
|
|
|
|
|
|
Log.d(Config.LOGTAG,"on presence selected encrpytion="+encryption);
|
|
|
|
|
|
|
|
if (encryption == Message.ENCRYPTION_PGP) {
|
|
|
|
replaceToast(getString(R.string.encrypting_message));
|
|
|
|
xmppConnectionService.getPgpEngine().encrypt(message,messageEncryptionCallback);
|
|
|
|
return;
|
|
|
|
}
|
2018-02-27 10:44:23 +00:00
|
|
|
xmppConnectionService.sendMessage(message);
|
2017-01-17 14:56:21 +00:00
|
|
|
finishAndSend(message);
|
2016-04-14 19:12:44 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
if (conversation.getNextEncryption() == Message.ENCRYPTION_OTR) {
|
|
|
|
selectPresence(conversation, callback);
|
|
|
|
} else {
|
|
|
|
callback.onPresenceSelected();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
switchToConversation(conversation, this.share.text, true);
|
|
|
|
}
|
2014-10-22 16:38:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-07-20 13:48:58 +00:00
|
|
|
public void refreshUiReal() {
|
2016-03-16 09:46:33 +00:00
|
|
|
xmppConnectionService.populateWithOrderedConversations(mConversations, this.share != null && this.share.uris.size() == 0);
|
|
|
|
mAdapter.notifyDataSetChanged();
|
2015-07-20 13:48:58 +00:00
|
|
|
}
|
|
|
|
|
2016-03-16 09:46:33 +00:00
|
|
|
@Override
|
|
|
|
public void onBackPressed() {
|
|
|
|
if (attachmentCounter.get() >= 1) {
|
|
|
|
replaceToast(getString(R.string.sharing_files_please_wait));
|
|
|
|
} else {
|
|
|
|
super.onBackPressed();
|
|
|
|
}
|
|
|
|
}
|
2014-12-16 03:31:55 +00:00
|
|
|
}
|