Java Code Examples for android.util.Range#getLower()
The following examples show how to use
android.util.Range#getLower() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OneCameraCharacteristicsImpl.java From Camera2 with Apache License 2.0 | 5 votes |
@Override public boolean isExposureCompensationSupported() { // Turn off exposure compensation for Nexus 6 on L (API level 21) // because the bug in framework b/19219128. if (ApiHelper.IS_NEXUS_6 && ApiHelper.isLollipop()) { return false; } Range<Integer> compensationRange = mCameraCharacteristics.get(CameraCharacteristics.CONTROL_AE_COMPENSATION_RANGE); return compensationRange.getLower() != 0 || compensationRange.getUpper() != 0; }
Example 2
Source File: OneCameraCharacteristicsImpl.java From Camera2 with Apache License 2.0 | 5 votes |
@Override public int getMinExposureCompensation() { if (!isExposureCompensationSupported()) { return -1; } Range<Integer> compensationRange = mCameraCharacteristics.get(CameraCharacteristics.CONTROL_AE_COMPENSATION_RANGE); return compensationRange.getLower(); }
Example 3
Source File: LegacyMetadataMapper.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
private static int[] convertAeFpsRangeToLegacy(Range<Integer> fpsRange) { int[] legacyFps = new int[2]; legacyFps[Camera.Parameters.PREVIEW_FPS_MIN_INDEX] = fpsRange.getLower(); legacyFps[Camera.Parameters.PREVIEW_FPS_MAX_INDEX] = fpsRange.getUpper(); return legacyFps; }
Example 4
Source File: LegacyRequestMapper.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
private static int[] convertAeFpsRangeToLegacy(Range<Integer> fpsRange) { int[] legacyFps = new int[2]; legacyFps[Parameters.PREVIEW_FPS_MIN_INDEX] = fpsRange.getLower() * 1000; legacyFps[Parameters.PREVIEW_FPS_MAX_INDEX] = fpsRange.getUpper() * 1000; return legacyFps; }
Example 5
Source File: AndroidCamera2Settings.java From Camera2 with Apache License 2.0 | 4 votes |
private boolean matchesTemplateDefault(Key<?> setting) { if (setting == CONTROL_AE_REGIONS) { return mMeteringAreas.size() == 0; } else if (setting == CONTROL_AF_REGIONS) { return mFocusAreas.size() == 0; } else if (setting == CONTROL_AE_TARGET_FPS_RANGE) { Range<Integer> defaultFpsRange = mTemplateSettings.get(CONTROL_AE_TARGET_FPS_RANGE); return (mPreviewFpsRangeMin == 0 && mPreviewFpsRangeMax == 0) || (defaultFpsRange != null && mPreviewFpsRangeMin == defaultFpsRange.getLower() && mPreviewFpsRangeMax == defaultFpsRange.getUpper()); } else if (setting == JPEG_QUALITY) { return Objects.equals(mJpegCompressQuality, mTemplateSettings.get(JPEG_QUALITY)); } else if (setting == CONTROL_AE_EXPOSURE_COMPENSATION) { return Objects.equals(mExposureCompensationIndex, mTemplateSettings.get(CONTROL_AE_EXPOSURE_COMPENSATION)); } else if (setting == CONTROL_VIDEO_STABILIZATION_MODE) { Integer videoStabilization = mTemplateSettings.get(CONTROL_VIDEO_STABILIZATION_MODE); return (videoStabilization != null && (mVideoStabilizationEnabled && videoStabilization == CONTROL_VIDEO_STABILIZATION_MODE_ON) || (!mVideoStabilizationEnabled && videoStabilization == CONTROL_VIDEO_STABILIZATION_MODE_OFF)); } else if (setting == CONTROL_AE_LOCK) { return Objects.equals(mAutoExposureLocked, mTemplateSettings.get(CONTROL_AE_LOCK)); } else if (setting == CONTROL_AWB_LOCK) { return Objects.equals(mAutoWhiteBalanceLocked, mTemplateSettings.get(CONTROL_AWB_LOCK)); } else if (setting == JPEG_THUMBNAIL_SIZE) { if (mExifThumbnailSize == null) { // It doesn't matter if this is true or false since setting this // to null in the request settings will use the default anyway. return false; } android.util.Size defaultThumbnailSize = mTemplateSettings.get(JPEG_THUMBNAIL_SIZE); return (mExifThumbnailSize.width() == 0 && mExifThumbnailSize.height() == 0) || (defaultThumbnailSize != null && mExifThumbnailSize.width() == defaultThumbnailSize.getWidth() && mExifThumbnailSize.height() == defaultThumbnailSize.getHeight()); } Log.w(TAG, "Settings implementation checked default of unhandled option key"); // Since this class isn't equipped to handle it, claim it matches the default to prevent // updateRequestSettingOrForceToDefault from going with the user-provided preference return true; }
Example 6
Source File: AndroidCamera2Capabilities.java From Camera2 with Apache License 2.0 | 4 votes |
AndroidCamera2Capabilities(CameraCharacteristics p) { super(new Stringifier()); StreamConfigurationMap s = p.get(SCALER_STREAM_CONFIGURATION_MAP); for (Range<Integer> fpsRange : p.get(CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES)) { mSupportedPreviewFpsRange.add(new int[] { fpsRange.getLower(), fpsRange.getUpper() }); } // TODO: We only support TextureView preview rendering mSupportedPreviewSizes.addAll(Size.buildListFromAndroidSizes(Arrays.asList( s.getOutputSizes(SurfaceTexture.class)))); for (int format : s.getOutputFormats()) { mSupportedPreviewFormats.add(format); } // TODO: We only support MediaRecorder video capture mSupportedVideoSizes.addAll(Size.buildListFromAndroidSizes(Arrays.asList( s.getOutputSizes(MediaRecorder.class)))); // TODO: We only support JPEG image capture mSupportedPhotoSizes.addAll(Size.buildListFromAndroidSizes(Arrays.asList( s.getOutputSizes(ImageFormat.JPEG)))); mSupportedPhotoFormats.addAll(mSupportedPreviewFormats); buildSceneModes(p); buildFlashModes(p); buildFocusModes(p); buildWhiteBalances(p); // TODO: Populate mSupportedFeatures // TODO: Populate mPreferredPreviewSizeForVideo Range<Integer> ecRange = p.get(CONTROL_AE_COMPENSATION_RANGE); mMinExposureCompensation = ecRange.getLower(); mMaxExposureCompensation = ecRange.getUpper(); Rational ecStep = p.get(CONTROL_AE_COMPENSATION_STEP); mExposureCompensationStep = (float) ecStep.getNumerator() / ecStep.getDenominator(); mMaxNumOfFacesSupported = p.get(STATISTICS_INFO_MAX_FACE_COUNT); mMaxNumOfMeteringArea = p.get(CONTROL_MAX_REGIONS_AE); mMaxZoomRatio = p.get(SCALER_AVAILABLE_MAX_DIGITAL_ZOOM); // TODO: Populate mHorizontalViewAngle // TODO: Populate mVerticalViewAngle // TODO: Populate mZoomRatioList // TODO: Populate mMaxZoomIndex if (supports(FocusMode.AUTO)) { mMaxNumOfFocusAreas = p.get(CONTROL_MAX_REGIONS_AF); if (mMaxNumOfFocusAreas > 0) { mSupportedFeatures.add(Feature.FOCUS_AREA); } } if (mMaxNumOfMeteringArea > 0) { mSupportedFeatures.add(Feature.METERING_AREA); } if (mMaxZoomRatio > CameraCapabilities.ZOOM_RATIO_UNZOOMED) { mSupportedFeatures.add(Feature.ZOOM); } // TODO: Detect other features }
Example 7
Source File: UiObject2Element.java From appium-uiautomator2-server with Apache License 2.0 | 4 votes |
@Nullable @Override public String getAttribute(String attr) throws UiObjectNotFoundException { final Attribute dstAttribute = Attribute.fromString(attr); if (dstAttribute == null) { throw generateNoAttributeException(attr); } final Object result; switch (dstAttribute) { case TEXT: result = getText(); break; case CONTENT_DESC: result = element.getContentDescription(); break; case CLASS: result = element.getClassName(); break; case RESOURCE_ID: result = element.getResourceName(); break; case CONTENT_SIZE: result = ElementHelpers.getContentSize(this); break; case ENABLED: result = element.isEnabled(); break; case CHECKABLE: result = element.isCheckable(); break; case CHECKED: result = element.isChecked(); break; case CLICKABLE: result = element.isClickable(); break; case FOCUSABLE: result = element.isFocusable(); break; case FOCUSED: result = element.isFocused(); break; case LONG_CLICKABLE: result = element.isLongClickable(); break; case SCROLLABLE: result = element.isScrollable(); break; case SELECTED: result = element.isSelected(); break; case DISPLAYED: result = AccessibilityNodeInfoHelpers.isVisible(AccessibilityNodeInfoGetter.fromUiObject(element)); break; case PASSWORD: result = AccessibilityNodeInfoHelpers.isPassword(AccessibilityNodeInfoGetter.fromUiObject(element)); break; case BOUNDS: result = element.getVisibleBounds().toShortString(); break; case PACKAGE: result = AccessibilityNodeInfoHelpers.getPackageName(AccessibilityNodeInfoGetter.fromUiObject(element)); break; case SELECTION_END: case SELECTION_START: Range<Integer> selectionRange = AccessibilityNodeInfoHelpers.getSelectionRange(AccessibilityNodeInfoGetter.fromUiObject(element)); result = selectionRange == null ? null : (dstAttribute == Attribute.SELECTION_END ? selectionRange.getUpper() : selectionRange.getLower()); break; default: throw generateNoAttributeException(attr); } if (result == null) { return null; } return (result instanceof String) ? (String) result : String.valueOf(result); }
Example 8
Source File: UiObjectElement.java From appium-uiautomator2-server with Apache License 2.0 | 4 votes |
@Nullable @Override public String getAttribute(String attr) throws UiObjectNotFoundException { final Attribute dstAttribute = Attribute.fromString(attr); if (dstAttribute == null) { throw generateNoAttributeException(attr); } final Object result; switch (dstAttribute) { case TEXT: result = getText(); break; case CONTENT_DESC: result = element.getContentDescription(); break; case CLASS: result = element.getClassName(); break; case RESOURCE_ID: result = getResourceId(); break; case CONTENT_SIZE: result = ElementHelpers.getContentSize(this); break; case ENABLED: result = element.isEnabled(); break; case CHECKABLE: result = element.isCheckable(); break; case CHECKED: result = element.isChecked(); break; case CLICKABLE: result = element.isClickable(); break; case FOCUSABLE: result = element.isFocusable(); break; case FOCUSED: result = element.isFocused(); break; case LONG_CLICKABLE: result = element.isLongClickable(); break; case SCROLLABLE: result = element.isScrollable(); break; case SELECTED: result = element.isSelected(); break; case DISPLAYED: result = element.exists() && AccessibilityNodeInfoHelpers.isVisible(AccessibilityNodeInfoGetter.fromUiObject(element)); break; case PASSWORD: result = AccessibilityNodeInfoHelpers.isPassword(AccessibilityNodeInfoGetter.fromUiObject(element)); break; case BOUNDS: result = element.getVisibleBounds().toShortString(); break; case PACKAGE: { result = AccessibilityNodeInfoHelpers.getPackageName(AccessibilityNodeInfoGetter.fromUiObject(element)); break; } case SELECTION_END: case SELECTION_START: Range<Integer> selectionRange = AccessibilityNodeInfoHelpers.getSelectionRange(AccessibilityNodeInfoGetter.fromUiObject(element)); result = selectionRange == null ? null : (dstAttribute == Attribute.SELECTION_END ? selectionRange.getUpper() : selectionRange.getLower()); break; default: throw generateNoAttributeException(attr); } if (result == null) { return null; } return (result instanceof String) ? (String) result : String.valueOf(result); }