Skip to content

Commit

Permalink
Instant dynamic app (#175)
Browse files Browse the repository at this point in the history
* Instant dynamic app

* Instant dynamic app

* Instant dynamic app
  • Loading branch information
michaelbel authored Nov 5, 2023
1 parent a7e179b commit 5c99adc
Show file tree
Hide file tree
Showing 29 changed files with 147 additions and 24 deletions.
2 changes: 2 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ android {
compose = true
}

dynamicFeatures += setOf(":instant")

composeOptions {
kotlinCompilerExtensionVersion = libs.versions.androidx.compose.compiler.get()
}
Expand Down
24 changes: 17 additions & 7 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:dist="http://schemas.android.com/apk/distribution"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />
<dist:module dist:instant="true" />

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />

<queries>
<package android:name="org.michaelbel.movies" />
Expand All @@ -25,8 +28,7 @@
android:localeConfig="@xml/locale_config"
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="@style/Theme.Movies.Starting"
tools:ignore="UnusedAttribute">
android:theme="@style/Theme.Movies.Starting">

<profileable
android:shell="true"
Expand All @@ -42,19 +44,26 @@
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER" />
</intent-filter>

<intent-filter>
<intent-filter
android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data
android:host="www.themoviedb.org"
android:path="/movie"
android:scheme="http" />

<data
android:host="www.themoviedb.org"
android:path="/movie"
android:scheme="https" />

</intent-filter>

<intent-filter>
<intent-filter
android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
Expand All @@ -65,7 +74,8 @@

</intent-filter>

<intent-filter>
<intent-filter
android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
package org.michaelbel.movies.benchmark

import androidx.benchmark.macro.junit4.BaselineProfileRule
import org.junit.Rule
import org.junit.Test

/**
* ./gradlew :benchmark:connectedCheck
*/
internal class BaselineProfileGenerator {
/*internal class BaselineProfileGenerator {
@get:Rule
val baselineProfileRule = BaselineProfileRule()
Expand All @@ -21,4 +17,4 @@ internal class BaselineProfileGenerator {
startActivityAndWait()
device.waitForIdle()
}
}
}*/
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
alias(libs.plugins.application) apply false
alias(libs.plugins.library) apply false
alias(libs.plugins.dynamic.feature) apply false
alias(libs.plugins.test) apply false
alias(libs.plugins.kotlin) apply false
alias(libs.plugins.kotlin.ksp) apply false
Expand Down
6 changes: 3 additions & 3 deletions config/detekt/detekt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ complexity:
includePrivateDeclarations: false
ignoreOverloaded: false
CyclomaticComplexMethod:
active: true
active: false
threshold: 15
ignoreSingleWhenExpression: false
ignoreSimpleWhenEntries: false
Expand Down Expand Up @@ -144,7 +144,7 @@ complexity:
threshold: 3
ignoreArgumentsMatchingNames: false
NestedBlockDepth:
active: true
active: false
threshold: 4
NestedScopeFunctions:
active: false
Expand Down Expand Up @@ -345,7 +345,7 @@ naming:
active: false
parameterPattern: '[a-z][A-Za-z0-9]*|_'
MatchingDeclarationName:
active: true
active: false
mustBeFirst: true
MemberNameEqualsClassName:
active: false
Expand Down
Binary file added config/images/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added config/images/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added config/images/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added config/images/4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added config/images/5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added config/images/6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added config/images/7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added config/images/8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed config/screenshots/screen1.png
Binary file not shown.
Binary file removed config/screenshots/screen2.png
Binary file not shown.
Binary file removed config/screenshots/screen3.png
Binary file not shown.
Binary file removed config/screenshots/screen4.png
Binary file not shown.
5 changes: 4 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ spotless = "6.22.0"
google-services = "4.4.0"
gms-play-services-ads = "22.5.0"
gms-play-services-base = "18.2.0"
gms-play-services-instantapps = "18.0.1"
firebase-analytics-ktx = "21.5.0"
firebase-appdistribution = "4.0.1"
firebase-config-ktx = "21.5.0"
Expand All @@ -32,7 +33,7 @@ androidx-compose-ui = "1.5.4"
androidx-compose-compiler = "1.5.3"
androidx-compose-material = "1.5.4"
androidx-compose-material3 = "1.1.2"
androidx-appcompat = "1.7.0-alpha03"
androidx-appcompat = "1.6.1"
androidx-activity = "1.8.0"
androidx-autofill = "1.1.0"
androidx-browser = "1.6.0"
Expand Down Expand Up @@ -72,6 +73,7 @@ kotlin-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-te
kotlin-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlin-serialization-json" }
gms-play-services-ads = { module = "com.google.android.gms:play-services-ads", version.ref = "gms-play-services-ads" }
gms-play-services-base = { module = "com.google.android.gms:play-services-base", version.ref = "gms-play-services-base" }
gms-play-services-instantapps = { module = "com.google.android.gms:play-services-instantapps", version.ref = "gms-play-services-instantapps" }
firebase-analytics-ktx = { module = "com.google.firebase:firebase-analytics-ktx", version.ref = "firebase-analytics-ktx" }
firebase-config-ktx = { module = "com.google.firebase:firebase-config-ktx", version.ref = "firebase-config-ktx" }
firebase-crashlytics-ktx = { module = "com.google.firebase:firebase-crashlytics-ktx", version.ref = "firebase-crashlytics-ktx" }
Expand Down Expand Up @@ -207,5 +209,6 @@ hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" }
androidx-navigation-safeargs = { id = "androidx.navigation.safeargs.kotlin", version.ref = "androidx-navigation" }
application = { id = "com.android.application", version.ref = "gradle" }
library = { id = "com.android.library", version.ref = "gradle" }
dynamic-feature = { id = "com.android.dynamic-feature", version.ref = "gradle" }
test = { id = "com.android.test", version.ref = "gradle" }
palantir-git = { id = "com.palantir.git-version", version.ref = "palantir-git" }
1 change: 1 addition & 0 deletions instant/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
35 changes: 35 additions & 0 deletions instant/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
plugins {
alias(libs.plugins.dynamic.feature)
alias(libs.plugins.kotlin)
}

android {
namespace = "org.michaelbel.movies.instant"
compileSdk = libs.versions.compile.sdk.get().toInt()

defaultConfig {
minSdk = libs.versions.min.sdk.get().toInt()
}

buildFeatures {
compose = true
}

composeOptions {
kotlinCompilerExtensionVersion = libs.versions.androidx.compose.compiler.get()
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
}

dependencies {
implementation(project(":app"))
implementation(project(":core:ui"))
implementation(libs.androidx.activity.compose)
implementation(libs.androidx.appcompat)
implementation(libs.androidx.compose.material3)
implementation(libs.gms.play.services.instantapps)
}
37 changes: 37 additions & 0 deletions instant/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:dist="http://schemas.android.com/apk/distribution"
xmlns:tools="http://schemas.android.com/tools"
android:targetSandboxVersion="2">

<dist:module
dist:instant="true"
dist:title="@null">

<dist:delivery>
<dist:install-time />
</dist:delivery>

<dist:fusing dist:include="false" />

</dist:module>

<application
tools:ignore="MissingApplicationIcon">

<activity
android:name="org.michaelbel.movies.dynamic.InstantMainActivity"
android:exported="true"
android:theme="@style/Theme.Movies">

<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

</activity>

</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package org.michaelbel.movies.dynamic

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.core.view.WindowCompat
import org.michaelbel.movies.ui.theme.MoviesTheme

internal class InstantMainActivity: ComponentActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
WindowCompat.setDecorFitsSystemWindows(window, false)
setContent {
MoviesTheme {
Box(
modifier = Modifier.fillMaxSize(),
contentAlignment = Alignment.Center
) {
Text(
text = "Hello Movies Instant App!",
color = MaterialTheme.colorScheme.onBackground
)
}
}
}
}
}
16 changes: 10 additions & 6 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@ Movies
Movies - easy way to discover popular movies. This is a simple TMDb client for Android

<div style="dispaly:flex">
<img src="config/screenshots/screen1.png" width="24%">
<img src="config/screenshots/screen2.png" width="24%">
<img src="config/screenshots/screen3.png" width="24%">
<img src="config/screenshots/screen4.png" width="24%">
<img src="config/images/1.png" width="24%">
<img src="config/images/2.png" width="24%">
<img src="config/images/3.png" width="24%">
<img src="config/images/4.png" width="24%">
<img src="config/images/5.png" width="24%">
<img src="config/images/6.png" width="24%">
<img src="config/images/7.png" width="24%">
<img src="config/images/8.png" width="24%">
</div>

## Build
Expand All @@ -25,7 +29,7 @@ TMDB_API_KEY=your_own_tmdb_api_key
## Download

[<img src="https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png" alt="" height="80">](https://play.google.com/store/apps/details?id=org.michaelbel.moviemade)
[<img src="config/screenshots/direct-apk.png" alt="" height="80">](https://github.com/michaelbel/movies/releases/download/1.4.6/Movies-v1.4.6.1196.-release.apk)
[<img src="config/images/direct-apk.png" alt="" height="80">](https://github.com/michaelbel/movies/releases/download/1.4.6/Movies-v1.4.6.1196.-release.apk)

## Technologies

Expand Down Expand Up @@ -116,7 +120,7 @@ If you find any problems or would like to suggest a feature, please feel free to

## License
<a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank">
<img alt="Apache License 2.0" src="config/screenshots/apache.png" height="110"/>
<img alt="Apache License 2.0" src="config/images/apache.png" height="110"/>
</a>

Copyright 2017 Michael Bely
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ rootProject.name = "movies"

include(
":app",

":instant",
":benchmark",

":core:analytics",
Expand Down

0 comments on commit 5c99adc

Please sign in to comment.