Fix endless redraw loop for voice message showing.

This commit is contained in:
B. Petersen
2017-03-02 23:23:48 +01:00
parent c9d8ad3d4a
commit 5e72e30d58
2 changed files with 11 additions and 3 deletions
@@ -1018,11 +1018,14 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
for (int a = 0; a < documentAttach.attributes.size(); a++) {
TLRPC.DocumentAttribute attribute = documentAttach.attributes.get(a);
if (attribute instanceof TLRPC.TL_documentAttributeAudio) {
/* this does not work and result in endless reloading of the messages in the
chatlist (you can check this using the `Log.i()`-command in ChatActivity
if (attribute.waveform == null || attribute.waveform.length == 0) {
MediaController.getInstance().generateWaveform(currentMessageObject);
}
useSeekBarWaweform = attribute.waveform != null;
seekBarWaveform.setWaveform(attribute.waveform);
*/
break;
}
}
@@ -1919,9 +1922,10 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
durationLayout.draw(canvas);
canvas.restore();
if (currentMessageObject.type != MessageObject.MO_TYPE0_TEXT && currentMessageObject.messageOwner.to_id.channel_id == 0 && currentMessageObject.isContentUnread()) {
docBackPaint.setColor(currentMessageObject.isOutOwner() ? Theme.MSG_OUT_VOICE_SEEKBAR_FILL_COLOR : Theme.MSG_IN_VOICE_SEEKBAR_FILL_COLOR);
canvas.drawCircle(timeAudioX + timeWidthAudio + dp(6), dp(51) + namesOffset + mediaOffsetY, dp(3), docBackPaint);
if (!currentMessageObject.isOutOwner() && currentMessageObject.isUnread()) {
// mark unread incoming messages with a little dot (only works if we mark the voice messages as being read only if heard)
docBackPaint.setColor(Theme.MSG_IN_VOICE_SEEKBAR_FILL_COLOR);
canvas.drawCircle(timeAudioX + timeWidthAudio + dp(6), dp(51) + namesOffset + mediaOffsetY, dp(4), docBackPaint);
}
}
@@ -45,6 +45,7 @@ import android.provider.MediaStore;
import android.text.TextUtils;
import android.text.style.ClickableSpan;
import android.text.style.URLSpan;
import android.util.Log;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.MotionEvent;
@@ -193,6 +194,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private final static int ID_CHAT_COMPOSE_PANEL = 1000;
private TextView m_replyMenuItem, m_infoMenuItem, m_saveToXXMenuItem, m_openMenuItem, m_shareMenuItem;
private static final String TAG = "ChatActivity";
public ChatActivity(Bundle args) {
super(args);
}
@@ -2824,6 +2827,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
View view = holder.itemView;
int msg_id = m_msglist[i];
//Log.i(TAG, String.format("Loading message #%d to index #%d", msg_id, i));
boolean selected = false;
boolean disableSelection = false;
if (actionBar.isActionModeShowed()) {