@@ -87,12 +87,12 @@ public class MediaController implements NotificationCenter.NotificationCenterDel
87
87
88
88
public static int [] readArgs = new int [3 ];
89
89
90
- public static interface FileDownloadProgressListener {
91
- public void onFailedDownload (String fileName );
92
- public void onSuccessDownload (String fileName );
93
- public void onProgressDownload (String fileName , float progress );
94
- public void onProgressUpload (String fileName , float progress , boolean isEncrypted );
95
- public int getObserverTag ();
90
+ public interface FileDownloadProgressListener {
91
+ void onFailedDownload (String fileName );
92
+ void onSuccessDownload (String fileName );
93
+ void onProgressDownload (String fileName , float progress );
94
+ void onProgressUpload (String fileName , float progress , boolean isEncrypted );
95
+ int getObserverTag ();
96
96
}
97
97
98
98
private class AudioBuffer {
@@ -234,6 +234,7 @@ public static class SearchImage {
234
234
private long recordStartTime ;
235
235
private long recordTimeCount ;
236
236
private long recordDialogId ;
237
+ private MessageObject recordReplyingMessageObject ;
237
238
private DispatchQueue fileDecodingQueue ;
238
239
private DispatchQueue playerQueue ;
239
240
private ArrayList <AudioBuffer > usedPlayerBuffers = new ArrayList <>();
@@ -509,7 +510,7 @@ public void run() {
509
510
lastProgress = progress ;
510
511
playingMessageObject .audioProgress = value ;
511
512
playingMessageObject .audioProgressSec = lastProgress / 1000 ;
512
- NotificationCenter .getInstance ().postNotificationName (NotificationCenter .audioProgressDidChanged , playingMessageObject .messageOwner . id , value );
513
+ NotificationCenter .getInstance ().postNotificationName (NotificationCenter .audioProgressDidChanged , playingMessageObject .getId () , value );
513
514
} catch (Exception e ) {
514
515
FileLog .e ("tmessages" , e );
515
516
}
@@ -977,7 +978,7 @@ public void didReceivedNotification(int id, Object... args) {
977
978
} else if (id == NotificationCenter .messagesDeleted ) {
978
979
if (playingMessageObject != null ) {
979
980
ArrayList <Integer > markAsDeletedMessages = (ArrayList <Integer >)args [0 ];
980
- if (markAsDeletedMessages .contains (playingMessageObject .messageOwner . id )) {
981
+ if (markAsDeletedMessages .contains (playingMessageObject .getId () )) {
981
982
clenupPlayer (false );
982
983
}
983
984
}
@@ -1187,7 +1188,7 @@ private void clenupPlayer(boolean notify) {
1187
1188
playingMessageObject .audioProgressSec = 0 ;
1188
1189
playingMessageObject = null ;
1189
1190
if (notify ) {
1190
- NotificationCenter .getInstance ().postNotificationName (NotificationCenter .audioDidReset , lastFile .messageOwner . id );
1191
+ NotificationCenter .getInstance ().postNotificationName (NotificationCenter .audioDidReset , lastFile .getId () );
1191
1192
}
1192
1193
}
1193
1194
}
@@ -1227,7 +1228,7 @@ public void run() {
1227
1228
}
1228
1229
1229
1230
public boolean seekToProgress (MessageObject messageObject , float progress ) {
1230
- if (audioTrackPlayer == null && audioPlayer == null || messageObject == null || playingMessageObject == null || playingMessageObject != null && playingMessageObject .messageOwner . id != messageObject .messageOwner . id ) {
1231
+ if (audioTrackPlayer == null && audioPlayer == null || messageObject == null || playingMessageObject == null || playingMessageObject != null && playingMessageObject .getId () != messageObject .getId () ) {
1231
1232
return false ;
1232
1233
}
1233
1234
try {
@@ -1249,7 +1250,7 @@ public boolean playAudio(MessageObject messageObject) {
1249
1250
if (messageObject == null ) {
1250
1251
return false ;
1251
1252
}
1252
- if ((audioTrackPlayer != null || audioPlayer != null ) && playingMessageObject != null && messageObject .messageOwner . id == playingMessageObject .messageOwner . id ) {
1253
+ if ((audioTrackPlayer != null || audioPlayer != null ) && playingMessageObject != null && messageObject .getId () == playingMessageObject .getId () ) {
1253
1254
if (isPaused ) {
1254
1255
resumeAudio (messageObject );
1255
1256
}
@@ -1412,7 +1413,7 @@ public void stopAudio() {
1412
1413
1413
1414
public boolean pauseAudio (MessageObject messageObject ) {
1414
1415
stopProximitySensor ();
1415
- if (audioTrackPlayer == null && audioPlayer == null || messageObject == null || playingMessageObject == null || playingMessageObject != null && playingMessageObject .messageOwner . id != messageObject .messageOwner . id ) {
1416
+ if (audioTrackPlayer == null && audioPlayer == null || messageObject == null || playingMessageObject == null || playingMessageObject != null && playingMessageObject .getId () != messageObject .getId () ) {
1416
1417
return false ;
1417
1418
}
1418
1419
try {
@@ -1432,7 +1433,7 @@ public boolean pauseAudio(MessageObject messageObject) {
1432
1433
1433
1434
public boolean resumeAudio (MessageObject messageObject ) {
1434
1435
startProximitySensor ();
1435
- if (audioTrackPlayer == null && audioPlayer == null || messageObject == null || playingMessageObject == null || playingMessageObject != null && playingMessageObject .messageOwner . id != messageObject .messageOwner . id ) {
1436
+ if (audioTrackPlayer == null && audioPlayer == null || messageObject == null || playingMessageObject == null || playingMessageObject != null && playingMessageObject .getId () != messageObject .getId () ) {
1436
1437
return false ;
1437
1438
}
1438
1439
try {
@@ -1451,14 +1452,14 @@ public boolean resumeAudio(MessageObject messageObject) {
1451
1452
}
1452
1453
1453
1454
public boolean isPlayingAudio (MessageObject messageObject ) {
1454
- return !(audioTrackPlayer == null && audioPlayer == null || messageObject == null || playingMessageObject == null || playingMessageObject != null && playingMessageObject .messageOwner . id != messageObject .messageOwner . id );
1455
+ return !(audioTrackPlayer == null && audioPlayer == null || messageObject == null || playingMessageObject == null || playingMessageObject != null && playingMessageObject .getId () != messageObject .getId () );
1455
1456
}
1456
1457
1457
1458
public boolean isAudioPaused () {
1458
1459
return isPaused ;
1459
1460
}
1460
1461
1461
- public void startRecording (final long dialog_id ) {
1462
+ public void startRecording (final long dialog_id , final MessageObject reply_to_msg ) {
1462
1463
clenupPlayer (true );
1463
1464
1464
1465
try {
@@ -1505,6 +1506,7 @@ public void run() {
1505
1506
recordStartTime = System .currentTimeMillis ();
1506
1507
recordTimeCount = 0 ;
1507
1508
recordDialogId = dialog_id ;
1509
+ recordReplyingMessageObject = reply_to_msg ;
1508
1510
fileBuffer .rewind ();
1509
1511
1510
1512
audioRecorder .startRecording ();
@@ -1557,11 +1559,11 @@ public void run() {
1557
1559
long duration = recordTimeCount ;
1558
1560
audioToSend .duration = (int ) (duration / 1000 );
1559
1561
if (duration > 700 ) {
1560
- SendMessagesHelper .getInstance ().sendMessage (audioToSend , recordingAudioFileToSend .getAbsolutePath (), recordDialogId );
1562
+ SendMessagesHelper .getInstance ().sendMessage (audioToSend , recordingAudioFileToSend .getAbsolutePath (), recordDialogId , recordReplyingMessageObject );
1563
+ NotificationCenter .getInstance ().postNotificationName (NotificationCenter .audioDidSent );
1561
1564
} else {
1562
1565
recordingAudioFileToSend .delete ();
1563
1566
}
1564
- NotificationCenter .getInstance ().postNotificationName (NotificationCenter .audioDidSent );
1565
1567
}
1566
1568
});
1567
1569
}
@@ -1739,7 +1741,7 @@ public GifDrawable getGifDrawable(ChatMediaCell cell, boolean create) {
1739
1741
return null ;
1740
1742
}
1741
1743
1742
- if (currentGifDrawable != null && currentGifMessageObject != null && messageObject .messageOwner . id == currentGifMessageObject .messageOwner . id ) {
1744
+ if (currentGifDrawable != null && currentGifMessageObject != null && messageObject .getId () == currentGifMessageObject .getId () ) {
1743
1745
currentMediaCell = cell ;
1744
1746
currentGifDrawable .parentView = new WeakReference <View >(cell );
1745
1747
return currentGifDrawable ;
@@ -1788,7 +1790,7 @@ public void clearGifDrawable(ChatMediaCell cell) {
1788
1790
return ;
1789
1791
}
1790
1792
1791
- if (currentGifMessageObject != null && messageObject .messageOwner . id == currentGifMessageObject .messageOwner . id ) {
1793
+ if (currentGifMessageObject != null && messageObject .getId () == currentGifMessageObject .getId () ) {
1792
1794
if (currentGifDrawable != null ) {
1793
1795
currentGifDrawable .stop ();
1794
1796
currentGifDrawable .recycle ();
0 commit comments