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

Java UIDevice类代码示例

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

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



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

示例1: updateBatteryLevel

import org.robovm.apple.uikit.UIDevice; //导入依赖的package包/类
private void updateBatteryLevel() {
    float batteryLevel = UIDevice.getCurrentDevice().getBatteryLevel();
    if (batteryLevel < 0) {
        // -1.0 means battery state is UIDeviceBatteryState.Unknown
        levelLabel.setText(NSString.getLocalizedString("Unknown"));
    } else {
        NSNumberFormatter numberFormatter = null;
        if (numberFormatter == null) {
            numberFormatter = new NSNumberFormatter();
            numberFormatter.setNumberStyle(NSNumberFormatterStyle.Percent);
            numberFormatter.setMaximumFractionDigits(1);
        }

        NSNumber levelObj = NSNumber.valueOf(batteryLevel);
        levelLabel.setText(numberFormatter.format(levelObj));
    }
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:18,代码来源:BatStatViewController.java


示例2: updateBatteryState

import org.robovm.apple.uikit.UIDevice; //导入依赖的package包/类
private void updateBatteryState() {
    UITableViewCell[] batteryStateCells = new UITableViewCell[] { unknownCell, unpluggedCell, chargingCell,
        fullCell };

    UIDeviceBatteryState currentState = UIDevice.getCurrentDevice().getBatteryState();

    for (int i = 0; i < batteryStateCells.length; i++) {
        UITableViewCell cell = batteryStateCells[i];

        if (i + UIDeviceBatteryState.Unknown.value() == currentState.value()) {
            cell.setAccessoryType(UITableViewCellAccessoryType.Checkmark);
        } else {
            cell.setAccessoryType(UITableViewCellAccessoryType.None);
        }
    }
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:17,代码来源:BatStatViewController.java


示例3: viewDidLoad

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

    // Register for battery level and state change notifications.
    UIDevice.Notifications.observeBatteryLevelDidChange(new Runnable() {
        @Override
        public void run() {
            updateBatteryLevel();
        }
    });
    UIDevice.Notifications.observeBatteryStateDidChange(new Runnable() {
        @Override
        public void run() {
            updateBatteryLevel();
            updateBatteryState();
        }
    });
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:20,代码来源:BatStatViewController.java


示例4: didFinishLaunching

import org.robovm.apple.uikit.UIDevice; //导入依赖的package包/类
@Override
public boolean didFinishLaunching (UIApplication app, UIApplicationLaunchOptions launchOpts) {
  // create a full-screen window
  CGRect bounds = UIScreen.getMainScreen().getBounds();
  UIWindow window = new UIWindow(bounds);

  // create and initialize the PlayN platform
  RoboPlatform.Config config = new RoboPlatform.Config();
  config.orients = UIInterfaceOrientationMask.All;
  RoboPlatform pf = RoboPlatform.create(window, config);
  addStrongRef(pf);

  final Showcase game = new Showcase(pf, new Showcase.DeviceService() {
                        public String info () {
                          UIDevice device = UIDevice.getCurrentDevice();
                          return "iOS [model=" + device.getModel() +
                            ", os=" + device.getSystemName() + "/" + device.getSystemVersion() +
                            ", name=" + device.getName() +
                            ", orient=" + device.getOrientation() + "]";
                        }
  });
  pf.orient.connect(new Slot<RoboOrientEvent>() {
    public void onEmit (RoboOrientEvent event) {
      if (event instanceof RoboOrientEvent.DidRotate) {
        game.rotate.emit(game);
      }
    }
  });

  // make our main window visible (the platform starts when the window becomes viz)
  window.makeKeyAndVisible();
  addStrongRef(window);
  return true;
}
 
开发者ID:playn,项目名称:playn-samples,代码行数:35,代码来源:ShowcaseRoboVM.java


示例5: crateStatsRequestVO

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


示例6: setupPeripherals

import org.robovm.apple.uikit.UIDevice; //导入依赖的package包/类
void setupPeripherals () {
	//motionManager = new CMMotionManager();
	setupAccelerometer();
	setupCompass();
	UIDevice device = UIDevice.getCurrentDevice();
	if (device.getModel().equalsIgnoreCase("iphone")) hasVibrator = true;
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:8,代码来源:IOSInput.java


示例7: createApplication

import org.robovm.apple.uikit.UIDevice; //导入依赖的package包/类
@Override
protected IOSApplication createApplication() {
	String deviceName = UIDevice.getCurrentDevice().getModel();
	double screenWidth = UIScreen.getMainScreen().getBounds().getWidth();
	double screenHeight = UIScreen.getMainScreen().getBounds().getHeight();
	System.out.println("Device Model: " + deviceName);
    IOSApplicationConfiguration config = new IOSApplicationConfiguration();
    return new IOSApplication(new CDGame(new DesktopGoogleServices(), "Touch", false, (int)screenWidth, (int)screenHeight), config);
}
 
开发者ID:buzzbyte,项目名称:CatchDROP,代码行数:10,代码来源:IOSLauncher.java


示例8: viewDidLayoutSubviews

import org.robovm.apple.uikit.UIDevice; //导入依赖的package包/类
@Override
public void viewDidLayoutSubviews() {
    // Enable battery monitoring.
    UIDevice.getCurrentDevice().setBatteryMonitoringEnabled(true);
    updateBatteryLevel();
    updateBatteryState();
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:8,代码来源:BatStatViewController.java


示例9: MyMovieViewController

import org.robovm.apple.uikit.UIDevice; //导入依赖的package包/类
public MyMovieViewController() {
    movieBackgroundImageView = new UIImageView(UIImage.getImage("images/movieBackground.jpg"));
    movieBackgroundImageView.setFrame(new CGRect(0, 0, 240, 128));

    backgroundView = new UIView(new CGRect(0, 0, 320, 460));
    backgroundView.setBackgroundColor(UIColor.fromWhiteAlpha(0.66, 1));

    overlayController = new MyOverlayViewController(this);

    if (Integer.valueOf(UIDevice.getCurrentDevice().getSystemVersion().substring(0, 1)) >= 7) {
        setEdgesForExtendedLayout(UIRectEdge.None);
    }
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:14,代码来源:MyMovieViewController.java


示例10: setupPeripherals

import org.robovm.apple.uikit.UIDevice; //导入依赖的package包/类
void setupPeripherals() {
	// motionManager = new CMMotionManager();
	setupAccelerometer();
	setupCompass();
	UIDevice device = UIDevice.getCurrentDevice();
	if (device.getModel().equalsIgnoreCase("iphone"))
		hasVibrator = true;
}
 
开发者ID:mini2Dx,项目名称:mini2Dx,代码行数:9,代码来源:IOSMini2DxInput.java


示例11: getIosVersion

import org.robovm.apple.uikit.UIDevice; //导入依赖的package包/类
private int getIosVersion() {
    String systemVersion = UIDevice.getCurrentDevice().getSystemVersion().substring(0, 1);
    return Integer.parseInt(systemVersion);
}
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:5,代码来源:IOS_Launcher.java


示例12: useHalfSize

import org.robovm.apple.uikit.UIDevice; //导入依赖的package包/类
private static boolean useHalfSize (RoboPlatform.Config config) {
  boolean isPad = UIDevice.getCurrentDevice().getUserInterfaceIdiom() == UIUserInterfaceIdiom.Pad;
  return isPad && config.iPadLikePhone;
}
 
开发者ID:playn,项目名称:playn,代码行数:5,代码来源:RoboGraphics.java


示例13: boundsChanged

import org.robovm.apple.uikit.UIDevice; //导入依赖的package包/类
void boundsChanged(CGRect bounds) {
  viewportChanged(scale().scaledCeil((float)bounds.getWidth()),
                  scale().scaledCeil((float)bounds.getHeight()));
  orientDetailM.update(toOrientationDetail(UIDevice.getCurrentDevice().getOrientation()));
}
 
开发者ID:playn,项目名称:playn,代码行数:6,代码来源:RoboGraphics.java


示例14: getOSVersion

import org.robovm.apple.uikit.UIDevice; //导入依赖的package包/类
private int getOSVersion () {
  String systemVersion = UIDevice.getCurrentDevice().getSystemVersion();
  int version = Integer.parseInt(systemVersion.split("\\.")[0]);
  return version;
}
 
开发者ID:playn,项目名称:playn,代码行数:6,代码来源:RoboPlatform.java


示例15: didFinishLaunching

import org.robovm.apple.uikit.UIDevice; //导入依赖的package包/类
final boolean didFinishLaunching (UIApplication uiApp, UIApplicationLaunchOptions options) {
	Gdx.app = this;
	this.uiApp = uiApp;

	// enable or disable screen dimming
	UIApplication.getSharedApplication().setIdleTimerDisabled(config.preventScreenDimming);

	Gdx.app.debug("IOSApplication", "iOS version: " + UIDevice.getCurrentDevice().getSystemVersion());
	// fix the scale factor if we have a retina device (NOTE: iOS screen sizes are in "points" not pixels by default!)

	float scale = (float)(getIosVersion() >= 8 ? UIScreen.getMainScreen().getNativeScale() : UIScreen.getMainScreen()
		.getScale());
	if (scale >= 2.0f) {
		Gdx.app.debug("IOSApplication", "scale: " + scale);
		if (UIDevice.getCurrentDevice().getUserInterfaceIdiom() == UIUserInterfaceIdiom.Pad) {
			// it's an iPad!
			displayScaleFactor = config.displayScaleLargeScreenIfRetina * scale;
		} else {
			// it's an iPod or iPhone
			displayScaleFactor = config.displayScaleSmallScreenIfRetina * scale;
		}
	} else {
		// no retina screen: no scaling!
		if (UIDevice.getCurrentDevice().getUserInterfaceIdiom() == UIUserInterfaceIdiom.Pad) {
			// it's an iPad!
			displayScaleFactor = config.displayScaleLargeScreenIfNonRetina;
		} else {
			// it's an iPod or iPhone
			displayScaleFactor = config.displayScaleSmallScreenIfNonRetina;
		}
	}

	GL20 gl20 = new IOSGLES20();

	Gdx.gl = gl20;
	Gdx.gl20 = gl20;

	// setup libgdx
	this.input = new IOSInput(this);
	this.graphics = new IOSGraphics(getBounds(null), scale, this, config, input, gl20);
	this.files = new IOSFiles();
	this.audio = new IOSAudio(config);
	this.net = new IOSNet(this);

	Gdx.files = this.files;
	Gdx.graphics = this.graphics;
	Gdx.audio = this.audio;
	Gdx.input = this.input;
	Gdx.net = this.net;

	this.input.setupPeripherals();

	this.uiWindow = new UIWindow(UIScreen.getMainScreen().getBounds());
	this.uiWindow.setRootViewController(this.graphics.viewController);
	this.uiWindow.makeKeyAndVisible();
	Gdx.app.debug("IOSApplication", "created");
	return true;
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:59,代码来源:IOSApplication.java


示例16: getIosVersion

import org.robovm.apple.uikit.UIDevice; //导入依赖的package包/类
private int getIosVersion () {
	String systemVersion = UIDevice.getCurrentDevice().getSystemVersion();
	int version = Integer.parseInt(systemVersion.split("\\.")[0]);
	return version;
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:6,代码来源:IOSApplication.java


示例17: getVersion

import org.robovm.apple.uikit.UIDevice; //导入依赖的package包/类
@Override
public int getVersion () {
	return Integer.parseInt(UIDevice.getCurrentDevice().getSystemVersion().split("\\.")[0]);
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:5,代码来源:IOSApplication.java


示例18: switchAction

import org.robovm.apple.uikit.UIDevice; //导入依赖的package包/类
@IBAction
private void switchAction(UISwitch sender) {
    UIDevice.getCurrentDevice().setBatteryMonitoringEnabled(sender.isOn());
    updateBatteryLevel();
    updateBatteryState();
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:7,代码来源:BatStatViewController.java


示例19: viewWillAppear

import org.robovm.apple.uikit.UIDevice; //导入依赖的package包/类
@Override
public void viewWillAppear (boolean animated) {
    // Start the progress indicator animation.
    loadingProgressIndicator.startAnimating();

    CGSize viewSize = getView().getBounds().getSize();

    // On iPhone/iPod touch we want to see a similar amount of the scene as on iPad.
    // So, we set the size of the scene to be double the size of the view, which is
    // the whole screen, 3.5- or 4- inch. This effectively scales the scene to 50%.
    if (UIDevice.getCurrentDevice().getUserInterfaceIdiom() == UIUserInterfaceIdiom.Phone) {
        viewSize.setHeight(viewSize.getHeight() * 2);
        viewSize.setWidth(viewSize.getWidth() * 2);
    }
    scene = new APAAdventureScene(viewSize);

    // Load the shared assets of the scene.
    scene.loadSceneAssets(new Runnable() {
        @Override
        public void run () {
            scene.setup();

            scene.setScaleMode(SKSceneScaleMode.AspectFill);

            scene.configureGameControllers();

            loadingProgressIndicator.stopAnimating();
            loadingProgressIndicator.setHidden(true);

            skView.presentScene(scene);

            UIView.animate(2, 0, UIViewAnimationOptions.CurveEaseInOut, new Runnable() {
                @Override
                public void run () {
                    archerButton.setAlpha(1);
                    warriorButton.setAlpha(1);
                }
            }, null);
        }
    });

    if (SHOW_DEBUG_INFO) {
        // Show debug information.
        skView.setShowsFPS(true);
        skView.setShowsDrawCount(true);
        skView.setShowsNodeCount(true);
    }
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:49,代码来源:APAViewController.java


示例20: didFinishLaunching

import org.robovm.apple.uikit.UIDevice; //导入依赖的package包/类
final boolean didFinishLaunching (UIApplication uiApp, UIApplicationLaunchOptions options) {
	setApplicationLogger(new IOSApplicationLogger());
	Gdx.app = this;
	this.uiApp = uiApp;

	// enable or disable screen dimming
	UIApplication.getSharedApplication().setIdleTimerDisabled(config.preventScreenDimming);

	Gdx.app.debug("IOSMini2DxGame", "iOS version: " + UIDevice.getCurrentDevice().getSystemVersion());
	// fix the scale factor if we have a retina device (NOTE: iOS screen sizes are in "points" not pixels by default!)

	Gdx.app.debug("IOSMini2DxGame", "Running in " + (Bro.IS_64BIT ? "64-bit" : "32-bit") + " mode");

	float scale = (float)(getIosVersion() >= 8 ? UIScreen.getMainScreen().getNativeScale() : UIScreen.getMainScreen()
		.getScale());
	if (scale >= 2.0f) {
		Gdx.app.debug("IOSMini2DxGame", "scale: " + scale);
		if (UIDevice.getCurrentDevice().getUserInterfaceIdiom() == UIUserInterfaceIdiom.Pad) {
			// it's an iPad!
			displayScaleFactor = config.displayScaleLargeScreenIfRetina * scale;
		} else {
			// it's an iPod or iPhone
			displayScaleFactor = config.displayScaleSmallScreenIfRetina * scale;
		}
	} else {
		// no retina screen: no scaling!
		if (UIDevice.getCurrentDevice().getUserInterfaceIdiom() == UIUserInterfaceIdiom.Pad) {
			// it's an iPad!
			displayScaleFactor = config.displayScaleLargeScreenIfNonRetina;
		} else {
			// it's an iPod or iPhone
			displayScaleFactor = config.displayScaleSmallScreenIfNonRetina;
		}
	}

	// setup libgdx
	this.input = new IOSMini2DxInput(this);
	this.graphics = new IOSMini2DxGraphics(scale, this, config, input, config.useGL30);
	Gdx.gl = Gdx.gl20 = graphics.gl20;
	Gdx.gl30 = graphics.gl30;
	this.files = new IOSFiles();
	this.audio = new IOSAudio(config);
	this.net = new IOSMini2DxNet(this);

	Gdx.files = this.files;
	Gdx.graphics = this.graphics;
	Gdx.audio = this.audio;
	Gdx.input = this.input;
	Gdx.net = this.net;

	this.input.setupPeripherals();

	this.uiWindow = new UIWindow(UIScreen.getMainScreen().getBounds());
	this.uiWindow.setRootViewController(this.graphics.viewController);
	this.uiWindow.makeKeyAndVisible();
	Gdx.app.debug("IOSMini2DxGame", "created");
	return true;
}
 
开发者ID:mini2Dx,项目名称:mini2Dx,代码行数:59,代码来源:IOSMini2DxGame.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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