nus-yam/ex-repair huggingface dataset:
Program: 35570
Project: 35570
Buggy source:
@Override public void onNext(RoomsOverall roomsOverall){
  for (  Room room : roomsOverall.getOcs().getData()) {
    if (roomId.equals(room.getRoomId())) {
      currentRoom=room;
      conversationNameTextView.setText(room.getDisplayName());
      loadAvatar();
      checkIfAnyParticipantsRemainInRoom();
      break;
    }
  }
}

Fixed version (ground truth):
@Override public void onNext(RoomsOverall roomsOverall){
  for (  Room room : roomsOverall.getOcs().getData()) {
    if (roomId.equals(room.getRoomId())) {
      currentRoom=room;
      conversationNameTextView.setText(room.getDisplayName());
      loadAvatar();
      checkIfAnyParticipantsRemainInRoom();
      showAnswerControls();
      break;
    }
  }
}
Program: 35571
Project: 35571
Buggy source:
private void handleFromNotification(){
  ncApi.getRooms(credentials,ApiUtils.getUrlForGetRooms(userBeingCalled.getBaseUrl())).subscribeOn(Schedulers.newThread()).retry(3).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<RoomsOverall>(){
    @Override public void onSubscribe(    Disposable d){
      disposablesList.add(d);
    }
    @Override public void onNext(    RoomsOverall roomsOverall){
      for (      Room room : roomsOverall.getOcs().getData()) {
        if (roomId.equals(room.getRoomId())) {
          currentRoom=room;
          conversationNameTextView.setText(room.getDisplayName());
          loadAvatar();
          checkIfAnyParticipantsRemainInRoom();
          break;
        }
      }
    }
    @Override public void onError(    Throwable e){
    }
    @Override public void onComplete(){
    }
  }
);
}

Fixed version (ground truth):
private void handleFromNotification(){
  ncApi.getRooms(credentials,ApiUtils.getUrlForGetRooms(userBeingCalled.getBaseUrl())).subscribeOn(Schedulers.newThread()).retry(3).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<RoomsOverall>(){
    @Override public void onSubscribe(    Disposable d){
      disposablesList.add(d);
    }
    @Override public void onNext(    RoomsOverall roomsOverall){
      for (      Room room : roomsOverall.getOcs().getData()) {
        if (roomId.equals(room.getRoomId())) {
          currentRoom=room;
          conversationNameTextView.setText(room.getDisplayName());
          loadAvatar();
          checkIfAnyParticipantsRemainInRoom();
          showAnswerControls();
          break;
        }
      }
    }
    @Override public void onError(    Throwable e){
    }
    @Override public void onComplete(){
    }
  }
);
}
Program: 35573
Project: 35573
Buggy source:
@SuppressLint("String_Node_Str") @Override public boolean onItemClick(View view,int position){
  NotificationSoundItem notificationSoundItem=(NotificationSoundItem)adapter.getItem(position);
  Uri ringtoneUri=null;
  Runnable runnable=() -> endMediaPlayer();
  if (!TextUtils.isEmpty(notificationSoundItem.getNotificationSoundUri())) {
    ringtoneUri=Uri.parse(notificationSoundItem.getNotificationSoundUri());
    endMediaPlayer();
    mediaPlayer=MediaPlayer.create(getActivity(),ringtoneUri);
    cancelMediaPlayerHandler=new Handler();
    cancelMediaPlayerHandler.postDelayed(runnable,mediaPlayer.getDuration() + 25);
    mediaPlayer.start();
  }
  if (adapter.getSelectedPositions().get(0) != position) {
    RingtoneSettings ringtoneSettings=new RingtoneSettings();
    ringtoneSettings.setRingtoneName(notificationSoundItem.getNotificationSoundName());
    ringtoneSettings.setRingtoneUri(ringtoneUri);
    if (callNotificationSounds) {
      try {
        appPreferences.setCallRingtoneUri(LoganSquare.serialize(ringtoneSettings));
        toggleSelection(position);
      }
 catch (      IOException e) {
        Log.e(TAG,"String_Node_Str");
      }
    }
 else {
      try {
        appPreferences.setMessageRingtoneUri(LoganSquare.serialize(ringtoneSettings));
        toggleSelection(position);
      }
 catch (      IOException e) {
        Log.e(TAG,"String_Node_Str");
      }
    }
  }
  return true;
}

Fixed version (ground truth):
@SuppressLint("String_Node_Str") @Override public boolean onItemClick(View view,int position){
  NotificationSoundItem notificationSoundItem=(NotificationSoundItem)adapter.getItem(position);
  Uri ringtoneUri=null;
  Runnable runnable=() -> endMediaPlayer();
  if (!TextUtils.isEmpty(notificationSoundItem.getNotificationSoundUri())) {
    ringtoneUri=Uri.parse(notificationSoundItem.getNotificationSoundUri());
    endMediaPlayer();
    mediaPlayer=MediaPlayer.create(getActivity(),ringtoneUri);
    cancelMediaPlayerHandler=new Handler();
    cancelMediaPlayerHandler.postDelayed(runnable,mediaPlayer.getDuration() + 25);
    mediaPlayer.start();
  }
  if (adapter.getSelectedPositions().size() == 0 || adapter.getSelectedPositions().get(0) != position) {
    RingtoneSettings ringtoneSettings=new RingtoneSettings();
    ringtoneSettings.setRingtoneName(notificationSoundItem.getNotificationSoundName());
    ringtoneSettings.setRingtoneUri(ringtoneUri);
    if (callNotificationSounds) {
      try {
        appPreferences.setCallRingtoneUri(LoganSquare.serialize(ringtoneSettings));
        toggleSelection(position);
      }
 catch (      IOException e) {
        Log.e(TAG,"String_Node_Str");
      }
    }
 else {
      try {
        appPreferences.setMessageRingtoneUri(LoganSquare.serialize(ringtoneSettings));
        toggleSelection(position);
      }
 catch (      IOException e) {
        Log.e(TAG,"String_Node_Str");
      }
    }
  }
  return true;
}
Program: 35574
Project: 35574
Buggy source:
@Override public Uri getFromString(String string){
  return Uri.parse(string);
}

Fixed version (ground truth):
@Override public Uri getFromString(String string){
  if (!TextUtils.isEmpty(string)) {
    return Uri.parse(string);
  }
 else {
    return null;
  }
}
Program: 35575
Project: 35575
Buggy source:
@Override public String convertToString(Uri object){
  return object.toString();
}

