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

Java NSURL类代码示例

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

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



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

示例1: execute

import org.robovm.apple.foundation.NSURL; //导入依赖的package包/类
@Override protected RFuture<Response> execute(Builder req) {
  RPromise<Response> result = plat.exec().deferredPromise();

  NSMutableURLRequest mreq = new NSMutableURLRequest();
  mreq.setURL(new NSURL(req.url));
  for (Header header : req.headers) {
    mreq.setHTTPHeaderField(header.name, header.value);
  }
  mreq.setHTTPMethod(req.method());
  if (req.isPost()) {
    mreq.setHTTPHeaderField("Content-type", req.contentType());
    if (req.payloadString != null) {
      try {
        mreq.setHTTPBody(new NSData(req.payloadString.getBytes("UTF-8")));
      } catch (UnsupportedEncodingException uee) {
        throw new RuntimeException(uee);
      }
    } else {
      mreq.setHTTPBody(new NSData(req.payloadBytes));
    }
  }
  sendRequest(mreq, result);
  return result;
}
 
开发者ID:playn,项目名称:playn,代码行数:25,代码来源:RoboNet.java


示例2: setContentOfCell

import org.robovm.apple.foundation.NSURL; //导入依赖的package包/类
public static UITableViewCell setContentOfCell(String name, NSURL url, String adresse, String email) {
	UITableViewCell cell = new UITableViewCell(new CGRect(0, 0, 300, 60));
	UIImageView img = new UIImageView(new CGRect(20, 10, 70, 70));
	NSData data = (NSData)NSData.read(url);
	img.setImage(new UIImage(data));		
	cell.getContentView().addSubview(img);
	
	UILabel label1 = new UILabel(new CGRect(100, 10, cell.getContentView().getFrame().getWidth(), 20));
	label1.setText(name);
	label1.setTextColor(UIColor.colorBrown());
	cell.getContentView().addSubview(label1);
	
	UILabel label2 = new UILabel(new CGRect(100, 35, cell.getContentView().getFrame().getWidth(), 20));
	label2.setText(adresse);
	cell.getContentView().addSubview(label2);
	
	UILabel label3 = new UILabel(new CGRect(100, 55, cell.getContentView().getFrame().getWidth(), 20));
	label3.setText(email);
	cell.getContentView().addSubview(label3);
	return cell;
}
 
开发者ID:Kourtessia,项目名称:RoboVM-for-iOS,代码行数:22,代码来源:AddressbookUtils.java


示例3: handleActionURL

