當前位置: 首頁>>代碼示例>>Java>>正文


Java FeatureInfo類代碼示例

本文整理匯總了Java中android.content.pm.FeatureInfo的典型用法代碼示例。如果您正苦於以下問題:Java FeatureInfo類的具體用法?Java FeatureInfo怎麽用?Java FeatureInfo使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


FeatureInfo類屬於android.content.pm包,在下文中一共展示了FeatureInfo類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getOpenGL

import android.content.pm.FeatureInfo; //導入依賴的package包/類
/**
 * Returns the current device openGL version.
 */
static String getOpenGL(Context context) {
    PackageManager packageManager = context.getPackageManager();
    FeatureInfo[] featureInfos = packageManager.getSystemAvailableFeatures();
    if (featureInfos != null && featureInfos.length > 0) {
        for (FeatureInfo featureInfo : featureInfos) {
            // Null feature name means this feature is the open gl es version feature.
            if (featureInfo.name == null) {
                if (featureInfo.reqGlEsVersion != FeatureInfo.GL_ES_VERSION_UNDEFINED) {
                    return Integer.toString((featureInfo.reqGlEsVersion & 0xffff0000) >> 16);
                } else {
                    return "1"; // Lack of property means OpenGL ES version 1
                }
            }
        }
    }
    return "1";
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:21,代碼來源:CrashDetails.java

示例2: isSupportCameraLedFlash

import android.content.pm.FeatureInfo; //導入依賴的package包/類
/**
 * 判斷是否支持閃光燈
 *
 * @return true 支持,false 不支持
 */
public static boolean isSupportCameraLedFlash() {
    PackageManager pm = UtilManager.getContext().getPackageManager();
    if (pm != null) {
        FeatureInfo[] features = pm.getSystemAvailableFeatures();
        if (features != null) {
            for (FeatureInfo f : features) {
                //判斷設備是否支持閃光燈
                if (f != null && PackageManager.FEATURE_CAMERA_FLASH.equals(f.name)) {
                    return true;
                }
            }
        }
    }
    return false;
}
 
開發者ID:sundevin,項目名稱:utilsLibrary,代碼行數:21,代碼來源:DeviceInfo.java

示例3: isHTCSenseDevice

import android.content.pm.FeatureInfo; //導入依賴的package包/類
private boolean isHTCSenseDevice()
{
	boolean isHTC = false;
	
	FeatureInfo[] features = TiApplication.getInstance().getApplicationContext().getPackageManager().getSystemAvailableFeatures();
	if(features == null) { 
		return isHTC;
	}
	for (FeatureInfo f : features) {
		String fName = f.name;
		if (fName != null) {
			isHTC = fName.contains("com.htc.software.Sense");
			if (isHTC) {
				Log.i(TAG, "Detected com.htc.software.Sense feature "+fName);
				break;
			}
		}
	}
	
	return isHTC;
}
 
開發者ID:chreck,項目名稱:movento-webview,代碼行數:22,代碼來源:TiUIWebView.java

示例4: parseUsesFeature

import android.content.pm.FeatureInfo; //導入依賴的package包/類
private FeatureInfo parseUsesFeature(Resources res, AttributeSet attrs)
        throws XmlPullParserException, IOException {
    FeatureInfo fi = new FeatureInfo();
    TypedArray sa = res.obtainAttributes(attrs,
            Hooks.getStyleableArray("AndroidManifestUsesFeature"));
    // Note: don't allow this value to be a reference to a resource
    // that may change.
    fi.name = sa.getNonResourceString(
            Hooks.getStyleable("AndroidManifestUsesFeature_name"));
    if (fi.name == null) {
        fi.reqGlEsVersion = sa.getInt(
                Hooks.getStyleable("AndroidManifestUsesFeature_glEsVersion"),
                FeatureInfo.GL_ES_VERSION_UNDEFINED);
    }
    if (sa.getBoolean(
            Hooks.getStyleable("AndroidManifestUsesFeature_required"), true)) {
        fi.flags |= FeatureInfo.FLAG_REQUIRED;
    }
    sa.recycle();
    return fi;
}
 
開發者ID:ximsfei,項目名稱:Android-plugin-support,代碼行數:22,代碼來源:DynamicApkParser.java

示例5: getVersionFromPackageManager

import android.content.pm.FeatureInfo; //導入依賴的package包/類
private static int getVersionFromPackageManager(Context context) {
    PackageManager packageManager=context.getPackageManager();
    FeatureInfo[] featureInfos=
            packageManager.getSystemAvailableFeatures();
    if (featureInfos != null && featureInfos.length > 0) {
        for (FeatureInfo featureInfo : featureInfos) {
            // Null feature name means this feature is the open
            // gl es version feature.
            if (featureInfo.name == null) {
                if (featureInfo.reqGlEsVersion != FeatureInfo.GL_ES_VERSION_UNDEFINED) {
                    return getMajorVersion(featureInfo.reqGlEsVersion);
                }
                else {
                    return 1; // Lack of property means OpenGL ES
                    // version 1
                }
            }
        }
    }
    return 1;
}
 
開發者ID:dklisiaris,項目名稱:geopin,代碼行數:22,代碼來源:AbstractMapActivity.java

示例6: _isHTC

import android.content.pm.FeatureInfo; //導入依賴的package包/類
private static boolean _isHTC(Context context) {
    // CHECK: Build prop to see if HTC is there.
    if (Build.MANUFACTURER.contains("HTC")) return true;
    // CHECK: available features, like HTC sense.
    FeatureInfo[] features = context.getPackageManager().getSystemAvailableFeatures();
    for (FeatureInfo feature : features) {
        if (!TextUtils.isEmpty(feature.name) &&
            feature.name.startsWith("com.htc")) {
            return true;
        }
    }
    // CHECK: the HTC Sense launcher package.
    PackageManager pm = context.getPackageManager();
    Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.addCategory(Intent.CATEGORY_HOME);
    List<ResolveInfo> list = pm.queryIntentActivities(
            intent, PackageManager.MATCH_DEFAULT_ONLY);
    for (ResolveInfo info : list) {
        if (info.activityInfo != null) {
            if ("com.htc.launcher.Launcher".equals(info.activityInfo.name)) {
                return true;
            }
        }
    }
    return false;
}
 
開發者ID:Tombarr,項目名稱:Noyze,代碼行數:27,代碼來源:AudioHelper.java

示例7: initialize

import android.content.pm.FeatureInfo; //導入依賴的package包/類
/**
 * Initialize SPen support. This is done lazily at the first invocation of
 * {@link #convertSPenEventAction(int)}.
 */
private static void initialize() {
    if (sIsSPenSupported != null) return;

    if (!"SAMSUNG".equalsIgnoreCase(Build.MANUFACTURER)) {
        sIsSPenSupported = false;
        return;
    }

    Context context = ContextUtils.getApplicationContext();
    final FeatureInfo[] infos = context.getPackageManager().getSystemAvailableFeatures();
    for (FeatureInfo info : infos) {
        if ("com.sec.feature.spen_usp".equalsIgnoreCase(info.name)) {
            sIsSPenSupported = true;
            return;
        }
    }
    sIsSPenSupported = false;
}
 
開發者ID:mogoweb,項目名稱:365browser,代碼行數:23,代碼來源:SPenSupport.java

示例8: getVersionFromPackageManager

import android.content.pm.FeatureInfo; //導入依賴的package包/類
private static int getVersionFromPackageManager(Context context) {
  PackageManager packageManager=context.getPackageManager();
  FeatureInfo[] featureInfos=
      packageManager.getSystemAvailableFeatures();
  if (featureInfos != null && featureInfos.length > 0) {
    for (FeatureInfo featureInfo : featureInfos) {
      // Null feature name means this feature is the open
      // gl es version feature.
      if (featureInfo.name == null) {
        if (featureInfo.reqGlEsVersion != FeatureInfo.GL_ES_VERSION_UNDEFINED) {
          return getMajorVersion(featureInfo.reqGlEsVersion);
        }
        else {
          return 1; // Lack of property means OpenGL ES
                    // version 1
        }
      }
    }
  }
  return 1;
}
 
開發者ID:dklisiaris,項目名稱:downtown,代碼行數:22,代碼來源:AbstractMapActivity.java

示例9: setUpSystemFeatures

import android.content.pm.FeatureInfo; //導入依賴的package包/類
private void setUpSystemFeatures(TextView systemFeaturesTextView) {
    FeatureInfo[] featureInfoArray = getActivity().getPackageManager().getSystemAvailableFeatures();
    List<String> features = new ArrayList<>();
    for (FeatureInfo featureInfo : featureInfoArray) {
        final String name = featureInfo.name;
        if (name != null) {
            features.add(name);
        }
    }
    Collections.sort(features, new Comparator<String>() {
        @Override
        public int compare(String lhs, String rhs) {
            return lhs.compareTo(rhs);
        }
    });
    StringBuilder systemFeatures = new StringBuilder();
    for (String feature : features) {
        systemFeatures.append(feature);
        systemFeatures.append("\n");
    }
    this.systemFeatures = systemFeatures.toString();
    systemFeaturesTextView.setText(this.systemFeatures);
    this.systemFeatures = "Device: " + Utils.getDeviceSummary() + "\n" + this.systemFeatures;
}
 
開發者ID:roys,項目名稱:java-android-developertools,代碼行數:25,代碼來源:SystemFeaturesFragment.java

示例10: isSPenSupported

import android.content.pm.FeatureInfo; //導入依賴的package包/類
private boolean isSPenSupported()
{
    final FeatureInfo[] featureInfo = getPackageManager().getSystemAvailableFeatures();
    for (FeatureInfo info : featureInfo)
    {
        if (SPEN_FEATURE.equalsIgnoreCase(info.name))
        {
            return true;
        }
    }
    if (SAMSUNG.equalsIgnoreCase(Build.MANUFACTURER))
    {
        if (Build.MODEL.toUpperCase(Locale.ENGLISH).startsWith(NOTE))
        {
            return true;
        }
    }
    return false;
}
 
開發者ID:LorenK96,項目名稱:slide-android,代碼行數:20,代碼來源:SettingsActivity.java

示例11: getVersionFromPackageManager

import android.content.pm.FeatureInfo; //導入依賴的package包/類
private static int getVersionFromPackageManager(Context context) {
    PackageManager packageManager = context.getPackageManager();
    FeatureInfo[] featureInfos  = packageManager.getSystemAvailableFeatures();
    if (featureInfos != null && featureInfos.length > 0) {
        for (FeatureInfo featureInfo : featureInfos) {
            // Null feature name means this feature is the open
            // gl es version feature.
            if (featureInfo.name == null) {
                if (featureInfo.reqGlEsVersion != FeatureInfo.GL_ES_VERSION_UNDEFINED) {
                    return getMajorVersion(featureInfo.reqGlEsVersion);
                }
                else {
                    return 1; // Lack of property means OpenGL ES
                    // version 1
                }
            }
        }
    }
    return 1;
}
 
開發者ID:kartheininger,項目名稱:ClusteredMarkers,代碼行數:21,代碼來源:AbstractMapActivity.java

示例12: EclairChecker

import android.content.pm.FeatureInfo; //導入依賴的package包/類
public EclairChecker(Context ctx) {

                SharedPreferences prefs = PreferenceManager
                        .getDefaultSharedPreferences(ctx);
                ignoreTouchscreen = prefs
                        .getBoolean("ignoreTouchscreen", false);

                PackageManager pm = ctx.getPackageManager();
                StringBuilder logMsg = new StringBuilder();
                logMsg.append("Available device features:");
                features = new HashSet<String>();
                for (FeatureInfo fi : pm.getSystemAvailableFeatures()) {
                    features.add(fi.name);
                    logMsg.append('\n');
                    logMsg.append(fi.name);
                }
                Log.d("FDroid", logMsg.toString());
            }
 
開發者ID:devscitech1,項目名稱:aakash-fdroid-client,代碼行數:19,代碼來源:DB.java

示例13: getOpenGLVersion

import android.content.pm.FeatureInfo; //導入依賴的package包/類
private String getOpenGLVersion() {
    Context context = getActivity();
    PackageManager packageManager = context.getPackageManager();
    FeatureInfo[] featureInfos = packageManager.getSystemAvailableFeatures();
    if (featureInfos != null && featureInfos.length > 0) {
        for (FeatureInfo featureInfo : featureInfos) {
            // Null feature name means this feature is the open gl es version feature.
            if (featureInfo.name == null) {
                if (featureInfo.reqGlEsVersion != FeatureInfo.GL_ES_VERSION_UNDEFINED) {
                    return String.valueOf((featureInfo.reqGlEsVersion & 0xFFFF0000) >> 16) + "." + String.valueOf((featureInfo.reqGlEsVersion & 0x0000FFFF));
                } else {
                    return "1.0"; // Lack of property means OpenGL ES version 1
                }
            }
        }
    }
    return "1.0";
}
 
開發者ID:soarcn,項目名稱:COCOFramework,代碼行數:19,代碼來源:DeviceInfo.java

示例14: EclairChecker

import android.content.pm.FeatureInfo; //導入依賴的package包/類
public EclairChecker(Context ctx) {

				SharedPreferences prefs = PreferenceManager
						.getDefaultSharedPreferences(ctx);
				ignoreTouchscreen = prefs
						.getBoolean("ignoreTouchscreen", false);

				PackageManager pm = ctx.getPackageManager();
				StringBuilder logMsg = new StringBuilder();
				logMsg.append("Available device features:");
				features = new HashSet<String>();
				for (FeatureInfo fi : pm.getSystemAvailableFeatures()) {
					features.add(fi.name);
					logMsg.append('\n');
					logMsg.append(fi.name);
				}
				Log.d("FDroid", logMsg.toString());
			}
 
開發者ID:keensam04,項目名稱:aakash_bazaar_client,代碼行數:19,代碼來源:DB.java

示例15: isSupportCameraLedFlash

import android.content.pm.FeatureInfo; //導入依賴的package包/類
/** 判斷是否支持閃光燈 */
public static boolean isSupportCameraLedFlash(PackageManager pm) {
    if (pm != null) {
        FeatureInfo[] features = pm.getSystemAvailableFeatures();
        if (features != null) {
            for (FeatureInfo f : features) {
                if (f != null && PackageManager.FEATURE_CAMERA_FLASH.equals(f.name)) //判斷設備是否支持閃光燈
                    return true;
            }
        }
    }
    return false;
}
 
開發者ID:Zhaoss,項目名稱:WeiXinRecordedDemo,代碼行數:14,代碼來源:DeviceUtils.java


注:本文中的android.content.pm.FeatureInfo類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。