use of com.android.incallui.sessiondata.MultimediaFragment in project android_packages_apps_Dialer by LineageOS.
the class AnswerFragment method updateDataFragment.
private void updateDataFragment() {
if (!isAdded()) {
return;
}
LogUtil.enterBlock("AnswerFragment.updateDataFragment");
Fragment current = getChildFragmentManager().findFragmentById(R.id.incall_data_container);
Fragment newFragment = null;
MultimediaData multimediaData = getSessionData();
if (multimediaData != null && (!TextUtils.isEmpty(multimediaData.getText()) || (multimediaData.getImageUri() != null) || (multimediaData.getLocation() != null && canShowMap()))) {
// Need message fragment
String subject = multimediaData.getText();
Uri imageUri = multimediaData.getImageUri();
Location location = multimediaData.getLocation();
if (!(current instanceof MultimediaFragment) || !Objects.equals(((MultimediaFragment) current).getSubject(), subject) || !Objects.equals(((MultimediaFragment) current).getImageUri(), imageUri) || !Objects.equals(((MultimediaFragment) current).getLocation(), location)) {
LogUtil.i("AnswerFragment.updateDataFragment", "Replacing multimedia fragment");
// Needs replacement
newFragment = MultimediaFragment.newInstance(multimediaData, false, /* isInteractive */
!primaryInfo.isSpam, /* showAvatar */
primaryInfo.isSpam);
}
} else if (shouldShowAvatar()) {
// Needs Avatar
if (!(current instanceof AvatarFragment)) {
LogUtil.i("AnswerFragment.updateDataFragment", "Replacing avatar fragment");
// Needs replacement
newFragment = new AvatarFragment();
}
} else {
// Needs empty
if (current != null) {
LogUtil.i("AnswerFragment.updateDataFragment", "Removing current fragment");
getChildFragmentManager().beginTransaction().remove(current).commitNow();
}
contactGridManager.setAvatarImageView(null, 0, false);
}
if (newFragment != null) {
getChildFragmentManager().beginTransaction().replace(R.id.incall_data_container, newFragment).commitNow();
}
}
Aggregations