71
71
import org .telegram .ui .Cells .ChatMediaCell ;
72
72
import org .telegram .ui .Cells .ChatMessageCell ;
73
73
import org .telegram .ui .Views .ActionBar .ActionBarLayer ;
74
- import org .telegram .ui .Views .ActionBar .ActionBarLayout ;
75
74
import org .telegram .ui .Views .ActionBar .ActionBarMenu ;
76
75
import org .telegram .ui .Views .ActionBar .ActionBarMenuItem ;
77
76
import org .telegram .ui .Views .BackupImageView ;
@@ -131,7 +130,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
131
130
private View pagedownButton ;
132
131
private TextView topPanelText ;
133
132
private long dialog_id ;
134
- private boolean isBraodcast = false ;
133
+ private boolean isBroadcast = false ;
135
134
private HashMap <Integer , MessageObject > selectedMessagesIds = new HashMap <Integer , MessageObject >();
136
135
private HashMap <Integer , MessageObject > selectedMessagesCanCopyIds = new HashMap <Integer , MessageObject >();
137
136
@@ -241,15 +240,15 @@ public void run() {
241
240
if (chatId > 0 ) {
242
241
dialog_id = -chatId ;
243
242
} else {
244
- isBraodcast = true ;
243
+ isBroadcast = true ;
245
244
dialog_id = AndroidUtilities .makeBroadcastId (chatId );
246
245
}
247
246
Semaphore semaphore = null ;
248
- if (isBraodcast ) {
247
+ if (isBroadcast ) {
249
248
semaphore = new Semaphore (0 );
250
249
}
251
250
MessagesController .getInstance ().loadChatInfo (currentChat .id , semaphore );
252
- if (isBraodcast ) {
251
+ if (isBroadcast ) {
253
252
try {
254
253
semaphore .acquire ();
255
254
} catch (Exception e ) {
@@ -1176,7 +1175,7 @@ public void onClick(View view) {
1176
1175
if (currentChat .photo != null ) {
1177
1176
photo = currentChat .photo .photo_small ;
1178
1177
}
1179
- if (isBraodcast ) {
1178
+ if (isBroadcast ) {
1180
1179
placeHolderId = AndroidUtilities .getBroadcastAvatarForId (currentChat .id );
1181
1180
} else {
1182
1181
placeHolderId = AndroidUtilities .getGroupAvatarForId (currentChat .id );
@@ -1203,9 +1202,12 @@ private void updateOnlineCount() {
1203
1202
}
1204
1203
1205
1204
private int getMessageType (MessageObject messageObject ) {
1205
+ if (messageObject == null ) {
1206
+ return -1 ;
1207
+ }
1206
1208
if (currentEncryptedChat == null ) {
1207
- boolean isBroadcastError = isBraodcast && messageObject .messageOwner .id <= 0 && messageObject .isSendError ();
1208
- if (!isBraodcast && messageObject .messageOwner .id <= 0 && messageObject .isOut () || isBroadcastError ) {
1209
+ boolean isBroadcastError = isBroadcast && messageObject .messageOwner .id <= 0 && messageObject .isSendError ();
1210
+ if (!isBroadcast && messageObject .messageOwner .id <= 0 && messageObject .isOut () || isBroadcastError ) {
1209
1211
if (messageObject .isSendError ()) {
1210
1212
if (!(messageObject .messageOwner .media instanceof TLRPC .TL_messageMediaEmpty )) {
1211
1213
return 0 ;
@@ -1447,7 +1449,7 @@ private void checkAndUpdateAvatar() {
1447
1449
if (currentChat .photo != null ) {
1448
1450
newPhoto = currentChat .photo .photo_small ;
1449
1451
}
1450
- if (isBraodcast ) {
1452
+ if (isBroadcast ) {
1451
1453
placeHolderId = AndroidUtilities .getBroadcastAvatarForId (currentChat .id );
1452
1454
} else {
1453
1455
placeHolderId = AndroidUtilities .getGroupAvatarForId (currentChat .id );
@@ -1458,7 +1460,7 @@ private void checkAndUpdateAvatar() {
1458
1460
}
1459
1461
}
1460
1462
1461
- public boolean openVideoEditor (String videoPath , boolean removeLast , ActionBarLayout parentLayout ) {
1463
+ public boolean openVideoEditor (String videoPath , boolean removeLast ) {
1462
1464
Bundle args = new Bundle ();
1463
1465
args .putString ("videoPath" , videoPath );
1464
1466
VideoEditorActivity fragment = new VideoEditorActivity (args );
@@ -1543,7 +1545,7 @@ public void onActivityResultFragment(int requestCode, int resultCode, Intent dat
1543
1545
if (paused ) {
1544
1546
startVideoEdit = videoPath ;
1545
1547
} else {
1546
- openVideoEditor (videoPath , false , parentLayout );
1548
+ openVideoEditor (videoPath , false );
1547
1549
}
1548
1550
} else {
1549
1551
SendMessagesHelper .prepareSendingVideo (videoPath , 0 , 0 , 0 , 0 , null , dialog_id );
@@ -1735,7 +1737,7 @@ public void didReceivedNotification(int id, final Object... args) {
1735
1737
if (messArr .size () != count ) {
1736
1738
if (isCache ) {
1737
1739
cacheEndReaced = true ;
1738
- if (currentEncryptedChat != null || isBraodcast ) {
1740
+ if (currentEncryptedChat != null || isBroadcast ) {
1739
1741
endReached = true ;
1740
1742
}
1741
1743
} else {
@@ -2102,7 +2104,7 @@ public void run() {
2102
2104
if (currentChat != null && chatId == currentChat .id ) {
2103
2105
info = (TLRPC .ChatParticipants )args [1 ];
2104
2106
updateOnlineCount ();
2105
- if (isBraodcast ) {
2107
+ if (isBroadcast ) {
2106
2108
SendMessagesHelper .getInstance ().setCurrentChatInfo (info );
2107
2109
}
2108
2110
}
@@ -2386,7 +2388,7 @@ public void onResume() {
2386
2388
AndroidUtilities .RunOnUIThread (new Runnable () {
2387
2389
@ Override
2388
2390
public void run () {
2389
- openVideoEditor (startVideoEdit , false , parentLayout );
2391
+ openVideoEditor (startVideoEdit , false );
2390
2392
startVideoEdit = null ;
2391
2393
}
2392
2394
});
@@ -2501,6 +2503,9 @@ public void createMenu(View v, boolean single) {
2501
2503
} else if (v instanceof ChatActionCell ) {
2502
2504
message = ((ChatActionCell )v ).getMessageObject ();
2503
2505
}
2506
+ if (message == null ) {
2507
+ return ;
2508
+ }
2504
2509
final int type = getMessageType (message );
2505
2510
2506
2511
selectedObject = null ;
@@ -2774,7 +2779,7 @@ private void forwardSelectedMessages(long did, boolean fromMyName) {
2774
2779
@ Override
2775
2780
public void didSelectDialog (MessagesActivity activity , long did , boolean param ) {
2776
2781
if (dialog_id != 0 && (forwaringMessage != null || !selectedMessagesIds .isEmpty ())) {
2777
- if (isBraodcast ) {
2782
+ if (isBroadcast ) {
2778
2783
param = true ;
2779
2784
}
2780
2785
if (did != dialog_id ) {
@@ -3178,9 +3183,10 @@ public void didClickAddButton(ChatContactCell cell, TLRPC.User user) {
3178
3183
processRowSelect (cell );
3179
3184
return ;
3180
3185
}
3186
+ MessageObject messageObject = cell .getMessageObject ();
3181
3187
Bundle args = new Bundle ();
3182
- args .putInt ("user_id" , message .messageOwner .media .user_id );
3183
- args .putString ("phone" , message .messageOwner .media .phone_number );
3188
+ args .putInt ("user_id" , messageObject .messageOwner .media .user_id );
3189
+ args .putString ("phone" , messageObject .messageOwner .media .phone_number );
3184
3190
presentFragment (new ContactAddActivity (args ));
3185
3191
}
3186
3192
0 commit comments