private void internalAdd(MediaModel media) throws IllegalStateException { if (media == null) { // Don't add null value into the list. return; } if (media.isText()) { String contentType = media.getContentType(); if (TextUtils.isEmpty(contentType) || ContentType.TEXT_PLAIN.equals(contentType) || ContentType.TEXT_HTML.equals(contentType)) { internalAddOrReplace(mText, media); mText = media; } else { Log.w( TAG, "[SlideModel] content type " + media.getContentType() + " isn't supported (as text)"); } } else if (media.isImage()) { if (mCanAddImage) { internalAddOrReplace(mImage, media); mImage = media; mCanAddVideo = false; } else { Log.w( TAG, "[SlideModel] content type " + media.getContentType() + " - can't add image in this state"); } } else if (media.isAudio()) { if (mCanAddAudio) { internalAddOrReplace(mAudio, media); mAudio = media; mCanAddVideo = false; } else { Log.w( TAG, "[SlideModel] content type " + media.getContentType() + " - can't add audio in this state"); } } else if (media.isVideo()) { if (mCanAddVideo) { internalAddOrReplace(mVideo, media); mVideo = media; mCanAddImage = false; mCanAddAudio = false; } else { Log.w( TAG, "[SlideModel] content type " + media.getContentType() + " - can't add video in this state"); } } }