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

Java SystemUtils类代码示例

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

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



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

示例1: onLoadBitmap

import org.andengine.util.system.SystemUtils; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
	@Override
	public Bitmap onLoadBitmap(final Config pBitmapConfig, final boolean pMutable) {
		final BitmapFactory.Options decodeOptions = new BitmapFactory.Options();
		decodeOptions.inPreferredConfig = pBitmapConfig;
		decodeOptions.inDither = false;
//		decodeOptions.inScaled = false; // TODO Check how this behaves with drawable-""/nodpi/ldpi/mdpi/hdpi folders

		if (pMutable && SystemUtils.isAndroidVersionOrHigher(Build.VERSION_CODES.HONEYCOMB)) {
			decodeOptions.inMutable = pMutable;
		}

		final Bitmap bitmap = BitmapFactory.decodeResource(this.mResources, this.mDrawableResourceID, decodeOptions);

		if (pMutable) {
			return BitmapUtils.ensureBitmapIsMutable(bitmap);
		} else {
			return bitmap;
		}
	}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:21,代码来源:ResourceBitmapTextureAtlasSource.java


示例2: applyEngineOptions

import org.andengine.util.system.SystemUtils; //导入依赖的package包/类
private void applyEngineOptions() {
	final EngineOptions engineOptions = this.mEngine.getEngineOptions();

	if (engineOptions.isFullscreen()) {
		ActivityUtils.requestFullscreen(this);
	}

	if (engineOptions.getAudioOptions().needsMusic() || engineOptions.getAudioOptions().needsSound()) {
		this.setVolumeControlStream(AudioManager.STREAM_MUSIC);
	}

	switch (engineOptions.getScreenOrientation()) {
		case LANDSCAPE_FIXED:
			this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
			break;
		case LANDSCAPE_SENSOR:
			if (SystemUtils.SDK_VERSION_GINGERBREAD_OR_LATER) {
				this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
			} else {
				Debug.w(ScreenOrientation.class.getSimpleName() + "." + ScreenOrientation.LANDSCAPE_SENSOR + " is not supported on this device. Falling back to " + ScreenOrientation.class.getSimpleName() + "." + ScreenOrientation.LANDSCAPE_FIXED);
				this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
			}
			break;
		case PORTRAIT_FIXED:
			this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
			break;
		case PORTRAIT_SENSOR:
			if (SystemUtils.SDK_VERSION_GINGERBREAD_OR_LATER) {
				this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
			} else {
				Debug.w(ScreenOrientation.class.getSimpleName() + "." + ScreenOrientation.PORTRAIT_SENSOR + " is not supported on this device. Falling back to " + ScreenOrientation.class.getSimpleName() + "." + ScreenOrientation.PORTRAIT_FIXED);
				this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
			}
			break;
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:37,代码来源:BaseGameActivity.java


示例3: HighPerformanceVertexBufferObject

import org.andengine.util.system.SystemUtils; //导入依赖的package包/类
public HighPerformanceVertexBufferObject(final VertexBufferObjectManager pVertexBufferObjectManager, final int pCapacity, final DrawType pDrawType, final boolean pAutoDispose, final VertexBufferObjectAttributes pVertexBufferObjectAttributes) {
	super(pVertexBufferObjectManager, pCapacity, pDrawType, pAutoDispose, pVertexBufferObjectAttributes);

	this.mBufferData = new float[pCapacity];
	if (SystemUtils.SDK_VERSION_HONEYCOMB_OR_LATER) {
		this.mFloatBuffer = this.mByteBuffer.asFloatBuffer();
	} else {
		this.mFloatBuffer = null;
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:11,代码来源:HighPerformanceVertexBufferObject.java


示例4: onBufferData

import org.andengine.util.system.SystemUtils; //导入依赖的package包/类
@Override
protected void onBufferData() {
	// TODO Check if, and how mow this condition affects performance.
	if (SystemUtils.SDK_VERSION_HONEYCOMB_OR_LATER) {
		// TODO Check if this is similar fast or faster than the non Honeycomb codepath.
		this.mFloatBuffer.position(0);
		this.mFloatBuffer.put(this.mBufferData);

		GLES20.glBufferData(GLES20.GL_ARRAY_BUFFER, this.mByteBuffer.capacity(), this.mByteBuffer, this.mUsage);
	} else {
		BufferUtils.put(this.mByteBuffer, this.mBufferData, this.mBufferData.length, 0);
		GLES20.glBufferData(GLES20.GL_ARRAY_BUFFER, this.mByteBuffer.limit(), this.mByteBuffer, this.mUsage);
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:15,代码来源:HighPerformanceVertexBufferObject.java


示例5: onLoadBitmap

import org.andengine.util.system.SystemUtils; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
public Bitmap onLoadBitmap(final Config pBitmapConfig, final boolean pMutable) {
	final BitmapFactory.Options decodeOptions = new BitmapFactory.Options();
	decodeOptions.inPreferredConfig = pBitmapConfig;
	decodeOptions.inDither = false;

	if (pMutable && SystemUtils.isAndroidVersionOrHigher(Build.VERSION_CODES.HONEYCOMB)) {
		decodeOptions.inMutable = pMutable;
	}

	InputStream in = null;
	try {
		in = new FileInputStream(this.mFile);
		final Bitmap bitmap = BitmapFactory.decodeStream(in, null, decodeOptions);

		if (pMutable) {
			return BitmapUtils.ensureBitmapIsMutable(bitmap);
		} else {
			return bitmap;
		}
	} catch (final IOException e) {
		Debug.e("Failed loading Bitmap in " + this.getClass().getSimpleName() + ". File: " + this.mFile, e);
		return null;
	} finally {
		StreamUtils.close(in);
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:29,代码来源:FileBitmapTextureAtlasSource.java


示例6: onLoadBitmap

import org.andengine.util.system.SystemUtils; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
public Bitmap onLoadBitmap(final Config pBitmapConfig, final boolean pMutable) {
	InputStream in = null;
	try {
		final BitmapFactory.Options decodeOptions = new BitmapFactory.Options();
		decodeOptions.inPreferredConfig = pBitmapConfig;
		decodeOptions.inDither = false;

		if (pMutable && SystemUtils.isAndroidVersionOrHigher(Build.VERSION_CODES.HONEYCOMB)) {
			decodeOptions.inMutable = pMutable;
		}

		in = this.mAssetManager.open(this.mAssetPath);

		final Bitmap bitmap = BitmapFactory.decodeStream(in, null, decodeOptions);

		if (pMutable) {
			return BitmapUtils.ensureBitmapIsMutable(bitmap);
		} else {
			return bitmap;
		}
	} catch (final IOException e) {
		Debug.e("Failed loading Bitmap in " + this.getClass().getSimpleName() + ". AssetPath: " + this.mAssetPath, e);
		return null;
	} finally {
		StreamUtils.close(in);
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:30,代码来源:AssetBitmapTextureAtlasSource.java


示例7: ColorSwapBitmapTextureAtlasSourceDecorator

import org.andengine.util.system.SystemUtils; //导入依赖的package包/类
public ColorSwapBitmapTextureAtlasSourceDecorator(final IBitmapTextureAtlasSource pBitmapTextureAtlasSource, final IBitmapTextureAtlasSourceDecoratorShape pBitmapTextureAtlasSourceDecoratorShape, final int pColorKeyColorARGBPackedInt, final int pTolerance, final int pColorSwapColorARGBPackedInt, final TextureAtlasSourceDecoratorOptions pTextureAtlasSourceDecoratorOptions) {
	super(pBitmapTextureAtlasSource, pBitmapTextureAtlasSourceDecoratorShape, pTextureAtlasSourceDecoratorOptions);

	this.mColorKeyColorARGBPackedInt = pColorKeyColorARGBPackedInt;
	this.mTolerance = pTolerance;
	this.mColorSwapColorARGBPackedInt = pColorSwapColorARGBPackedInt;
	this.mPaint.setXfermode(new AvoidXfermode(pColorKeyColorARGBPackedInt, pTolerance, Mode.TARGET));
	this.mPaint.setColor(pColorSwapColorARGBPackedInt);

	if (SystemUtils.isAndroidVersionOrHigher(Build.VERSION_CODES.JELLY_BEAN)) {
		Debug.w("The class " + ColorSwapBitmapTextureAtlasSourceDecorator.class.getSimpleName() + " is deprecated for Android API Level: '" + Build.VERSION_CODES.JELLY_BEAN + "' and higher, since the class " + AvoidXfermode.class.getSimpleName() + " is deprecated since then.");
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:14,代码来源:ColorSwapBitmapTextureAtlasSourceDecorator.java


示例8: execute

import org.andengine.util.system.SystemUtils; //导入依赖的package包/类
/**
 * @see <a href="https://groups.google.com/forum/?fromgroups=#!topic/android-developers/8M0RTFfO7-M">groups.google.com/forum/?fromgroups=#!topic/android-developers/8M0RTFfO7-M</a>
 */
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static <T> void execute(final AsyncTask<T, ?, ?> pAsyncTask, final T ... pParameters) {
	if (SystemUtils.isAndroidVersionOrHigher(Build.VERSION_CODES.HONEYCOMB)) {
		pAsyncTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, pParameters);
	} else {
		pAsyncTask.execute(pParameters);
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:12,代码来源:AsyncTaskUtils.java


示例9: isSupported

import org.andengine.util.system.SystemUtils; //导入依赖的package包/类
public static boolean isSupported(final Context pContext) {
	if (sSupported == null) {
		if (SystemUtils.isAndroidVersionOrHigher(Build.VERSION_CODES.ECLAIR_MR1)) {
			try {
				sSupported = SystemUtils.hasSystemFeature(pContext, PackageManager.FEATURE_BLUETOOTH);
			} catch (final SystemUtilsException e) {
				sSupported = Boolean.FALSE;
			}
		} else {
			sSupported = Boolean.FALSE;
		}
	}

	return sSupported;
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:16,代码来源:Bluetooth.java


示例10: isEthernetAvailable

import org.andengine.util.system.SystemUtils; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
public static boolean isEthernetAvailable(final Context pContext) throws ConnectivityUtilsException {
	if (SystemUtils.isAndroidVersionOrHigher(Build.VERSION_CODES.HONEYCOMB_MR2)) {
		return ConnectivityUtils.isNetworkAvailable(pContext, ConnectivityManager.TYPE_ETHERNET);
	} else {
		throw new ConnectivityUtilsException();
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:9,代码来源:ConnectivityUtils.java


示例11: isEthernetConnected

import org.andengine.util.system.SystemUtils; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
public static boolean isEthernetConnected(final Context pContext) throws ConnectivityUtilsException {
	if (SystemUtils.isAndroidVersionOrHigher(Build.VERSION_CODES.HONEYCOMB_MR2)) {
		return ConnectivityUtils.isNetworkConnected(pContext, ConnectivityManager.TYPE_ETHERNET);
	} else {
		throw new ConnectivityUtilsException();
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:9,代码来源:ConnectivityUtils.java


示例12: isEthernetConnectedOrConnecting

import org.andengine.util.system.SystemUtils; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
public static boolean isEthernetConnectedOrConnecting(final Context pContext) throws ConnectivityUtilsException {
	if (SystemUtils.isAndroidVersionOrHigher(Build.VERSION_CODES.HONEYCOMB_MR2)) {
		return ConnectivityUtils.isNetworkConnectedOrConnecting(pContext, ConnectivityManager.TYPE_ETHERNET);
	} else {
		throw new ConnectivityUtilsException();
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:9,代码来源:ConnectivityUtils.java


示例13: isWifiHotspotSupported

import org.andengine.util.system.SystemUtils; //导入依赖的package包/类
/**
 * The check currently performed is not sufficient, as some carriers disabled this feature manually!
 */
public static boolean isWifiHotspotSupported(final Context pContext) {
	if (SystemUtils.isAndroidVersionOrLower(Build.VERSION_CODES.ECLAIR_MR1)) {
		return false;
	} else {
		final WifiManager wifiManager = WifiUtils.getWifiManager(pContext);
		try {
			final Method WifiManager_isWifiApEnabled = wifiManager.getClass().getMethod("isWifiApEnabled");
			return WifiManager_isWifiApEnabled != null;
		} catch (final Throwable t) {
			return false;
		}
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:17,代码来源:WifiUtils.java


示例14: getWifiHotspotIPAddressRaw

import org.andengine.util.system.SystemUtils; //导入依赖的package包/类
/**
 * @return prefers to return an IPv4 address if found, otherwise an IPv6 address.
 * @throws org.andengine.util.WifiUtils.WifiUtilsException
 */
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
public static byte[] getWifiHotspotIPAddressRaw() throws WifiUtilsException {
	try {
		byte[] ipv6Address = null;

		final Enumeration<NetworkInterface> networkInterfaceEnumeration = NetworkInterface.getNetworkInterfaces();
		while (networkInterfaceEnumeration.hasMoreElements()) {
			final NetworkInterface networkInterface = networkInterfaceEnumeration.nextElement();
			if (SystemUtils.isAndroidVersionOrLower(Build.VERSION_CODES.FROYO) || !networkInterface.isLoopback()) {
				final String networkInterfaceName = networkInterface.getName();

				if (ArrayUtils.contains(WifiUtils.HOTSPOT_NETWORKINTERFACE_NAMES, networkInterfaceName)) {
					final Enumeration<InetAddress> inetAddressEnumeration = networkInterface.getInetAddresses();
					while (inetAddressEnumeration.hasMoreElements()) {
						final InetAddress inetAddress = inetAddressEnumeration.nextElement();
						if (!inetAddress.isLoopbackAddress()) {
							final byte[] ipAddress = inetAddress.getAddress();
							if (ipAddress.length == IPUtils.IPV4_LENGTH) {
								return ipAddress;
							} else {
								ipv6Address = ipAddress;
							}
						}
					}
				}
			}
		}

		if (ipv6Address != null) {
			return ipv6Address;
		} else {
			throw new WifiUtilsException("No IP bound to '" + Arrays.toString(WifiUtils.HOTSPOT_NETWORKINTERFACE_NAMES) + "'!");
		}
	} catch (final SocketException e) {
		throw new WifiUtilsException("Unexpected error!", e);
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:42,代码来源:WifiUtils.java


示例15: getEmulatorIPAddressRaw

import org.andengine.util.system.SystemUtils; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
public static byte[] getEmulatorIPAddressRaw() throws WifiUtilsException {
	try {
		byte[] ipv6Address = null;

		final Enumeration<NetworkInterface> networkInterfaceEnumeration = NetworkInterface.getNetworkInterfaces();
		while (networkInterfaceEnumeration.hasMoreElements()) {
			final NetworkInterface networkInterface = networkInterfaceEnumeration.nextElement();
			if (SystemUtils.isAndroidVersionOrLower(Build.VERSION_CODES.FROYO) || !networkInterface.isLoopback()) {
				final Enumeration<InetAddress> inetAddressEnumeration = networkInterface.getInetAddresses();
				while (inetAddressEnumeration.hasMoreElements()) {
					final InetAddress inetAddress = inetAddressEnumeration.nextElement();
					if (!inetAddress.isLoopbackAddress()) {
						final byte[] ipAddress = inetAddress.getAddress();
						if (ipAddress.length == IPUtils.IPV4_LENGTH) {
							return ipAddress;
						} else {
							ipv6Address = ipAddress;
						}
					}
				}
			}
		}

		if (ipv6Address != null) {
			return ipv6Address;
		} else {
			throw new WifiUtilsException("No IP found that is not bound to localhost!");
		}
	} catch (final SocketException e) {
		throw new WifiUtilsException("Unexpected error!", e);
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:34,代码来源:WifiUtils.java


示例16: fromWifiApState

import org.andengine.util.system.SystemUtils; //导入依赖的package包/类
public static WifiHotspotState fromWifiApState(final int pWifiApState) throws WifiUtilsException {
	if (SystemUtils.isAndroidVersionOrHigher(Build.VERSION_CODES.ICE_CREAM_SANDWICH)) {
		switch (pWifiApState) {
			case 10:
				return DISABLING;
			case 11:
				return DISABLED;
			case 12:
				return ENABLING;
			case 13:
				return ENABLED;
			case 14:
				return FAILED;
			default:
				throw new WifiUtilsException("TODO...");
		}
	} else {
		switch (pWifiApState) {
			case 0:
				return DISABLING;
			case 1:
				return DISABLED;
			case 2:
				return ENABLING;
			case 3:
				return ENABLED;
			case 4:
				return FAILED;
			default:
				if (pWifiApState >= 10) {
					return WifiHotspotState.fromWifiApState(pWifiApState - 10);
				} else {
					throw new WifiUtilsException("TODO...");
				}
		}
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:38,代码来源:WifiUtils.java


示例17: getEthernetIPAddressRaw

import org.andengine.util.system.SystemUtils; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
public static byte[] getEthernetIPAddressRaw() throws EthernetUtilsException {
	try {
		byte[] ipv6Address = null;

		final Enumeration<NetworkInterface> networkInterfaceEnumeration = NetworkInterface.getNetworkInterfaces();
		while (networkInterfaceEnumeration.hasMoreElements()) {
			final NetworkInterface networkInterface = networkInterfaceEnumeration.nextElement();
			if (SystemUtils.isAndroidVersionOrLower(Build.VERSION_CODES.FROYO) || !networkInterface.isLoopback()) {
				final Enumeration<InetAddress> inetAddressEnumeration = networkInterface.getInetAddresses();
				while (inetAddressEnumeration.hasMoreElements()) {
					final InetAddress inetAddress = inetAddressEnumeration.nextElement();

					if (!inetAddress.isLoopbackAddress()) {
						final byte[] ipAddress = inetAddress.getAddress();
						if (ipAddress.length == IPUtils.IPV4_LENGTH) {
							return ipAddress;
						} else {
							ipv6Address = ipAddress;
						}
					}
				}
			}
		}

		if (ipv6Address != null) {
			return ipv6Address;
		} else {
			throw new EthernetUtilsException("No ethernet IP found that is not bound to localhost!");
		}
	} catch (final SocketException e) {
		throw new EthernetUtilsException("Unexpected error!", e);
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:35,代码来源:EthernetUtils.java


示例18: isSupported

import org.andengine.util.system.SystemUtils; //导入依赖的package包/类
public static boolean isSupported(final Context pContext) {
	if (MultiTouch.sSupported == null) {
		MultiTouch.sSupported = SystemUtils.hasSystemFeature(pContext, PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH, false);
	}

	return MultiTouch.sSupported;
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:8,代码来源:MultiTouch.java


示例19: isSupportedDistinct

import org.andengine.util.system.SystemUtils; //导入依赖的package包/类
public static boolean isSupportedDistinct(final Context pContext) {
	if (MultiTouch.sSupportedDistinct == null) {
		MultiTouch.sSupportedDistinct = SystemUtils.hasSystemFeature(pContext, PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT, false);
	}

	return MultiTouch.sSupportedDistinct;
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:8,代码来源:MultiTouch.java


示例20: checkCodePathSupport

import org.andengine.util.system.SystemUtils; //导入依赖的package包/类
private static void checkCodePathSupport() throws DeviceNotSupportedException {
	if (SystemUtils.isAndroidVersionOrLower(Build.VERSION_CODES.FROYO)) {
		try {
			System.loadLibrary("andengine");
		} catch (final UnsatisfiedLinkError e) {
			throw new DeviceNotSupportedException(DeviceNotSupportedCause.CODEPATH_INCOMPLETE, e);
		}
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:10,代码来源:AndEngine.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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