Skip to content

Commit

Permalink
[Sample] [Camera2] - Implementation of "UltraHDR Image Capture" (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
madebymozart authored Jul 11, 2023
1 parent f89f4ce commit cd3a84a
Show file tree
Hide file tree
Showing 19 changed files with 841 additions and 390 deletions.
10 changes: 6 additions & 4 deletions samples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ Showcases how to pin widget within the app. Check the launcher widget menu for a
This sample will show you how get all audio sources and set an audio device. Covers Bluetooth, LEA, Wired and internal speakers
- [Call Notification Sample](connectivity/callnotification/src/main/java/com/example/platform/connectivity/callnotification/CallNotificationSample.kt):
Sample demonstrating how to make incoming call notifications and in call notifications
- [Camera2 - Image Capture](camera/camera2/src/main/java/com/example/platform/camera/imagecapture/Camera2ImageCapture.kt):
This sample demonstrates how to capture and image and encode it into a JPEG
- [Camera2 - Preview](camera/camera2/src/main/java/com/example/platform/camera/preview/Camera2Preview.kt):
- [Camera Preview](camera/camera2/src/main/java/com/example/platform/camera/preview/Camera2Preview.kt):
Demonstrates displaying processed pixel data directly from the camera sensor
- [Color Contrast](accessibility/src/main/java/com/example/platform/accessibility/ColorContrast.kt):
This sample demonstrates the importance of proper color contrast and how to
Expand All @@ -23,7 +21,7 @@ Shows how to create a GATT server and communicate with the GATT client
- [Data Access](privacy/transparency/src/main/java/com/example/platform/privacy/transparency/DataAccess.kt):
Demonstrates how to implement data access auditing for your app to identify
- [Displaying UltraHDR](graphics/ultrahdr/src/main/java/com/example/platform/graphics/ultrahdr/display/DisplayingUltraHDR.kt):
This sample demonstrates displaying an UltraHDR image
This sample demonstrates displaying an UltraHDR image.
- [Downloadable Fonts](user-interface/text/src/main/java/com/example/platform/ui/text/DownloadableFonts.kt):
Download fonts instead of bundling them in the app resources.
- [Drag and Drop](user-interface/draganddrop/src/main/java/com/example/platform/ui/draganddrop/DragAndDrop.kt):
Expand All @@ -34,6 +32,8 @@ This example will demonstrate how to scanning for Low Energy Devices
Shows various vibration effects.
- [Hyphenation](user-interface/text/src/main/java/com/example/platform/ui/text/Hyphenation.kt):
Demonstrates different options for the `android:hyphenationFrequency` attribute
- [Image Capture](camera/camera2/src/main/java/com/example/platform/camera/imagecapture/Camera2ImageCapture.kt):
This sample demonstrates how to capture and image using Camera2 and encode it
- [Immersive mode](user-interface/window-insets/src/main/java/com/example/platform/ui/insets/ImmersiveMode.kt):
Immersive mode enables your app to display full-screen by hiding system bars.
- [LineBreak](user-interface/text/src/main/java/com/example/platform/ui/text/LineBreak.kt):
Expand Down Expand Up @@ -80,6 +80,8 @@ Shows the recommended flow to request single runtime permissions
The sample demonstrates the importance of having proper labels for
- [TextSpan](user-interface/text/src/main/java/com/example/platform/ui/text/TextSpan.kt):
buildSpannedString is useful for quickly building a rich text.
- [UltraHDR Image Capture](camera/camera2/src/main/java/com/example/platform/camera/imagecapture/Camera2UltraHDRCapture.kt):
This sample demonstrates how to capture a 10-bit compressed still image and
- [Visualizing an UltraHDR Gainmap](graphics/ultrahdr/src/main/java/com/example/platform/graphics/ultrahdr/display/VisualizingAnUltraHDRGainmap.kt):
This sample demonstrates visualizing the underlying gainmap of an UltraHDR
- [WindowInsetsAnimation](user-interface/window-insets/src/main/java/com/example/platform/ui/insets/WindowInsetsAnimation.kt):
Expand Down
3 changes: 3 additions & 0 deletions samples/camera/camera2/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,8 @@ dependencies {

// ViewPager2
implementation(libs.androidx.viewpager2)

// Link to UltraHDR Graphics Samples
implementation(project(mapOf("path" to ":samples:graphics:ultrahdr")))
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,11 @@ import android.view.*
import androidx.activity.result.contract.ActivityResultContracts
import androidx.core.content.ContextCompat
import androidx.core.graphics.drawable.toDrawable
import androidx.core.os.bundleOf
import androidx.exifinterface.media.ExifInterface
import androidx.fragment.app.Fragment
import androidx.fragment.app.add
import androidx.fragment.app.commit
import androidx.lifecycle.lifecycleScope
import com.example.platform.camera.R
import com.example.platform.camera.common.*
import com.example.platform.camera.databinding.FragmentCamera2ImageCaptureBinding
import com.example.platform.camera.databinding.Camera2ImageCaptureBinding
import com.google.android.catalog.framework.annotations.Sample
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
Expand All @@ -59,16 +55,17 @@ import kotlin.coroutines.resumeWithException
import kotlin.coroutines.suspendCoroutine

@Sample(
name = "Camera2 - Image Capture",
description = "This sample demonstrates how to capture and image and encode it into a JPEG "
+ "container. Includes torch (flash) support is available.",
name = "Image Capture",
description = "This sample demonstrates how to capture and image using Camera2 and encode it " +
"into a JPEG container.",
documentation = "https://developer.android.com/training/camera2/capture-sessions-requests",
tags = ["Camera2"]
)
class Camera2ImageCapture : Fragment() {
/**
* Android ViewBinding.
*/
private var _binding: FragmentCamera2ImageCaptureBinding? = null
private var _binding: Camera2ImageCaptureBinding? = null
private val binding get() = _binding!!

/**
Expand Down Expand Up @@ -164,7 +161,7 @@ class Camera2ImageCapture : Fragment() {
container: ViewGroup?,
savedInstanceState: Bundle?,
): View {
_binding = FragmentCamera2ImageCaptureBinding.inflate(inflater, container, false)
_binding = Camera2ImageCaptureBinding.inflate(inflater, container, false)
return binding.root
}

Expand Down
Loading

0 comments on commit cd3a84a

Please sign in to comment.