Fixed version (ground truth):
@Override public String convertToString(Uri object){
  if (object != null) {
    return object.toString();
  }
 else {
    return null;
  }
}
Program: 35576
Project: 35576
Buggy source:
private void checkIfAnyParticipantsRemainInRoom(){
  ncApi.getPeersForCall(credentials,ApiUtils.getUrlForParticipants(userBeingCalled.getBaseUrl(),currentRoom.getToken())).subscribeOn(Schedulers.newThread()).takeWhile(observable -> !leavingScreen).retry(3).subscribe(new Observer<ParticipantsOverall>(){
    @Override public void onSubscribe(    Disposable d){
      disposablesList.add(d);
      participantsCheckIsRunning=true;
    }
    @Override public void onNext(    ParticipantsOverall participantsOverall){
      boolean hasParticipantsInCall=false;
      boolean inCallOnDifferentDevice=false;
      List<Participant> participantList=participantsOverall.getOcs().getData();
      for (      Participant participant : participantList) {
        if (participant.isInCall()) {
          hasParticipantsInCall=true;
          if (participant.getUserId().equals(userBeingCalled.getUserId())) {
            inCallOnDifferentDevice=true;
          }
          break;
        }
      }
      if (!hasParticipantsInCall || inCallOnDifferentDevice) {
        if (getActivity() != null) {
          getActivity().runOnUiThread(() -> hangup());
        }
      }
    }
    @Override public void onError(    Throwable e){
    }
    @Override public void onComplete(){
      if (!leavingScreen) {
        checkIfAnyParticipantsRemainInRoom();
      }
    }
  }
);
}

