Java Code Examples for org.robovm.apple.foundation.NSArray#get()

The following examples show how to use org.robovm.apple.foundation.NSArray#get() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PAPPhotoDetailsViewController.java    From robovm-samples with Apache License 2.0 6 votes vote down vote up
@Override
public double getHeightForRow(UITableView tableView, NSIndexPath indexPath) {
    NSArray<PAPActivity> objects = getObjects();
    if (indexPath.getRow() < objects.size()) { // A comment row
        PAPActivity object = objects.get(indexPath.getRow());

        if (object != null) {
            String commentString = object.getContent();

            PAPUser commentAuthor = object.getFromUser();

            String nameString = "";
            if (commentAuthor != null) {
                nameString = commentAuthor.getDisplayName();
            }

            return PAPActivityCell.getHeightForCell(nameString, commentString, CELL_INSET_WIDTH);
        }
    }

    // The pagination row
    return 44;
}
 
Example 2
Source File: PAPActivityFeedViewController.java    From robovm-samples with Apache License 2.0 6 votes vote down vote up
@Override
public double getHeightForRow(UITableView tableView, NSIndexPath indexPath) {
    NSArray<PAPActivity> objects = getObjects();
    if (indexPath.getRow() < objects.size()) {
        PAPActivity activity = objects.get(indexPath.getRow());
        String activityString = activity.getType().getMessage();

        PAPUser user = activity.getFromUser();
        String nameString = "Someone";
        if (user != null && user.getDisplayName() != null && user.getDisplayName().length() > 0) {
            nameString = user.getDisplayName();
        }

        return PAPActivityCell.getHeightForCell(nameString, activityString);
    } else {
        return 44;
    }
}
 
Example 3
Source File: PAPPhotoTimelineViewController.java    From robovm-samples with Apache License 2.0 5 votes vote down vote up
@Override
public PAPPhoto getObject(NSIndexPath indexPath) {
    int index = getIndexForObjectAt(indexPath);
    NSArray<PAPPhoto> objects = getObjects();
    if (index < objects.size()) {
        return objects.get(index);
    }
    return null;
}
 
Example 4
Source File: MyViewController.java    From robovm-samples with Apache License 2.0 5 votes vote down vote up
@IBAction
private void decreaseRating() {
    if (--this.rating < 0) {
        this.rating = 0;
        return;
    }

    NSArray<UIView> icons = this.ratingsStack.getArrangedSubviews();
    UIView lastIcon = icons.get(icons.size() - 1);
    this.ratingsStack.removeArrangedSubview(lastIcon);
    lastIcon.removeFromSuperview();

    UIView.animate(0.5, () -> this.ratingsStack.layoutIfNeeded());
}
 
Example 5
Source File: APAMultiplayerLayeredCharacterScene.java    From robovm-samples with Apache License 2.0 5 votes vote down vote up
private void updateHUDAfterHeroDeath(APAPlayer player) {
    int playerIndex = players.indexOf(player);

    // Fade out the relevant heart - one-based livesLeft has already been
    // decremented.
    int heartNumber = player.livesLeft;

    NSArray<SKSpriteNode> heartArray = hudLifeHeartArrays.get(playerIndex);
    SKSpriteNode heart = heartArray.get(heartNumber);
    heart.runAction(SKAction.fadeAlphaTo(0.0, 3.0));
}