本文整理匯總了Java中android.content.pm.ConfigurationInfo類的典型用法代碼示例。如果您正苦於以下問題:Java ConfigurationInfo類的具體用法?Java ConfigurationInfo怎麽用?Java ConfigurationInfo使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ConfigurationInfo類屬於android.content.pm包,在下文中一共展示了ConfigurationInfo類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCreate
import android.content.pm.ConfigurationInfo; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mGLSurfaceView = new GLSurfaceView(this);
// Check if the system support OpenGL ES 2.0
final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;
if (supportsEs2) {
// Request an OpenGL ES 2.0 compatible context.
mGLSurfaceView.setEGLContextClientVersion(2);
// Set the renderer to out demo renderer, define below
// mGLSurfaceView.setRenderer(new LessonThreeRenderer());
mGLSurfaceView.setRenderer(new NativeThreeRenderer());
} else {
// This is where you could create an OpenGL ES 1.x compatible
// renderer if you wanted to support both ES 1 and ES 2
return;
}
setContentView(mGLSurfaceView);
}
示例2: onCreate
import android.content.pm.ConfigurationInfo; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mGLSurfaceView = new LessonFiveGLSurfaceView(this);
// Check if the system support OpenGL ES 2.0
final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;
if (supportsEs2) {
// Request an OpenGL ES 2.0 compatible context.
mGLSurfaceView.setEGLContextClientVersion(2);
// Set the renderer to out demo renderer, define below
// mGLSurfaceView.setRenderer(new LessonFiveRenderer(this));
mGLSurfaceView.setRenderer(new NativeFiveRenderer(this));
} else {
// This is where you could create an OpenGL ES 1.x compatible
// renderer if you wanted to support both ES 1 and ES 2
return;
}
setContentView(mGLSurfaceView);
}
示例3: onCreate
import android.content.pm.ConfigurationInfo; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mGLSurfaceView = new GLSurfaceView(this);
// Check if the system support OpenGL ES 2.0
final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;
if (supportsEs2) {
// Request an OpenGL ES 2.0 compatible context.
mGLSurfaceView.setEGLContextClientVersion(2);
// Set the renderer to out demo renderer, define below
// mGLSurfaceView.setRenderer(new LessonTwoRenderer());
mGLSurfaceView.setRenderer(new NativeTwoRenderer());
} else {
// This is where you could create an OpenGL ES 1.x compatible
// renderer if you wanted to support both ES 1 and ES 2
return;
}
setContentView(mGLSurfaceView);
}
示例4: onCreate
import android.content.pm.ConfigurationInfo; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mGLSurfaceView = new GLSurfaceView(this);
// Check if the system support OpenGL ES 2.0
final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;
if (supportsEs2) {
// Request an OpenGL ES 2.0 compatible context.
mGLSurfaceView.setEGLContextClientVersion(2);
// Set the renderer to out demo renderer, define below
// mGLSurfaceView.setRenderer(new LessonOneRenderer());
// or set a native implementation
mGLSurfaceView.setRenderer(new NativeOneRenderer());
} else {
// This is where you could create an OpenGL ES 1.x compatible
// renderer if you wanted to support both ES 1 and ES 2
return;
}
setContentView(mGLSurfaceView);
}
示例5: onCreate
import android.content.pm.ConfigurationInfo; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mGLSurfaceView = new GLSurfaceView(this);
// Check if the system support OpenGL ES 2.0
final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;
if (supportsEs2) {
// Request an OpenGL ES 2.0 compatible context.
mGLSurfaceView.setEGLContextClientVersion(2);
// Set the renderer to out demo renderer, define below
// mGLSurfaceView.setRenderer(new LessonFourRenderer(this));
mGLSurfaceView.setRenderer(new NativeFourRenderer(this));
} else {
// This is where you could create an OpenGL ES 1.x compatible
// renderer if you wanted to support both ES 1 and ES 2
return;
}
setContentView(mGLSurfaceView);
}
示例6: init
import android.content.pm.ConfigurationInfo; //導入依賴的package包/類
void init(OpenGLEngine engine) {
// Check if the system supports OpenGL ES 2.0.
final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
final ConfigurationInfo configurationInfo = activityManager
.getDeviceConfigurationInfo();
final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;
if (supportsEs2) {
// Request an OpenGL ES 2.0 compatible context.
engine.setEGLContextClientVersion(2);
// Set the renderer to our user-defined renderer.
engine.setRenderer(getNewRenderer());
} else {
// This is where you could create an OpenGL ES 1.x compatible
// renderer if you wanted to support both ES 1 and ES 2.
return;
}
}
示例7: onCreate
import android.content.pm.ConfigurationInfo; //導入依賴的package包/類
@Override
public void onCreate(SurfaceHolder surfaceHolder) {
super.onCreate(surfaceHolder);
// Check if the system supports OpenGL ES 2.0.
final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;
if (supportsEs2)
{
// Request an OpenGL ES 2.0 compatible context.
setEGLContextClientVersion(2);
// Set the renderer to our user-defined renderer.
setRenderer(getNewRenderer());
}
else
{
// This is where you could create an OpenGL ES 1.x compatible
// renderer if you wanted to support both ES 1 and ES 2.
return;
}
}
示例8: onCreate
import android.content.pm.ConfigurationInfo; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mGLSurfaceView = new GLSurfaceView(this);
// Check if the system supports OpenGL ES 2.0.
final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;
if (supportsEs2) {
// Request an OpenGL ES 2.0 compatible context.
mGLSurfaceView.setEGLContextClientVersion(2);
// Set the renderer to our demo renderer, defined below.
mGLSurfaceView.setRenderer(new LessonOneRenderer());
} else {
// This is where you could create an OpenGL ES 1.x compatible
// renderer if you wanted to support both ES 1 and ES 2.
return;
}
setContentView(mGLSurfaceView);
}
示例9: setUp
import android.content.pm.ConfigurationInfo; //導入依賴的package包/類
@Before
public void setUp() throws Exception {
mockStatic(Build.class, System.class);
mockStaticField(Build.VERSION.class, "RELEASE", ANDROID_VERSION);
mockStaticField(Build.VERSION.class, "SDK_INT", ANDROID_API);
mockStaticField(Build.class, "ID", BUILD_ID);
mockStaticField(Build.class, "CPU_ABI", ABI);
mockStaticField(Build.class, "BOOTLOADER", BOOTLOADER);
when(System.getProperty(SystemInfoProviderImpl.OS_NAME)).thenReturn(OS_NAME);
when(System.getProperty(SystemInfoProviderImpl.OS_VERSION)).thenReturn(OS_VERSION);
ActivityManager mockActivityManager = mock(ActivityManager.class);
ConfigurationInfo mockConfigInfo = mock(ConfigurationInfo.class);
when(mMockContext.getSystemService(Application.ACTIVITY_SERVICE)).thenReturn(mockActivityManager);
when(mockActivityManager.getDeviceConfigurationInfo()).thenReturn(mockConfigInfo);
when(mockConfigInfo.getGlEsVersion()).thenReturn(OPEN_GL_VERSION);
mProvider = new SystemInfoProviderImpl(mMockContext);
}
示例10: checkGLESVersion
import android.content.pm.ConfigurationInfo; //導入依賴的package包/類
private void checkGLESVersion() {
if (!mGLESVersionCheckComplete) {
// mGLESVersion = SystemProperties.getInt(
// "ro.opengles.version",
// ConfigurationInfo.GL_ES_VERSION_UNDEFINED);
ActivityManager am = (ActivityManager) context
.getSystemService(Context.ACTIVITY_SERVICE);
ConfigurationInfo info = am.getDeviceConfigurationInfo();
mGLESVersion = info.reqGlEsVersion;
if (mGLESVersion >= kGLES_20) {
mMultipleGLESContextsAllowed = true;
}
if (LOG_SURFACE) {
Log.w(TAG, "checkGLESVersion mGLESVersion =" + " "
+ mGLESVersion + " mMultipleGLESContextsAllowed = "
+ mMultipleGLESContextsAllowed);
}
mGLESVersionCheckComplete = true;
}
}
示例11: initView
import android.content.pm.ConfigurationInfo; //導入依賴的package包/類
/**
* Basic settings for component
*
* @param glSurfaceView - view that will contain the component
* @param backgroundColor - preferable background color for correct colors blending
*/
private void initView(GLSurfaceView glSurfaceView, @ColorInt int backgroundColor) {
// check if the system supports opengl es 2.0.
Context context = glSurfaceView.getContext();
final ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;
if (supportsEs2) {
// Request an OpenGL ES 2.0 compatible context.
glSurfaceView.setEGLContextClientVersion(2);
// Set the renderer to our demo renderer, defined below.
mRenderer = new BezierRenderer(glSurfaceView, backgroundColor);
glSurfaceView.setRenderer(mRenderer);
glSurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);
} else {
throw new UnsupportedOperationException();
}
}
示例12: createSystemFeatureInfo
import android.content.pm.ConfigurationInfo; //導入依賴的package包/類
/**
* Convince feature to add state of multiple system features.
* Uses {@link PackageManager#hasSystemFeature(String)} call.
* <p>
* See https://developer.android.com/guide/topics/manifest/uses-feature-element.html#features-reference for
* available system features.
*
* @param context can be null, but will just return an empty list
* @param labelSystemFeatureMap a map which has ui labels as key and android system feature string
* (as returned as name by {@link PackageManager#getSystemAvailableFeatures()}) as value
* @return list of page-entries (one for each map entry)
*/
public static List<PageEntry<?>> createSystemFeatureInfo(@Nullable Context context, Map<CharSequence, String> labelSystemFeatureMap) {
List<PageEntry<?>> entries = new ArrayList<>();
if (context != null) {
for (Map.Entry<CharSequence, String> entry : labelSystemFeatureMap.entrySet()) {
boolean supported;
if (entry.getValue().matches("^-?\\d+$")) {
final ConfigurationInfo configurationInfo = ((ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE)).getDeviceConfigurationInfo();
supported = configurationInfo.reqGlEsVersion >= Integer.valueOf(entry.getValue());
} else {
supported = context.getPackageManager().hasSystemFeature(entry.getValue());
}
entries.add(Hood.get().createPropertyEntry(entry.getKey(), String.valueOf(supported)));
}
}
return entries;
}
示例13: onCreateView
import android.content.pm.ConfigurationInfo; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final Context context = getActivity();
final View v = inflater.inflate(getContentViewId(), container, false);
ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
ConfigurationInfo info = am.getDeviceConfigurationInfo();
if (info.reqGlEsVersion < 0x20000)
throw new Error("OpenGL ES 2.0 is not supported by this device");
loading = v.findViewById(R.id.loading);
gLView = (GLSurfaceView) v.findViewById(R.id.gl);
renderer = new ModelRenderer(context);
renderer.setSurfaceView(gLView);
gLView.setRenderer(renderer);
loader.loadModel(getActivity(), this);
return v;
}
示例14: initGlSurfaceView
import android.content.pm.ConfigurationInfo; //導入依賴的package包/類
private void initGlSurfaceView() {
mGLSurfaceView = new StarWarsTilesGLSurfaceView(getContext());
mGLSurfaceView.setBackgroundColor(Color.TRANSPARENT);
// Check if the system supports OpenGL ES 2.0.
final ActivityManager activityManager = (ActivityManager) getContext().getSystemService(Context.ACTIVITY_SERVICE);
final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;
if (supportsEs2) {
// Request an OpenGL ES 2.0 compatible context.
mGLSurfaceView.setEGLContextClientVersion(2);
mRenderer = new StarWarsRenderer(mGLSurfaceView, this, mAnimationDuration, mNumberOfTilesX);
mGLSurfaceView.setEGLConfigChooser(8, 8, 8, 8, 16, 0);
mGLSurfaceView.getHolder().setFormat(PixelFormat.TRANSPARENT);
mGLSurfaceView.setRenderer(mRenderer);
mGLSurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
mGLSurfaceView.setZOrderOnTop(true);
} else {
throw new UnsupportedOperationException();
}
}
示例15: onCreate
import android.content.pm.ConfigurationInfo; //導入依賴的package包/類
@Override protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mGlSurfaceView = new GLSurfaceView(this);
final ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
final ConfigurationInfo deviceConfigurationInfo = am.getDeviceConfigurationInfo();
mIsSupportedEs2 =
deviceConfigurationInfo.reqGlEsVersion >= 0x20000 || (Build.VERSION.SDK_INT
>= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1
&& (Build.FINGERPRINT.startsWith("generic") || Build.FINGERPRINT.startsWith(
"unknow") || Build.MODEL.contains("google_sdk") || Build.MODEL.contains(
"Emulator") || Build.MODEL.contains("Android SDK built for x86")));
mGlSurfaceView.setEGLContextClientVersion(2);
if (mIsSupportedEs2) {
setGlSurfaceViewRenderer();
mRenderSet = true;
} else {
Toast.makeText(this, "This device does not support OpenGl ES 2.0", Toast.LENGTH_SHORT)
.show();
return;
}
setContentView(mGlSurfaceView);
}