Fixed version (ground truth):
private void checkIfAnyParticipantsRemainInRoom(){
  ncApi.getPeersForCall(credentials,ApiUtils.getUrlForParticipants(userBeingCalled.getBaseUrl(),currentRoom.getToken())).subscribeOn(Schedulers.newThread()).takeWhile(observable -> !leavingScreen).retry(3).subscribe(new Observer<ParticipantsOverall>(){
    @Override public void onSubscribe(    Disposable d){
      disposablesList.add(d);
      participantsCheckIsRunning=true;
    }
    @Override public void onNext(    ParticipantsOverall participantsOverall){
      boolean hasParticipantsInCall=false;
      boolean inCallOnDifferentDevice=false;
      List<Participant> participantList=participantsOverall.getOcs().getData();
      for (      Participant participant : participantList) {
        if (participant.isInCall()) {
          hasParticipantsInCall=true;
          if (participant.getUserId().equals(userBeingCalled.getUserId())) {
            inCallOnDifferentDevice=true;
            break;
          }
        }
      }
      if (!hasParticipantsInCall || inCallOnDifferentDevice) {
        if (getActivity() != null) {
          getActivity().runOnUiThread(() -> hangup());
        }
      }
    }
    @Override public void onError(    Throwable e){
    }
    @Override public void onComplete(){
      if (!leavingScreen) {
        checkIfAnyParticipantsRemainInRoom();
      }
    }
  }
);
}
Program: 35580
Project: 35580
Buggy source:
@Override public void onScrollStateChanged(RecyclerView recyclerView,int newState){
  super.onScrollStateChanged(recyclerView,newState);
  if (newState == AbsListView.OnScrollListener.SCROLL_STATE_IDLE) {
    if (newMessagesCount != 0) {
      if (layoutManager.findFirstCompletelyVisibleItemPosition() < newMessagesCount) {
        newMessagesCount=0;
        if (popupBubble.isShown()) {
          popupBubble.hide();
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onScrollStateChanged(RecyclerView recyclerView,int newState){
  super.onScrollStateChanged(recyclerView,newState);
  if (newState == AbsListView.OnScrollListener.SCROLL_STATE_IDLE) {
    if (newMessagesCount != 0) {
      if (layoutManager.findFirstCompletelyVisibleItemPosition() < newMessagesCount) {
        newMessagesCount=0;
        if (popupBubble != null && popupBubble.isShown()) {
          popupBubble.hide();
        }
      }
    }
  }
}
Program: 35583
Project: 35583
Buggy source:
private void sendMessage(String message){
  Map<String,String> fieldMap=new HashMap<>();
  fieldMap.put("String_Node_Str",message);
  fieldMap.put("String_Node_Str",conversationUser.getDisplayName());
  ncApi.sendChatMessage(credentials,ApiUtils.getUrlForChat(baseUrl,roomToken),fieldMap).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).retry(3,observable -> inChat).subscribe(new Observer<GenericOverall>(){
    @Override public void onSubscribe(    Disposable d){
    }
    @Override public void onNext(    GenericOverall genericOverall){
      if (conversationUser.getUserId().equals("String_Node_Str") && TextUtils.isEmpty(myFirstMessage)) {
        myFirstMessage=message;
      }
      if (popupBubble.isShown()) {
        popupBubble.hide();
      }
      messagesList.smoothScrollToPosition(0);
    }
    @Override public void onError(    Throwable e){
    }
    @Override public void onComplete(){
    }
  }
);
}

Fixed version (ground truth):
private void sendMessage(String message){
  Map<String,String> fieldMap=new HashMap<>();
  fieldMap.put("String_Node_Str",message);
  fieldMap.put("String_Node_Str",conversationUser.getDisplayName());
  ncApi.sendChatMessage(credentials,ApiUtils.getUrlForChat(baseUrl,roomToken),fieldMap).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).retry(3,observable -> inChat).subscribe(new Observer<GenericOverall>(){
    @Override public void onSubscribe(    Disposable d){
    }
    @Override public void onNext(    GenericOverall genericOverall){
      if (conversationUser.getUserId().equals("String_Node_Str") && TextUtils.isEmpty(myFirstMessage)) {
        myFirstMessage=message;
      }
      getActivity().runOnUiThread(() -> {
        if (popupBubble.isShown()) {
          popupBubble.hide();
        }
        messagesList.smoothScrollToPosition(0);
      }
);
    }
    @Override public void onError(    Throwable e){
    }
    @Override public void onComplete(){
    }
  }
);
}
Program: 35584
Project: 35584
Buggy source:
@Subscribe(threadMode=ThreadMode.MAIN) public void onMessageEvent(BottomSheetLockEvent bottomSheetLockEvent){
  if (bottomSheet != null) {
    if (!bottomSheetLockEvent.isCancelable()) {
      bottomSheet.setCancelable(bottomSheetLockEvent.isCancelable());
    }
 else {
      bottomSheet.setCancelable(bottomSheetLockEvent.isCancelable());
      if (bottomSheet.isShowing() && bottomSheetLockEvent.isCancel()) {
        new Handler().postDelayed(() -> {
          bottomSheet.setOnCancelListener(null);
          bottomSheet.cancel();
          if (bottomSheetLockEvent.isDismissView()) {
            new Handler().postDelayed(() -> getRouter().popCurrentController(),100);
          }
        }
,bottomSheetLockEvent.getDelay());
      }
    }
  }
}

Fixed version (ground truth):
@Subscribe(threadMode=ThreadMode.MAIN) public void onMessageEvent(BottomSheetLockEvent bottomSheetLockEvent){
  if (bottomSheet != null) {
    if (!bottomSheetLockEvent.isCancelable()) {
      bottomSheet.setCancelable(bottomSheetLockEvent.isCancelable());
    }
 else {
      bottomSheet.setCancelable(bottomSheetLockEvent.isCancelable());
      if (bottomSheet.isShowing() && bottomSheetLockEvent.isCancel()) {
        new Handler().postDelayed(() -> {
          bottomSheet.setOnCancelListener(null);
          bottomSheet.cancel();
        }
,bottomSheetLockEvent.getDelay());
      }
    }
  }
}
Program: 35585
Project: 35585
Buggy source:
private void initiateConversation(boolean dismissView,@Nullable List<String> spreedCapabilities){
  Bundle bundle=new Bundle();
  boolean hasChatCapability;
  if (baseUrl != null && !baseUrl.equals(currentUser.getBaseUrl())) {
    bundle.putString(BundleKeys.KEY_MODIFIED_BASE_URL,baseUrl);
    hasChatCapability=spreedCapabilities != null && spreedCapabilities.contains("String_Node_Str");
  }
 else {
    hasChatCapability=currentUser.hasSpreedCapabilityWithName("String_Node_Str");
  }
  if (hasChatCapability) {
    eventBus.post(new BottomSheetLockEvent(true,0,true,true,dismissView));
    Intent conversationIntent=new Intent(getActivity(),CallActivity.class);
    bundle.putString(BundleKeys.KEY_ROOM_TOKEN,room.getToken());
    bundle.putString(BundleKeys.KEY_ROOM_ID,room.getToken());
    bundle.putString(BundleKeys.KEY_CONVERSATION_NAME,room.getDisplayName());
    bundle.putParcelable(BundleKeys.KEY_ACTIVE_CONVERSATION,Parcels.wrap(call));
    conversationIntent.putExtras(bundle);
    getParentController().getParentController().getRouter().pushController((RouterTransaction.with(new ChatController(bundle)).pushChangeHandler(new HorizontalChangeHandler()).popChangeHandler(new HorizontalChangeHandler())));
  }
 else {
    initiateCall();
  }
}

Fixed version (ground truth):
private void initiateConversation(boolean dismissView,@Nullable List<String> spreedCapabilities){
  Bundle bundle=new Bundle();
  boolean hasChatCapability;
  if (baseUrl != null && !baseUrl.equals(currentUser.getBaseUrl())) {
    bundle.putString(BundleKeys.KEY_MODIFIED_BASE_URL,baseUrl);
    hasChatCapability=spreedCapabilities != null && spreedCapabilities.contains("String_Node_Str");
  }
 else {
    hasChatCapability=currentUser.hasSpreedCapabilityWithName("String_Node_Str");
  }
  if (hasChatCapability) {
    eventBus.post(new BottomSheetLockEvent(true,0,true,true,dismissView));
    Intent conversationIntent=new Intent(getActivity(),CallActivity.class);
    bundle.putString(BundleKeys.KEY_ROOM_TOKEN,room.getToken());
    bundle.putString(BundleKeys.KEY_ROOM_ID,room.getRoomId());
    bundle.putString(BundleKeys.KEY_CONVERSATION_NAME,room.getDisplayName());
    bundle.putParcelable(BundleKeys.KEY_ACTIVE_CONVERSATION,Parcels.wrap(call));
    conversationIntent.putExtras(bundle);
    getParentController().getRouter().pushController(RouterTransaction.with(new ChatController(bundle)).pushChangeHandler(new HorizontalChangeHandler()).popChangeHandler(new HorizontalChangeHandler()));
  }
 else {
    initiateCall();
  }
}
Program: 35586
Project: 35586
Buggy source:
private void inviteUsersToAConversation(){
  RetrofitBucket retrofitBucket;
  final ArrayList<String> localInvitedUsers=invitedUsers;
  if (localInvitedUsers.size() > 0) {
    for (int i=0; i < invitedUsers.size(); i++) {
      final String userId=invitedUsers.get(i);
      retrofitBucket=ApiUtils.getRetrofitBucketForAddParticipant(currentUser.getBaseUrl(),room.getToken(),userId);
      ncApi.addParticipant(credentials,retrofitBucket.getUrl(),retrofitBucket.getQueryMap()).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).retry(1).subscribe(new Observer<AddParticipantOverall>(){
        @Override public void onSubscribe(        Disposable d){
        }
        @Override public void onNext(        AddParticipantOverall addParticipantOverall){
        }
        @Override public void onError(        Throwable e){
          dispose();
        }
        @Override public void onComplete(){
synchronized (localInvitedUsers) {
            localInvitedUsers.remove(userId);
          }
          if (localInvitedUsers.size() == 0) {
            initiateConversation(false,null);
          }
          dispose();
        }
      }
);
    }
  }
 else {
    showResultImage(true,false);
  }
}

Fixed version (ground truth):
private void inviteUsersToAConversation(){
  RetrofitBucket retrofitBucket;
  final ArrayList<String> localInvitedUsers=invitedUsers;
  if (localInvitedUsers.size() > 0) {
    for (int i=0; i < invitedUsers.size(); i++) {
      final String userId=invitedUsers.get(i);
      retrofitBucket=ApiUtils.getRetrofitBucketForAddParticipant(currentUser.getBaseUrl(),room.getToken(),userId);
      ncApi.addParticipant(credentials,retrofitBucket.getUrl(),retrofitBucket.getQueryMap()).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).retry(1).subscribe(new Observer<AddParticipantOverall>(){
        @Override public void onSubscribe(        Disposable d){
        }
        @Override public void onNext(        AddParticipantOverall addParticipantOverall){
        }
        @Override public void onError(        Throwable e){
          dispose();
        }
        @Override public void onComplete(){
synchronized (localInvitedUsers) {
            localInvitedUsers.remove(userId);
          }
          if (localInvitedUsers.size() == 0) {
            initiateConversation(true,null);
          }
          dispose();
        }
      }
);
    }
  }
 else {
    showResultImage(true,false);
  }
}
Program: 35591
Project: 35591
Buggy source:
private void leaveRoom(){
  ncApi.leaveRoom(credentials,ApiUtils.getRoom(baseUrl,roomToken)).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<GenericOverall>(){
    @Override public void onSubscribe(    Disposable d){
    }
    @Override public void onNext(    GenericOverall genericOverall){
      finish();
    }
    @Override public void onError(    Throwable e){
    }
    @Override public void onComplete(){
    }
  }
);
}

