Java 类com.facebook.share.internal.LikeActionController 实例源码

项目:kognitivo    文件:LikeView.java   
private void setObjectIdAndTypeForced(String newObjectId, ObjectType newObjectType) {
    tearDownObjectAssociations();

    objectId = newObjectId;
    objectType = newObjectType;

    if (Utility.isNullOrEmpty(newObjectId)) {
        return;
    }

    creationCallback = new LikeActionControllerCreationCallback();
    if (!isInEditMode()) {
        LikeActionController.getControllerForObjectId(
                newObjectId,
                newObjectType,
                creationCallback);
    }
}
项目:Move-Alarm_ORCA    文件:LikeView.java   
private void setObjectIdAndTypeForced(String newObjectId, ObjectType newObjectType) {
    tearDownObjectAssociations();

    objectId = newObjectId;
    objectType = newObjectType;

    if (Utility.isNullOrEmpty(newObjectId)) {
        return;
    }

    creationCallback = new LikeActionControllerCreationCallback();
    LikeActionController.getControllerForObjectId(
            newObjectId,
            newObjectType,
            creationCallback);
}
项目:Move-Alarm_ORCA    文件:LikeView.java   
private void associateWithLikeActionController(LikeActionController likeActionController) {
    this.likeActionController = likeActionController;
    implicitlyDisabled = likeActionController.shouldDisableView();

    this.broadcastReceiver = new LikeControllerBroadcastReceiver();
    LocalBroadcastManager localBroadcastManager =
            LocalBroadcastManager.getInstance(getContext());

    // add the broadcast receiver
    IntentFilter filter = new IntentFilter();
    filter.addAction(LikeActionController.ACTION_LIKE_ACTION_CONTROLLER_UPDATED);
    filter.addAction(LikeActionController.ACTION_LIKE_ACTION_CONTROLLER_DID_ERROR);
    filter.addAction(LikeActionController.ACTION_LIKE_ACTION_CONTROLLER_DID_RESET);

    localBroadcastManager.registerReceiver(broadcastReceiver, filter);
}
项目:SocioBlood    文件:LikeView.java   
private void setObjectIdAndTypeForced(String newObjectId, ObjectType newObjectType) {
    tearDownObjectAssociations();

    objectId = newObjectId;
    objectType = newObjectType;

    if (Utility.isNullOrEmpty(newObjectId)) {
        return;
    }

    creationCallback = new LikeActionControllerCreationCallback();
    LikeActionController.getControllerForObjectId(
            newObjectId,
            newObjectType,
            creationCallback);
}
项目:kognitivo    文件:LikeView.java   
private void associateWithLikeActionController(LikeActionController likeActionController) {
    this.likeActionController = likeActionController;

    this.broadcastReceiver = new LikeControllerBroadcastReceiver();
    LocalBroadcastManager localBroadcastManager =
            LocalBroadcastManager.getInstance(getContext());

    // add the broadcast receiver
    IntentFilter filter = new IntentFilter();
    filter.addAction(LikeActionController.ACTION_LIKE_ACTION_CONTROLLER_UPDATED);
    filter.addAction(LikeActionController.ACTION_LIKE_ACTION_CONTROLLER_DID_ERROR);
    filter.addAction(LikeActionController.ACTION_LIKE_ACTION_CONTROLLER_DID_RESET);

    localBroadcastManager.registerReceiver(broadcastReceiver, filter);
}
项目:kognitivo    文件:LikeView.java   
@Override
public void onReceive(Context context, Intent intent) {
    String intentAction = intent.getAction();
    Bundle extras = intent.getExtras();
    boolean shouldRespond = true;
    if (extras != null) {
        // See if an Id was set in the broadcast Intent. If it was, treat it as a filter.
        String broadcastObjectId = extras.getString(
                LikeActionController.ACTION_OBJECT_ID_KEY);
        shouldRespond = Utility.isNullOrEmpty(broadcastObjectId) ||
                Utility.areObjectsEqual(objectId, broadcastObjectId);
    }

    if (!shouldRespond) {
        return;
    }

    if (LikeActionController.ACTION_LIKE_ACTION_CONTROLLER_UPDATED.equals(intentAction)) {
        updateLikeStateAndLayout();
    } else if (LikeActionController.ACTION_LIKE_ACTION_CONTROLLER_DID_ERROR.equals(
            intentAction)) {
        if (onErrorListener != null) {
            onErrorListener.onError(NativeProtocol.getExceptionFromErrorData(extras));
        }
    } else if (LikeActionController.ACTION_LIKE_ACTION_CONTROLLER_DID_RESET.equals(
            intentAction)) {
        // This will recreate the controller and associated objects
        setObjectIdAndTypeForced(objectId, objectType);
        updateLikeStateAndLayout();
    }
}
项目:Move-Alarm_ORCA    文件:LikeView.java   
@Override
public void onReceive(Context context, Intent intent) {
    String intentAction = intent.getAction();
    Bundle extras = intent.getExtras();
    boolean shouldRespond = true;
    if (extras != null) {
        // See if an Id was set in the broadcast Intent. If it was, treat it as a filter.
        String broadcastObjectId = extras.getString(
                LikeActionController.ACTION_OBJECT_ID_KEY);
        shouldRespond = Utility.isNullOrEmpty(broadcastObjectId) ||
                Utility.areObjectsEqual(objectId, broadcastObjectId);
    }

    if (!shouldRespond) {
        return;
    }

    if (LikeActionController.ACTION_LIKE_ACTION_CONTROLLER_UPDATED.equals(intentAction)) {
        updateLikeStateAndLayout();
    } else if (LikeActionController.ACTION_LIKE_ACTION_CONTROLLER_DID_ERROR.equals(
            intentAction)) {
        if (onErrorListener != null) {
            onErrorListener.onError(NativeProtocol.getExceptionFromErrorData(extras));
        }
    } else if (LikeActionController.ACTION_LIKE_ACTION_CONTROLLER_DID_RESET.equals(
            intentAction)) {
        // This will recreate the controller and associated objects
        setObjectIdAndTypeForced(objectId, objectType);
        updateLikeStateAndLayout();
    }
}
项目:Move-Alarm_ORCA    文件:LikeView.java   
@Override
public void onComplete(
        LikeActionController likeActionController,
        FacebookException error) {
    if (isCancelled) {
        return;
    }

    if (likeActionController != null) {
        if (likeActionController.shouldDisableView()) {
            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;
}
项目:SocioBlood    文件:LikeView.java   
private void associateWithLikeActionController(LikeActionController likeActionController) {
    this.likeActionController = likeActionController;

    this.broadcastReceiver = new LikeControllerBroadcastReceiver();
    LocalBroadcastManager localBroadcastManager =
            LocalBroadcastManager.getInstance(getContext());

    // add the broadcast receiver
    IntentFilter filter = new IntentFilter();
    filter.addAction(LikeActionController.ACTION_LIKE_ACTION_CONTROLLER_UPDATED);
    filter.addAction(LikeActionController.ACTION_LIKE_ACTION_CONTROLLER_DID_ERROR);
    filter.addAction(LikeActionController.ACTION_LIKE_ACTION_CONTROLLER_DID_RESET);

    localBroadcastManager.registerReceiver(broadcastReceiver, filter);
}
项目:SocioBlood    文件:LikeView.java   
@Override
public void onReceive(Context context, Intent intent) {
    String intentAction = intent.getAction();
    Bundle extras = intent.getExtras();
    boolean shouldRespond = true;
    if (extras != null) {
        // See if an Id was set in the broadcast Intent. If it was, treat it as a filter.
        String broadcastObjectId = extras.getString(
                LikeActionController.ACTION_OBJECT_ID_KEY);
        shouldRespond = Utility.isNullOrEmpty(broadcastObjectId) ||
                Utility.areObjectsEqual(objectId, broadcastObjectId);
    }

    if (!shouldRespond) {
        return;
    }

    if (LikeActionController.ACTION_LIKE_ACTION_CONTROLLER_UPDATED.equals(intentAction)) {
        updateLikeStateAndLayout();
    } else if (LikeActionController.ACTION_LIKE_ACTION_CONTROLLER_DID_ERROR.equals(
            intentAction)) {
        if (onErrorListener != null) {
            onErrorListener.onError(NativeProtocol.getExceptionFromErrorData(extras));
        }
    } else if (LikeActionController.ACTION_LIKE_ACTION_CONTROLLER_DID_RESET.equals(
            intentAction)) {
        // This will recreate the controller and associated objects
        setObjectIdAndTypeForced(objectId, objectType);
        updateLikeStateAndLayout();
    }
}
项目:SocioBlood    文件:LikeView.java   
@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;
}