Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Onboarding #222

Merged
merged 44 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
0800f2c
feat: Basic structure of the OnboardingActivity
LunarX Nov 22, 2024
969c48c
feat: Animate the onboarding button
LunarX Nov 22, 2024
66ae2ab
feat: Import and use illustrations
LunarX Nov 26, 2024
ecda14b
feat: Add vertical scroll for screen that are not heigh enough
LunarX Nov 26, 2024
fe6b383
feat: Import and use strings
LunarX Nov 26, 2024
c576a58
feat: Specify correct HighlightedText rotation angle for each onboard…
LunarX Nov 28, 2024
b9f8ed0
feat: Add background radial gradient to onboarding
LunarX Nov 28, 2024
4e4f2f9
feat: Describe onboarding pages with an enum
LunarX Nov 28, 2024
bd1bdb5
feat: Give control over the HighlightedText highlight state
LunarX Nov 28, 2024
3856830
feat: Manually trigger the animation of onboarding highlighted texts
LunarX Nov 28, 2024
eeeab3e
refactor: Extract OnboardingScaffold to their own files
LunarX Nov 28, 2024
3a51f25
feat: Extract OnboardingScaffold to Core2
LunarX Nov 28, 2024
eaa277c
refactor: Clean OnboardingScreen and extract some components
LunarX Nov 28, 2024
03d4df2
feat: Add missing start button string
LunarX Nov 28, 2024
836d0b4
feat: Add OnboardingScaffold preview
LunarX Nov 29, 2024
cd287f7
refactor: Remove unnecessary padding
LunarX Nov 29, 2024
a1694cb
feat: Connect the user at the end of the onboarding
LunarX Nov 29, 2024
3c4a0cc
style: Clean code
LunarX Nov 29, 2024
b92ab42
fix: Update onboarding illustrations
LunarX Nov 29, 2024
ad50070
style: Add todo and clean temporary HorizontalPagerIndicator
LunarX Nov 29, 2024
30229a4
style: Rename angleDegree into highlightAngleDegree for clarity
LunarX Nov 29, 2024
e3dcc8b
fix: Windows inset to draw the background of the onboarding behind sy…
LunarX Nov 29, 2024
d16f989
fix: English onboarding storage wording
LunarX Dec 3, 2024
fe76f58
style: Add space to split debug dependencies from normal ones
LunarX Dec 4, 2024
39492ca
fix: Edge to edge on onboarding horizontal pager
LunarX Dec 4, 2024
545c693
style: Add some missing variable names
LunarX Dec 4, 2024
0838cbc
refactor: Remove double signature for HighlightedText
LunarX Dec 4, 2024
9dfefc5
style: Update some copyright, new lines and imports
LunarX Dec 4, 2024
7519160
refactor: Simplify onboarding isHighlighted update logic
LunarX Dec 4, 2024
23aab03
style: Clean OnboardingScreen
LunarX Dec 4, 2024
6e8f360
fix: Add missing contentDescription for onboarding next button
LunarX Dec 4, 2024
06787b0
style: Clean code
LunarX Dec 4, 2024
2f628ec
refactor: Introduce compose BOM to handle compose dependencies versions
LunarX Dec 4, 2024
0918c1e
fix: Reimport illustrations with correct baked paddings
LunarX Dec 4, 2024
e7a153e
refactor: Start activity using an `also`
LunarX Dec 9, 2024
ee16c1d
refactor: Clean illustration code
LunarX Dec 9, 2024
d54063d
feat: Lock onboarding activity's rotation for small screens
LunarX Dec 9, 2024
ce72d80
feat: Base the lock of the orientation on smalls screen on the compos…
LunarX Dec 9, 2024
1cc014f
style: Add missing comma
LunarX Dec 9, 2024
f44f30c
style: Order dependencies alphabetically
LunarX Dec 9, 2024
8cfd53e
style: Rename `startMainActivity` argument into `goToMainActivity`
LunarX Dec 9, 2024
3aaf95e
refactor: Rename Core2's "compose" module into "Compose"
LunarX Dec 10, 2024
d0e77df
refactor: Remove unused ScreenUtils.kt in Core2
LunarX Dec 11, 2024
0f1520c
refactor: Add tailrec annotation to the recursive findActivity method
LunarX Dec 13, 2024
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
47 changes: 47 additions & 0 deletions Core2/Compose/Core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.compose.compiler)
}

