• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java NSBundle类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: fetchProductInformation

import org.robovm.apple.foundation.NSBundle; //导入依赖的package包/类
/** Retrieve product information from the App Store */
@SuppressWarnings("unchecked")
private void fetchProductInformation() {
    // Query the App Store for product information if the user is is allowed
    // to make purchases.
    // Display an alert, otherwise.
    if (SKPaymentQueue.canMakePayments()) {
        // Load the product identifiers fron ProductIds.plist
        String filePath = NSBundle.getMainBundle().findResourcePath("ProductIds", "plist");
        NSArray<NSString> productIds = (NSArray<NSString>) NSArray.read(new File(filePath));

        StoreManager.getInstance().fetchProductInformationForIds(productIds.asStringList());
    } else {
        // Warn the user that they are not allowed to make purchases.
        alert("Warning", "Purchases are disabled on this device.");
    }
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:18,代码来源:IOSProductsList.java


示例2: displayMailComposerSheet

import org.robovm.apple.foundation.NSBundle; //导入依赖的package包/类
/**
 * Displays an email composition interface inside the application. Populates
 * all the Mail fields.
 */
private void displayMailComposerSheet() {
    MFMailComposeViewController picker = new MFMailComposeViewController();
    picker.setMailComposeDelegate(this);
    picker.setSubject("Hello from California!");

    // Set up recipients
    picker.setToRecipients(Arrays.asList("[email protected]"));
    picker.setCcRecipients(Arrays.asList("[email protected]", "[email protected]"));
    picker.setBccRecipients(Arrays.asList("[email protected]"));

    // Attach an image to the email
    String path = NSBundle.getMainBundle().findResourcePath("rainy", "jpg");
    NSData myData = NSData.read(new File(path));
    picker.addAttachmentData(myData, "image/jpeg", "rainy");

    // Fill out the email body text
    String emailBody = "It is raining in sunny California!";
    picker.setMessageBody(emailBody, false);

    presentViewController(picker, true, null);
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:26,代码来源:MessageComposerViewController.java


示例3: populateRegistrationDomain

import org.robovm.apple.foundation.NSBundle; //导入依赖的package包/类
/**
 * Locates the file representing the root page of the settings for this app,
 * invokes loadDefaults:fromSettingsPage:inSettingsBundleAtURL: on it, and
 * registers the loaded values as the app's defaults.
 */
private void populateRegistrationDomain() {
    NSURL settingsBundleURL = NSBundle.getMainBundle().findResourceURL("Settings", "bundle");

    /*
     * Invoke loadDefaults() on the property list file for the root settings
     * page (always named Root.plist).
     */
    NSDictionary<NSString, ?> appDefaults = loadDefaults("Root.plist", settingsBundleURL);

    /*
     * appDefaults is now populated with the preferences and their default
     * values. Add these to the registration domain.
     */
    NSUserDefaults.getStandardUserDefaults().registerDefaults(appDefaults);
    NSUserDefaults.getStandardUserDefaults().synchronize();
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:22,代码来源:AppPrefs.java


示例4: viewDidLoad

import org.robovm.apple.foundation.NSBundle; //导入依赖的package包/类
@Override
public void viewDidLoad() {
    super.viewDidLoad();

    try {
        // Load the display strings.
        String resourcePath = NSBundle.getMainBundle().findResourcePath("DisplayStrings", "txt");
        String string = NSString.readFile(resourcePath, NSStringEncoding.UTF16BigEndian);

        if (string != null) {
            String[] displayStrings = string.split("\\r?\\n");
            moveMeView.setDisplayStrings(displayStrings);
            moveMeView.setupNextDisplayString();
        }
    } catch (NSErrorException e) {
        throw new Error(e);
    }
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:19,代码来源:APLViewController.java


示例5: createApplication

import org.robovm.apple.foundation.NSBundle; //导入依赖的package包/类
@Override
protected IOSApplication createApplication()
{
    IOSApplicationConfiguration config = new IOSApplicationConfiguration();
    final String version = NSBundle.getMainBundle().getInfoDictionaryObject("CFBundleShortVersionString").toString();
    return new IOSApplication(new PixelDungeon(new PDPlatformSupport(version, null, new IOSInputProcessor())), config);
}
 
开发者ID:kurtyu,项目名称:PixelDungeonTC,代码行数:8,代码来源:IOSLauncher.java


示例6: LayoutViewController

import org.robovm.apple.foundation.NSBundle; //导入依赖的package包/类
public LayoutViewController(String layoutName, NSBundle layoutBundle) {
    super(null, null);

    if(layoutBundle == null) {
        layoutBundle = NSBundle.getMainBundle();
    }
    if(layoutName != null) {
        this.layoutUrl = layoutBundle.findResourceURL(layoutName, "xml");
    }
}
 
开发者ID:liraz,项目名称:robolayout,代码行数:11,代码来源:LayoutViewController.java


示例7: testInflateURL

import org.robovm.apple.foundation.NSBundle; //导入依赖的package包/类
@Test
public void testInflateURL() throws Exception {
    NSURL url = NSBundle.getMainBundle().findResourceURL("test/testLayout1", "xml");
    LayoutInflater inflater = new LayoutInflater();

    LayoutBridge rootView = new LayoutBridge(new CGRect(0, 0, 100, 100));
    UIView view = inflater.inflate(url, rootView, false);

    Assert.assertNotNull("Inflater returned null when inflating simple view", view);
}
 
开发者ID:liraz,项目名称:robolayout,代码行数:11,代码来源:LayoutInflaterTest.java


示例8: testInflateAttachToRootTrue

import org.robovm.apple.foundation.NSBundle; //导入依赖的package包/类
@Test
public void testInflateAttachToRootTrue() throws Exception {
    NSURL url = NSBundle.getMainBundle().findResourceURL("test/testLayout1", "xml");
    LayoutInflater inflater = new LayoutInflater();

    LayoutBridge rootView = new LayoutBridge(new CGRect(0, 0, 100, 100));
    UIView view = inflater.inflate(url, rootView, true);

    Assert.assertEquals("Inflater did not return rootView", view, rootView);
    Assert.assertEquals("Inflater did not attach inflated view to rootView", 1, rootView.getSubviews().size());
}
 
开发者ID:liraz,项目名称:robolayout,代码行数:12,代码来源:LayoutInflaterTest.java


示例9: testInflateAttachToRootFalse

import org.robovm.apple.foundation.NSBundle; //导入依赖的package包/类
@Test
public void testInflateAttachToRootFalse() throws Exception {
    NSURL url = NSBundle.getMainBundle().findResourceURL("test/testLayout1", "xml");
    LayoutInflater inflater = new LayoutInflater();

    LayoutBridge rootView = new LayoutBridge(new CGRect(0, 0, 100, 100));
    UIView view = inflater.inflate(url, rootView, false);

    Assert.assertNull("Inflater attached inflated view to rootView", view.getSuperview());
}
 
开发者ID:liraz,项目名称:robolayout,代码行数:11,代码来源:LayoutInflaterTest.java


示例10: testInflateCustomView

import org.robovm.apple.foundation.NSBundle; //导入依赖的package包/类
@Test
public void testInflateCustomView() throws Exception {
    NSURL url = NSBundle.getMainBundle().findResourceURL("test/testLayout2", "xml");
    LayoutInflater inflater = new LayoutInflater();

    LayoutBridge rootView = new LayoutBridge(new CGRect(0, 0, 100, 100));
    UIView view = inflater.inflate(url, rootView, false);

    Assert.assertEquals("Inflater inflated the wrong view type", view.getClass(), CustomTestView.class);
}
 
开发者ID:liraz,项目名称:robolayout,代码行数:11,代码来源:LayoutInflaterTest.java


示例11: testInflatePrefixedViews

import org.robovm.apple.foundation.NSBundle; //导入依赖的package包/类
@Test
public void testInflatePrefixedViews() throws Exception {
    NSURL url = NSBundle.getMainBundle().findResourceURL("test/testLayout3", "xml");
    LayoutInflater inflater = new LayoutInflater();

    LayoutBridge rootView = new LayoutBridge(new CGRect(0, 0, 100, 100));
    UIView view = inflater.inflate(url, rootView, false);

    Assert.assertEquals("Inflater didn't resolve the non-prefixed view name to a prefixed class name", view.getClass(), CustomTestView.class);
}
 
开发者ID:liraz,项目名称:robolayout,代码行数:11,代码来源:LayoutInflaterTest.java


示例12: testInflateSubviews

import org.robovm.apple.foundation.NSBundle; //导入依赖的package包/类
@Test
public void testInflateSubviews() throws Exception {
    NSURL url = NSBundle.getMainBundle().findResourceURL("test/testLayout4", "xml");
    LayoutInflater inflater = new LayoutInflater();

    LayoutBridge rootView = new LayoutBridge(new CGRect(0, 0, 100, 100));
    UIView view = inflater.inflate(url, rootView, false);

    Assert.assertEquals("Inflater did not inflate the LinearLayout root view", view.getClass(), LinearLayout.class);
    Assert.assertEquals("Inflater inflated the wrong number of subviews", 2, view.getSubviews().size());
}
 
开发者ID:liraz,项目名称:robolayout,代码行数:12,代码来源:LayoutInflaterTest.java


示例13: crateStatsRequestVO

import org.robovm.apple.foundation.NSBundle; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
protected StatsRequestVO crateStatsRequestVO() throws IllegalAccessException, InstantiationException {
    U statsReporterVO = (U) requestType.newInstance();
    statsReporterVO.udid = UIDevice.getCurrentDevice().getIdentifierForVendor().asString();
    statsReporterVO.model = UIDevice.getCurrentDevice().getModel();
    statsReporterVO.version = String.valueOf(NSBundle.getMainBundle().getInfoDictionary().asStringMap().get("CFBundleVersion"));
    //System.out.println(statsReporterVO);
    return statsReporterVO;
}
 
开发者ID:UnderwaterApps,项目名称:submarine,代码行数:11,代码来源:IOSStatsReporter.java


示例14: viewDidLoad

import org.robovm.apple.foundation.NSBundle; //导入依赖的package包/类
@Override
public void viewDidLoad() {
    super.viewDidLoad();

    result.setText("Enter 2 numbers");

    // this just demonstrates how to load a resources
    // from a framework. The storyboard is not really used.
    NSBundle bundle = NSBundle.getBundle("org.robovm.MySwiftFramework");
    UIStoryboard storyboard = new UIStoryboard("Storyboard", bundle);
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:12,代码来源:MyViewController.java


示例15: getImageData

import org.robovm.apple.foundation.NSBundle; //导入依赖的package包/类
private static NSArray<?> getImageData() {
    if (imageData == null) {
        String path = NSBundle.getMainBundle().findResourcePath("ImageData", "plist");
        NSData plistData = NSData.read(new File(path));
        try {
            imageData = (NSArray<?>) NSPropertyListSerialization.getPropertyListFromData(plistData,
                    NSPropertyListMutabilityOptions.None);
        } catch (NSErrorException e) {
            System.err.println("Unable to read image data: " + e.getError());
        }
    }
    return imageData;
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:14,代码来源:ImageScrollView.java


示例16: prepareForSegue

import org.robovm.apple.foundation.NSBundle; //导入依赖的package包/类
/**
 * This method will be called when the 'Begin' button is tapped.
 */
@Override
public void prepareForSegue(UIStoryboardSegue segue, NSObject sender) {
    // Create a new Quiz from the questions.xml file in the bundle
    // resources.
    String questionsPath = NSBundle.getMainBundle().findResourcePath("questions", "xml");
    Quiz newQuiz = new Quiz(questionsPath);

    // Set the newQuiz as the currentQuiz of the destination view
    // controller.
    QuestionViewController firstQuestionVC = (QuestionViewController) ((UINavigationController) segue
            .getDestinationViewController())
            .getViewControllers().get(0);
    firstQuestionVC.setQuiz(newQuiz);
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:18,代码来源:MainMenuViewController.java


示例17: accessGrantedForAddressBook

import org.robovm.apple.foundation.NSBundle; //导入依赖的package包/类
/**
 * This method is called when the user has granted access to their address
 * book data.
 */
private void accessGrantedForAddressBook() {
    // Load data from the plist file
    String plistPath = NSBundle.getMainBundle().findResourcePath("Menu", "plist");
    menuArray = (NSArray<NSDictionary<NSString, NSString>>) NSArray.read(new File(plistPath));
    getTableView().reloadData();
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:11,代码来源:QuickContactsViewController.java


示例18: ShortcutsTableViewController

import org.robovm.apple.foundation.NSBundle; //导入依赖的package包/类
public ShortcutsTableViewController(NSCoder coder) {
    super(coder);
    NSDictionary<NSString, ?> info = NSBundle.getMainBundle().getInfoDictionary(); // TODO
                                                                                   // we
                                                                                   // could
                                                                                   // wrap
                                                                                   // it
    // Obtain the UIApplicationShortcutItems array from the Info.plist. If
    // unavailable, there are no static shortcuts.
    @SuppressWarnings("unchecked") NSArray<NSDictionary<NSString, ?>> shortcuts = (NSArray<NSDictionary<NSString, ?>>) info
            .get("UIApplicationShortcutItems");
    if (shortcuts == null) {
        staticShortcuts = new NSArray<>();
    } else {
        staticShortcuts = new NSMutableArray<>();
        for (NSDictionary<NSString, ?> shortcut : shortcuts) {
            String shortcutType = shortcut.getString("UIApplicationShortcutItemType");
            String shortcutTitle = shortcut.getString("UIApplicationShortcutItemTitle");

            String localizedTitle = NSBundle.getMainBundle().getLocalizedInfoDictionary()
                    .getString(shortcutTitle, null);
            if (localizedTitle != null) {
                shortcutTitle = localizedTitle;
            }

            String shortcutSubtitle = shortcut.getString("UIApplicationShortcutItemSubtitle", null);
            if (shortcutSubtitle != null) {
                shortcutSubtitle = NSBundle.getMainBundle().getLocalizedInfoDictionary()
                        .getString(shortcutSubtitle, null);
            }

            staticShortcuts.add(new UIApplicationShortcutItem(shortcutType, shortcutTitle, shortcutSubtitle, null,
                    null));
        }
    }
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:37,代码来源:ShortcutsTableViewController.java


示例19: IAPStoreProductViewController

import org.robovm.apple.foundation.NSBundle; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public IAPStoreProductViewController() {
    getNavigationItem().setTitle("Store");

    // Create a store product view controller
    storeProductViewController = new SKStoreProductViewController();
    storeProductViewController.setDelegate(this);

    // Fetch all the products
    String plistPath = NSBundle.getMainBundle().findResourcePath("Products", "plist");
    NSArray<NSDictionary<NSString, NSObject>> temp = (NSArray<NSDictionary<NSString, NSObject>>) NSArray
            .read(new File(
                    plistPath));

    for (NSDictionary<NSString, NSObject> item : temp) {
        // Create an Product object to store its category, title, and
        // identifier properties
        Product product = new Product(item);

        // Keep track of all the products
        myProducts.add(product);
    }

    UITableView tableView = new UITableView(UIScreen.getMainScreen().getBounds(), UITableViewStyle.Grouped);
    tableView.registerReusableCellClass(UITableViewCell.class, "productID");
    setTableView(tableView);
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:28,代码来源:IAPStoreProductViewController.java


示例20: createApplication

import org.robovm.apple.foundation.NSBundle; //导入依赖的package包/类
@Override
protected IOSApplication createApplication() {
	IOSApplicationConfiguration config = new IOSApplicationConfiguration();
	final String version = NSBundle.getMainBundle().getInfoDictionaryObject("CFBundleShortVersionString").toString();
	final int versionCode = Integer.parseInt(NSBundle.getMainBundle().getInfoDictionaryObject("CFBundleVersion").toString());
	return new IOSApplication(new ShatteredPixelDungeon(new PDPlatformSupport(version, versionCode, null, new IOSInputProcessor())), config);
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon-gdx,代码行数:8,代码来源:IOSLauncher.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DurationField类代码示例发布时间:2022-05-22
下一篇:
Java MatcherUtil类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap