当前位置: 首页>>代码示例>>Java>>正文


Java ConfigurationInfo类代码示例

本文整理汇总了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);
    }
 
开发者ID:biezhihua,项目名称:Android_OpenGL_Demo,代码行数:26,代码来源:LessonThreeActivity.java

示例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);
    }
 
开发者ID:biezhihua,项目名称:Android_OpenGL_Demo,代码行数:26,代码来源:LessonFiveActivity.java

示例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);
    }
 
开发者ID:biezhihua,项目名称:Android_OpenGL_Demo,代码行数:26,代码来源:LessonTwoActivity.java

示例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);
    }
 
开发者ID:biezhihua,项目名称:Android_OpenGL_Demo,代码行数:27,代码来源:LessonOneActivity.java

示例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);
    }
 
开发者ID:biezhihua,项目名称:Android_OpenGL_Demo,代码行数:26,代码来源:LessonFourActivity.java

示例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;
	}
}
 
开发者ID:biezhihua,项目名称:Android_OpenGL_Demo,代码行数:20,代码来源:OpenGLES2WallpaperService.java

示例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;
	}			
}
 
开发者ID:biezhihua,项目名称:Android_OpenGL_Demo,代码行数:25,代码来源:OpenGLES2WallpaperService.java

示例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);
}
 
开发者ID:victordiaz,项目名称:phonk,代码行数:26,代码来源:OpenGLActivity.java

示例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);
}
 
开发者ID:Smart-Studio,项目名称:device-info,代码行数:22,代码来源:SystemInfoProviderImplTest.java

示例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;
	}
}
 
开发者ID:iQuick,项目名称:NewsMe,代码行数:21,代码来源:GLSurfaceView.java

示例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();
    }
}
 
开发者ID:rohanoid5,项目名称:Muzesto,代码行数:26,代码来源:Horizon.java

示例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;
}
 
开发者ID:patrickfav,项目名称:under-the-hood,代码行数:30,代码来源:DefaultProperties.java

示例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;
}
 
开发者ID:tzxl10000,项目名称:BLE_Fun,代码行数:20,代码来源:GlFragment.java

示例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();
    }
}
 
开发者ID:Yalantis,项目名称:StarWars.Android,代码行数:24,代码来源:TilesFrameLayout.java

示例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);
}
 
开发者ID:xu6148152,项目名称:binea_project_for_android,代码行数:24,代码来源:BaseOpenglActivity.java


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