Skip to content

Commit

Permalink
Merge pull request #45 from ImaginativeShohag/baseline-profile
Browse files Browse the repository at this point in the history
Baseline profile
  • Loading branch information
ImaginativeShohag authored Dec 18, 2024
2 parents d2ec3cc + c21bb52 commit cf9c0e8
Show file tree
Hide file tree
Showing 28 changed files with 83,078 additions and 22 deletions.
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
bin/
gen/
out/
# Uncomment the following line in case you need and you don't have the release build type files in your app
release/
# Uncomment the following line in case you need and you don't have the release build type files in your app
release/*
# Baseline profile files
!release/generated/baselineProfiles/*

# Gradle files
.gradle/
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Feel free to request features or suggestions for improvements.
- [ ] Migrate ExoPlayer: https://developer.android.com/media/media3/exoplayer/migration-guide
- [ ] Update all `LaunchedEffect` with lambda issue using `rememberUpdatedState`: https://developer.android.com/develop/ui/compose/side-effects#rememberupdatedstate
- [ ] Add example for AppColorLocal from Jaber vai
- [ ] Update to coil 3
- [x] Update to coil 3

# Note

Expand Down
15 changes: 15 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ plugins {
alias(libs.plugins.secrets)
alias(libs.plugins.gms)
alias(libs.plugins.firebase.crashlytics)
alias(libs.plugins.baselineprofile)
}

android {
Expand Down Expand Up @@ -67,6 +68,9 @@ android {
// To publish on the Play store a private signing key is required, but to allow anyone
// who clones the code to sign and run the release variant, use the debug signing key.
signingConfig = signingConfigs.named("debug").get()

// Ensure Baseline Profile is fresh for release builds.
baselineProfile.automaticGenerationDuringBuild = true
}
}

Expand Down Expand Up @@ -114,11 +118,13 @@ dependencies {
implementation(project(":exoplayer"))
implementation(project(":cms"))
implementation(project(":popbackstack"))
"baselineProfile"(project(":benchmarks"))

implementation(libs.kotlin.stdlib)
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.androidx.swiperefreshlayout)
implementation(libs.androidx.profileinstaller)

testImplementation(libs.junit)
androidTestImplementation(libs.androidx.test.ext)
Expand Down Expand Up @@ -244,3 +250,12 @@ dependencies {

implementation(libs.firebase.analytics.ktx)
}

baselineProfile {
// Don't build on every iteration of a full assemble.
// Instead enable generation directly for the release build variant.
automaticGenerationDuringBuild = false

// Make use of Dex Layout Optimizations via Startup Profiles
dexLayoutOptimization = true
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import androidx.compose.foundation.background
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.testTagsAsResourceId
import androidx.compose.ui.tooling.preview.Preview
import androidx.navigation.compose.rememberNavController
import org.imaginativeworld.whynotcompose.base.models.UIThemeMode
Expand Down Expand Up @@ -64,6 +66,10 @@ fun MainScreenSkeleton(
NavHostMain(
navController = navController,
updateUiThemeMode = updateUiThemeMode,
Modifier.background(MaterialTheme.colorScheme.background)
modifier = Modifier
.background(MaterialTheme.colorScheme.background)
.semantics {
testTagsAsResourceId = true
}
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
Expand All @@ -66,11 +67,11 @@ import org.imaginativeworld.whynotcompose.common.compose.theme.AppTheme

@Composable
fun EmudiScreen() {
val animState = MutableStateFlow(false)
val animStateDot1 = MutableStateFlow(false)
val animStateDot2 = MutableStateFlow(false)
val animStateDot3 = MutableStateFlow(false)
val animStateDot4 = MutableStateFlow(false)
val animState = remember { MutableStateFlow(false) }
val animStateDot1 = remember { MutableStateFlow(false) }
val animStateDot2 = remember { MutableStateFlow(false) }
val animStateDot3 = remember { MutableStateFlow(false) }
val animStateDot4 = remember { MutableStateFlow(false) }

LaunchedEffect(Unit) {
while (true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.tooling.preview.PreviewLightDark
import androidx.compose.ui.unit.dp
import org.imaginativeworld.whynotcompose.common.compose.compositions.AppComponent.Header
Expand Down Expand Up @@ -75,6 +76,7 @@ fun AnimationIndexSkeleton(
) {
Scaffold(
Modifier
.testTag("screen:animations:index")
.navigationBarsPadding()
.imePadding()
.statusBarsPadding(),
Expand All @@ -95,13 +97,13 @@ fun AnimationIndexSkeleton(
contentPadding = PaddingValues(bottom = 16.dp)
) {
itemsIndexed(Animation.animationList) { index, item ->

if (index != 0) {
HorizontalDivider(Modifier.padding(16.dp, 0.dp))
}

Text(
modifier = Modifier
.testTag("list-item")
.clickable {
navigate(item.route)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import org.imaginativeworld.whynotcompose.common.compose.compositions.AppComponent.Header
Expand Down Expand Up @@ -75,6 +76,7 @@ fun CompositionIndexSkeleton(
) {
Scaffold(
Modifier
.testTag("screen:compositions:index")
.navigationBarsPadding()
.imePadding()
.statusBarsPadding(),
Expand All @@ -101,6 +103,7 @@ fun CompositionIndexSkeleton(

Text(
modifier = Modifier
.testTag("list-item")
.clickable {
navigate(item.route)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontFamily
Expand Down Expand Up @@ -191,6 +192,7 @@ fun HomeIndexScreen(

Scaffold(
Modifier
.testTag("screen:home")
.navigationBarsPadding()
.imePadding()
) { innerPadding ->
Expand Down Expand Up @@ -265,7 +267,9 @@ fun HomeIndexScreen(
)

Button(onClick = {
requestNotificationPermission.launch(Manifest.permission.POST_NOTIFICATIONS)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
requestNotificationPermission.launch(Manifest.permission.POST_NOTIFICATIONS)
}
}) {
Text("Allow")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.font.FontFamily
Expand Down Expand Up @@ -83,6 +84,7 @@ fun TutorialIndexSkeleton(
) {
Scaffold(
Modifier
.testTag("screen:tutorials:index")
.navigationBarsPadding()
.imePadding()
.statusBarsPadding(),
Expand Down Expand Up @@ -111,7 +113,9 @@ fun TutorialIndexSkeleton(
item = item,
onClick = {
navigate(item.route)
}
},
modifier = Modifier
.testTag("list-item")
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.tooling.preview.PreviewLightDark
import androidx.compose.ui.unit.dp
import org.imaginativeworld.whynotcompose.common.compose.compositions.AppComponent.Header
Expand Down Expand Up @@ -75,6 +76,7 @@ fun UiIndexSkeleton(
) {
Scaffold(
Modifier
.testTag("screen:uis:index")
.navigationBarsPadding()
.imePadding()
.statusBarsPadding(),
Expand All @@ -101,6 +103,7 @@ fun UiIndexSkeleton(

Text(
modifier = Modifier
.testTag("list-item")
.clickable {
navigate(item.route)
}
Expand Down
Loading

0 comments on commit cf9c0e8

Please sign in to comment.