Skip to content

Commit f29a2e1

Browse files
authored
Google AI Mediapipe (#276)
* Mediapipe patch 1 * Architecture finalization * Allowed modes fix * Working MediaPipe prototype * Update tests * Fix unit tests * Add project icon * Optimize BL, translations * Fix source selection list auto non-visible scroll * Fix deprecations
1 parent fcec91b commit f29a2e1

File tree

134 files changed

+1832
-741
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+1832
-741
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ captures/
4444
!/.idea/vcs.xml
4545
!/.idea/fileTemplates/
4646
!/.idea/inspectionProfiles/
47+
!/.idea/icon.svg
4748
!/.idea/scopes/
4849
!/.idea/codeStyleSettings.xml
4950
!/.idea/encodings.xml

.idea/icon.svg

Lines changed: 106 additions & 0 deletions
Loading

app/build.gradle.kts

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -51,27 +51,6 @@ android {
5151
println("[Signature] -> Build will be signed with signature: $alias")
5252
buildTypes.getByName("release").signingConfig = signingConfigs.getByName("release")
5353
}
54-
55-
flavorDimensions += "type"
56-
productFlavors {
57-
create("dev") {
58-
dimension = "type"
59-
applicationIdSuffix = ".dev"
60-
resValue("string", "app_name", "SDAI Dev")
61-
buildConfigField("String", "BUILD_FLAVOR_TYPE", "\"FOSS\"")
62-
}
63-
create("foss") {
64-
dimension = "type"
65-
applicationIdSuffix = ".foss"
66-
resValue("string", "app_name", "SDAI FOSS")
67-
buildConfigField("String", "BUILD_FLAVOR_TYPE", "\"FOSS\"")
68-
}
69-
create("playstore") {
70-
dimension = "type"
71-
resValue("string", "app_name", "SDAI")
72-
buildConfigField("String", "BUILD_FLAVOR_TYPE", "\"GOOGLE_PLAY\"")
73-
}
74-
}
7554
}
7655

7756
dependencies {
@@ -85,6 +64,7 @@ dependencies {
8564
implementation(project(":domain"))
8665
implementation(project(":feature:auth"))
8766
implementation(project(":feature:diffusion"))
67+
implementation(project(":feature:mediapipe"))
8868
implementation(project(":feature:work"))
8969
implementation(project(":data"))
9070
implementation(project(":demo"))
File renamed without changes.

app/src/main/AndroidManifest.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
android:theme="@style/Theme.AiSdCompose.Splash"
1313
android:usesCleartextTraffic="true">
1414

15+
<uses-native-library android:name="libOpenCL.so" android:required="false" />
16+
<uses-native-library android:name="libOpenCL-car.so" android:required="false"/>
17+
<uses-native-library android:name="libOpenCL-pixel.so" android:required="false" />
18+
1519
<activity
1620
android:name="com.shifthackz.aisdv1.presentation.activity.AiStableDiffusionActivity"
1721
android:exported="true"

app/src/main/java/com/shifthackz/aisdv1/app/di/FeatureModule.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ package com.shifthackz.aisdv1.app.di
22

33
import com.shifthackz.aisdv1.feature.auth.di.authModule
44
import com.shifthackz.aisdv1.feature.diffusion.di.diffusionModule
5+
import com.shifthackz.aisdv1.feature.mediapipe.di.mediaPipeModule
56

6-
val featureModule = (
7-
authModule
8-
+ diffusionModule
9-
).toTypedArray()
7+
val featureModule = arrayOf(
8+
authModule,
9+
diffusionModule,
10+
mediaPipeModule,
11+
)

app/src/main/java/com/shifthackz/aisdv1/app/di/ProvidersModule.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,11 @@ val providersModule = module {
130130
append("$version")
131131
if (BuildConfig.DEBUG) append("-dev")
132132
append(" ($buildNumber)")
133-
if (type == BuildType.FOSS) append(" FOSS")
133+
when (type) {
134+
BuildType.FULL -> append(" FULL")
135+
BuildType.FOSS -> append(" FOSS")
136+
BuildType.PLAY -> Unit
137+
}
134138
}
135139
}
136140
}
@@ -172,14 +176,14 @@ val providersModule = module {
172176

173177
single {
174178
DeviceNNAPIFlagProvider {
175-
get<PreferenceManager>().localUseNNAPI
179+
get<PreferenceManager>().localOnnxUseNNAPI
176180
.let { nnApi -> if (nnApi) LocalDiffusionFlag.NN_API else LocalDiffusionFlag.CPU }
177181
.let(LocalDiffusionFlag::value)
178182
}
179183
}
180184

181185
single {
182-
LocalModelIdProvider { get<PreferenceManager>().localModelId }
186+
LocalModelIdProvider { get<PreferenceManager>().localOnnxModelId }
183187
}
184188

185189
single {

build-logic/convention/build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ gradlePlugin {
3636
id = "generic.application"
3737
implementationClass = "ApplicationConventionPlugin"
3838
}
39+
register("Flavors") {
40+
id = "generic.flavors"
41+
implementationClass = "FlavorsConventionPlugin"
42+
}
3943
register("BaselineProFm") {
4044
id = "generic.baseline.profm"
4145
implementationClass = "BaselineProFmConventionPlugin"

build-logic/convention/src/main/kotlin/ApplicationConventionPlugin.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import com.android.build.api.dsl.ApplicationExtension
2+
import com.android.build.gradle.BaseExtension
23
import com.shifthackz.aisdv1.buildlogic.configureApplication
34
import com.shifthackz.aisdv1.buildlogic.configureCompose
5+
import com.shifthackz.aisdv1.buildlogic.configureFlavors
46
import com.shifthackz.aisdv1.buildlogic.libs
57
import org.gradle.api.Plugin
68
import org.gradle.api.Project
@@ -22,6 +24,9 @@ class ApplicationConventionPlugin : Plugin<Project> {
2224
configureCompose(this)
2325
defaultConfig.targetSdk = libs.findVersion("targetSdk").get().toString().toInt()
2426
}
27+
extensions.configure<BaseExtension> {
28+
configureFlavors(this)
29+
}
2530
}
2631
}
2732
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import com.android.build.gradle.LibraryExtension
2+
import com.shifthackz.aisdv1.buildlogic.configureFlavorsCommon
3+
import org.gradle.api.Plugin
4+
import org.gradle.api.Project
5+
import org.gradle.kotlin.dsl.configure
6+
7+
class FlavorsConventionPlugin : Plugin<Project> {
8+
9+
override fun apply(target: Project) {
10+
with(target) {
11+
extensions.configure<LibraryExtension> {
12+
configureFlavorsCommon(this)
13+
}
14+
}
15+
}
16+
}

0 commit comments

Comments
 (0)