Fixed version (ground truth):
private void leaveRoom(){
  ncApi.leaveRoom(credentials,ApiUtils.getUrlForRoomParticipants(baseUrl,roomToken)).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<GenericOverall>(){
    @Override public void onSubscribe(    Disposable d){
    }
    @Override public void onNext(    GenericOverall genericOverall){
      finish();
    }
    @Override public void onError(    Throwable e){
    }
    @Override public void onComplete(){
    }
  }
);
}
Program: 35592
Project: 35592
Buggy source:
private void joinRoomAndCall(){
  if ("String_Node_Str".equals(callSession)) {
    ncApi.joinRoom(credentials,ApiUtils.getUrlForRoomParticipants(baseUrl,roomToken),null).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).retry(3).subscribe(new Observer<CallOverall>(){
      @Override public void onSubscribe(      Disposable d){
      }
      @Override public void onNext(      CallOverall callOverall){
        performCall();
      }
      @Override public void onError(      Throwable e){
      }
      @Override public void onComplete(){
      }
    }
);
  }
 else {
    performCall();
  }
}

Fixed version (ground truth):
private void joinRoomAndCall(){
  if ("String_Node_Str".equals(callSession)) {
    ncApi.joinRoom(credentials,ApiUtils.getUrlForRoomParticipants(baseUrl,roomToken),null).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).retry(3).subscribe(new Observer<CallOverall>(){
      @Override public void onSubscribe(      Disposable d){
      }
      @Override public void onNext(      CallOverall callOverall){
        callSession=callOverall.getOcs().getData().getSessionId();
        performCall();
      }
      @Override public void onError(      Throwable e){
      }
      @Override public void onComplete(){
      }
    }
);
  }
 else {
    performCall();
  }
}
Program: 35593
Project: 35593
Buggy source:
private void initiateConversation(boolean dismissView,@Nullable List<String> spreedCapabilities){
  Bundle bundle=new Bundle();
  boolean hasChatCapability;
  if (baseUrl != null && !baseUrl.equals(currentUser.getBaseUrl())) {
    bundle.putString(BundleKeys.KEY_MODIFIED_BASE_URL,baseUrl);
    hasChatCapability=spreedCapabilities != null && spreedCapabilities.contains("String_Node_Str");
  }
 else {
    hasChatCapability=currentUser.hasSpreedCapabilityWithName("String_Node_Str");
  }
  if (hasChatCapability) {
    eventBus.post(new BottomSheetLockEvent(true,0,true,true,dismissView));
    Intent conversationIntent=new Intent(getActivity(),CallActivity.class);
    bundle.putString(BundleKeys.KEY_ROOM_TOKEN,room.getToken());
    bundle.putString(BundleKeys.KEY_ROOM_ID,room.getRoomId());
    bundle.putString(BundleKeys.KEY_CONVERSATION_NAME,room.getDisplayName());
    bundle.putParcelable(BundleKeys.KEY_ACTIVE_CONVERSATION,Parcels.wrap(call));
    conversationIntent.putExtras(bundle);
    getParentController().getRouter().pushController(RouterTransaction.with(new ChatController(bundle)).pushChangeHandler(new HorizontalChangeHandler()).popChangeHandler(new HorizontalChangeHandler()));
  }
 else {
    initiateCall();
  }
}

Fixed version (ground truth):
private void initiateConversation(boolean dismissView,@Nullable List<String> spreedCapabilities){
  Bundle bundle=new Bundle();
  boolean hasChatCapability;
  if (baseUrl != null && !baseUrl.equals(currentUser.getBaseUrl())) {
    bundle.putString(BundleKeys.KEY_MODIFIED_BASE_URL,baseUrl);
    hasChatCapability=spreedCapabilities != null && spreedCapabilities.contains("String_Node_Str");
  }
 else {
    hasChatCapability=currentUser.hasSpreedCapabilityWithName("String_Node_Str");
  }
  if (hasChatCapability) {
    eventBus.post(new BottomSheetLockEvent(true,0,true,true,dismissView));
    Intent conversationIntent=new Intent(getActivity(),CallActivity.class);
    bundle.putString(BundleKeys.KEY_ROOM_TOKEN,room.getToken());
    bundle.putString(BundleKeys.KEY_ROOM_ID,room.getRoomId());
    bundle.putString(BundleKeys.KEY_CONVERSATION_NAME,room.getDisplayName());
    bundle.putParcelable(BundleKeys.KEY_ACTIVE_CONVERSATION,Parcels.wrap(call));
    conversationIntent.putExtras(bundle);
    if (getParentController() != null) {
      if (getParentController().getParentController() != null) {
        getParentController().getParentController().getRouter().pushController(RouterTransaction.with(new ChatController(bundle)).pushChangeHandler(new HorizontalChangeHandler()).popChangeHandler(new HorizontalChangeHandler()));
      }
 else {
        getParentController().getRouter().pushController(RouterTransaction.with(new ChatController(bundle)).pushChangeHandler(new HorizontalChangeHandler()).popChangeHandler(new HorizontalChangeHandler()));
      }
    }
  }
 else {
    initiateCall();
  }
}
Program: 35594
Project: 35594
Buggy source:
private void handleFromNotification(){
  ncApi.getRooms(credentials,ApiUtils.getUrlForGetRooms(baseUrl)).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<RoomsOverall>(){
    @Override public void onSubscribe(    Disposable d){
    }
    @Override public void onNext(    RoomsOverall roomsOverall){
      for (      Room room : roomsOverall.getOcs().getData()) {
        if (roomId.equals(room.getRoomId())) {
          roomToken=room.getToken();
          conversationName=room.getDisplayName();
          setTitle();
          break;
        }
      }
      setupMentionAutocomplete();
      joinRoomWithPassword();
    }
    @Override public void onError(    Throwable e){
    }
    @Override public void onComplete(){
    }
  }
);
}

