Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Camera2SlowMotion/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ in an MP4 video file.
Pre-requisites
--------------

- Android SDK 29+
- Android Studio 3.5+
- Android SDK 33+
- Android Studio Panda 4
- Device with high-speed capture capability

Screenshots
Expand Down
46 changes: 21 additions & 25 deletions Camera2SlowMotion/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,15 @@
*/

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: "androidx.navigation.safeargs"

android {
compileSdkVersion 29
compileSdkVersion 37
defaultConfig {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
applicationId "com.android.example.camera2.slowmo"
minSdkVersion 23
targetSdkVersion 29
minSdkVersion 33
targetSdkVersion 37
versionCode 1
versionName "1.0.0"
}
Expand All @@ -35,14 +33,10 @@ android {
targetCompatibility rootProject.ext.java_version
}

kotlinOptions {
jvmTarget = "$rootProject.ext.java_version"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

Expand All @@ -59,37 +53,39 @@ android {

buildFeatures {
viewBinding true
buildConfig true
}
namespace 'com.example.android.camera2.slowmo'
}

dependencies {
implementation project(':utils')

// Kotlin lang
implementation 'androidx.core:core-ktx:1.3.0'
implementation 'androidx.core:core-ktx:1.18.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.4'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.11.0'

// App compat and UI things
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.2.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.appcompat:appcompat:1.7.1'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.10.0'
implementation 'androidx.constraintlayout:constraintlayout:2.2.1'

// Navigation library
def nav_version = "2.2.2"
def nav_version = "2.9.8"
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"

// Unit testing
testImplementation 'androidx.test.ext:junit:1.1.1'
testImplementation 'androidx.test:rules:1.2.0'
testImplementation 'androidx.test:runner:1.2.0'
testImplementation 'androidx.test.espresso:espresso-core:3.2.0'
testImplementation "org.robolectric:robolectric:4.3.1"
testImplementation 'androidx.test.ext:junit:1.3.0'
testImplementation 'androidx.test:rules:1.7.0'
testImplementation 'androidx.test:runner:1.7.0'
testImplementation 'androidx.test.espresso:espresso-core:3.7.0'
testImplementation "org.robolectric:robolectric:4.16.1"

// Instrumented testing
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test:rules:1.2.0'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'androidx.test.ext:junit:1.3.0'
androidTestImplementation 'androidx.test:rules:1.7.0'
androidTestImplementation 'androidx.test:runner:1.7.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.7.0'
}
5 changes: 2 additions & 3 deletions Camera2SlowMotion/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
~ limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.android.camera2.slowmo">
xmlns:tools="http://schemas.android.com/tools">

<!-- Permission declarations -->
<uses-permission android:name="android.permission.CAMERA" />
Expand All @@ -26,14 +25,14 @@
<uses-feature android:name="android.hardware.camera.any" />

<application
android:allowBackup="true"
android:label="@string/app_name"
android:icon="@drawable/ic_launcher"
tools:ignore="AllowBackup,GoogleAppIndexingWarning">

<activity
android:name="com.example.android.camera2.slowmo.CameraActivity"
android:clearTaskOnLaunch="true"
android:exported="true"
android:theme="@style/AppTheme">

<!-- Main app intent filter -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
package com.example.android.camera2.slowmo

import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.WindowCompat
import androidx.core.view.WindowInsetsCompat
import com.example.android.camera2.slowmo.databinding.ActivityCameraBinding

class CameraActivity : AppCompatActivity() {

private lateinit var activityCameraBinding: ActivityCameraBinding

override fun onCreate(savedInstanceState: Bundle?) {
Expand All @@ -33,21 +33,16 @@ class CameraActivity : AppCompatActivity() {

override fun onResume() {
super.onResume()
// Before setting full screen flags, we must wait a bit to let UI settle; otherwise, we may
// Before setting full screen, we must wait a bit to let UI settle; otherwise, we may
// be trying to set app to immersive mode before it's ready and the flags do not stick
activityCameraBinding.fragmentContainer.postDelayed({
activityCameraBinding.fragmentContainer.systemUiVisibility = FLAGS_FULLSCREEN
WindowCompat
.getInsetsController(window, window.decorView)
.hide(WindowInsetsCompat.Type.systemBars())
}, IMMERSIVE_FLAG_TIMEOUT)
}

companion object {
/** Combination of all flags required to put activity into immersive mode */
const val FLAGS_FULLSCREEN =
View.SYSTEM_UI_FLAG_LOW_PROFILE or
View.SYSTEM_UI_FLAG_FULLSCREEN or
View.SYSTEM_UI_FLAG_LAYOUT_STABLE or
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY

/** Milliseconds used for UI animations */
const val ANIMATION_FAST_MILLIS = 50L
const val ANIMATION_SLOW_MILLIS = 100L
Expand Down
Loading