val sharedCompileSdk: Int by rootProject.extra
val sharedMinSdk: Int by rootProject.extra
val sharedJavaVersion: JavaVersion by rootProject.extra

android {
namespace = "com.infomaniak.core2.compose.core"
compileSdk = sharedCompileSdk

defaultConfig {
minSdk = sharedMinSdk

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
compileOptions {
sourceCompatibility = sharedJavaVersion
targetCompatibility = sharedJavaVersion
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.5.14"
}
kotlinOptions {
jvmTarget = sharedJavaVersion.toString()
}
}

dependencies {
implementation(platform(core2.compose.bom))
implementation(core2.compose.runtime)
implementation(core2.compose.ui.tooling)
}
Empty file.
21 changes: 21 additions & 0 deletions Core2/Compose/Core/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Infomaniak SwissTransfer - Android
* Copyright (C) 2024 Infomaniak Network SA
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.infomaniak.core2.compose.core

import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.content.ContextWrapper
import android.content.pm.ActivityInfo
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.platform.LocalContext

@Composable
fun LockScreenOrientation(isLocked: Boolean) {
if (!isLocked) return

val context = LocalContext.current
LaunchedEffect(Unit) {
val activity = context.findActivity() ?: return@LaunchedEffect

@SuppressLint("SourceLockedOrientationActivity")
activity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
}
}

private tailrec fun Context.findActivity(): Activity? = when (this) {
is Activity -> this
is ContextWrapper -> baseContext.findActivity()
else -> null
}
52 changes: 52 additions & 0 deletions Core2/Onboarding/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.compose.compiler)
}

val sharedCompileSdk: Int by rootProject.extra
val sharedMinSdk: Int by rootProject.extra
val sharedJavaVersion: JavaVersion by rootProject.extra

android {
namespace = "com.infomaniak.library.onboarding"
compileSdk = sharedCompileSdk

defaultConfig {
minSdk = sharedMinSdk

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
compileOptions {
sourceCompatibility = sharedJavaVersion
targetCompatibility = sharedJavaVersion
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.5.14"
}
kotlinOptions {
jvmTarget = sharedJavaVersion.toString()
}
}

dependencies {
implementation(platform(core2.compose.bom))
implementation(core2.androidx.core.ktx)
implementation(core2.compose.foundation)
implementation(core2.compose.material3)
implementation(core2.compose.runtime)
implementation(core2.compose.ui.tooling.preview)

debugImplementation(core2.compose.ui.tooling)
}
Empty file.
21 changes: 21 additions & 0 deletions Core2/Onboarding/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
LunarX marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Infomaniak SwissTransfer - Android
* Copyright (C) 2024 Infomaniak Network SA
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.infomaniak.library.onboarding

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.pager.PagerState
import androidx.compose.foundation.pager.rememberPagerState
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp

// TODO: Simple placeholder code for now. Will be styled correctly in the next PR
@Composable
fun HorizontalPagerIndicator(modifier: Modifier = Modifier, pagerState: PagerState) {
Row(
modifier
.wrapContentHeight()
.fillMaxWidth()
.padding(bottom = 8.dp),
horizontalArrangement = Arrangement.Center
) {
repeat(pagerState.pageCount) { iteration ->
val color = if (pagerState.currentPage == iteration) Color.DarkGray else Color.LightGray
Box(
modifier = Modifier
.padding(2.dp)
.clip(CircleShape)
.background(color)
.size(16.dp)
)
}
}
}

@Preview
@Composable
private fun Preview() {
HorizontalPagerIndicator(pagerState = rememberPagerState { 3 })
}
Loading
Loading