@Override public void onComplete(LikeActionController likeActionController, FacebookException error) { if (isCancelled) { return; } if (likeActionController != null) { if (!likeActionController.shouldEnableView()) { error = new FacebookException("Cannot use LikeView. The device may not be supported."); } // Always associate with the controller, so it can get updates if the view gets // enabled again. associateWithLikeActionController(likeActionController); updateLikeStateAndLayout(); } if (error != null) { if (onErrorListener != null) { onErrorListener.onError(error); } } LikeView.this.creationCallback = null; }
private void updateLikeStateAndLayout() { boolean enabled = !explicitlyDisabled; if (likeActionController == null) { likeButton.setSelected(false); socialSentenceView.setText(null); likeBoxCountView.setText(null); } else { likeButton.setSelected(likeActionController.isObjectLiked()); socialSentenceView.setText(likeActionController.getSocialSentence()); likeBoxCountView.setText(likeActionController.getLikeCountString()); enabled &= likeActionController.shouldEnableView(); } super.setEnabled(enabled); likeButton.setEnabled(enabled); updateLayout(); }