both cases are 空運, which is a travelling violation.
Hong Kong street ball is the only place in the world that allow you to do any of this, which is crazy.
Rule is if you pass or shoot the ball, you cannot be the first one touching after it left your hand. even you intended to shoot or not, airball doesn't give you the right to catch it again.