Fixed version (ground truth):
private void handleFromNotification(){
  ncApi.getRooms(credentials,ApiUtils.getUrlForGetRooms(baseUrl)).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<RoomsOverall>(){
    @Override public void onSubscribe(    Disposable d){
    }
    @Override public void onNext(    RoomsOverall roomsOverall){
      for (      Room room : roomsOverall.getOcs().getData()) {
        if (roomId.equals(room.getRoomId())) {
          roomToken=room.getToken();
          conversationName=room.getDisplayName();
          setTitle();
          break;
        }
      }
      getActivity().runOnUiThread(() -> setupMentionAutocomplete());
      joinRoomWithPassword();
    }
    @Override public void onError(    Throwable e){
    }
    @Override public void onComplete(){
    }
  }
);
}
Program: 35595
Project: 35595
Buggy source:
@Override protected void onQuery(@Nullable CharSequence query){
  if (!TextUtils.isEmpty(query)) {
    UserEntity currentUser=userUtils.getCurrentUser();
    adapter.setFilter(query.toString());
    ncApi.getMentionAutocompleteSuggestions(ApiUtils.getCredentials(currentUser.getUserId(),currentUser.getToken()),ApiUtils.getUrlForMentionSuggestions(currentUser.getBaseUrl(),roomToken),query.toString(),null).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).retry(3).subscribe(new Observer<MentionOverall>(){
      @Override public void onSubscribe(      Disposable d){
      }
      @Override public void onNext(      MentionOverall mentionOverall){
        List<Mention> mentionsList=mentionOverall.getOcs().getData();
        if (mentionsList.size() == 0) {
          adapter.clear();
        }
 else {
          List<AbstractFlexibleItem> internalAbstractFlexibleItemList=new ArrayList<>();
          for (          Mention mention : mentionsList) {
            internalAbstractFlexibleItemList.add(new MentionAutocompleteItem(mention.getId(),mention.getLabel(),currentUser));
          }
          adapter.updateDataSet(internalAbstractFlexibleItemList);
        }
      }
      @Override public void onError(      Throwable e){
        adapter.clear();
      }
      @Override public void onComplete(){
      }
    }
);
  }
 else {
    adapter.clear();
  }
}

Fixed version (ground truth):
@Override protected void onQuery(@Nullable CharSequence query){
  if (!TextUtils.isEmpty(query)) {
    UserEntity currentUser=userUtils.getCurrentUser();
    adapter.setFilter(query.toString());
    ncApi.getMentionAutocompleteSuggestions(ApiUtils.getCredentials(currentUser.getUserId(),currentUser.getToken()),ApiUtils.getUrlForMentionSuggestions(currentUser.getBaseUrl(),roomToken),query.toString(),null).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).retry(3).subscribe(new Observer<MentionOverall>(){
      @Override public void onSubscribe(      Disposable d){
      }
      @Override public void onNext(      MentionOverall mentionOverall){
        List<Mention> mentionsList=mentionOverall.getOcs().getData();
        if (mentionsList.size() == 0) {
          adapter.clear();
        }
 else {
          List<AbstractFlexibleItem> internalAbstractFlexibleItemList=new ArrayList<>();
          for (          Mention mention : mentionsList) {
            internalAbstractFlexibleItemList.add(new MentionAutocompleteItem(mention.getId(),mention.getLabel(),currentUser));
          }
          if (adapter.getItemCount() != 0) {
            adapter.clear();
          }
          adapter.updateDataSet(internalAbstractFlexibleItemList);
        }
      }
      @Override public void onError(      Throwable e){
        adapter.clear();
      }
      @Override public void onComplete(){
      }
    }
);
  }
 else {
    adapter.clear();
  }
}
Program: 35596
Project: 35596
Buggy source:
@Override protected RecyclerView.Adapter instantiateAdapter(){
  adapter=new FlexibleAdapter<>(abstractFlexibleItemList,context,true);
  adapter.addListener(this);
  return adapter;
}

Fixed version (ground truth):
@Override protected RecyclerView.Adapter instantiateAdapter(){
  adapter=new FlexibleAdapter<>(abstractFlexibleItemList,context,false);
  adapter.addListener(this);
  return adapter;
}
Program: 35597
Project: 35597
Buggy source:
@Override public void onNext(MentionOverall mentionOverall){
  List<Mention> mentionsList=mentionOverall.getOcs().getData();
  if (mentionsList.size() == 0) {
    adapter.clear();
  }
 else {
    List<AbstractFlexibleItem> internalAbstractFlexibleItemList=new ArrayList<>();
    for (    Mention mention : mentionsList) {
      internalAbstractFlexibleItemList.add(new MentionAutocompleteItem(mention.getId(),mention.getLabel(),currentUser));
    }
    adapter.updateDataSet(internalAbstractFlexibleItemList);
  }
}

