本文整理匯總了Java中android.hardware.Camera.Parameters.FOCUS_MODE_AUTO屬性的典型用法代碼示例。如果您正苦於以下問題:Java Parameters.FOCUS_MODE_AUTO屬性的具體用法?Java Parameters.FOCUS_MODE_AUTO怎麽用?Java Parameters.FOCUS_MODE_AUTO使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類android.hardware.Camera.Parameters
的用法示例。
在下文中一共展示了Parameters.FOCUS_MODE_AUTO屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getFocusMode
public String getFocusMode() {
if (mOverrideFocusMode != null) return mOverrideFocusMode;
if (mParameters == null) return Parameters.FOCUS_MODE_AUTO;
List<String> supportedFocusModes = mParameters.getSupportedFocusModes();
if (mFocusAreaSupported && !mFocusDefault) {
// Always use autofocus in tap-to-focus.
mFocusMode = Parameters.FOCUS_MODE_AUTO;
} else {
// The default is continuous autofocus.
mFocusMode = mPreferences.getString(
CameraSettings.KEY_FOCUS_MODE, null);
// Try to find a supported focus mode from the default list.
if (mFocusMode == null) {
for (int i = 0; i < mDefaultFocusModes.length; i++) {
String mode = mDefaultFocusModes[i];
if (CameraUtil.isSupported(mode, supportedFocusModes)) {
mFocusMode = mode;
break;
}
}
}
}
if (!CameraUtil.isSupported(mFocusMode, supportedFocusModes)) {
// For some reasons, the driver does not support the current
// focus mode. Fall back to auto.
if (CameraUtil.isSupported(Parameters.FOCUS_MODE_AUTO,
mParameters.getSupportedFocusModes())) {
mFocusMode = Parameters.FOCUS_MODE_AUTO;
} else {
mFocusMode = mParameters.getFocusMode();
}
}
return mFocusMode;
}