import org.robovm.apple.foundation.NSURL; //导入依赖的package包/类
private boolean handleActionURL(NSURL url) {
    if (url.getHost().equals("camera")) {
        if (PAPUser.getCurrentUser() != null) {
            return tabBarController.shouldPresentPhotoCaptureController();
        }
    } else {
        if (url.getFragment().matches("pic/[A-Za-z0-9]{10}")) {
            String photoObjectId = url.getFragment().substring(4, 10);
            if (photoObjectId != null && photoObjectId.length() > 0) {
                Log.d("PHOTO: %s", photoObjectId);
                shouldNavigateToPhoto(PFObject.createWithoutData(PAPPhoto.class, photoObjectId));
                return true;
            }
        }
    }

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


示例4: populateRegistrationDomain

import org.robovm.apple.foundation.NSURL; //导入依赖的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


示例5: getCellForRow

import org.robovm.apple.foundation.NSURL; //导入依赖的package包/类
@Override
public UITableViewCell getCellForRow(UITableView uiTableView, NSIndexPath nsIndexPath) {
    TopicCell cell = (TopicCell) uiTableView.dequeueReusableCell("cell");
    Topic topic = topics.get(nsIndexPath.getRow());
    cell.text.setText(topic.getDisplayText());
    cell.icon.setImage(null);

    if (topic.icon != null && topic.icon.url != null && !topic.icon.url.isEmpty()) {
        NSURLSession.getSharedSession().newDataTask(new NSURL(topic.icon.url), (data, response, error) -> {
            DispatchQueue.getMainQueue().async(() -> {
                cell.icon.setContentMode(UIViewContentMode.ScaleAspectFill);
                cell.icon.setImage(new UIImage(data));
            });
        }).resume();
    }

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


示例6: openUrlExtern

import org.robovm.apple.foundation.NSURL; //导入依赖的package包/类
@Override
public void openUrlExtern(String link) {
    log.debug("Open URL @Safari: {}", link);
    if (link.startsWith("www.")) {
        link = "http://" + link;
    }
    if (!UIApplication.getSharedApplication().openURL(new NSURL(link))) {
        log.error(Translation.get("Cann_not_open_cache_browser") + " (" + link + ")");
        CB.viewmanager.toast(Translation.get("Cann_not_open_cache_browser") + " (" + link + ")");
    }
}
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:12,代码来源:IOS_PlatformConnector.java


示例7: createAVAP

import org.robovm.apple.foundation.NSURL; //导入依赖的package包/类
Sound createAVAP(final NSURL url) {
  final RoboSoundAVAP sound = new RoboSoundAVAP(plat);
  plat.exec().invokeAsync(new Runnable() {
    public void run () {
      try {
        sound.succeed(new AVAudioPlayer(url));
      } catch (Exception e) {
        plat.log().warn("Error loading sound [" + url + "]", e);
        sound.fail(e);
      }
    }
  });
  return sound;
}
 
开发者ID:playn,项目名称:playn,代码行数:15,代码来源:RoboAudio.java


示例8: clickedCall

import org.robovm.apple.foundation.NSURL; //导入依赖的package包/类
@IBAction
private void clickedCall() {
    phoneNumbers.add(translatedNumber);

    NSURL url = new NSURL("tel:" + translatedNumber);

    if (!UIApplication.getSharedApplication().openURL(url)) {
        UIAlertController alert = new UIAlertController("Not supported", "Scheme 'tel:' is not supported on this device", UIAlertControllerStyle.Alert);
        alert.addAction(new UIAlertAction("Ok", UIAlertActionStyle.Default, null));
        presentViewController(alert, true, null);
    }
}
 
开发者ID:robovm,项目名称:robovm-tutorials,代码行数:13,代码来源:MyViewController.java


示例9: clickedCall

import org.robovm.apple.foundation.NSURL; //导入依赖的package包/类
@IBAction
private void clickedCall() {
    NSURL url = new NSURL("tel:" + translatedNumber);

    if (!UIApplication.getSharedApplication().openURL(url)) {
        UIAlertController alert = new UIAlertController("Not supported", "Scheme 'tel:' is not supported on this device", UIAlertControllerStyle.Alert);
        alert.addAction(new UIAlertAction("Ok", UIAlertActionStyle.Default, null));
        presentViewController(alert, true, null);
    }
}
 
开发者ID:robovm,项目名称:robovm-tutorials,代码行数:11,代码来源:MyViewController.java


示例10: CollectionViewCell

import org.robovm.apple.foundation.NSURL; //导入依赖的package包/类
public CollectionViewCell(NSURL url) {
    super(CGRect.Zero());

    LayoutBridge bridge = new LayoutBridge(getContentView().getBounds());
    bridge.setAutoresizingMask(UIViewAutoresizing.FlexibleWidth.set(UIViewAutoresizing.FlexibleHeight));

    getContentView().addSubview(bridge);
    getContentView().setTranslatesAutoresizingMaskIntoConstraints(true);

    LayoutInflater inflater = new LayoutInflater();
    inflater.inflate(url, bridge, true);

    layoutBridge = bridge;
}
 
开发者ID:liraz,项目名称:robolayout,代码行数:15,代码来源:CollectionViewCell.java


示例11: create

import org.robovm.apple.foundation.NSURL; //导入依赖的package包/类
public static Drawable create(NSURL url) {
    Drawable drawable = null;

    ResourceManager resourceManager = ResourceManager.getCurrent();
    XMLCache cache = resourceManager.getXmlCache();

    try {
        Document xml = cache.getXML(url);
        drawable = create(xml.getDocumentElement());
    } catch (IOException e) {
        e.printStackTrace();
    }
    return drawable;
}
 
开发者ID:liraz,项目名称:robolayout,代码行数:15,代码来源:Drawable.java


示例12: getXML

import org.robovm.apple.foundation.NSURL; //导入依赖的package包/类
public Document getXML(NSURL url) throws IOException {
    Document document = null;

    NSData nsData = (NSData) cache.get(url.getAbsoluteString());

    try {
        if(nsData == null) { // trying to fetch (does not exist in cache)
            nsData = NSData.read(url);

            if(nsData == null) {
                if(url.isFileURL())
                    throw new FileNotFoundException(url.getAbsoluteString());
            } else {
                cache.put(url.getAbsoluteString(), nsData);
            }
        }

        if(nsData != null) {
            DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();

            byte[] bytes = nsData.getBytes();
            if(bytes != null) {
                ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes);

                DocumentBuilder db = dfactory.newDocumentBuilder();
                InputSource inputSource = new InputSource(inputStream);
                document = db.parse(inputSource);
            }
        }
    } catch (SAXException | ParserConfigurationException e) {
        e.printStackTrace();
    }

    return document;
}
 
开发者ID:liraz,项目名称:robolayout,代码行数:36,代码来源:XMLCache.java


示例13: getXML

import org.robovm.apple.foundation.NSURL; //导入依赖的package包/类
public static Document getXML(NSURL url) throws IOException {
    Document document = null;
    NSData nsData = NSData.read(url);

    if(nsData == null) {
        if(url.isFileURL())
            throw new FileNotFoundException(url.getAbsoluteString());
    }

    if(nsData != null) {
        document = getXML(nsData);
    }
    return document;
}
 
开发者ID:liraz,项目名称:robolayout,代码行数:15,代码来源:XMLUtil.java


示例14: testInflateURL

import org.robovm.apple.foundation.NSURL; //导入依赖的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


示例15: testInflateAttachToRootTrue

import org.robovm.apple.foundation.NSURL; //导入依赖的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


示例16: testInflateAttachToRootFalse

import org.robovm.apple.foundation.NSURL; //导入依赖的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


示例17: testInflateCustomView

import org.robovm.apple.foundation.NSURL; //导入依赖的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


示例18: testInflatePrefixedViews

import org.robovm.apple.foundation.NSURL; //导入依赖的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


示例19: testInflateSubviews

import org.robovm.apple.foundation.NSURL; //导入依赖的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


示例20: applyAttributes

import org.robovm.apple.foundation.NSURL; //导入依赖的package包/类
public static void applyAttributes(UIWebView webview, Map<String, String> attrs, NSObject actionTarget) {
    UIViewLayoutUtil.applyAttributes(webview, attrs);

    String src = attrs.get("src");
    if(src != null) {
        NSURL url = new NSURL(src);
        webview.loadRequest(new NSURLRequest(url));
    }
}
 
开发者ID:liraz,项目名称:robolayout,代码行数:10,代码来源:UIWebViewLayoutUtil.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java Description类代码示例发布时间:2022-05-22
下一篇:
Java ThrottledInputStream类代码示例发布时间: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