refactored ui listeners a little bit
This commit is contained in:
parent
fd5760d27a
commit
9968ae5260
|
@ -98,8 +98,7 @@ public class PgpEngine {
|
||||||
message.setEncryption(Message.ENCRYPTION_DECRYPTED);
|
message.setEncryption(Message.ENCRYPTION_DECRYPTED);
|
||||||
PgpEngine.this.mXmppConnectionService
|
PgpEngine.this.mXmppConnectionService
|
||||||
.updateMessage(message);
|
.updateMessage(message);
|
||||||
PgpEngine.this.mXmppConnectionService.updateUi(
|
PgpEngine.this.mXmppConnectionService.updateConversationUi();
|
||||||
message.getConversation(), false);
|
|
||||||
callback.success(message);
|
callback.success(message);
|
||||||
return;
|
return;
|
||||||
case OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED:
|
case OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED:
|
||||||
|
|
|
@ -114,7 +114,7 @@ public class MessageParser extends AbstractParser implements
|
||||||
if (packet.hasChild("subject")) {
|
if (packet.hasChild("subject")) {
|
||||||
conversation.getMucOptions().setSubject(
|
conversation.getMucOptions().setSubject(
|
||||||
packet.findChild("subject").getContent());
|
packet.findChild("subject").getContent());
|
||||||
mXmppConnectionService.updateUi(conversation, false);
|
mXmppConnectionService.updateConversationUi();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if ((fromParts.length == 1)) {
|
if ((fromParts.length == 1)) {
|
||||||
|
@ -217,10 +217,10 @@ public class MessageParser extends AbstractParser implements
|
||||||
} else if (packet.hasChild("x")) {
|
} else if (packet.hasChild("x")) {
|
||||||
Element x = packet.findChild("x");
|
Element x = packet.findChild("x");
|
||||||
if (x.hasChild("invite")) {
|
if (x.hasChild("invite")) {
|
||||||
Conversation conversation = mXmppConnectionService
|
mXmppConnectionService
|
||||||
.findOrCreateConversation(account,
|
.findOrCreateConversation(account,
|
||||||
packet.getAttribute("from"), true);
|
packet.getAttribute("from"), true);
|
||||||
mXmppConnectionService.updateUi(conversation, false);
|
mXmppConnectionService.updateConversationUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -318,6 +318,6 @@ public class MessageParser extends AbstractParser implements
|
||||||
if (packet.getType() != MessagePacket.TYPE_ERROR) {
|
if (packet.getType() != MessagePacket.TYPE_ERROR) {
|
||||||
mXmppConnectionService.databaseBackend.createMessage(message);
|
mXmppConnectionService.databaseBackend.createMessage(message);
|
||||||
}
|
}
|
||||||
mXmppConnectionService.updateUi(conversation, notify);
|
mXmppConnectionService.notifyUi(conversation, notify);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class PresenceParser extends AbstractParser implements
|
||||||
int error = muc.getMucOptions().getError();
|
int error = muc.getMucOptions().getError();
|
||||||
muc.getMucOptions().processPacket(packet, mPgpEngine);
|
muc.getMucOptions().processPacket(packet, mPgpEngine);
|
||||||
if (muc.getMucOptions().getError() != error) {
|
if (muc.getMucOptions().getError() != error) {
|
||||||
mXmppConnectionService.updateUi(muc, false);
|
mXmppConnectionService.updateConversationUi();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,8 +33,6 @@ import eu.siacs.conversations.parser.MessageParser;
|
||||||
import eu.siacs.conversations.parser.PresenceParser;
|
import eu.siacs.conversations.parser.PresenceParser;
|
||||||
import eu.siacs.conversations.persistance.DatabaseBackend;
|
import eu.siacs.conversations.persistance.DatabaseBackend;
|
||||||
import eu.siacs.conversations.persistance.FileBackend;
|
import eu.siacs.conversations.persistance.FileBackend;
|
||||||
import eu.siacs.conversations.ui.OnAccountListChangedListener;
|
|
||||||
import eu.siacs.conversations.ui.OnConversationListChangedListener;
|
|
||||||
import eu.siacs.conversations.ui.UiCallback;
|
import eu.siacs.conversations.ui.UiCallback;
|
||||||
import eu.siacs.conversations.utils.CryptoHelper;
|
import eu.siacs.conversations.utils.CryptoHelper;
|
||||||
import eu.siacs.conversations.utils.ExceptionHelper;
|
import eu.siacs.conversations.utils.ExceptionHelper;
|
||||||
|
@ -103,9 +101,9 @@ public class XmppConnectionService extends Service {
|
||||||
private JingleConnectionManager mJingleConnectionManager = new JingleConnectionManager(
|
private JingleConnectionManager mJingleConnectionManager = new JingleConnectionManager(
|
||||||
this);
|
this);
|
||||||
|
|
||||||
private OnConversationListChangedListener convChangedListener = null;
|
private OnConversationUpdate mOnConversationUpdate = null;
|
||||||
private int convChangedListenerCount = 0;
|
private int convChangedListenerCount = 0;
|
||||||
private OnAccountListChangedListener accountChangedListener = null;
|
private OnAccountUpdate mOnAccountUpdate = null;
|
||||||
private OnTLSExceptionReceived tlsException = null;
|
private OnTLSExceptionReceived tlsException = null;
|
||||||
public OnContactStatusChanged onContactStatusChanged = new OnContactStatusChanged() {
|
public OnContactStatusChanged onContactStatusChanged = new OnContactStatusChanged() {
|
||||||
|
|
||||||
|
@ -144,8 +142,8 @@ public class XmppConnectionService extends Service {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStatusChanged(Account account) {
|
public void onStatusChanged(Account account) {
|
||||||
if (accountChangedListener != null) {
|
if (mOnAccountUpdate != null) {
|
||||||
accountChangedListener.onAccountListChangedListener();
|
mOnAccountUpdate.onAccountUpdate();;
|
||||||
}
|
}
|
||||||
if (account.getStatus() == Account.STATUS_ONLINE) {
|
if (account.getStatus() == Account.STATUS_ONLINE) {
|
||||||
mJingleConnectionManager.cancelInTransmission();
|
mJingleConnectionManager.cancelInTransmission();
|
||||||
|
@ -329,8 +327,8 @@ public class XmppConnectionService extends Service {
|
||||||
// in any case. reschedule wakup call
|
// in any case. reschedule wakup call
|
||||||
this.scheduleWakeupCall(PING_MAX_INTERVAL, true);
|
this.scheduleWakeupCall(PING_MAX_INTERVAL, true);
|
||||||
}
|
}
|
||||||
if (accountChangedListener != null) {
|
if (mOnAccountUpdate != null) {
|
||||||
accountChangedListener.onAccountListChangedListener();
|
mOnAccountUpdate.onAccountUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -470,9 +468,7 @@ public class XmppConnectionService extends Service {
|
||||||
fetchRosterFromServer(account);
|
fetchRosterFromServer(account);
|
||||||
sendPresencePacket(account, mPresenceGenerator.sendPresence(account));
|
sendPresencePacket(account, mPresenceGenerator.sendPresence(account));
|
||||||
connectMultiModeConversations(account);
|
connectMultiModeConversations(account);
|
||||||
if (convChangedListener != null) {
|
updateConversationUi();
|
||||||
convChangedListener.onConversationListChanged();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return connection;
|
return connection;
|
||||||
|
@ -565,9 +561,7 @@ public class XmppConnectionService extends Service {
|
||||||
databaseBackend.createMessage(message);
|
databaseBackend.createMessage(message);
|
||||||
}
|
}
|
||||||
conv.getMessages().add(message);
|
conv.getMessages().add(message);
|
||||||
if (convChangedListener != null) {
|
updateConversationUi();
|
||||||
convChangedListener.onConversationListChanged();
|
|
||||||
}
|
|
||||||
if ((send) && (packet != null)) {
|
if ((send) && (packet != null)) {
|
||||||
sendMessagePacket(account, packet);
|
sendMessagePacket(account, packet);
|
||||||
}
|
}
|
||||||
|
@ -798,9 +792,7 @@ public class XmppConnectionService extends Service {
|
||||||
&& (conversation.getMode() == Conversation.MODE_MULTI)) {
|
&& (conversation.getMode() == Conversation.MODE_MULTI)) {
|
||||||
joinMuc(conversation);
|
joinMuc(conversation);
|
||||||
}
|
}
|
||||||
if (this.convChangedListener != null) {
|
updateConversationUi();
|
||||||
this.convChangedListener.onConversationListChanged();
|
|
||||||
}
|
|
||||||
return conversation;
|
return conversation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -812,18 +804,14 @@ public class XmppConnectionService extends Service {
|
||||||
}
|
}
|
||||||
this.databaseBackend.updateConversation(conversation);
|
this.databaseBackend.updateConversation(conversation);
|
||||||
this.conversations.remove(conversation);
|
this.conversations.remove(conversation);
|
||||||
if (this.convChangedListener != null) {
|
updateConversationUi();
|
||||||
this.convChangedListener.onConversationListChanged();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearConversationHistory(Conversation conversation) {
|
public void clearConversationHistory(Conversation conversation) {
|
||||||
this.databaseBackend.deleteMessagesInConversation(conversation);
|
this.databaseBackend.deleteMessagesInConversation(conversation);
|
||||||
this.fileBackend.removeFiles(conversation);
|
this.fileBackend.removeFiles(conversation);
|
||||||
conversation.getMessages().clear();
|
conversation.getMessages().clear();
|
||||||
if (this.convChangedListener != null) {
|
updateConversationUi();
|
||||||
this.convChangedListener.onConversationListChanged();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getConversationCount() {
|
public int getConversationCount() {
|
||||||
|
@ -834,17 +822,14 @@ public class XmppConnectionService extends Service {
|
||||||
databaseBackend.createAccount(account);
|
databaseBackend.createAccount(account);
|
||||||
this.accounts.add(account);
|
this.accounts.add(account);
|
||||||
this.reconnectAccount(account, false);
|
this.reconnectAccount(account, false);
|
||||||
if (accountChangedListener != null)
|
updateAccountUi();
|
||||||
accountChangedListener.onAccountListChangedListener();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateAccount(Account account) {
|
public void updateAccount(Account account) {
|
||||||
this.statusListener.onStatusChanged(account);
|
this.statusListener.onStatusChanged(account);
|
||||||
databaseBackend.updateAccount(account);
|
databaseBackend.updateAccount(account);
|
||||||
reconnectAccount(account, false);
|
reconnectAccount(account, false);
|
||||||
if (accountChangedListener != null) {
|
updateAccountUi();
|
||||||
accountChangedListener.onAccountListChangedListener();
|
|
||||||
}
|
|
||||||
UIHelper.showErrorNotification(getApplicationContext(), getAccounts());
|
UIHelper.showErrorNotification(getApplicationContext(), getAccounts());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -854,32 +839,29 @@ public class XmppConnectionService extends Service {
|
||||||
}
|
}
|
||||||
databaseBackend.deleteAccount(account);
|
databaseBackend.deleteAccount(account);
|
||||||
this.accounts.remove(account);
|
this.accounts.remove(account);
|
||||||
if (accountChangedListener != null) {
|
updateAccountUi();
|
||||||
accountChangedListener.onAccountListChangedListener();
|
|
||||||
}
|
|
||||||
UIHelper.showErrorNotification(getApplicationContext(), getAccounts());
|
UIHelper.showErrorNotification(getApplicationContext(), getAccounts());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOnConversationListChangedListener(
|
public void setOnConversationListChangedListener(
|
||||||
OnConversationListChangedListener listener) {
|
OnConversationUpdate listener) {
|
||||||
this.convChangedListener = listener;
|
this.mOnConversationUpdate = listener;
|
||||||
this.convChangedListenerCount++;
|
this.convChangedListenerCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeOnConversationListChangedListener() {
|
public void removeOnConversationListChangedListener() {
|
||||||
this.convChangedListenerCount--;
|
this.convChangedListenerCount--;
|
||||||
if (this.convChangedListenerCount == 0) {
|
if (this.convChangedListenerCount == 0) {
|
||||||
this.convChangedListener = null;
|
this.mOnConversationUpdate = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOnAccountListChangedListener(
|
public void setOnAccountListChangedListener(OnAccountUpdate listener) {
|
||||||
OnAccountListChangedListener listener) {
|
this.mOnAccountUpdate = listener;
|
||||||
this.accountChangedListener = listener;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeOnAccountListChangedListener() {
|
public void removeOnAccountListChangedListener() {
|
||||||
this.accountChangedListener = null;
|
this.mOnAccountUpdate = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void connectMultiModeConversations(Account account) {
|
public void connectMultiModeConversations(Account account) {
|
||||||
|
@ -1062,7 +1044,7 @@ public class XmppConnectionService extends Service {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateUi(conversation, false);
|
notifyUi(conversation, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean renewSymmetricKey(Conversation conversation) {
|
public boolean renewSymmetricKey(Conversation conversation) {
|
||||||
|
@ -1197,9 +1179,7 @@ public class XmppConnectionService extends Service {
|
||||||
public void markMessage(Message message, int status) {
|
public void markMessage(Message message, int status) {
|
||||||
message.setStatus(status);
|
message.setStatus(status);
|
||||||
databaseBackend.updateMessage(message);
|
databaseBackend.updateMessage(message);
|
||||||
if (convChangedListener != null) {
|
updateConversationUi();
|
||||||
convChangedListener.onConversationListChanged();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public SharedPreferences getPreferences() {
|
public SharedPreferences getPreferences() {
|
||||||
|
@ -1211,15 +1191,27 @@ public class XmppConnectionService extends Service {
|
||||||
return getPreferences().getBoolean("confirm_messages", true);
|
return getPreferences().getBoolean("confirm_messages", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateUi(Conversation conversation, boolean notify) {
|
public void notifyUi(Conversation conversation, boolean notify) {
|
||||||
if (convChangedListener != null) {
|
if (mOnConversationUpdate != null) {
|
||||||
convChangedListener.onConversationListChanged();
|
mOnConversationUpdate.onConversationUpdate();
|
||||||
} else {
|
} else {
|
||||||
UIHelper.updateNotification(getApplicationContext(),
|
UIHelper.updateNotification(getApplicationContext(),
|
||||||
getConversations(), conversation, notify);
|
getConversations(), conversation, notify);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateConversationUi() {
|
||||||
|
if (mOnConversationUpdate != null) {
|
||||||
|
mOnConversationUpdate.onConversationUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateAccountUi() {
|
||||||
|
if (mOnAccountUpdate != null) {
|
||||||
|
mOnAccountUpdate.onAccountUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Account findAccountByJid(String accountJid) {
|
public Account findAccountByJid(String accountJid) {
|
||||||
for (Account account : this.accounts) {
|
for (Account account : this.accounts) {
|
||||||
if (account.getJid().equals(accountJid)) {
|
if (account.getJid().equals(accountJid)) {
|
||||||
|
@ -1316,4 +1308,16 @@ public class XmppConnectionService extends Service {
|
||||||
public JingleConnectionManager getJingleConnectionManager() {
|
public JingleConnectionManager getJingleConnectionManager() {
|
||||||
return this.mJingleConnectionManager;
|
return this.mJingleConnectionManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface OnConversationUpdate {
|
||||||
|
public void onConversationUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OnAccountUpdate {
|
||||||
|
public void onAccountUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OnRosterUpdate {
|
||||||
|
public void onRosterUpdate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import eu.siacs.conversations.entities.Contact;
|
||||||
import eu.siacs.conversations.entities.Conversation;
|
import eu.siacs.conversations.entities.Conversation;
|
||||||
import eu.siacs.conversations.entities.Message;
|
import eu.siacs.conversations.entities.Message;
|
||||||
import eu.siacs.conversations.services.ImageProvider;
|
import eu.siacs.conversations.services.ImageProvider;
|
||||||
|
import eu.siacs.conversations.services.XmppConnectionService.OnConversationUpdate;
|
||||||
import eu.siacs.conversations.utils.ExceptionHelper;
|
import eu.siacs.conversations.utils.ExceptionHelper;
|
||||||
import eu.siacs.conversations.utils.UIHelper;
|
import eu.siacs.conversations.utils.UIHelper;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
@ -83,10 +84,10 @@ public class ConversationActivity extends XmppActivity {
|
||||||
private boolean showLastseen = false;
|
private boolean showLastseen = false;
|
||||||
private ArrayAdapter<Conversation> listAdapter;
|
private ArrayAdapter<Conversation> listAdapter;
|
||||||
|
|
||||||
private OnConversationListChangedListener onConvChanged = new OnConversationListChangedListener() {
|
private OnConversationUpdate onConvChanged = new OnConversationUpdate() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConversationListChanged() {
|
public void onConversationUpdate() {
|
||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(new Runnable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -655,7 +656,7 @@ public class ConversationActivity extends XmppActivity {
|
||||||
this.onBackendConnected();
|
this.onBackendConnected();
|
||||||
}
|
}
|
||||||
if (conversationList.size() >= 1) {
|
if (conversationList.size() >= 1) {
|
||||||
onConvChanged.onConversationListChanged();
|
onConvChanged.onConversationUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||||
|
|
||||||
import eu.siacs.conversations.R;
|
import eu.siacs.conversations.R;
|
||||||
import eu.siacs.conversations.entities.Account;
|
import eu.siacs.conversations.entities.Account;
|
||||||
|
import eu.siacs.conversations.services.XmppConnectionService.OnAccountUpdate;
|
||||||
import eu.siacs.conversations.ui.EditAccount.EditAccountListener;
|
import eu.siacs.conversations.ui.EditAccount.EditAccountListener;
|
||||||
import eu.siacs.conversations.xmpp.OnTLSExceptionReceived;
|
import eu.siacs.conversations.xmpp.OnTLSExceptionReceived;
|
||||||
import eu.siacs.conversations.xmpp.XmppConnection;
|
import eu.siacs.conversations.xmpp.XmppConnection;
|
||||||
|
@ -42,10 +43,10 @@ public class ManageAccountActivity extends XmppActivity {
|
||||||
protected List<Account> accountList = new ArrayList<Account>();
|
protected List<Account> accountList = new ArrayList<Account>();
|
||||||
protected ListView accountListView;
|
protected ListView accountListView;
|
||||||
protected ArrayAdapter<Account> accountListViewAdapter;
|
protected ArrayAdapter<Account> accountListViewAdapter;
|
||||||
protected OnAccountListChangedListener accountChanged = new OnAccountListChangedListener() {
|
protected OnAccountUpdate accountChanged = new OnAccountUpdate() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAccountListChangedListener() {
|
public void onAccountUpdate() {
|
||||||
accountList.clear();
|
accountList.clear();
|
||||||
accountList.addAll(xmppConnectionService.getAccounts());
|
accountList.addAll(xmppConnectionService.getAccounts());
|
||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(new Runnable() {
|
||||||
|
@ -61,37 +62,45 @@ public class ManageAccountActivity extends XmppActivity {
|
||||||
protected OnTLSExceptionReceived tlsExceptionReceived = new OnTLSExceptionReceived() {
|
protected OnTLSExceptionReceived tlsExceptionReceived = new OnTLSExceptionReceived() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTLSExceptionReceived(final String fingerprint, final Account account) {
|
public void onTLSExceptionReceived(final String fingerprint,
|
||||||
|
final Account account) {
|
||||||
activity.runOnUiThread(new Runnable() {
|
activity.runOnUiThread(new Runnable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
AlertDialog.Builder builder = new AlertDialog.Builder(
|
||||||
|
activity);
|
||||||
builder.setTitle(getString(R.string.account_status_error));
|
builder.setTitle(getString(R.string.account_status_error));
|
||||||
builder.setIconAttribute(android.R.attr.alertDialogIcon);
|
builder.setIconAttribute(android.R.attr.alertDialogIcon);
|
||||||
View view = (View) getLayoutInflater().inflate(R.layout.cert_warning, null);
|
View view = (View) getLayoutInflater().inflate(
|
||||||
|
R.layout.cert_warning, null);
|
||||||
TextView sha = (TextView) view.findViewById(R.id.sha);
|
TextView sha = (TextView) view.findViewById(R.id.sha);
|
||||||
TextView hint = (TextView) view.findViewById(R.id.hint);
|
TextView hint = (TextView) view.findViewById(R.id.hint);
|
||||||
StringBuilder humanReadableSha = new StringBuilder();
|
StringBuilder humanReadableSha = new StringBuilder();
|
||||||
humanReadableSha.append(fingerprint);
|
humanReadableSha.append(fingerprint);
|
||||||
for(int i = 2; i < 59; i += 3) {
|
for (int i = 2; i < 59; i += 3) {
|
||||||
if ((i==14)||(i==29)||(i==44)) {
|
if ((i == 14) || (i == 29) || (i == 44)) {
|
||||||
humanReadableSha.insert(i, "\n");
|
humanReadableSha.insert(i, "\n");
|
||||||
} else {
|
} else {
|
||||||
humanReadableSha.insert(i, ":");
|
humanReadableSha.insert(i, ":");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
hint.setText(getString(R.string.untrusted_cert_hint,account.getServer()));
|
hint.setText(getString(R.string.untrusted_cert_hint,
|
||||||
|
account.getServer()));
|
||||||
sha.setText(humanReadableSha.toString());
|
sha.setText(humanReadableSha.toString());
|
||||||
builder.setView(view);
|
builder.setView(view);
|
||||||
builder.setNegativeButton(getString(R.string.certif_no_trust), null);
|
builder.setNegativeButton(
|
||||||
builder.setPositiveButton(getString(R.string.certif_trust), new OnClickListener() {
|
getString(R.string.certif_no_trust), null);
|
||||||
|
builder.setPositiveButton(getString(R.string.certif_trust),
|
||||||
|
new OnClickListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog,
|
||||||
|
int which) {
|
||||||
account.setSSLCertFingerprint(fingerprint);
|
account.setSSLCertFingerprint(fingerprint);
|
||||||
activity.xmppConnectionService.updateAccount(account);
|
activity.xmppConnectionService
|
||||||
|
.updateAccount(account);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
builder.create().show();
|
builder.create().show();
|
||||||
|
@ -124,55 +133,68 @@ public class ManageAccountActivity extends XmppActivity {
|
||||||
.findViewById(R.id.account_status);
|
.findViewById(R.id.account_status);
|
||||||
switch (account.getStatus()) {
|
switch (account.getStatus()) {
|
||||||
case Account.STATUS_DISABLED:
|
case Account.STATUS_DISABLED:
|
||||||
statusView.setText(getString(R.string.account_status_disabled));
|
statusView
|
||||||
|
.setText(getString(R.string.account_status_disabled));
|
||||||
statusView.setTextColor(0xFF1da9da);
|
statusView.setTextColor(0xFF1da9da);
|
||||||
break;
|
break;
|
||||||
case Account.STATUS_ONLINE:
|
case Account.STATUS_ONLINE:
|
||||||
statusView.setText(getString(R.string.account_status_online));
|
statusView
|
||||||
|
.setText(getString(R.string.account_status_online));
|
||||||
statusView.setTextColor(0xFF83b600);
|
statusView.setTextColor(0xFF83b600);
|
||||||
break;
|
break;
|
||||||
case Account.STATUS_CONNECTING:
|
case Account.STATUS_CONNECTING:
|
||||||
statusView.setText(getString(R.string.account_status_connecting));
|
statusView
|
||||||
|
.setText(getString(R.string.account_status_connecting));
|
||||||
statusView.setTextColor(0xFF1da9da);
|
statusView.setTextColor(0xFF1da9da);
|
||||||
break;
|
break;
|
||||||
case Account.STATUS_OFFLINE:
|
case Account.STATUS_OFFLINE:
|
||||||
statusView.setText(getString(R.string.account_status_offline));
|
statusView
|
||||||
|
.setText(getString(R.string.account_status_offline));
|
||||||
statusView.setTextColor(0xFFe92727);
|
statusView.setTextColor(0xFFe92727);
|
||||||
break;
|
break;
|
||||||
case Account.STATUS_UNAUTHORIZED:
|
case Account.STATUS_UNAUTHORIZED:
|
||||||
statusView.setText(getString(R.string.account_status_unauthorized));
|
statusView
|
||||||
|
.setText(getString(R.string.account_status_unauthorized));
|
||||||
statusView.setTextColor(0xFFe92727);
|
statusView.setTextColor(0xFFe92727);
|
||||||
break;
|
break;
|
||||||
case Account.STATUS_SERVER_NOT_FOUND:
|
case Account.STATUS_SERVER_NOT_FOUND:
|
||||||
statusView.setText(getString(R.string.account_status_not_found));
|
statusView
|
||||||
|
.setText(getString(R.string.account_status_not_found));
|
||||||
statusView.setTextColor(0xFFe92727);
|
statusView.setTextColor(0xFFe92727);
|
||||||
break;
|
break;
|
||||||
case Account.STATUS_NO_INTERNET:
|
case Account.STATUS_NO_INTERNET:
|
||||||
statusView.setText(getString(R.string.account_status_no_internet));
|
statusView
|
||||||
|
.setText(getString(R.string.account_status_no_internet));
|
||||||
statusView.setTextColor(0xFFe92727);
|
statusView.setTextColor(0xFFe92727);
|
||||||
break;
|
break;
|
||||||
case Account.STATUS_SERVER_REQUIRES_TLS:
|
case Account.STATUS_SERVER_REQUIRES_TLS:
|
||||||
statusView.setText(getString(R.string.account_status_requires_tls));
|
statusView
|
||||||
|
.setText(getString(R.string.account_status_requires_tls));
|
||||||
statusView.setTextColor(0xFFe92727);
|
statusView.setTextColor(0xFFe92727);
|
||||||
break;
|
break;
|
||||||
case Account.STATUS_TLS_ERROR:
|
case Account.STATUS_TLS_ERROR:
|
||||||
statusView.setText(getString(R.string.account_status_error));
|
statusView
|
||||||
|
.setText(getString(R.string.account_status_error));
|
||||||
statusView.setTextColor(0xFFe92727);
|
statusView.setTextColor(0xFFe92727);
|
||||||
break;
|
break;
|
||||||
case Account.STATUS_REGISTRATION_FAILED:
|
case Account.STATUS_REGISTRATION_FAILED:
|
||||||
statusView.setText(getString(R.string.account_status_regis_fail));
|
statusView
|
||||||
|
.setText(getString(R.string.account_status_regis_fail));
|
||||||
statusView.setTextColor(0xFFe92727);
|
statusView.setTextColor(0xFFe92727);
|
||||||
break;
|
break;
|
||||||
case Account.STATUS_REGISTRATION_CONFLICT:
|
case Account.STATUS_REGISTRATION_CONFLICT:
|
||||||
statusView.setText(getString(R.string.account_status_regis_conflict));
|
statusView
|
||||||
|
.setText(getString(R.string.account_status_regis_conflict));
|
||||||
statusView.setTextColor(0xFFe92727);
|
statusView.setTextColor(0xFFe92727);
|
||||||
break;
|
break;
|
||||||
case Account.STATUS_REGISTRATION_SUCCESSFULL:
|
case Account.STATUS_REGISTRATION_SUCCESSFULL:
|
||||||
statusView.setText(getString(R.string.account_status_regis_success));
|
statusView
|
||||||
|
.setText(getString(R.string.account_status_regis_success));
|
||||||
statusView.setTextColor(0xFF83b600);
|
statusView.setTextColor(0xFF83b600);
|
||||||
break;
|
break;
|
||||||
case Account.STATUS_REGISTRATION_NOT_SUPPORTED:
|
case Account.STATUS_REGISTRATION_NOT_SUPPORTED:
|
||||||
statusView.setText(getString(R.string.account_status_regis_not_sup));
|
statusView
|
||||||
|
.setText(getString(R.string.account_status_regis_not_sup));
|
||||||
statusView.setTextColor(0xFFe92727);
|
statusView.setTextColor(0xFFe92727);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -192,10 +214,14 @@ public class ManageAccountActivity extends XmppActivity {
|
||||||
int position, long arg3) {
|
int position, long arg3) {
|
||||||
if (!isActionMode) {
|
if (!isActionMode) {
|
||||||
Account account = accountList.get(position);
|
Account account = accountList.get(position);
|
||||||
if ((account.getStatus() == Account.STATUS_OFFLINE)||(account.getStatus() == Account.STATUS_TLS_ERROR)) {
|
if ((account.getStatus() == Account.STATUS_OFFLINE)
|
||||||
activity.xmppConnectionService.reconnectAccount(accountList.get(position),true);
|
|| (account.getStatus() == Account.STATUS_TLS_ERROR)) {
|
||||||
|
activity.xmppConnectionService.reconnectAccount(
|
||||||
|
accountList.get(position), true);
|
||||||
} else if (account.getStatus() == Account.STATUS_ONLINE) {
|
} else if (account.getStatus() == Account.STATUS_ONLINE) {
|
||||||
activity.startActivity(new Intent(activity.getApplicationContext(),StartConversation.class));
|
activity.startActivity(new Intent(activity
|
||||||
|
.getApplicationContext(),
|
||||||
|
StartConversation.class));
|
||||||
} else if (account.getStatus() != Account.STATUS_DISABLED) {
|
} else if (account.getStatus() != Account.STATUS_DISABLED) {
|
||||||
editAccount(account);
|
editAccount(account);
|
||||||
}
|
}
|
||||||
|
@ -205,128 +231,210 @@ public class ManageAccountActivity extends XmppActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
accountListView.setOnItemLongClickListener(new OnItemLongClickListener() {
|
accountListView
|
||||||
|
.setOnItemLongClickListener(new OnItemLongClickListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemLongClick(AdapterView<?> arg0, View view,
|
public boolean onItemLongClick(AdapterView<?> arg0,
|
||||||
int position, long arg3) {
|
View view, int position, long arg3) {
|
||||||
if (!isActionMode) {
|
if (!isActionMode) {
|
||||||
accountListView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
|
accountListView
|
||||||
accountListView.setItemChecked(position,true);
|
.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
|
||||||
selectedAccountForActionMode = accountList.get(position);
|
accountListView.setItemChecked(position, true);
|
||||||
actionMode = activity.startActionMode((new ActionMode.Callback() {
|
selectedAccountForActionMode = accountList
|
||||||
|
.get(position);
|
||||||
|
actionMode = activity
|
||||||
|
.startActionMode((new ActionMode.Callback() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
|
public boolean onPrepareActionMode(
|
||||||
if (selectedAccountForActionMode.isOptionSet(Account.OPTION_DISABLED)) {
|
ActionMode mode, Menu menu) {
|
||||||
menu.findItem(R.id.mgmt_account_enable).setVisible(true);
|
if (selectedAccountForActionMode
|
||||||
menu.findItem(R.id.mgmt_account_disable).setVisible(false);
|
.isOptionSet(Account.OPTION_DISABLED)) {
|
||||||
|
menu.findItem(
|
||||||
|
R.id.mgmt_account_enable)
|
||||||
|
.setVisible(true);
|
||||||
|
menu.findItem(
|
||||||
|
R.id.mgmt_account_disable)
|
||||||
|
.setVisible(false);
|
||||||
} else {
|
} else {
|
||||||
menu.findItem(R.id.mgmt_account_disable).setVisible(true);
|
menu.findItem(
|
||||||
menu.findItem(R.id.mgmt_account_enable).setVisible(false);
|
R.id.mgmt_account_disable)
|
||||||
|
.setVisible(true);
|
||||||
|
menu.findItem(
|
||||||
|
R.id.mgmt_account_enable)
|
||||||
|
.setVisible(false);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroyActionMode(ActionMode mode) {
|
public void onDestroyActionMode(
|
||||||
|
ActionMode mode) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
|
public boolean onCreateActionMode(
|
||||||
MenuInflater inflater = mode.getMenuInflater();
|
ActionMode mode, Menu menu) {
|
||||||
inflater.inflate(R.menu.manageaccounts_context, menu);
|
MenuInflater inflater = mode
|
||||||
|
.getMenuInflater();
|
||||||
|
inflater.inflate(
|
||||||
|
R.menu.manageaccounts_context,
|
||||||
|
menu);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onActionItemClicked(final ActionMode mode, MenuItem item) {
|
public boolean onActionItemClicked(
|
||||||
if (item.getItemId()==R.id.mgmt_account_edit) {
|
final ActionMode mode,
|
||||||
|
MenuItem item) {
|
||||||
|
if (item.getItemId() == R.id.mgmt_account_edit) {
|
||||||
editAccount(selectedAccountForActionMode);
|
editAccount(selectedAccountForActionMode);
|
||||||
} else if (item.getItemId()==R.id.mgmt_account_disable) {
|
} else if (item.getItemId() == R.id.mgmt_account_disable) {
|
||||||
selectedAccountForActionMode.setOption(Account.OPTION_DISABLED, true);
|
selectedAccountForActionMode
|
||||||
xmppConnectionService.updateAccount(selectedAccountForActionMode);
|
.setOption(
|
||||||
|
Account.OPTION_DISABLED,
|
||||||
|
true);
|
||||||
|
xmppConnectionService
|
||||||
|
.updateAccount(selectedAccountForActionMode);
|
||||||
mode.finish();
|
mode.finish();
|
||||||
} else if (item.getItemId()==R.id.mgmt_account_enable) {
|
} else if (item.getItemId() == R.id.mgmt_account_enable) {
|
||||||
selectedAccountForActionMode.setOption(Account.OPTION_DISABLED, false);
|
selectedAccountForActionMode
|
||||||
xmppConnectionService.updateAccount(selectedAccountForActionMode);
|
.setOption(
|
||||||
|
Account.OPTION_DISABLED,
|
||||||
|
false);
|
||||||
|
xmppConnectionService
|
||||||
|
.updateAccount(selectedAccountForActionMode);
|
||||||
mode.finish();
|
mode.finish();
|
||||||
} else if (item.getItemId()==R.id.mgmt_account_delete) {
|
} else if (item.getItemId() == R.id.mgmt_account_delete) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
AlertDialog.Builder builder = new AlertDialog.Builder(
|
||||||
|
activity);
|
||||||
builder.setTitle(getString(R.string.mgmt_account_are_you_sure));
|
builder.setTitle(getString(R.string.mgmt_account_are_you_sure));
|
||||||
builder.setIconAttribute(android.R.attr.alertDialogIcon);
|
builder.setIconAttribute(android.R.attr.alertDialogIcon);
|
||||||
builder.setMessage(getString(R.string.mgmt_account_delete_confirm_text));
|
builder.setMessage(getString(R.string.mgmt_account_delete_confirm_text));
|
||||||
builder.setPositiveButton(getString(R.string.delete), new OnClickListener() {
|
builder.setPositiveButton(
|
||||||
|
getString(R.string.delete),
|
||||||
|
new OnClickListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(
|
||||||
xmppConnectionService.deleteAccount(selectedAccountForActionMode);
|
DialogInterface dialog,
|
||||||
|
int which) {
|
||||||
|
xmppConnectionService
|
||||||
|
.deleteAccount(selectedAccountForActionMode);
|
||||||
selectedAccountForActionMode = null;
|
selectedAccountForActionMode = null;
|
||||||
mode.finish();
|
mode.finish();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
builder.setNegativeButton(getString(R.string.cancel),null);
|
builder.setNegativeButton(
|
||||||
|
getString(R.string.cancel),
|
||||||
|
null);
|
||||||
builder.create().show();
|
builder.create().show();
|
||||||
} else if (item.getItemId()==R.id.mgmt_account_announce_pgp) {
|
} else if (item.getItemId() == R.id.mgmt_account_announce_pgp) {
|
||||||
if (activity.hasPgp()) {
|
if (activity.hasPgp()) {
|
||||||
mode.finish();
|
mode.finish();
|
||||||
announcePgp(selectedAccountForActionMode,null);
|
announcePgp(
|
||||||
|
selectedAccountForActionMode,
|
||||||
|
null);
|
||||||
} else {
|
} else {
|
||||||
activity.showInstallPgpDialog();
|
activity.showInstallPgpDialog();
|
||||||
}
|
}
|
||||||
} else if (item.getItemId() == R.id.mgmt_otr_key) {
|
} else if (item.getItemId() == R.id.mgmt_otr_key) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
AlertDialog.Builder builder = new AlertDialog.Builder(
|
||||||
|
activity);
|
||||||
builder.setTitle("OTR Fingerprint");
|
builder.setTitle("OTR Fingerprint");
|
||||||
String fingerprintTxt = selectedAccountForActionMode.getOtrFingerprint(getApplicationContext());
|
String fingerprintTxt = selectedAccountForActionMode
|
||||||
View view = (View) getLayoutInflater().inflate(R.layout.otr_fingerprint, null);
|
.getOtrFingerprint(getApplicationContext());
|
||||||
if (fingerprintTxt!=null) {
|
View view = (View) getLayoutInflater()
|
||||||
TextView fingerprint = (TextView) view.findViewById(R.id.otr_fingerprint);
|
.inflate(
|
||||||
TextView noFingerprintView = (TextView) view.findViewById(R.id.otr_no_fingerprint);
|
R.layout.otr_fingerprint,
|
||||||
fingerprint.setText(fingerprintTxt);
|
null);
|
||||||
fingerprint.setVisibility(View.VISIBLE);
|
if (fingerprintTxt != null) {
|
||||||
noFingerprintView.setVisibility(View.GONE);
|
TextView fingerprint = (TextView) view
|
||||||
|
.findViewById(R.id.otr_fingerprint);
|
||||||
|
TextView noFingerprintView = (TextView) view
|
||||||
|
.findViewById(R.id.otr_no_fingerprint);
|
||||||
|
fingerprint
|
||||||
|
.setText(fingerprintTxt);
|
||||||
|
fingerprint
|
||||||
|
.setVisibility(View.VISIBLE);
|
||||||
|
noFingerprintView
|
||||||
|
.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
builder.setView(view);
|
builder.setView(view);
|
||||||
builder.setPositiveButton(getString(R.string.done), null);
|
builder.setPositiveButton(
|
||||||
|
getString(R.string.done),
|
||||||
|
null);
|
||||||
builder.create().show();
|
builder.create().show();
|
||||||
} else if (item.getItemId() == R.id.mgmt_account_info) {
|
} else if (item.getItemId() == R.id.mgmt_account_info) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
AlertDialog.Builder builder = new AlertDialog.Builder(
|
||||||
|
activity);
|
||||||
builder.setTitle(getString(R.string.account_info));
|
builder.setTitle(getString(R.string.account_info));
|
||||||
if (selectedAccountForActionMode.getStatus() == Account.STATUS_ONLINE) {
|
if (selectedAccountForActionMode
|
||||||
XmppConnection xmpp = selectedAccountForActionMode.getXmppConnection();
|
.getStatus() == Account.STATUS_ONLINE) {
|
||||||
long connectionAge = (SystemClock.elapsedRealtime() - xmpp.lastConnect) / 60000;
|
XmppConnection xmpp = selectedAccountForActionMode
|
||||||
long sessionAge = (SystemClock.elapsedRealtime() - xmpp.lastSessionStarted) / 60000;
|
.getXmppConnection();
|
||||||
|
long connectionAge = (SystemClock
|
||||||
|
.elapsedRealtime() - xmpp.lastConnect) / 60000;
|
||||||
|
long sessionAge = (SystemClock
|
||||||
|
.elapsedRealtime() - xmpp.lastSessionStarted) / 60000;
|
||||||
long connectionAgeHours = connectionAge / 60;
|
long connectionAgeHours = connectionAge / 60;
|
||||||
long sessionAgeHours = sessionAge / 60;
|
long sessionAgeHours = sessionAge / 60;
|
||||||
View view = (View) getLayoutInflater().inflate(R.layout.server_info, null);
|
View view = (View) getLayoutInflater()
|
||||||
TextView connection = (TextView) view.findViewById(R.id.connection);
|
.inflate(
|
||||||
TextView session = (TextView) view.findViewById(R.id.session);
|
R.layout.server_info,
|
||||||
TextView pcks_sent = (TextView) view.findViewById(R.id.pcks_sent);
|
null);
|
||||||
TextView pcks_received = (TextView) view.findViewById(R.id.pcks_received);
|
TextView connection = (TextView) view
|
||||||
TextView carbon = (TextView) view.findViewById(R.id.carbon);
|
.findViewById(R.id.connection);
|
||||||
TextView stream = (TextView) view.findViewById(R.id.stream);
|
TextView session = (TextView) view
|
||||||
TextView roster = (TextView) view.findViewById(R.id.roster);
|
.findViewById(R.id.session);
|
||||||
TextView presences = (TextView) view.findViewById(R.id.number_presences);
|
TextView pcks_sent = (TextView) view
|
||||||
presences.setText(selectedAccountForActionMode.countPresences()+"");
|
.findViewById(R.id.pcks_sent);
|
||||||
pcks_received.setText(""+xmpp.getReceivedStanzas());
|
TextView pcks_received = (TextView) view
|
||||||
pcks_sent.setText(""+xmpp.getSentStanzas());
|
.findViewById(R.id.pcks_received);
|
||||||
|
TextView carbon = (TextView) view
|
||||||
|
.findViewById(R.id.carbon);
|
||||||
|
TextView stream = (TextView) view
|
||||||
|
.findViewById(R.id.stream);
|
||||||
|
TextView roster = (TextView) view
|
||||||
|
.findViewById(R.id.roster);
|
||||||
|
TextView presences = (TextView) view
|
||||||
|
.findViewById(R.id.number_presences);
|
||||||
|
presences.setText(selectedAccountForActionMode
|
||||||
|
.countPresences()
|
||||||
|
+ "");
|
||||||
|
pcks_received.setText(""
|
||||||
|
+ xmpp.getReceivedStanzas());
|
||||||
|
pcks_sent.setText(""
|
||||||
|
+ xmpp.getSentStanzas());
|
||||||
if (connectionAgeHours >= 2) {
|
if (connectionAgeHours >= 2) {
|
||||||
connection.setText(connectionAgeHours+" " + getString(R.string.hours));
|
connection
|
||||||
|
.setText(connectionAgeHours
|
||||||
|
+ " "
|
||||||
|
+ getString(R.string.hours));
|
||||||
} else {
|
} else {
|
||||||
connection.setText(connectionAge+" " + getString(R.string.mins));
|
connection
|
||||||
|
.setText(connectionAge
|
||||||
|
+ " "
|
||||||
|
+ getString(R.string.mins));
|
||||||
}
|
}
|
||||||
if (xmpp.hasFeatureStreamManagment()) {
|
if (xmpp.hasFeatureStreamManagment()) {
|
||||||
if (sessionAgeHours >= 2) {
|
if (sessionAgeHours >= 2) {
|
||||||
session.setText(sessionAgeHours+" " + getString(R.string.hours));
|
session.setText(sessionAgeHours
|
||||||
|
+ " "
|
||||||
|
+ getString(R.string.hours));
|
||||||
} else {
|
} else {
|
||||||
session.setText(sessionAge+" " + getString(R.string.mins));
|
session.setText(sessionAge
|
||||||
|
+ " "
|
||||||
|
+ getString(R.string.mins));
|
||||||
}
|
}
|
||||||
stream.setText(getString(R.string.yes));
|
stream.setText(getString(R.string.yes));
|
||||||
} else {
|
} else {
|
||||||
stream.setText(getString(R.string.no));
|
stream.setText(getString(R.string.no));
|
||||||
session.setText(connection.getText());
|
session.setText(connection
|
||||||
|
.getText());
|
||||||
}
|
}
|
||||||
if (xmpp.hasFeaturesCarbon()) {
|
if (xmpp.hasFeaturesCarbon()) {
|
||||||
carbon.setText(getString(R.string.yes));
|
carbon.setText(getString(R.string.yes));
|
||||||
|
@ -342,13 +450,14 @@ public class ManageAccountActivity extends XmppActivity {
|
||||||
} else {
|
} else {
|
||||||
builder.setMessage(getString(R.string.mgmt_account_account_offline));
|
builder.setMessage(getString(R.string.mgmt_account_account_offline));
|
||||||
}
|
}
|
||||||
builder.setPositiveButton(getString(R.string.hide), null);
|
builder.setPositiveButton(
|
||||||
|
getString(R.string.hide),
|
||||||
|
null);
|
||||||
builder.create().show();
|
builder.create().show();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}));
|
}));
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -370,11 +479,12 @@ public class ManageAccountActivity extends XmppActivity {
|
||||||
@Override
|
@Override
|
||||||
void onBackendConnected() {
|
void onBackendConnected() {
|
||||||
xmppConnectionService.setOnAccountListChangedListener(accountChanged);
|
xmppConnectionService.setOnAccountListChangedListener(accountChanged);
|
||||||
xmppConnectionService.setOnTLSExceptionReceivedListener(tlsExceptionReceived);
|
xmppConnectionService
|
||||||
|
.setOnTLSExceptionReceivedListener(tlsExceptionReceived);
|
||||||
this.accountList.clear();
|
this.accountList.clear();
|
||||||
this.accountList.addAll(xmppConnectionService.getAccounts());
|
this.accountList.addAll(xmppConnectionService.getAccounts());
|
||||||
accountListViewAdapter.notifyDataSetChanged();
|
accountListViewAdapter.notifyDataSetChanged();
|
||||||
if ((this.accountList.size() == 0)&&(this.firstrun)) {
|
if ((this.accountList.size() == 0) && (this.firstrun)) {
|
||||||
getActionBar().setDisplayHomeAsUpEnabled(false);
|
getActionBar().setDisplayHomeAsUpEnabled(false);
|
||||||
getActionBar().setHomeButtonEnabled(false);
|
getActionBar().setHomeButtonEnabled(false);
|
||||||
addAccount();
|
addAccount();
|
||||||
|
@ -409,7 +519,8 @@ public class ManageAccountActivity extends XmppActivity {
|
||||||
Intent.FLAG_ACTIVITY_CLEAR_TOP |
|
Intent.FLAG_ACTIVITY_CLEAR_TOP |
|
||||||
// otherwise, make a new task for it
|
// otherwise, make a new task for it
|
||||||
Intent.FLAG_ACTIVITY_NEW_TASK |
|
Intent.FLAG_ACTIVITY_NEW_TASK |
|
||||||
// don't use the new activity animation; finish animation runs instead
|
// don't use the new activity animation; finish
|
||||||
|
// animation runs instead
|
||||||
Intent.FLAG_ACTIVITY_NO_ANIMATION);
|
Intent.FLAG_ACTIVITY_NO_ANIMATION);
|
||||||
startActivity(contactsIntent);
|
startActivity(contactsIntent);
|
||||||
finish();
|
finish();
|
||||||
|
@ -433,7 +544,7 @@ public class ManageAccountActivity extends XmppActivity {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
dialog.show(getFragmentManager(), "edit_account");
|
dialog.show(getFragmentManager(), "edit_account");
|
||||||
dialog.setKnownHosts(xmppConnectionService.getKnownHosts(),this);
|
dialog.setKnownHosts(xmppConnectionService.getKnownHosts(), this);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,10 +561,9 @@ public class ManageAccountActivity extends XmppActivity {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
dialog.show(getFragmentManager(), "add_account");
|
dialog.show(getFragmentManager(), "add_account");
|
||||||
dialog.setKnownHosts(xmppConnectionService.getKnownHosts(),this);
|
dialog.setKnownHosts(xmppConnectionService.getKnownHosts(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActionModeStarted(ActionMode mode) {
|
public void onActionModeStarted(ActionMode mode) {
|
||||||
super.onActionModeStarted(mode);
|
super.onActionModeStarted(mode);
|
||||||
|
@ -479,7 +589,7 @@ public class ManageAccountActivity extends XmppActivity {
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
if (resultCode == RESULT_OK) {
|
if (resultCode == RESULT_OK) {
|
||||||
if (requestCode == REQUEST_ANNOUNCE_PGP) {
|
if (requestCode == REQUEST_ANNOUNCE_PGP) {
|
||||||
announcePgp(selectedAccountForActionMode,null);
|
announcePgp(selectedAccountForActionMode, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
package eu.siacs.conversations.ui;
|
|
||||||
|
|
||||||
public interface OnAccountListChangedListener {
|
|
||||||
public void onAccountListChangedListener();
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
package eu.siacs.conversations.ui;
|
|
||||||
|
|
||||||
public interface OnConversationListChangedListener {
|
|
||||||
public void onConversationListChanged();
|
|
||||||
}
|
|
|
@ -83,7 +83,7 @@ public class JingleConnection {
|
||||||
sendSuccess();
|
sendSuccess();
|
||||||
if (acceptedAutomatically) {
|
if (acceptedAutomatically) {
|
||||||
message.markUnread();
|
message.markUnread();
|
||||||
JingleConnection.this.mXmppConnectionService.updateUi(message.getConversation(), true);
|
JingleConnection.this.mXmppConnectionService.notifyUi(message.getConversation(), true);
|
||||||
}
|
}
|
||||||
BitmapFactory.Options options = new BitmapFactory.Options();
|
BitmapFactory.Options options = new BitmapFactory.Options();
|
||||||
options.inJustDecodeBounds = true;
|
options.inJustDecodeBounds = true;
|
||||||
|
@ -277,7 +277,7 @@ public class JingleConnection {
|
||||||
} else {
|
} else {
|
||||||
message.markUnread();
|
message.markUnread();
|
||||||
Log.d("xmppService","not auto accepting new file offer with size: "+size+" allowed size:"+this.mJingleConnectionManager.getAutoAcceptFileSize());
|
Log.d("xmppService","not auto accepting new file offer with size: "+size+" allowed size:"+this.mJingleConnectionManager.getAutoAcceptFileSize());
|
||||||
this.mXmppConnectionService.updateUi(conversation, true);
|
this.mXmppConnectionService.notifyUi(conversation, true);
|
||||||
}
|
}
|
||||||
this.file = this.mXmppConnectionService.getFileBackend().getJingleFile(message,false);
|
this.file = this.mXmppConnectionService.getFileBackend().getJingleFile(message,false);
|
||||||
if (message.getEncryption() == Message.ENCRYPTION_OTR) {
|
if (message.getEncryption() == Message.ENCRYPTION_OTR) {
|
||||||
|
|
Loading…
Reference in a new issue