All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bugvm.apple.mediaplayer.MPNowPlayingInfo Maven / Gradle / Ivy

There is a newer version: 1.2.9
Show newest version
/*
 * Copyright (C) 2013-2015 RoboVM AB
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.bugvm.apple.mediaplayer;

/**/
import java.io.*;
import java.nio.*;
import java.util.*;
import com.bugvm.objc.*;
import com.bugvm.objc.annotation.*;
import com.bugvm.objc.block.*;
import com.bugvm.rt.*;
import com.bugvm.rt.annotation.*;
import com.bugvm.rt.bro.*;
import com.bugvm.rt.bro.annotation.*;
import com.bugvm.rt.bro.ptr.*;
import com.bugvm.apple.foundation.*;
import com.bugvm.apple.uikit.*;
import com.bugvm.apple.coregraphics.*;
/**/

/**/
/**/
/**/@Library("MediaPlayer")/**/
@Marshaler(/**/MPNowPlayingInfo/**/.Marshaler.class)
/**/public/**/ class /**/MPNowPlayingInfo/**/ 
    extends /**/NSDictionaryWrapper/**/
    /**//**/ {

    /**/
    public static class Marshaler {
        @MarshalsPointer
        public static MPNowPlayingInfo toObject(Class cls, long handle, long flags) {
            NSDictionary o = (NSDictionary) NSObject.Marshaler.toObject(NSDictionary.class, handle, flags);
            if (o == null) {
                return null;
            }
            return new MPNowPlayingInfo(o);
        }
        @MarshalsPointer
        public static long toNative(MPNowPlayingInfo o, long flags) {
            if (o == null) {
                return 0L;
            }
            return NSObject.Marshaler.toNative(o.data, flags);
        }
    }
    public static class AsListMarshaler {
        @MarshalsPointer
        public static List toObject(Class cls, long handle, long flags) {
            NSArray o = (NSArray) NSObject.Marshaler.toObject(NSArray.class, handle, flags);
            if (o == null) {
                return null;
            }
            List list = new ArrayList<>();
            for (int i = 0; i < o.size(); i++) {
                list.add(new MPNowPlayingInfo(o.get(i)));
            }
            return list;
        }
        @MarshalsPointer
        public static long toNative(List l, long flags) {
            if (l == null) {
                return 0L;
            }
            NSArray array = new NSMutableArray<>();
            for (MPNowPlayingInfo i : l) {
                array.add(i.getDictionary());
            }
            return NSObject.Marshaler.toNative(array, flags);
        }
    }
    /**/

    /**/
    MPNowPlayingInfo(NSDictionary data) {
        super(data);
    }
    public MPNowPlayingInfo() {}
    /**/

    /**/
    public boolean has(NSString key) {
        return data.containsKey(key);
    }
    public NSObject get(NSString key) {
        if (has(key)) {
            return data.get(key);
        }
        return null;
    }
    public MPNowPlayingInfo set(NSString key, NSObject value) {
        data.put(key, value);
        return this;
    }
    

    /**
     * @since Available in iOS 5.0 and later.
     */
    public double getElapsedPlaybackTime() {
        if (has(Keys.ElapsedPlaybackTime())) {
            NSNumber val = (NSNumber) get(Keys.ElapsedPlaybackTime());
            return val.doubleValue();
        }
        return 0;
    }
    /**
     * @since Available in iOS 5.0 and later.
     */
    public MPNowPlayingInfo setElapsedPlaybackTime(double elapsedPlaybackTime) {
        set(Keys.ElapsedPlaybackTime(), NSNumber.valueOf(elapsedPlaybackTime));
        return this;
    }
    /**
     * @since Available in iOS 5.0 and later.
     */
    public double getPlaybackRate() {
        if (has(Keys.PlaybackRate())) {
            NSNumber val = (NSNumber) get(Keys.PlaybackRate());
            return val.doubleValue();
        }
        return 0;
    }
    /**
     * @since Available in iOS 5.0 and later.
     */
    public MPNowPlayingInfo setPlaybackRate(double playbackRate) {
        set(Keys.PlaybackRate(), NSNumber.valueOf(playbackRate));
        return this;
    }
    /**
     * @since Available in iOS 8.0 and later.
     */
    public double getDefaultPlaybackRate() {
        if (has(Keys.DefaultPlaybackRate())) {
            NSNumber val = (NSNumber) get(Keys.DefaultPlaybackRate());
            return val.doubleValue();
        }
        return 0;
    }
    /**
     * @since Available in iOS 8.0 and later.
     */
    public MPNowPlayingInfo setDefaultPlaybackRate(double defaultPlaybackRate) {
        set(Keys.DefaultPlaybackRate(), NSNumber.valueOf(defaultPlaybackRate));
        return this;
    }
    /**
     * @since Available in iOS 5.0 and later.
     */
    public int getPlaybackQueueIndex() {
        if (has(Keys.PlaybackQueueIndex())) {
            NSNumber val = (NSNumber) get(Keys.PlaybackQueueIndex());
            return val.intValue();
        }
        return 0;
    }
    /**
     * @since Available in iOS 5.0 and later.
     */
    public MPNowPlayingInfo setPlaybackQueueIndex(int playbackQueueIndex) {
        set(Keys.PlaybackQueueIndex(), NSNumber.valueOf(playbackQueueIndex));
        return this;
    }
    /**
     * @since Available in iOS 5.0 and later.
     */
    public int getPlaybackQueueCount() {
        if (has(Keys.PlaybackQueueCount())) {
            NSNumber val = (NSNumber) get(Keys.PlaybackQueueCount());
            return val.intValue();
        }
        return 0;
    }
    /**
     * @since Available in iOS 5.0 and later.
     */
    public MPNowPlayingInfo setPlaybackQueueCount(int playbackQueueCount) {
        set(Keys.PlaybackQueueCount(), NSNumber.valueOf(playbackQueueCount));
        return this;
    }
    /**
     * @since Available in iOS 5.0 and later.
     */
    public int getChapterNumber() {
        if (has(Keys.ChapterNumber())) {
            NSNumber val = (NSNumber) get(Keys.ChapterNumber());
            return val.intValue();
        }
        return 0;
    }
    /**
     * @since Available in iOS 5.0 and later.
     */
    public MPNowPlayingInfo setChapterNumber(int chapterNumber) {
        set(Keys.ChapterNumber(), NSNumber.valueOf(chapterNumber));
        return this;
    }
    /**
     * @since Available in iOS 5.0 and later.
     */
    public int getChapterCount() {
        if (has(Keys.ChapterCount())) {
            NSNumber val = (NSNumber) get(Keys.ChapterCount());
            return val.intValue();
        }
        return 0;
    }
    /**
     * @since Available in iOS 5.0 and later.
     */
    public MPNowPlayingInfo setChapterCount(int chapterCount) {
        set(Keys.ChapterCount(), NSNumber.valueOf(chapterCount));
        return this;
    }
    /**/
    public boolean has(MPMediaEntityProperty key) {
        return data.containsKey(key.value());
    }
    public NSObject get(MPMediaEntityProperty key) {
        if (has(key)) {
            return data.get(key.value());
        }
        return null;
    }
    public MPNowPlayingInfo set(MPMediaEntityProperty key, NSObject value) {
        data.put(key.value(), value);
        return this;
    }
    
    public long getPersistentID() {
        if (has(MPMediaItemProperty.ItemPersistentID)) {
            NSNumber val = (NSNumber) get(MPMediaItemProperty.ItemPersistentID);
            return val.longValue();
        }
        return 0;
    }
    public MPNowPlayingInfo setPersistentID(long id) {
        set(MPMediaItemProperty.ItemPersistentID, NSNumber.valueOf(id));
        return this;
    }
    public String getTitle() {
        if (has(MPMediaItemProperty.Title)) {
            NSString val = (NSString) get(MPMediaItemProperty.Title);
            return val.toString();
        }
        return null;
    }
    public MPNowPlayingInfo setTitle(String title) {
        set(MPMediaItemProperty.Title, new NSString(title));
        return this;
    }
    public String getAlbumTitle() {
        if (has(MPMediaItemProperty.AlbumTitle)) {
            NSString val = (NSString) get(MPMediaItemProperty.AlbumTitle);
            return val.toString();
        }
        return null;
    }
    public MPNowPlayingInfo setAlbumTitle(String albumTitle) {
        set(MPMediaItemProperty.AlbumTitle, new NSString(albumTitle));
        return this;
    }
    public String getArtist() {
        if (has(MPMediaItemProperty.Artist)) {
            NSString val = (NSString) get(MPMediaItemProperty.Artist);
            return val.toString();
        }
        return null;
    }
    public MPNowPlayingInfo setArtist(String artist) {
        set(MPMediaItemProperty.Artist, new NSString(artist));
        return this;
    }
    public String getGenre() {
        if (has(MPMediaItemProperty.Genre)) {
            NSString val = (NSString) get(MPMediaItemProperty.Genre);
            return val.toString();
        }
        return null;
    }
    public MPNowPlayingInfo setGenre(String genre) {
        set(MPMediaItemProperty.Genre, new NSString(genre));
        return this;
    }
    public String getComposer() {
        if (has(MPMediaItemProperty.Composer)) {
            NSString val = (NSString) get(MPMediaItemProperty.Composer);
            return val.toString();
        }
        return null;
    }
    public MPNowPlayingInfo setComposer(String composer) {
        set(MPMediaItemProperty.Composer, new NSString(composer));
        return this;
    }
    public double getPlaybackDuration() {
        if (has(MPMediaItemProperty.PlaybackDuration)) {
            NSNumber val = (NSNumber) get(MPMediaItemProperty.PlaybackDuration);
            return val.doubleValue();
        }
        return 0;
    }
    public MPNowPlayingInfo setPlaybackDuration(double playbackDuration) {
        set(MPMediaItemProperty.PlaybackDuration, NSNumber.valueOf(playbackDuration));
        return this;
    }
    public int getAlbumTrackNumber() {
        if (has(MPMediaItemProperty.AlbumTrackNumber)) {
            NSNumber val = (NSNumber) get(MPMediaItemProperty.AlbumTrackNumber);
            return val.intValue();
        }
        return 0;
    }
    public MPNowPlayingInfo setAlbumTrackNumber(int albumTrackNumber) {
        set(MPMediaItemProperty.AlbumTrackNumber, NSNumber.valueOf(albumTrackNumber));
        return this;
    }
    public int getAlbumTrackCount() {
        if (has(MPMediaItemProperty.AlbumTrackCount)) {
            NSNumber val = (NSNumber) get(MPMediaItemProperty.AlbumTrackCount);
            return val.intValue();
        }
        return 0;
    }
    public MPNowPlayingInfo setAlbumTrackCount(int albumTrackCount) {
        set(MPMediaItemProperty.AlbumTrackCount, NSNumber.valueOf(albumTrackCount));
        return this;
    }
    public int getDiscNumber() {
        if (has(MPMediaItemProperty.DiscNumber)) {
            NSNumber val = (NSNumber) get(MPMediaItemProperty.DiscNumber);
            return val.intValue();
        }
        return 0;
    }
    public MPNowPlayingInfo setDiscNumber(int discNumber) {
        set(MPMediaItemProperty.DiscNumber, NSNumber.valueOf(discNumber));
        return this;
    }
    public int getDiscCount() {
        if (has(MPMediaItemProperty.DiscCount)) {
            NSNumber val = (NSNumber) get(MPMediaItemProperty.DiscCount);
            return val.intValue();
        }
        return 0;
    }
    public MPNowPlayingInfo setDiscCount(int discCount) {
        set(MPMediaItemProperty.DiscCount, NSNumber.valueOf(discCount));
        return this;
    }
    public MPMediaItemArtwork getArtwork() {
        if (has(MPMediaItemProperty.Artwork)) {
            MPMediaItemArtwork val = (MPMediaItemArtwork) get(MPMediaItemProperty.Artwork);
            return val;
        }
        return null;
    }
    public MPNowPlayingInfo setArtwork(MPMediaItemArtwork artwork) {
        set(MPMediaItemProperty.Artwork, artwork);
        return this;
    }
    
    /**/
    @Library("MediaPlayer")
    public static class Keys {
        static { Bro.bind(Keys.class); }
        /**
         * @since Available in iOS 5.0 and later.
         */
        @GlobalValue(symbol="MPNowPlayingInfoPropertyElapsedPlaybackTime", optional=true)
        public static native NSString ElapsedPlaybackTime();
        /**
         * @since Available in iOS 5.0 and later.
         */
        @GlobalValue(symbol="MPNowPlayingInfoPropertyPlaybackRate", optional=true)
        public static native NSString PlaybackRate();
        /**
         * @since Available in iOS 8.0 and later.
         */
        @GlobalValue(symbol="MPNowPlayingInfoPropertyDefaultPlaybackRate", optional=true)
        public static native NSString DefaultPlaybackRate();
        /**
         * @since Available in iOS 5.0 and later.
         */
        @GlobalValue(symbol="MPNowPlayingInfoPropertyPlaybackQueueIndex", optional=true)
        public static native NSString PlaybackQueueIndex();
        /**
         * @since Available in iOS 5.0 and later.
         */
        @GlobalValue(symbol="MPNowPlayingInfoPropertyPlaybackQueueCount", optional=true)
        public static native NSString PlaybackQueueCount();
        /**
         * @since Available in iOS 5.0 and later.
         */
        @GlobalValue(symbol="MPNowPlayingInfoPropertyChapterNumber", optional=true)
        public static native NSString ChapterNumber();
        /**
         * @since Available in iOS 5.0 and later.
         */
        @GlobalValue(symbol="MPNowPlayingInfoPropertyChapterCount", optional=true)
        public static native NSString ChapterCount();
    }
    /**/
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy