aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/eu/siacs/conversations/ui/XmppActivity.java')
-rw-r--r--src/main/java/eu/siacs/conversations/ui/XmppActivity.java38
1 files changed, 27 insertions, 11 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
index 535aa6a5..1f1af09c 100644
--- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
@@ -2,6 +2,7 @@ package eu.siacs.conversations.ui;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
+import android.app.ActionBar;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
@@ -97,6 +98,7 @@ public abstract class XmppActivity extends Activity {
private DisplayMetrics metrics;
protected int mTheme;
+ protected boolean mUsingEnterKey = false;
protected interface OnValueEdited {
public void onValueEdited(String value);
@@ -300,13 +302,23 @@ public abstract class XmppActivity extends Activity {
mColorOrange = getResources().getColor(R.color.orange);
mColorGreen = getResources().getColor(R.color.green);
mPrimaryColor = getResources().getColor(R.color.primary);
- mSecondaryBackgroundColor = getResources().getColor(
- R.color.secondarybackground);
+ mSecondaryBackgroundColor = getResources().getColor(R.color.secondarybackground);
this.mTheme = findTheme();
setTheme(this.mTheme);
+ this.mUsingEnterKey = usingEnterKey();
mUseSubject = getPreferences().getBoolean("use_subject", true);
+
Settings.initSettingsClassWithPreferences(getPreferences());
- }
+
+ final ActionBar ab = getActionBar();
+ if (ab!=null) {
+ ab.setDisplayHomeAsUpEnabled(true);
+ }
+ }
+
+ protected boolean usingEnterKey() {
+ return getPreferences().getBoolean("display_enter_key", false);
+ }
protected SharedPreferences getPreferences() {
return PreferenceManager
@@ -394,9 +406,7 @@ public abstract class XmppActivity extends Activity {
public void success(Account account) {
xmppConnectionService.databaseBackend
.updateAccount(account);
- xmppConnectionService.sendPresencePacket(account,
- xmppConnectionService.getPresenceGenerator()
- .sendPresence(account));
+ xmppConnectionService.sendPresence(account);
if (conversation != null) {
conversation
.setNextEncryption(Message.ENCRYPTION_PGP);
@@ -430,9 +440,12 @@ public abstract class XmppActivity extends Activity {
}
protected void showAddToRosterDialog(final Conversation conversation) {
- final Jid jid = conversation.getJid();
+ showAddToRosterDialog(conversation.getContact());
+ }
+
+ protected void showAddToRosterDialog(final Contact contact) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
- builder.setTitle(jid.toString());
+ builder.setTitle(contact.getJid().toString());
builder.setMessage(getString(R.string.not_in_roster));
builder.setNegativeButton(getString(R.string.cancel), null);
builder.setPositiveButton(getString(R.string.add_contact),
@@ -440,11 +453,10 @@ public abstract class XmppActivity extends Activity {
@Override
public void onClick(DialogInterface dialog, int which) {
- final Jid jid = conversation.getJid();
- Account account = conversation.getAccount();
+ final Jid jid = contact.getJid();
+ Account account = contact.getAccount();
Contact contact = account.getRoster().getContact(jid);
xmppConnectionService.createContact(contact);
- switchToContactDetails(contact);
}
});
builder.create().show();
@@ -677,6 +689,10 @@ public abstract class XmppActivity extends Activity {
return this.mPrimaryColor;
}
+ public int getOnlineColor() {
+ return this.mColorGreen;
+ }
+
public int getSecondaryBackgroundColor() {
return this.mSecondaryBackgroundColor;
}