aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2016-09-14 22:47:05 +0200
committerChristian Schneppe <christian@pix-art.de>2016-09-14 22:47:05 +0200
commit578857f40a509d86539e26eb97a9045af567c41e (patch)
tree4154e6a189d3cd3e139005180627d281bf4c1715 /src/main
parentd2c39be11bf29806d2fc0dea27fabbfd7c3a8daa (diff)
scroll actionbar titles if they are too long
Diffstat (limited to '')
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationActivity.java19
-rw-r--r--src/main/res/layout/ab_title.xml13
2 files changed, 19 insertions, 13 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java
index 6d03cb5d6..935b245a4 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java
@@ -470,48 +470,49 @@ public class ConversationActivity extends XmppActivity
ab.setDisplayShowTitleEnabled(false);
ab.setDisplayShowCustomEnabled(true);
ab.setCustomView(R.layout.ab_title);
+ TextView abtitle = (TextView) findViewById(android.R.id.text1);
+ TextView absubtitle = (TextView) findViewById(android.R.id.text2);
if (conversation.getMode() == Conversation.MODE_SINGLE || useSubjectToIdentifyConference()) {
- TextView abtitle = (TextView) findViewById(android.R.id.text1);
abtitle.setText(conversation.getName());
abtitle.setOnClickListener(this);
+ abtitle.setSelected(true);
if (conversation.getMode() == Conversation.MODE_SINGLE && !this.getSelectedConversation().withSelf()) {
if (conversation.getContact().getShownStatus() == Presence.Status.OFFLINE) {
- TextView absubtitle = (TextView) findViewById(android.R.id.text2);
absubtitle.setText(getString(R.string.account_status_offline));
+ absubtitle.setSelected(true);
absubtitle.setOnClickListener(this);
} else {
ChatState state = conversation.getIncomingChatState();
if (state == ChatState.COMPOSING) {
- TextView absubtitle = (TextView) findViewById(android.R.id.text2);
absubtitle.setText(getString(R.string.is_typing));
absubtitle.setTypeface(null, Typeface.BOLD_ITALIC);
+ absubtitle.setSelected(true);
absubtitle.setOnClickListener(this);
} else if (state == ChatState.PAUSED) {
- TextView absubtitle = (TextView) findViewById(android.R.id.text2);
absubtitle.setText(UIHelper.lastseen(getApplicationContext(), conversation.getContact().isActive(), conversation.getContact().getLastseen()));
+ absubtitle.setSelected(true);
absubtitle.setOnClickListener(this);
} else {
- TextView absubtitle = (TextView) findViewById(android.R.id.text2);
absubtitle.setText(UIHelper.lastseen(getApplicationContext(), conversation.getContact().isActive(), conversation.getContact().getLastseen()));
+ absubtitle.setSelected(true);
absubtitle.setOnClickListener(this);
}
}
} else if (useSubjectToIdentifyConference()) {
if (conversation.getParticipants() != null) {
- TextView absubtitle = (TextView) findViewById(android.R.id.text2);
absubtitle.setText(conversation.getParticipants());
+ absubtitle.setSelected(true);
absubtitle.setOnClickListener(this);
} else {
- TextView absubtitle = (TextView) findViewById(android.R.id.text2);
absubtitle.setText(R.string.no_participants);
+ abtitle.setSelected(true);
absubtitle.setOnClickListener(this);
}
}
} else {
- TextView abtitle = (TextView) findViewById(android.R.id.text1);
abtitle.setText(conversation.getJid().toBareJid().toString());
abtitle.setOnClickListener(this);
- TextView absubtitle = (TextView) findViewById(android.R.id.text2);
+ abtitle.setSelected(true);
absubtitle.setText(null);
absubtitle.setOnClickListener(this);
}
diff --git a/src/main/res/layout/ab_title.xml b/src/main/res/layout/ab_title.xml
index b6f917073..476a489e2 100644
--- a/src/main/res/layout/ab_title.xml
+++ b/src/main/res/layout/ab_title.xml
@@ -1,15 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
- android:layout_height="match_parent">
+ android:layout_height="match_parent"
+ android:gravity="left|center_vertical">
<github.ankushsachdeva.emojicon.EmojiconTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
style="@style/Base.TextAppearance.AppCompat.Widget.ActionBar.Title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:ellipsize="end"
android:singleLine="true"
+ android:ellipsize="marquee"
+ android:marqueeRepeatLimit="marquee_forever"
+ android:scrollHorizontally="true"
android:gravity="center_vertical"
android:textColor="@color/grey200"
android:clickable="true"
@@ -20,9 +23,11 @@
style="@style/Base.TextAppearance.AppCompat.Widget.ActionBar.Subtitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:ellipsize="end"
- android:layout_below="@android:id/text1"
android:singleLine="true"
+ android:ellipsize="marquee"
+ android:marqueeRepeatLimit="marquee_forever"
+ android:scrollHorizontally="true"
+ android:layout_below="@android:id/text1"
android:textSize="12sp"
android:textColor="@color/grey50"
android:gravity="center_vertical"