Skip to content

Commit

Permalink
Merge "UI improvements and bug fixes"
Browse files Browse the repository at this point in the history
  • Loading branch information
owahltinez authored and Gerrit Code Review committed Aug 15, 2019
2 parents 0725226 + 5229314 commit ae64098
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class CameraFragment : Fragment() {
private var imageCapture: ImageCapture? = null
private var imageAnalyzer: ImageAnalysis? = null

// Volume down button receiver
/** Volume down button receiver used to trigger shutter */
private val volumeDownReceiver = object : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
val keyCode = intent.getIntExtra(KEY_EVENT_EXTRA, KeyEvent.KEYCODE_UNKNOWN)
Expand All @@ -114,6 +114,9 @@ class CameraFragment : Fragment() {
}
}

/** Declare worker thread at the class level so it can be reused after config changes */
private val analyzerThread = HandlerThread("LuminosityAnalysis").apply { start() }

/** Internal reference of the [DisplayManager] */
private lateinit var displayManager: DisplayManager

Expand Down Expand Up @@ -296,7 +299,6 @@ class CameraFragment : Fragment() {
val analyzerConfig = ImageAnalysisConfig.Builder().apply {
setLensFacing(lensFacing)
// Use a worker thread for image analysis to prevent preview glitches
val analyzerThread = HandlerThread("LuminosityAnalysis").apply { start() }
setCallbackHandler(Handler(analyzerThread.looper))
// In our analysis, we care more about the latest image than analyzing *every* image
setImageReaderMode(ImageAnalysis.ImageReaderMode.ACQUIRE_LATEST_IMAGE)
Expand Down
1 change: 1 addition & 0 deletions CameraXBasic/app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:keepScreenOn="true"
tools:context=".MainActivity">

<fragment
Expand Down
2 changes: 2 additions & 0 deletions CameraXBasic/app/src/main/res/values-v28/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
<item name="colorAccent">@color/colorAccent</item>
<item name="android:immersive">true</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
</style>

Expand Down
2 changes: 2 additions & 0 deletions CameraXBasic/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
<item name="colorAccent">@color/colorAccent</item>
<item name="android:immersive">true</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
</style>

</resources>

0 comments on commit ae64098

Please sign in to comment.