aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java43
1 files changed, 36 insertions, 7 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;
@@ -354,17 +359,41 @@ public class ConversationActivity extends XmppActivity
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());
+ 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 {
- ab.setTitle(conversation.getJid().toBareJid().toString());
+ subtitle.setText(UIHelper.getStatusText(conversation.getContact().getMostAvailableStatus()));
}
} else {
- ab.setDisplayHomeAsUpEnabled(false);
- ab.setHomeButtonEnabled(false);
+ }
+
+ } 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);
}
}
}