Fixed version (ground truth):
@Override public void onNext(MentionOverall mentionOverall){
  List<Mention> mentionsList=mentionOverall.getOcs().getData();
  if (mentionsList.size() == 0) {
    adapter.clear();
  }
 else {
    List<AbstractFlexibleItem> internalAbstractFlexibleItemList=new ArrayList<>();
    for (    Mention mention : mentionsList) {
      internalAbstractFlexibleItemList.add(new MentionAutocompleteItem(mention.getId(),mention.getLabel(),currentUser));
    }
    if (adapter.getItemCount() != 0) {
      adapter.clear();
    }
    adapter.updateDataSet(internalAbstractFlexibleItemList);
  }
}
Program: 35598
Project: 35598
Buggy source:
@Override public void onBind(ChatMessage message){
  super.onBind(message);
  String author;
  if (!TextUtils.isEmpty(author=message.getActorDisplayName())) {
    messageAuthor.setText(author);
  }
 else {
    messageAuthor.setText(R.string.nc_nick_guest);
  }
  HashMap<String,HashMap<String,String>> messageParameters=message.getMessageParameters();
  Spannable messageString=new SpannableString(message.getText());
  if (messageParameters != null && message.getMessageParameters().size() > 0) {
    for (    String key : message.getMessageParameters().keySet()) {
      HashMap<String,String> individualHashMap=message.getMessageParameters().get(key);
      if (individualHashMap.get("String_Node_Str").equals("String_Node_Str")) {
        int color;
        if (!individualHashMap.get("String_Node_Str").equals(message.getActorId())) {
          if (individualHashMap.get("String_Node_Str").equals(currentUser.getUserId())) {
            color=NextcloudTalkApplication.getSharedApplication().getResources().getColor(R.color.nc_incoming_text_mention_you);
          }
 else {
            color=NextcloudTalkApplication.getSharedApplication().getResources().getColor(R.color.nc_incoming_text_mention_others);
          }
          messageString=DisplayUtils.searchAndColor(messageText.getText().toString(),messageString,"String_Node_Str" + individualHashMap.get("String_Node_Str"),color);
        }
      }
    }
  }
  messageText.setText(messageString);
}

Fixed version (ground truth):
@Override public void onBind(ChatMessage message){
  super.onBind(message);
  String author;
  if (!TextUtils.isEmpty(author=message.getActorDisplayName())) {
    messageAuthor.setText(author);
  }
 else {
    messageAuthor.setText(R.string.nc_nick_guest);
  }
  HashMap<String,HashMap<String,String>> messageParameters=message.getMessageParameters();
  Spannable messageString=new SpannableString(message.getText());
  if (messageParameters != null && message.getMessageParameters().size() > 0) {
    for (    String key : message.getMessageParameters().keySet()) {
      HashMap<String,String> individualHashMap=message.getMessageParameters().get(key);
      if (individualHashMap.get("String_Node_Str").equals("String_Node_Str")) {
        int color;
        if (individualHashMap.get("String_Node_Str").equals(currentUser.getUserId())) {
          color=NextcloudTalkApplication.getSharedApplication().getResources().getColor(R.color.nc_incoming_text_mention_you);
        }
 else {
          color=NextcloudTalkApplication.getSharedApplication().getResources().getColor(R.color.nc_incoming_text_mention_others);
        }
        messageString=DisplayUtils.searchAndColor(messageText.getText().toString(),messageString,"String_Node_Str" + individualHashMap.get("String_Node_Str"),color);
      }
    }
  }
  messageText.setText(messageString);
}
Program: 35599
Project: 35599
Buggy source:
@Override public void onError(Throwable e){
  userItemList=new ArrayList<>();
  adapter.updateDataSet(new ArrayList<>(),false);
}

Fixed version (ground truth):
@Override public void onError(Throwable e){
  adapter.updateDataSet(new ArrayList<>(),false);
}
Program: 35600
Project: 35600
Buggy source:
@Override public boolean onItemClick(View view,int position){
  Mention mention=new Mention();
  MentionAutocompleteItem mentionAutocompleteItem=(MentionAutocompleteItem)userItemList.get(position);
  mention.setId(mentionAutocompleteItem.getUserId());
  mention.setLabel(mentionAutocompleteItem.getDisplayName());
  mention.setSource("String_Node_Str");
  dispatchClick(mention);
  return true;
}

Fixed version (ground truth):
@Override public boolean onItemClick(View view,int position){
  Mention mention=new Mention();
  MentionAutocompleteItem mentionAutocompleteItem=(MentionAutocompleteItem)adapter.getItem(position);
  if (mentionAutocompleteItem != null) {
    mention.setId(mentionAutocompleteItem.getUserId());
    mention.setLabel(mentionAutocompleteItem.getDisplayName());
    mention.setSource("String_Node_Str");
    dispatchClick(mention);
  }
  return true;
}
Program: 35602
Project: 35602
Buggy source:
@Override protected RecyclerView.Adapter instantiateAdapter(){
  adapter=new FlexibleAdapter<>(userItemList,context,true);
  adapter.addListener(this);
  return adapter;
}

Fixed version (ground truth):
@Override protected RecyclerView.Adapter instantiateAdapter(){
  adapter=new FlexibleAdapter<>(new ArrayList<AbstractFlexibleItem>(),context,true);
  adapter.addListener(this);
  return adapter;
}
Program: 35603
Project: 35603
Buggy source:
@Override public void onNext(MentionOverall mentionOverall){
  List<Mention> mentionsList=mentionOverall.getOcs().getData();
  List<AbstractFlexibleItem> internalUserItemList=new ArrayList<>();
  if (mentionsList.size() == 0 || (mentionsList.size() == 1 && mentionsList.get(0).getId().equals(query.toString()))) {
    userItemList=new ArrayList<>();
    adapter.notifyDataSetChanged();
  }
 else {
    for (    Mention mention : mentionsList) {
      internalUserItemList.add(new MentionAutocompleteItem(mention.getId(),mention.getLabel(),currentUser));
    }
    userItemList=internalUserItemList;
    adapter.updateDataSet(internalUserItemList,true);
  }
}

Fixed version (ground truth):
@Override public void onNext(MentionOverall mentionOverall){
  List<Mention> mentionsList=mentionOverall.getOcs().getData();
  List<AbstractFlexibleItem> internalUserItemList=new ArrayList<>();
  if (mentionsList.size() == 0 || (mentionsList.size() == 1 && mentionsList.get(0).getId().equals(query.toString()))) {
    adapter.notifyDataSetChanged();
  }
 else {
    for (    Mention mention : mentionsList) {
      internalUserItemList.add(new MentionAutocompleteItem(mention.getId(),mention.getLabel(),currentUser));
    }
    adapter.updateDataSet(internalUserItemList,true);
  }
}
Program: 35604
Project: 35604
Buggy source:
@Override public void onDestroy(){
  inChat=false;
  super.onDestroy();
}

Fixed version (ground truth):
@Override public void onDestroy(){
  inChat=false;
  dispose();
  super.onDestroy();
}
Program: 35605
Project: 35605
Buggy source:
private void joinRoomWithPassword(){
  String password="String_Node_Str";
  if (TextUtils.isEmpty(roomPassword)) {
    password=roomPassword;
  }
  ncApi.joinRoom(ApiUtils.getCredentials(currentUser.getUserId(),currentUser.getToken()),ApiUtils.getUrlForRoomParticipants(currentUser.getBaseUrl(),roomToken),password).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).retry(3).subscribe(new Observer<CallOverall>(){
    @Override public void onSubscribe(    Disposable d){
    }
    @Override public void onNext(    CallOverall callOverall){
      inChat=true;
      pullChatMessages(0);
      currentCall=callOverall.getOcs().getData();
    }
    @Override public void onError(    Throwable e){
    }
    @Override public void onComplete(){
    }
  }
);
}

Fixed version (ground truth):
private void joinRoomWithPassword(){
  String password="String_Node_Str";
  if (TextUtils.isEmpty(roomPassword)) {
    password=roomPassword;
  }
  ncApi.joinRoom(ApiUtils.getCredentials(currentUser.getUserId(),currentUser.getToken()),ApiUtils.getUrlForRoomParticipants(currentUser.getBaseUrl(),roomToken),password).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).retry(3).subscribe(new Observer<CallOverall>(){
    @Override public void onSubscribe(    Disposable d){
      disposableList.add(d);
    }
    @Override public void onNext(    CallOverall callOverall){
      inChat=true;
      pullChatMessages(0);
      currentCall=callOverall.getOcs().getData();
    }
    @Override public void onError(    Throwable e){
    }
    @Override public void onComplete(){
    }
  }
);
}
Program: 35606
Project: 35606
Buggy source:
@Override public void onSubscribe(Disposable d){
}

Fixed version (ground truth):
@Override public void onSubscribe(Disposable d){
  disposableList.add(d);
}
Program: 35609
Project: 35609
Buggy source:
@OnClick(R.id.call_header_layout) void toggleCallHeader(){
  adapter.toggleSelection(0);
  isPublicCall=adapter.isSelected(0);
  if (!isPublicCall) {
    secondaryRelativeLayout.setVisibility(View.GONE);
    initialRelativeLayout.setVisibility(View.VISIBLE);
  }
 else {
    initialRelativeLayout.setVisibility(View.GONE);
    secondaryRelativeLayout.setVisibility(View.VISIBLE);
  }
  checkAndHandleBottomButtons();
}

Fixed version (ground truth):
@Optional @OnClick(R.id.call_header_layout) void toggleCallHeader(){
  adapter.toggleSelection(0);
  isPublicCall=adapter.isSelected(0);
  if (!isPublicCall) {
    secondaryRelativeLayout.setVisibility(View.GONE);
    initialRelativeLayout.setVisibility(View.VISIBLE);
  }
 else {
    initialRelativeLayout.setVisibility(View.GONE);
    secondaryRelativeLayout.setVisibility(View.VISIBLE);
  }
  checkAndHandleBottomButtons();
}
Program: 35610
Project: 35610
Buggy source:
@Override protected View inflateView(@NonNull LayoutInflater inflater,@NonNull ViewGroup container){
  return inflater.inflate(R.layout.controller_contacts_rv,container,false);
}

Fixed version (ground truth):
@Override protected View inflateView(@NonNull LayoutInflater inflater,@NonNull ViewGroup container){
  if (isNewConversationView) {
    return inflater.inflate(R.layout.controller_contacts_rv,container,false);
  }
 else {
    return inflater.inflate(R.layout.controller_generic_rv,container,false);
  }
}
Program: 35613
Project: 35613
Buggy source:
@Optional @OnClick(R.id.call_header_layout) void toggleCallHeader(){
  adapter.toggleSelection(0);
  isPublicCall=adapter.isSelected(0);
  if (!isPublicCall) {
    secondaryRelativeLayout.setVisibility(View.GONE);
    initialRelativeLayout.setVisibility(View.VISIBLE);
  }
 else {
    initialRelativeLayout.setVisibility(View.GONE);
    secondaryRelativeLayout.setVisibility(View.VISIBLE);
  }
  checkAndHandleBottomButtons();
}

Fixed version (ground truth):
@Optional @OnClick(R.id.call_header_layout) void toggleCallHeader(){
  isPublicCall=!isPublicCall;
  if (!isPublicCall) {
    secondaryRelativeLayout.setVisibility(View.GONE);
    initialRelativeLayout.setVisibility(View.VISIBLE);
  }
 else {
    initialRelativeLayout.setVisibility(View.GONE);
    secondaryRelativeLayout.setVisibility(View.VISIBLE);
  }
  checkAndHandleBottomButtons();
}
Program: 35614
Project: 35614
Buggy source:
private void checkAndHandleBottomButtons(){
  if (adapter != null && bottomButtonsLinearLayout != null && clearButton != null) {
    if (adapter.getSelectedItemCount() > 0 || isPublicCall) {
      if (bottomButtonsLinearLayout.getVisibility() != View.VISIBLE) {
        bottomButtonsLinearLayout.setVisibility(View.VISIBLE);
      }
      if (isPublicCall && adapter.getSelectedItemCount() < 2) {
        clearButton.setVisibility(View.GONE);
      }
 else {
        clearButton.setVisibility(View.VISIBLE);
      }
    }
 else {
      bottomButtonsLinearLayout.setVisibility(View.GONE);
    }
  }
 else   if (bottomButtonsLinearLayout != null) {
    bottomButtonsLinearLayout.setVisibility(View.GONE);
  }
}

Fixed version (ground truth):
private void checkAndHandleBottomButtons(){
  if (adapter != null && bottomButtonsLinearLayout != null && clearButton != null) {
    if (adapter.getSelectedItemCount() > 0 || isPublicCall) {
      if (bottomButtonsLinearLayout.getVisibility() != View.VISIBLE) {
        bottomButtonsLinearLayout.setVisibility(View.VISIBLE);
      }
      if (adapter.getSelectedItemCount() == 0) {
        clearButton.setVisibility(View.GONE);
      }
 else {
        clearButton.setVisibility(View.VISIBLE);
      }
    }
 else {
      bottomButtonsLinearLayout.setVisibility(View.GONE);
    }
  }
 else   if (bottomButtonsLinearLayout != null) {
    bottomButtonsLinearLayout.setVisibility(View.GONE);
  }
}
Program: 35615
Project: 35615
Buggy source:
@Override protected void onViewBound(@NonNull View view){
  super.onViewBound(view);
  bottomNavigationView.inflateMenu(getMenuResource());
  bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener(){
    @Override public boolean onNavigationItemSelected(    @NonNull MenuItem item){
      int nextItemId=item.getItemId();
      if (currentlySelectedItemId != nextItemId) {
        Router oldChildRouter=getChildRouter(currentlySelectedItemId);
        save(oldChildRouter,currentlySelectedItemId);
        destroyChildRouter(oldChildRouter);
        configureRouter(getChildRouter(nextItemId),nextItemId);
        currentlySelectedItemId=nextItemId;
      }
 else {
        resetCurrentBackstack();
      }
      return true;
    }
  }
);
}

