Commit f3027a3a authored by Grigory Fedorov's avatar Grigory Fedorov

Chat clickable links fix.

 Problem was in conflict with ViewPager finishUpdate method. Need testing if some things become worse.
parent 565b55c8
...@@ -14,14 +14,11 @@ ...@@ -14,14 +14,11 @@
*/ */
package com.xabber.android.data.message; package com.xabber.android.data.message;
import java.util.Date;
import android.text.Spannable;
import android.text.Html; import android.text.Html;
import android.text.Spannable;
import android.text.SpannableString; import android.text.SpannableString;
import android.text.util.Linkify;
import com.xabber.xmpp.uri.XMPPUri; import java.util.Date;
/** /**
* Message item. * Message item.
...@@ -31,76 +28,62 @@ import com.xabber.xmpp.uri.XMPPUri; ...@@ -31,76 +28,62 @@ import com.xabber.xmpp.uri.XMPPUri;
public class MessageItem implements Comparable<MessageItem> { public class MessageItem implements Comparable<MessageItem> {
private final AbstractChat chat; private final AbstractChat chat;
/**
* Tag used to identify collection in server side message archive. Equals to
* collection's start attribute.
*/
private String tag;
/** /**
* Contact's resource. * Contact's resource.
*/ */
private final String resource; private final String resource;
/** /**
* Text representation. * Text representation.
*/ */
private final String text; private final String text;
/**
* Cached text populated with smiles and link.
*/
private Spannable spannable;
/** /**
* Optional action. If set message represent not an actual message but some * Optional action. If set message represent not an actual message but some
* action in the chat. * action in the chat.
*/ */
private final ChatAction action; private final ChatAction action;
private final boolean incoming;
private final boolean unencypted;
/**
* Message was received from server side offline storage.
*/
private final boolean offline;
/**
* Tag used to identify collection in server side message archive. Equals to
* collection's start attribute.
*/
private String tag;
/**
* Cached text populated with smiles and link.
*/
private Spannable spannable;
/** /**
* Time when message was received or sent by Xabber. * Time when message was received or sent by Xabber.
*/ */
private Date timestamp; private Date timestamp;
/** /**
* Time when message was created. * Time when message was created.
*/ */
private Date delayTimestamp; private Date delayTimestamp;
private final boolean incoming;
private final boolean unencypted;
/** /**
* ID in database. * ID in database.
*/ */
private Long id; private Long id;
/** /**
* Error response received on send request. * Error response received on send request.
*/ */
private boolean error; private boolean error;
/** /**
* Receipt was received for sent message. * Receipt was received for sent message.
*/ */
private boolean delivered; private boolean delivered;
/** /**
* Message was sent. * Message was sent.
*/ */
private boolean sent; private boolean sent;
/** /**
* Message was shown to the user. * Message was shown to the user.
*/ */
private boolean read; private boolean read;
/**
* Message was received from server side offline storage.
*/
private final boolean offline;
/** /**
* Outgoing packet id. * Outgoing packet id.
*/ */
...@@ -152,8 +135,6 @@ public class MessageItem implements Comparable<MessageItem> { ...@@ -152,8 +135,6 @@ public class MessageItem implements Comparable<MessageItem> {
public Spannable getSpannable() { public Spannable getSpannable() {
if (spannable == null) { if (spannable == null) {
spannable = new SpannableString(Html.fromHtml(text)); spannable = new SpannableString(Html.fromHtml(text));
Linkify.addLinks(this.spannable, Linkify.ALL);
XMPPUri.addLinks(this.spannable);
} }
return spannable; return spannable;
} }
......
...@@ -424,7 +424,6 @@ public class ChatViewer extends ManagedActivity implements OnChatChangedListener ...@@ -424,7 +424,6 @@ public class ChatViewer extends ManagedActivity implements OnChatChangedListener
@Override @Override
public void onChatViewAdapterFinishUpdate() { public void onChatViewAdapterFinishUpdate() {
insertExtraText(); insertExtraText();
updateRegisteredChats();
} }
private void insertExtraText() { private void insertExtraText() {
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/message_layout"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/message_layout"
android:minWidth="160dp" android:minWidth="160dp"
android:orientation="vertical"
tools:showIn="@layout/chat_viewer_outgoing_message" tools:showIn="@layout/chat_viewer_outgoing_message"
android:descendantFocusability="blocksDescendants"
> >
<TextView <TextView
...@@ -21,8 +20,8 @@ ...@@ -21,8 +20,8 @@
android:id="@+id/message_unencrypted" android:id="@+id/message_unencrypted"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textSize="11sp" android:text="@string/otr_unencrypted_message"
android:text="@string/otr_unencrypted_message" /> android:textSize="11sp" />
<TextView <TextView
android:id="@+id/message_text" android:id="@+id/message_text"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment