当前位置: 首页>>代码示例>>Java>>正文


Java NSMutableDictionary类代码示例

本文整理汇总了Java中org.robovm.apple.foundation.NSMutableDictionary的典型用法代码示例。如果您正苦于以下问题:Java NSMutableDictionary类的具体用法?Java NSMutableDictionary怎么用?Java NSMutableDictionary使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NSMutableDictionary类属于org.robovm.apple.foundation包,在下文中一共展示了NSMutableDictionary类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPreferences

import org.robovm.apple.foundation.NSMutableDictionary; //导入依赖的package包/类
@Override
public Preferences getPreferences (String name) {
	File libraryPath = new File(System.getenv("HOME"), "Library");
	File finalPath = new File(libraryPath, name + ".plist");

	@SuppressWarnings("unchecked")
	NSMutableDictionary<NSString, NSObject> nsDictionary = (NSMutableDictionary<NSString, NSObject>)NSMutableDictionary
		.read(finalPath);

	// if it fails to get an existing dictionary, create a new one.
	if (nsDictionary == null) {
		nsDictionary = new NSMutableDictionary<NSString, NSObject>();
		nsDictionary.write(finalPath, false);
	}
	return new IOSPreferences(nsDictionary, finalPath.getAbsolutePath());
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:17,代码来源:IOSApplication.java

示例2: logEventWithParametersAction

import org.robovm.apple.foundation.NSMutableDictionary; //导入依赖的package包/类
private void logEventWithParametersAction() {
    UIAlertView alert = new UIAlertView("Log Event with Parameters", "Select parameters:",
            new UIAlertViewDelegateAdapter() {
                @Override
                public void clicked(UIAlertView alertView, long buttonIndex) {
                    final String eventName = "Event_with_Parameters";
                    switch ((int) buttonIndex) {
                    case 1:
                        Map<String, String> params1 = new HashMap<>();
                        params1.put("Param1", String.valueOf(101));
                        Flurry.logEvent(eventName, params1);
                        break;
                    case 2:
                        NSDictionary<?, ?> params2 = new NSMutableDictionary<>();
                        params2.put("Param1", "Test");
                        params2.put("Param2", 202);
                        Flurry.logEvent(eventName, params2);
                        break;
                    default:
                        break;
                    }
                }
            }, "Cancel", "Param1 = 101", "Param1 = Test, Param2 = 202");
    alert.show();
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:26,代码来源:MainMenuViewController.java

示例3: scheduleLocalNotification

import org.robovm.apple.foundation.NSMutableDictionary; //导入依赖的package包/类
/**
 * Schedule a local notification.
 * 
 * @param id
 * @param title
 * @param message
 * @param action
 * @param fireDate
 */
public void scheduleLocalNotification(String id, String category, String title, String message, String action,
        Date fireDate) {
    UILocalNotification notification = new UILocalNotification();
    NSDictionary<?, ?> userInfo = new NSMutableDictionary<>();
    userInfo.put(LOCAL_NOTIFICATION_ID_KEY, id);
    notification.setUserInfo(userInfo);
    notification.setAlertTitle(title);
    notification.setAlertBody(message);
    notification.setAlertAction(action);
    notification.setFireDate(new NSDate(fireDate));

    if (category != null) {
        // This will make the notification actionable.
        notification.setCategory(category);
    }

    UIApplication.getSharedApplication().scheduleLocalNotification(notification);
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:28,代码来源:AppDelegate.java

示例4: prepareForSegue

import org.robovm.apple.foundation.NSMutableDictionary; //导入依赖的package包/类
@Override
public void prepareForSegue(UIStoryboardSegue segue, NSObject sender) {
    if (shortcutItem == null) {
        throw new RuntimeException("shortcutItem was not set");
    }

    if (segue.getIdentifier().equals("ShortcutDetailUpdated")) {
        // In the updated case, create a shortcut item to represent the
        // final state of the view controller.
        UIApplicationShortcutIconType iconType = getIconTypeForSelectedRow((int) pickerView.getSelectedRow(0));

        UIApplicationShortcutIcon icon = new UIApplicationShortcutIcon(iconType);

        NSDictionary<NSString, ?> info = new NSMutableDictionary<>();
        info.put(ApplicationShortcuts.APPLICATION_SHORTCUT_USER_INFO_ICON_KEY, pickerView.getSelectedRow(0));
        shortcutItem = new UIApplicationShortcutItem(shortcutItem.getType(), titleTextField.getText(),
                subtitleTextField.getText(), icon, info);
    }
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:20,代码来源:ShortcutDetailViewController.java

示例5: fireProjectile

import org.robovm.apple.foundation.NSMutableDictionary; //导入依赖的package包/类
private void fireProjectile () {
    APAMultiplayerLayeredCharacterScene scene = getCharacterScene();

    SKSpriteNode projectile = (SKSpriteNode)getProjectile().copy();
    projectile.setPosition(getPosition());
    projectile.setZRotation(getZRotation());

    SKEmitterNode emitter = (SKEmitterNode)getProjectileEmitter().copy();
    emitter.setTargetNode(scene.getChild("world"));
    projectile.addChild(emitter);

    scene.addNode(projectile, APAWorldLayer.Character);

    double rot = getZRotation();

    projectile.runAction(SKAction.moveBy(-Math.sin(rot) * HERO_PROJECTILE_SPEED * HERO_PROJECTILE_LIFETIME, Math.cos(rot)
        * HERO_PROJECTILE_SPEED * HERO_PROJECTILE_LIFETIME, HERO_PROJECTILE_LIFETIME));
    projectile.runAction(SKAction.sequence(new NSArray<SKAction>(SKAction.wait(HERO_PROJECTILE_FADEOUT_TIME), SKAction
        .fadeOut(HERO_PROJECTILE_LIFETIME - HERO_PROJECTILE_FADEOUT_TIME), SKAction.removeFromParent())));
    projectile.runAction(sharedProjectileSoundAction);

    NSMutableDictionary<NSString, NSObject> userData = new NSMutableDictionary<>();
    userData.put(PLAYER_KEY, player);
    projectile.setUserData(userData);
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:26,代码来源:APAHeroCharacter.java

示例6: didTapShare

import org.robovm.apple.foundation.NSMutableDictionary; //导入依赖的package包/类
@IBAction
private void didTapShare(UIBarButtonItem sender) {
    GAITracker tracker = GAI.getSharedInstance().getTracker(GoogleAnalyticsApp.TRACKER_ID);
    NSMutableDictionary<?, ?> event = GAIDictionaryBuilder.createEvent("Action", "Share", null, null).build();
    tracker.send(event);

    String title = String.format("Share: %s", getSelectedViewController().getTitle());
    String message = "Share is not implemented in this quickstart";
    new UIAlertView(title, message, null, "OK").show();
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:11,代码来源:PatternTabBarController.java

示例7: convertStringMapToDictionary

import org.robovm.apple.foundation.NSMutableDictionary; //导入依赖的package包/类
private NSDictionary<NSString, NSString> convertStringMapToDictionary(Map<String, String> map) {
    NSDictionary<NSString, NSString> result = new NSMutableDictionary<>();
    if (map != null) {
        for (Map.Entry<String, String> entry : map.entrySet()) {
            result.put(new NSString(entry.getKey()), new NSString(entry.getValue()));
        }
    }
    return result;
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:10,代码来源:FacebookHandler.java

示例8: didFinishLaunching

import org.robovm.apple.foundation.NSMutableDictionary; //导入依赖的package包/类
@Override
public boolean didFinishLaunching(UIApplication application, UIApplicationLaunchOptions launchOptions) {
    // Override point for customization after application launch.
    boolean shouldPerformAdditionalDelegateHandling = true;

    // If a shortcut was launched, display its information and take the
    // appropriate action
    if (launchOptions != null) {
        launchedShortcutItem = launchOptions.getShortcutItem();
    }

    // This will block "performActionForShortcutItem:completionHandler" from
    // being called.
    shouldPerformAdditionalDelegateHandling = false;

    // Install initial versions of our two extra dynamic shortcuts.
    NSArray<UIApplicationShortcutItem> shortcutItems = application.getShortcutItems();
    if (shortcutItems == null || shortcutItems.isEmpty()) {
        // Construct the items.
        UIApplicationShortcutItem shortcut3 = new UIMutableApplicationShortcutItem(SHORTCUT_THIRD, "Play");
        shortcut3.setLocalizedSubtitle("Will Play an item");
        shortcut3.setIcon(new UIApplicationShortcutIcon(UIApplicationShortcutIconType.Play));
        NSDictionary<NSString, ?> info3 = new NSMutableDictionary<>();
        info3.put(APPLICATION_SHORTCUT_USER_INFO_ICON_KEY, UIApplicationShortcutIconType.Play.ordinal());
        shortcut3.setUserInfo(info3);

        UIApplicationShortcutItem shortcut4 = new UIMutableApplicationShortcutItem(SHORTCUT_FOURTH, "Pause");
        shortcut4.setLocalizedSubtitle("Will Pause an item");
        shortcut4.setIcon(new UIApplicationShortcutIcon(UIApplicationShortcutIconType.Pause));
        NSDictionary<NSString, ?> info4 = new NSMutableDictionary<>();
        info4.put(APPLICATION_SHORTCUT_USER_INFO_ICON_KEY, UIApplicationShortcutIconType.Pause.ordinal());
        shortcut4.setUserInfo(info4);

        // Update the application providing the initial 'dynamic' shortcut
        // items.
        application.setShortcutItems(new NSArray<>(shortcut3, shortcut4));
    }

    return shouldPerformAdditionalDelegateHandling;
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:41,代码来源:ApplicationShortcuts.java

示例9: IOSPreferences

import org.robovm.apple.foundation.NSMutableDictionary; //导入依赖的package包/类
public IOSPreferences (NSMutableDictionary<NSString, NSObject> nsDictionary, String filePath) {
	this.nsDictionary = nsDictionary;
	this.filePath = filePath;
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:5,代码来源:IOSPreferences.java

示例10: loadDefaults

import org.robovm.apple.foundation.NSMutableDictionary; //导入依赖的package包/类
/**
 * Helper function that parses a Settings page file, extracts each
 * preference defined within along with its default value. If the page
 * contains a 'Child Pane Element', this method will recurs on the
 * referenced page file.
 * 
 * @param plistName
 * @param settingsBundleURL
 * @return
 */
@SuppressWarnings("unchecked")
private NSDictionary<NSString, ?> loadDefaults(String plistName, NSURL settingsBundleURL) {
    /*
     * Each page of settings is represented by a property-list file that
     * follows the Settings Application Schema:
     * <https://developer.apple.com/
     * library/ios/#documentation/PreferenceSettings
     * /Conceptual/SettingsApplicationSchemaReference
     * /Introduction/Introduction.html>.
     */

    // Create an NSDictionary from the plist file.
    NSDictionary<NSString, NSObject> settingsDict = (NSDictionary<NSString, NSObject>) NSDictionary
            .read(settingsBundleURL
                    .newURLByAppendingPathComponent(plistName));

    // The elements defined in a settings page are contained within an array
    // that is associated with the root-level PreferenceSpecifiers key.
    NSArray<NSDictionary<NSString, NSObject>> prefSpecifierArray = (NSArray<NSDictionary<NSString, NSObject>>) settingsDict
            .get(new NSString("PreferenceSpecifiers"));

    // If prefSpecifierArray is nil, something wen't wrong. Either the
    // specified plist does not exist or is malformed.
    if (prefSpecifierArray == null)
        return null;

    // Create a dictionary to hold the parsed results.
    NSMutableDictionary<NSString, NSObject> keyValuePairs = new NSMutableDictionary<>();

    for (NSDictionary<NSString, NSObject> prefItem : prefSpecifierArray) {
        // Each element is itself a dictionary.

        // What kind of control is used to represent the preference element
        // in the
        // Settings app.
        NSString prefItemType = (NSString) prefItem.get(new NSString("Type"));
        // How this preference element maps to the defaults database for the
        // app.
        NSString prefItemKey = (NSString) prefItem.get(new NSString("Key"));
        // The default value for the preference key.
        NSObject prefItemDefaultValue = prefItem.get(new NSString("DefaultValue"));

        // If this is a 'Child Pane Element'. That is, a reference to
        // another
        // page.
        if (prefItemType.equals(new NSString("PSChildPaneSpecifier"))) {
            // There must be a value associated with the 'File' key in this
            // preference
            // element's dictionary. Its value is the name of the plist file
            // in the
            // Settings bundle for the referenced page.

            NSString prefItemFile = (NSString) prefItem.get(new NSString("File"));

            // Recurs on the referenced page.
            NSDictionary<NSString, NSObject> childPageKeyValuePairs = (NSDictionary<NSString, NSObject>) loadDefaults(
                    prefItemFile.toString(), settingsBundleURL);

            // Add the results to our dictionary
            keyValuePairs.putAll(childPageKeyValuePairs);
        } else if (prefItemKey != null && prefItemDefaultValue != null) {
            // Some elements, such as 'Group' or 'Text Field' elements do
            // not contain
            // a key and default value. Skip those.
            keyValuePairs.put(prefItemKey, prefItemDefaultValue);
        }
    }
    return keyValuePairs;
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:80,代码来源:AppPrefs.java


注:本文中的org.robovm.apple.foundation.NSMutableDictionary类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。