private void showChathead(Message message) { if (isDetached()) { return; } if (chatheadNotificationIsVisible || chatheadView == null) { return; } chatheadView.setMessage(message); final IConversation conversation = message.getConversation(); chatheadView.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (chatheadNotificationIsVisible) { getStoreFactory() .getConversationStore() .setCurrentConversation(conversation, ConversationChangeRequester.CHAT_HEAD); } } }); hideChatheadHandler.removeCallbacksAndMessages(null); if (MathUtils.floatEqual(chatheadView.getAlpha(), 1f)) { scheduleChatheadHide(); } else { if (isDetached()) { return; } chatheadView .animate() .alpha(1) .translationX(0) .setDuration( getResources().getInteger(R.integer.notification__chathead_animation__duration)) .withStartAction( new Runnable() { @Override public void run() { chatheadNotificationIsVisible = true; chatheadView.setTranslationX(-chatheadView.getMeasuredWidth()); } }) .withEndAction( new Runnable() { @Override public void run() { scheduleChatheadHide(); } }) .start(); } }
@Override public void onDestroyView() { if (chatheadView != null) { chatheadView.tearDown(); } chatheadView = null; if (hideChatheadHandler != null) { hideChatheadHandler.removeCallbacks(null); hideChatheadHandler = null; } notificationDisplayPrioritizer = null; super.onDestroyView(); }