aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/thedevstack')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java57
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/ui/ConversationFragment.java4
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/utils/UIHelper.java23
3 files changed, 68 insertions, 16 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java b/src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java
index ce1eb439..0167ef4b 100644
--- a/src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java
+++ b/src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java
@@ -11,6 +11,7 @@ import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.content.IntentSender.SendIntentException;
import android.content.pm.PackageManager;
+import android.graphics.Typeface;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
@@ -32,6 +33,7 @@ import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.PopupMenu;
import android.widget.PopupMenu.OnMenuItemClickListener;
+import android.widget.TextView;
import android.widget.Toast;
import net.java.otr4j.session.SessionStatus;
@@ -44,8 +46,11 @@ import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import de.thedevstack.android.logcat.Logging;
+import de.thedevstack.conversationsplus.entities.Presence;
import de.thedevstack.conversationsplus.services.filetransfer.FileTransferManager;
import de.thedevstack.conversationsplus.utils.AccountUtil;
+import de.thedevstack.conversationsplus.utils.UIHelper;
+import de.thedevstack.conversationsplus.xmpp.chatstate.ChatState;
import de.timroes.android.listview.EnhancedListView;
import de.thedevstack.conversationsplus.Config;
@@ -353,20 +358,44 @@ public class ConversationActivity extends XmppActivity
final ActionBar ab = getActionBar();
final Conversation conversation = getSelectedConversation();
if (ab != null) {
- if (titleShouldBeName && conversation != null) {
- ab.setDisplayHomeAsUpEnabled(true);
- ab.setHomeButtonEnabled(true);
- if (conversation.getMode() == Conversation.MODE_SINGLE || ConversationsPlusPreferences.useSubject()) {
- ab.setTitle(conversation.getName());
- } else {
- ab.setTitle(conversation.getJid().toBareJid().toString());
- }
- } else {
- ab.setDisplayHomeAsUpEnabled(false);
- ab.setHomeButtonEnabled(false);
- ab.setTitle(R.string.app_name);
- }
- }
+ if (titleShouldBeName && conversation != null) {
+ if ((ab.getDisplayOptions() & ActionBar.DISPLAY_HOME_AS_UP) != ActionBar.DISPLAY_HOME_AS_UP) {
+ ab.setDisplayOptions(ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_TITLE);
+ }
+ ab.setDisplayShowTitleEnabled(false);
+ ab.setDisplayShowCustomEnabled(true);
+ ab.setCustomView(R.layout.actionbar_title);
+ TextView abtitle = (TextView) findViewById(R.id.abTitle);
+ TextView subtitle = (TextView) findViewById(R.id.abSubstitle);
+ abtitle.setText(conversation.getName());
+ //abtitle.setOnClickListener(this);
+ abtitle.setSelected(true);
+ if (conversation.getMode() == Conversation.MODE_SINGLE) {
+ ChatState state = conversation.getIncomingChatState();
+ if (state == ChatState.COMPOSING) {
+ subtitle.setText(getString(R.string.is_typing));
+ subtitle.setSelected(true);
+ subtitle.setTypeface(null, Typeface.BOLD_ITALIC);
+ //absubtitle.setOnClickListener(this);
+ } else if (state == ChatState.PAUSED) {
+ subtitle.setText(R.string.contact_paused_typing);
+ subtitle.setTypeface(null, Typeface.BOLD_ITALIC);
+ } else {
+ subtitle.setText(UIHelper.getStatusText(conversation.getContact().getMostAvailableStatus()));
+ }
+ } else {
+ }
+
+ } else {
+ if ((ab.getDisplayOptions() & ActionBar.DISPLAY_HOME_AS_UP) == ActionBar.DISPLAY_HOME_AS_UP) {
+ ab.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE);
+ }
+ ab.setDisplayShowTitleEnabled(true);
+ ab.setDisplayShowCustomEnabled(false);
+ ab.setTitle(R.string.app_name);
+ ab.setSubtitle(null);
+ }
+ }
}
private void openConversation() {
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/ConversationFragment.java b/src/main/java/de/thedevstack/conversationsplus/ui/ConversationFragment.java
index 0f32e762..d25fa461 100644
--- a/src/main/java/de/thedevstack/conversationsplus/ui/ConversationFragment.java
+++ b/src/main/java/de/thedevstack/conversationsplus/ui/ConversationFragment.java
@@ -1097,9 +1097,9 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
if (conversation.getMode() == Conversation.MODE_SINGLE) {
ChatState state = conversation.getIncomingChatState();
if (state == ChatState.COMPOSING) {
- this.messageList.add(Message.createStatusMessage(conversation, getString(R.string.contact_is_typing, conversation.getName())));
+ //this.messageList.add(Message.createStatusMessage(conversation, getString(R.string.contact_is_typing, conversation.getName())));
} else if (state == ChatState.PAUSED) {
- this.messageList.add(Message.createStatusMessage(conversation, getString(R.string.contact_has_stopped_typing, conversation.getName())));
+ //this.messageList.add(Message.createStatusMessage(conversation, getString(R.string.contact_has_stopped_typing, conversation.getName())));
} else {
for (int i = this.messageList.size() - 1; i >= 0; --i) {
if (this.messageList.get(i).getStatus() == Message.STATUS_RECEIVED) {
diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/UIHelper.java b/src/main/java/de/thedevstack/conversationsplus/utils/UIHelper.java
index e3680b81..d27481df 100644
--- a/src/main/java/de/thedevstack/conversationsplus/utils/UIHelper.java
+++ b/src/main/java/de/thedevstack/conversationsplus/utils/UIHelper.java
@@ -12,6 +12,7 @@ import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
+import de.thedevstack.conversationsplus.ConversationsPlusApplication;
import de.thedevstack.conversationsplus.ConversationsPlusColors;
import de.thedevstack.conversationsplus.R;
import de.thedevstack.conversationsplus.entities.Contact;
@@ -253,6 +254,28 @@ public class UIHelper {
}
}
+ public static String getStatusText(Presence.Status status) {
+ int statusResId = R.string.contact_status_offline;
+ switch (status) {
+ case ONLINE:
+ statusResId = R.string.contact_status_online;
+ break;
+ case CHAT:
+ statusResId = R.string.contact_status_free_to_chat;
+ break;
+ case AWAY:
+ statusResId = R.string.contact_status_away;
+ break;
+ case XA:
+ statusResId = R.string.contact_status_extended_away;
+ break;
+ case DND:
+ statusResId = R.string.contact_status_do_not_disturb;
+ break;
+ }
+ return ConversationsPlusApplication.getAppContext().getString(statusResId);
+ }
+
public static int getStatusColor(Presence.Status status) {
switch (status) {
case ONLINE: