Skip to content

Commit a8ed649

Browse files
shahdDaghashcopybara-github
authored andcommittedNov 4, 2024
Create an empty module for Effect demo
The new demo module aims to showcase different `Effect` capabilities. PiperOrigin-RevId: 692912895
1 parent bd90ef3 commit a8ed649

File tree

14 files changed

+277
-0
lines changed

14 files changed

+277
-0
lines changed
 

‎demos/effect/README.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Effect demo
2+
3+
This app demonstrates how to use the [Effect][] API to modify videos. It uses
4+
[setVideoEffects] method to add different effects to [ExoPlayer].
5+
6+
See the [demos README](../README.md) for instructions on how to build and run
7+
this demo.

‎demos/effect/build.gradle

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
// Copyright 2024 The Android Open Source Project
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// https://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
apply from: '../../constants.gradle'
15+
apply plugin: 'com.android.application'
16+
apply plugin: 'kotlin-android'
17+
18+
android {
19+
namespace 'androidx.media3.demo.effect'
20+
21+
compileSdk project.ext.compileSdkVersion
22+
23+
compileOptions {
24+
sourceCompatibility JavaVersion.VERSION_1_8
25+
targetCompatibility JavaVersion.VERSION_1_8
26+
}
27+
28+
kotlinOptions {
29+
jvmTarget = '1.8'
30+
}
31+
32+
defaultConfig {
33+
versionName project.ext.releaseVersion
34+
versionCode project.ext.releaseVersionCode
35+
minSdkVersion project.ext.minSdkVersion
36+
targetSdkVersion project.ext.appTargetSdkVersion
37+
}
38+
39+
buildTypes {
40+
release {
41+
shrinkResources true
42+
minifyEnabled true
43+
signingConfig signingConfigs.debug
44+
}
45+
debug {
46+
jniDebuggable = true
47+
}
48+
}
49+
50+
lintOptions {
51+
// The demo app isn't indexed, and doesn't have translations.
52+
disable 'GoogleAppIndexingWarning','MissingTranslation'
53+
}
54+
buildFeatures {
55+
compose true
56+
}
57+
composeOptions {
58+
kotlinCompilerExtensionVersion = "1.5.3"
59+
}
60+
61+
testOptions {
62+
unitTests {
63+
includeAndroidResources = true
64+
}
65+
}
66+
}
67+
68+
dependencies {
69+
def composeBom = platform('androidx.compose:compose-bom:2024.10.00')
70+
implementation composeBom
71+
72+
implementation 'androidx.activity:activity-compose:1.9.3'
73+
implementation 'androidx.compose.foundation:foundation-android:1.7.4'
74+
implementation 'androidx.compose.material3:material3-android:1.3.0'
75+
implementation 'com.google.android.material:material:' + androidxMaterialVersion
76+
77+
// For detecting and debugging leaks only. LeakCanary is not needed for demo app to work.
78+
debugImplementation 'com.squareup.leakcanary:leakcanary-android:' + leakCanaryVersion
79+
}
+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Copyright 2024 The Android Open Source Project
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
https://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
-->
16+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
17+
xmlns:tools="http://schemas.android.com/tools"
18+
package="androidx.media3.demo.effect">
19+
20+
<uses-sdk/>
21+
<uses-permission android:name="android.permission.INTERNET" />
22+
23+
<application
24+
android:allowBackup="false"
25+
android:icon="@mipmap/ic_launcher"
26+
android:label="@string/app_name"
27+
android:theme="@style/Theme.Media3EffectDemo">
28+
29+
<activity
30+
android:name="androidx.media3.demo.effect.EffectActivity"
31+
android:exported="true">
32+
<intent-filter>
33+
<action android:name="android.intent.action.MAIN" />
34+
<category android:name="android.intent.category.LAUNCHER" />
35+
</intent-filter>
36+
</activity>
37+
</application>
38+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Copyright 2024 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package androidx.media3.demo.effect
17+
18+
import android.os.Bundle
19+
import androidx.activity.ComponentActivity
20+
import androidx.activity.compose.setContent
21+
import androidx.compose.foundation.layout.Arrangement
22+
import androidx.compose.foundation.layout.Column
23+
import androidx.compose.foundation.layout.fillMaxSize
24+
import androidx.compose.foundation.layout.fillMaxWidth
25+
import androidx.compose.material3.Surface
26+
import androidx.compose.material3.Text
27+
import androidx.compose.ui.Alignment
28+
import androidx.compose.ui.Modifier
29+
import androidx.compose.ui.text.style.TextAlign
30+
31+
class EffectActivity : ComponentActivity() {
32+
33+
override fun onCreate(savedInstanceState: Bundle?) {
34+
super.onCreate(savedInstanceState)
35+
setContent {
36+
Surface(modifier = Modifier.fillMaxSize()) {
37+
Column(
38+
modifier = Modifier.fillMaxWidth(),
39+
verticalArrangement = Arrangement.Center,
40+
horizontalAlignment = Alignment.CenterHorizontally,
41+
) {
42+
Text(text = "Effect demo", textAlign = TextAlign.Center)
43+
}
44+
}
45+
}
46+
}
47+
}
Loading
Loading
Loading
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Copyright 2024 The Android Open Source Project
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
https://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
-->
16+
<resources>
17+
<!-- Base application theme. -->
18+
<style name="Theme.Media3EffectDemo" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
19+
<!-- Primary brand color. -->
20+
<item name="colorPrimary">@color/purple_200</item>
21+
<item name="colorPrimaryVariant">@color/purple_700</item>
22+
<item name="colorOnPrimary">@color/black</item>
23+
<!-- Secondary brand color. -->
24+
<item name="colorSecondary">@color/teal_200</item>
25+
<item name="colorSecondaryVariant">@color/teal_200</item>
26+
<item name="colorOnSecondary">@color/black</item>
27+
<!-- Status bar color. -->
28+
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
29+
<!-- Customize your theme here. -->
30+
</style>
31+
</resources>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Copyright 2024 The Android Open Source Project
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
https://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
-->
16+
<resources>
17+
<color name="purple_200">#FFBB86FC</color>
18+
<color name="purple_500">#FF6200EE</color>
19+
<color name="purple_700">#FF3700B3</color>
20+
<color name="teal_200">#FF03DAC5</color>
21+
<color name="teal_700">#FF018786</color>
22+
<color name="black">#FF000000</color>
23+
<color name="white">#FFFFFFFF</color>
24+
</resources>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Copyright 2024 The Android Open Source Project
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
https://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
-->
16+
<resources>
17+
<string name="app_name">Effect Demo</string>
18+
</resources>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Copyright 2024 The Android Open Source Project
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
https://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
-->
16+
<resources>
17+
<!-- Base application theme. -->
18+
<style name="Theme.Media3EffectDemo" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
19+
<!-- Primary brand color. -->
20+
<item name="colorPrimary">@color/purple_500</item>
21+
<item name="colorPrimaryVariant">@color/purple_700</item>
22+
<item name="colorOnPrimary">@color/white</item>
23+
<!-- Secondary brand color. -->
24+
<item name="colorSecondary">@color/teal_200</item>
25+
<item name="colorSecondaryVariant">@color/teal_700</item>
26+
<item name="colorOnSecondary">@color/black</item>
27+
<!-- Status bar color. -->
28+
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
29+
<!-- Customize your theme here. -->
30+
</style>
31+
</resources>

‎settings.gradle

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ include modulePrefix + 'demo-compose'
3535
project(modulePrefix + 'demo-compose').projectDir = new File(rootDir, 'demos/compose')
3636
include modulePrefix + 'demo-composition'
3737
project(modulePrefix + 'demo-composition').projectDir = new File(rootDir, 'demos/composition')
38+
include modulePrefix + 'demo-effect'
39+
project(modulePrefix + 'demo-effect').projectDir = new File(rootDir, 'demos/effect')
3840
include modulePrefix + 'demo-gl'
3941
project(modulePrefix + 'demo-gl').projectDir = new File(rootDir, 'demos/gl')
4042
include modulePrefix + 'demo-session'

0 commit comments

Comments
 (0)
Please sign in to comment.