Fixed version (ground truth):
@Override protected void onViewBound(@NonNull View view){
  super.onViewBound(view);
  bottomNavigationView.inflateMenu(getMenuResource());
  bottomNavigationView.setOnNavigationItemSelectedListener(item -> {
    int nextItemId=item.getItemId();
    if (currentlySelectedItemId != nextItemId) {
      Router oldChildRouter=getChildRouter(currentlySelectedItemId);
      save(oldChildRouter,currentlySelectedItemId);
      destroyChildRouter(oldChildRouter);
      configureRouter(getChildRouter(nextItemId),nextItemId);
      currentlySelectedItemId=nextItemId;
    }
 else {
      resetCurrentBackstack();
    }
    return true;
  }
);
  CoordinatorLayout.LayoutParams layoutParams=(CoordinatorLayout.LayoutParams)bottomNavigationView.getLayoutParams();
  layoutParams.setBehavior(new ViewHidingBehaviourAnimation());
}
Program: 35616
Project: 35616
Buggy source:
@Override public void onBind(ChatMessage message){
  super.onBind(message);
  String author;
  if (TextUtils.isEmpty(author=message.getActorDisplayName())) {
    messageAuthor.setText(author);
  }
 else {
    messageAuthor.setText(R.string.nc_nick_guest);
  }
}

Fixed version (ground truth):
@Override public void onBind(ChatMessage message){
  super.onBind(message);
  String author;
  if (!TextUtils.isEmpty(author=message.getActorDisplayName())) {
    messageAuthor.setText(author);
  }
 else {
    messageAuthor.setText(R.string.nc_nick_guest);
  }
}
Program: 35618
Project: 35618
Buggy source:
@Override public void onAnimationEnd(Animator animation){
  super.onAnimationEnd(animation);
  if (callControls != null) {
    if (!show) {
      callControls.setVisibility(View.GONE);
      if (spotlightView.getVisibility() != View.GONE) {
        spotlightView.setVisibility(View.GONE);
      }
    }
 else {
      handler.postDelayed(new Runnable(){
        @Override public void run(){
          if (!isPTTActive) {
            animateCallControls(false,0);
          }
        }
      }
,7500);
    }
    callControls.setEnabled(true);
  }
}

Fixed version (ground truth):
@Override public void onAnimationEnd(Animator animation){
  super.onAnimationEnd(animation);
  if (callControls != null) {
    if (!show) {
      callControls.setVisibility(View.GONE);
      if (spotlightView != null && spotlightView.getVisibility() != View.GONE) {
        spotlightView.setVisibility(View.GONE);
      }
    }
 else {
      handler.postDelayed(new Runnable(){
        @Override public void run(){
          if (!isPTTActive) {
            animateCallControls(false,0);
          }
        }
      }
,7500);
    }
    callControls.setEnabled(true);
  }
}
Program: 35619
Project: 35619
Buggy source:
private void animateCallControls(boolean show,long startDelay){
  if (!isPTTActive) {
    float alpha;
    long duration;
    if (show) {
      handler.removeCallbacksAndMessages(null);
      alpha=1.0f;
      duration=1000;
      if (callControls.getVisibility() != View.VISIBLE) {
        callControls.setAlpha(0.0f);
        callControls.setVisibility(View.VISIBLE);
      }
 else {
        handler.postDelayed(new Runnable(){
          @Override public void run(){
            animateCallControls(false,0);
          }
        }
,5000);
        return;
      }
    }
 else {
      alpha=0.0f;
      duration=1000;
    }
    callControls.setEnabled(false);
    callControls.animate().translationY(0).alpha(alpha).setDuration(duration).setStartDelay(startDelay).setListener(new AnimatorListenerAdapter(){
      @Override public void onAnimationEnd(      Animator animation){
        super.onAnimationEnd(animation);
        if (callControls != null) {
          if (!show) {
            callControls.setVisibility(View.GONE);
            if (spotlightView.getVisibility() != View.GONE) {
              spotlightView.setVisibility(View.GONE);
            }
          }
 else {
            handler.postDelayed(new Runnable(){
              @Override public void run(){
                if (!isPTTActive) {
                  animateCallControls(false,0);
                }
              }
            }
,7500);
          }
          callControls.setEnabled(true);
        }
      }
    }
);
  }
}

Fixed version (ground truth):
private void animateCallControls(boolean show,long startDelay){
  if (!isPTTActive) {
    float alpha;
    long duration;
    if (show) {
      handler.removeCallbacksAndMessages(null);
      alpha=1.0f;
      duration=1000;
      if (callControls.getVisibility() != View.VISIBLE) {
        callControls.setAlpha(0.0f);
        callControls.setVisibility(View.VISIBLE);
      }
 else {
        handler.postDelayed(new Runnable(){
          @Override public void run(){
            animateCallControls(false,0);
          }
        }
,5000);
        return;
      }
    }
 else {
      alpha=0.0f;
      duration=1000;
    }
    callControls.setEnabled(false);
    callControls.animate().translationY(0).alpha(alpha).setDuration(duration).setStartDelay(startDelay).setListener(new AnimatorListenerAdapter(){
      @Override public void onAnimationEnd(      Animator animation){
        super.onAnimationEnd(animation);
        if (callControls != null) {
          if (!show) {
            callControls.setVisibility(View.GONE);
            if (spotlightView != null && spotlightView.getVisibility() != View.GONE) {
              spotlightView.setVisibility(View.GONE);
            }
          }
 else {
            handler.postDelayed(new Runnable(){
              @Override public void run(){
                if (!isPTTActive) {
                  animateCallControls(false,0);
                }
              }
            }
,7500);
          }
          callControls.setEnabled(true);
        }
      }
    }
);
  }
}