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 @@
*/
package com.xabber.android.data.message;
import java.util.Date;
import android.text.Spannable;
import android.text.Html;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.util.Linkify;
import com.xabber.xmpp.uri.XMPPUri;
import java.util.Date;
/**
* Message item.
......@@ -31,76 +28,62 @@ import com.xabber.xmpp.uri.XMPPUri;
public class MessageItem implements Comparable<MessageItem> {
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.
*/
private final String resource;
/**
* Text representation.
*/
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
* action in the chat.
*/
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.
*/
private Date timestamp;
/**
* Time when message was created.
*/
private Date delayTimestamp;
private final boolean incoming;
private final boolean unencypted;
/**
* ID in database.
*/
private Long id;
/**
* Error response received on send request.
*/
private boolean error;
/**
* Receipt was received for sent message.
*/
private boolean delivered;
/**
* Message was sent.
*/
private boolean sent;
/**
* Message was shown to the user.
*/
private boolean read;
/**
* Message was received from server side offline storage.
*/
private final boolean offline;
/**
* Outgoing packet id.
*/
......@@ -152,8 +135,6 @@ public class MessageItem implements Comparable<MessageItem> {
public Spannable getSpannable() {
if (spannable == null) {
spannable = new SpannableString(Html.fromHtml(text));
Linkify.addLinks(this.spannable, Linkify.ALL);
XMPPUri.addLinks(this.spannable);
}
return spannable;
}
......
......@@ -424,7 +424,6 @@ public class ChatViewer extends ManagedActivity implements OnChatChangedListener
@Override
public void onChatViewAdapterFinishUpdate() {
insertExtraText();
updateRegisteredChats();
}
private void insertExtraText() {
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/message_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/message_layout"
android:minWidth="160dp"
android:orientation="vertical"
tools:showIn="@layout/chat_viewer_outgoing_message"
android:descendantFocusability="blocksDescendants"
>
<TextView
......@@ -21,8 +20,8 @@
android:id="@+id/message_unencrypted"
android:layout_width="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
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