diff --git a/README.md b/README.md index 5d336cf..bac925b 100644 --- a/README.md +++ b/README.md @@ -11,16 +11,16 @@

-Bagel is a little native iOS network debugger. It's not a proxy debugger so you don't have to mess around with certificates, proxy settings etc. As long as your iOS devices and your Mac are in the same network, you can view the network traffic of your apps seperated by the devices or simulators. +Bagel is a little native iOS/Android network debugger. It's not a proxy debugger so you don't have to mess around with certificates, proxy settings etc. As long as your iOS/Android devices and your Mac are in the same network, you can view the network traffic of your apps seperated by the devices or simulators. ## Preview ![Bagel](https://github.com/yagiz/Bagel/blob/develop/assets/screenshot.png?raw=true) -## Installation -#### Install Mac App +## Install Mac App - Clone the repo. - Install pods. - Build and archive the project. -#### Install iOS Client + +## Install iOS Client #### CocoaPods ```shhttps://img.shields.io/badge/version-1.3.1-blue.svg?style=flat pod 'Bagel', '~> 1.4.0' @@ -71,7 +71,72 @@ bagelConfig.netserviceName = "" Bagel.start(bagelConfig) ``` -If you change Netservice parameters in your app, you should also change them on desktop client. + +## Install Android client +#### Dependency +* Add the below dependency in your preferred build system + ```groovy + implementation 'com.simform:bagel:1.0.1' + ``` + +### Usage +In order to start Bagel we need to start the client and add a interceptor to intercept [OkHttp](https://square.github.io/okhttp/) API calls. + +* You can start client in any one of the way you like from below + 1. Start client when `Application` class starts + ```kotlin + class App : Application() { + override fun onCreate() { + super.onCreate() + if (BuildConfig.DEBUG) { // Only expose in debug + Bagel.start(context) + } + } + } + ``` + 2. Start client using [AppStartup](https://developer.android.com/topic/libraries/app-startup) + ```kotlin + class BagelInitializer : Initializer { + override fun create(context: Context) { + if (BuildConfig.DEBUG) { // Only expose in debug + Bagel.start(context) + } + } + + override fun dependencies(): MutableList>> = + mutableListOf() + } + ``` + +* Add [OkHttp](https://square.github.io/okhttp/) interceptor (**This is required to route API call details**) + * While building your `OkHttp` client create interceptor instance as below + ```kotlin + OkHttpClient.Builder() + .apply { + if (BuildConfig.DEBUG) { // Only expose in debug + val bagelInterceptor = BagelInterceptor.getInstance() + addInterceptor(bagelInterceptor) + } + } + . // Add all other interceptor and configurations + .build() + ``` + +### Configuring Bagel +By default, Bagel gets your project name and device information. Desktop client uses these informations to separate projects and devices. You can configure `projectName` and `netServiceType` if you wish: + +```kotlin +val bagelConfiguration = BagelConfiguration + .getDefault(context) + .copy(projectName = "Bagel") + +Bagel.start( + context, + bagelConfiguration +) +``` + +#### Note : If you change `netServiceType` parameter in your app, you should also change them on desktop client. License ---- diff --git a/android/.gitignore b/android/.gitignore new file mode 100644 index 0000000..c8ee023 --- /dev/null +++ b/android/.gitignore @@ -0,0 +1,57 @@ +# Built application files +*.apk +*.ap_ + +# Files for the ART/Dalvik VM +*.dex + +# Java class files +*.class + +# Generated files +bin/ +gen/ +out/ + +# Gradle files +/.idea +.gradle/ +build/ + +# Local configuration file (sdk path, etc) +local.properties + +# Proguard folder generated by Eclipse +proguard/ + +# Log Files +*.log + +# Android Studio Navigation editor temp files +.navigation/ + +# Android Studio captures folder +captures/ + +# Intellij +*.iml +.idea/workspace.xml +.idea/tasks.xml +.idea/gradle.xml +.idea/dictionaries +.idea/libraries +app/.idea/ + +# Mac +*.DS_Store + +# Keystore files +*.jks + +# External native build folder generated in Android Studio 2.2 and later +.externalNativeBuild + +# Temporary API docs +docs/api + +artifacts \ No newline at end of file diff --git a/android/app/.gitignore b/android/app/.gitignore new file mode 100644 index 0000000..d849f4f --- /dev/null +++ b/android/app/.gitignore @@ -0,0 +1,55 @@ +# Built application files +*.apk +*.ap_ + +# Files for the ART/Dalvik VM +*.dex + +# Java class files +*.class + +# Generated files +bin/ +gen/ +out/ + +# Gradle files +/.idea +.gradle/ +build/ + +# Local configuration file (sdk path, etc) +local.properties + +# Proguard folder generated by Eclipse +proguard/ + +# Log Files +*.log + +# Android Studio Navigation editor temp files +.navigation/ + +# Android Studio captures folder +captures/ + +# Intellij +*.iml +.idea/workspace.xml +.idea/tasks.xml +.idea/gradle.xml +.idea/dictionaries +.idea/libraries +app/.idea/ + +# Mac +*.DS_Store + +# Keystore files +*.jks + +# External native build folder generated in Android Studio 2.2 and later +.externalNativeBuild + +# Temporary API docs +docs/api diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts new file mode 100644 index 0000000..a9ec7ba --- /dev/null +++ b/android/app/build.gradle.kts @@ -0,0 +1,79 @@ +plugins { + alias(libs.plugins.android.application) + alias(libs.plugins.jetbrains.kotlin.android) + alias(libs.plugins.compose.compiler) + alias(libs.plugins.kotlinx.serialization) + alias(libs.plugins.hilt) + alias(libs.plugins.ksp) +} + +android { + namespace = "com.simformsolutions.bagelandroid" + compileSdk = libs.versions.compileSdk.get().toInt() + + defaultConfig { + applicationId = "com.simformsolutions.bagelandroid" + minSdk = libs.versions.minSdk.get().toInt() + targetSdk = libs.versions.targetSdk.get().toInt() + versionCode = 1 + versionName = "1.0" + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + vectorDrawables { + useSupportLibrary = true + } + } + + buildTypes { + release { + isMinifyEnabled = true + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = "1.8" + } + buildFeatures { + compose = true + } +} + +dependencies { + // Uncomment this line to check locally published version +// implementation("com.simform:bagel:1.0.1") + // Comment this line to check locally published version + implementation(project(":bagel")) + implementation(libs.androidx.core.ktx) + implementation(libs.androidx.lifecycle.runtime.ktx) + implementation(libs.androidx.activity.compose) + implementation(platform(libs.androidx.compose.bom)) + implementation(libs.androidx.ui) + implementation(libs.androidx.ui.graphics) + implementation(libs.androidx.ui.tooling.preview) + implementation(libs.androidx.material3) + implementation(libs.timber) + implementation(libs.androidx.lifecycle.runtime.compose) + implementation(libs.kotlinx.serialization.json) + implementation(libs.androidx.startup.runtime) + implementation(platform(libs.retrofit.bom)) + implementation(libs.retrofit) + implementation(libs.hilt.android) + implementation(libs.logging.interceptor) + implementation(libs.retrofit2.kotlinx.serialization.converter) + implementation(libs.androidx.hilt.navigation.compose) + ksp(libs.hilt.android.compiler) + testImplementation(libs.junit) + androidTestImplementation(libs.androidx.junit) + androidTestImplementation(libs.androidx.espresso.core) + androidTestImplementation(platform(libs.androidx.compose.bom)) + androidTestImplementation(libs.androidx.ui.test.junit4) + debugImplementation(libs.androidx.ui.tooling) + debugImplementation(libs.androidx.ui.test.manifest) +} \ No newline at end of file diff --git a/android/app/proguard-rules.pro b/android/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/android/app/proguard-rules.pro @@ -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 \ No newline at end of file diff --git a/android/app/src/androidTest/java/com/simformsolutions/bagelandroid/ExampleInstrumentedTest.kt b/android/app/src/androidTest/java/com/simformsolutions/bagelandroid/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..640006e --- /dev/null +++ b/android/app/src/androidTest/java/com/simformsolutions/bagelandroid/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package com.simformsolutions.bagelandroid + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("com.simformsolutions.bagelandroid", appContext.packageName) + } +} \ No newline at end of file diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..cab5f88 --- /dev/null +++ b/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/android/app/src/main/java/com/simformsolutions/bagelandroid/BagelApp.kt b/android/app/src/main/java/com/simformsolutions/bagelandroid/BagelApp.kt new file mode 100644 index 0000000..cd1b00a --- /dev/null +++ b/android/app/src/main/java/com/simformsolutions/bagelandroid/BagelApp.kt @@ -0,0 +1,7 @@ +package com.simformsolutions.bagelandroid + +import android.app.Application +import dagger.hilt.android.HiltAndroidApp + +@HiltAndroidApp +class BagelApp : Application() diff --git a/android/app/src/main/java/com/simformsolutions/bagelandroid/di/NetworkModule.kt b/android/app/src/main/java/com/simformsolutions/bagelandroid/di/NetworkModule.kt new file mode 100644 index 0000000..6464136 --- /dev/null +++ b/android/app/src/main/java/com/simformsolutions/bagelandroid/di/NetworkModule.kt @@ -0,0 +1,75 @@ +package com.simformsolutions.bagelandroid.di + +import com.jakewharton.retrofit2.converter.kotlinx.serialization.asConverterFactory +import com.simform.bagel.intercept.BagelInterceptor +import com.simformsolutions.bagelandroid.remote.NetworkService +import dagger.Module +import dagger.Provides +import dagger.hilt.InstallIn +import dagger.hilt.components.SingletonComponent +import kotlinx.serialization.ExperimentalSerializationApi +import kotlinx.serialization.json.Json +import okhttp3.MediaType.Companion.toMediaType +import okhttp3.OkHttpClient +import okhttp3.logging.HttpLoggingInterceptor +import retrofit2.Retrofit +import retrofit2.create +import java.util.concurrent.TimeUnit +import javax.inject.Singleton + +private const val CONNECT_TIMEOUT_SECONDS = 10L +private const val READ_TIMEOUT_SECONDS = 5L +private const val WRITE_TIMEOUT_SECONDS = 5L + +@Module +@InstallIn(SingletonComponent::class) +object NetworkModule { + + @OptIn(ExperimentalSerializationApi::class) + @Provides + @Singleton + fun providesNetworkJson(): Json = Json { + ignoreUnknownKeys = true + explicitNulls = false + coerceInputValues = false + prettyPrint = true + encodeDefaults = true + } + + @Provides + @Singleton + fun provideLoggerInterceptor(): HttpLoggingInterceptor = HttpLoggingInterceptor().apply { + level = HttpLoggingInterceptor.Level.BODY + } + + @Provides + @Singleton + fun provideBagelInterceptor(): BagelInterceptor = + BagelInterceptor.getInstance() + + @Provides + @Singleton + fun provideApiClient( + logger: HttpLoggingInterceptor, + bagelInterceptor: BagelInterceptor + ): OkHttpClient = + OkHttpClient.Builder() + .addInterceptor(bagelInterceptor) + .addInterceptor(logger) + .connectTimeout(CONNECT_TIMEOUT_SECONDS, TimeUnit.SECONDS) + .readTimeout(READ_TIMEOUT_SECONDS, TimeUnit.SECONDS) + .writeTimeout(WRITE_TIMEOUT_SECONDS, TimeUnit.SECONDS) + .build() + + @Provides + @Singleton + fun provideRetrofit(networkJson: Json, client: OkHttpClient): Retrofit = Retrofit.Builder() + .baseUrl("https://google.com") + .client(client) + .addConverterFactory(networkJson.asConverterFactory("application/json".toMediaType())) + .build() + + @Provides + @Singleton + fun provideNetworkService(retrofit: Retrofit): NetworkService = retrofit.create() +} \ No newline at end of file diff --git a/android/app/src/main/java/com/simformsolutions/bagelandroid/di/RepositoryModule.kt b/android/app/src/main/java/com/simformsolutions/bagelandroid/di/RepositoryModule.kt new file mode 100644 index 0000000..c04bd92 --- /dev/null +++ b/android/app/src/main/java/com/simformsolutions/bagelandroid/di/RepositoryModule.kt @@ -0,0 +1,17 @@ +package com.simformsolutions.bagelandroid.di + +import com.simformsolutions.bagelandroid.domain.repository.NetworkRepository +import com.simformsolutions.bagelandroid.domain.repository.NetworkRepositoryImpl +import dagger.Binds +import dagger.Module +import dagger.hilt.InstallIn +import dagger.hilt.components.SingletonComponent +import javax.inject.Singleton + +@Module +@InstallIn(SingletonComponent::class) +interface RepositoryModule { + @Singleton + @Binds + fun bindNetworkRepository(impl: NetworkRepositoryImpl): NetworkRepository +} \ No newline at end of file diff --git a/android/app/src/main/java/com/simformsolutions/bagelandroid/domain/repository/NetworkRepository.kt b/android/app/src/main/java/com/simformsolutions/bagelandroid/domain/repository/NetworkRepository.kt new file mode 100644 index 0000000..67b7d66 --- /dev/null +++ b/android/app/src/main/java/com/simformsolutions/bagelandroid/domain/repository/NetworkRepository.kt @@ -0,0 +1,8 @@ +package com.simformsolutions.bagelandroid.domain.repository + +import retrofit2.Response + +interface NetworkRepository { + + suspend fun getHotCoffee() +} \ No newline at end of file diff --git a/android/app/src/main/java/com/simformsolutions/bagelandroid/domain/repository/NetworkRepositoryImpl.kt b/android/app/src/main/java/com/simformsolutions/bagelandroid/domain/repository/NetworkRepositoryImpl.kt new file mode 100644 index 0000000..37bbe1e --- /dev/null +++ b/android/app/src/main/java/com/simformsolutions/bagelandroid/domain/repository/NetworkRepositoryImpl.kt @@ -0,0 +1,19 @@ +package com.simformsolutions.bagelandroid.domain.repository + +import com.simformsolutions.bagelandroid.remote.NetworkService +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.withContext +import retrofit2.Response +import javax.inject.Inject +import javax.inject.Singleton + +@Singleton +class NetworkRepositoryImpl @Inject constructor( + private val networkService: NetworkService +) : NetworkRepository { + override suspend fun getHotCoffee() { + withContext(Dispatchers.IO) { + networkService.getHotCoffee() + } + } +} \ No newline at end of file diff --git a/android/app/src/main/java/com/simformsolutions/bagelandroid/initializer/BagelInitializer.kt b/android/app/src/main/java/com/simformsolutions/bagelandroid/initializer/BagelInitializer.kt new file mode 100644 index 0000000..36c8547 --- /dev/null +++ b/android/app/src/main/java/com/simformsolutions/bagelandroid/initializer/BagelInitializer.kt @@ -0,0 +1,15 @@ +package com.simformsolutions.bagelandroid.initializer + +import android.content.Context +import androidx.startup.Initializer +import com.simform.bagel.Bagel +import com.simform.bagel.config.BagelConfiguration + +class BagelInitializer : Initializer { + override fun create(context: Context) { + Bagel.start(context, BagelConfiguration.getDefault(context).copy(projectName = "Bagel")) + } + + override fun dependencies(): MutableList>> = + mutableListOf(TimberInitializer::class.java) +} \ No newline at end of file diff --git a/android/app/src/main/java/com/simformsolutions/bagelandroid/initializer/TimberInitializer.kt b/android/app/src/main/java/com/simformsolutions/bagelandroid/initializer/TimberInitializer.kt new file mode 100644 index 0000000..3952951 --- /dev/null +++ b/android/app/src/main/java/com/simformsolutions/bagelandroid/initializer/TimberInitializer.kt @@ -0,0 +1,14 @@ +package com.simformsolutions.bagelandroid.initializer + +import android.content.Context +import androidx.startup.Initializer +import timber.log.Timber + +class TimberInitializer : Initializer { + override fun create(context: Context) { + Timber.plant(Timber.DebugTree()) + Timber.d("TimberInitializer is initialized") + } + + override fun dependencies(): List>> = emptyList() +} \ No newline at end of file diff --git a/android/app/src/main/java/com/simformsolutions/bagelandroid/remote/NetworkService.kt b/android/app/src/main/java/com/simformsolutions/bagelandroid/remote/NetworkService.kt new file mode 100644 index 0000000..7c23129 --- /dev/null +++ b/android/app/src/main/java/com/simformsolutions/bagelandroid/remote/NetworkService.kt @@ -0,0 +1,10 @@ +package com.simformsolutions.bagelandroid.remote + +import retrofit2.Response +import retrofit2.http.GET + +interface NetworkService { + + @GET("https://api.sampleapis.com/coffee/hot") + suspend fun getHotCoffee(): Unit +} \ No newline at end of file diff --git a/android/app/src/main/java/com/simformsolutions/bagelandroid/ui/MainActivity.kt b/android/app/src/main/java/com/simformsolutions/bagelandroid/ui/MainActivity.kt new file mode 100644 index 0000000..ef0b3b4 --- /dev/null +++ b/android/app/src/main/java/com/simformsolutions/bagelandroid/ui/MainActivity.kt @@ -0,0 +1,46 @@ +package com.simformsolutions.bagelandroid.ui + +import android.os.Bundle +import androidx.activity.ComponentActivity +import androidx.activity.compose.setContent +import androidx.activity.enableEdgeToEdge +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.Scaffold +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.tooling.preview.Preview +import com.simformsolutions.bagelandroid.ui.main.MainRoute +import com.simformsolutions.bagelandroid.ui.main.MainScreen +import com.simformsolutions.bagelandroid.ui.theme.BagelAndroidTheme +import dagger.hilt.android.AndroidEntryPoint + +@AndroidEntryPoint +class MainActivity : ComponentActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + enableEdgeToEdge() + setContent { + BagelAndroidTheme { + Scaffold( + modifier = Modifier.fillMaxSize() + ) { innerPadding -> + MainApp( + modifier = Modifier + .padding(innerPadding), + ) + } + } + } + } +} + +@Composable +private fun MainApp( + modifier: Modifier = Modifier, +) { + MainRoute( + modifier = modifier + ) +} diff --git a/android/app/src/main/java/com/simformsolutions/bagelandroid/ui/main/MainScreen.kt b/android/app/src/main/java/com/simformsolutions/bagelandroid/ui/main/MainScreen.kt new file mode 100644 index 0000000..1ea9d3d --- /dev/null +++ b/android/app/src/main/java/com/simformsolutions/bagelandroid/ui/main/MainScreen.kt @@ -0,0 +1,66 @@ +package com.simformsolutions.bagelandroid.ui.main + +import android.content.res.Configuration +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.Button +import androidx.compose.material3.Scaffold +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.tooling.preview.Preview +import androidx.hilt.navigation.compose.hiltViewModel +import com.simformsolutions.bagelandroid.ui.theme.BagelAndroidTheme + +@Composable +fun MainRoute(modifier: Modifier = Modifier) { + val viewModel = hiltViewModel() + + val context = LocalContext.current + + MainScreen( + modifier = modifier, + onGetHotCoffee = viewModel::getHotCoffee, + ) +} + +@Composable +fun MainScreen( + modifier: Modifier = Modifier, + onGetHotCoffee: () -> Unit, +) { + Scaffold( + modifier = modifier + ) { innerPadding -> + Column( + modifier = Modifier + .padding(innerPadding) + .fillMaxSize(), + verticalArrangement = Arrangement.Center, + horizontalAlignment = Alignment.CenterHorizontally + ) { + Button( + onClick = onGetHotCoffee + ) { + Text("Get hot coffee") + } + } + } +} + +@Preview(showBackground = true) +@Preview(showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_YES) +@Composable +private fun MainScreenPreview() { + BagelAndroidTheme { + MainScreen( + modifier = Modifier + .fillMaxSize(), + onGetHotCoffee = {}, + ) + } +} diff --git a/android/app/src/main/java/com/simformsolutions/bagelandroid/ui/main/MainViewModel.kt b/android/app/src/main/java/com/simformsolutions/bagelandroid/ui/main/MainViewModel.kt new file mode 100644 index 0000000..2277db1 --- /dev/null +++ b/android/app/src/main/java/com/simformsolutions/bagelandroid/ui/main/MainViewModel.kt @@ -0,0 +1,32 @@ +package com.simformsolutions.bagelandroid.ui.main + +import androidx.lifecycle.ViewModel +import androidx.lifecycle.viewModelScope +import com.simformsolutions.bagelandroid.domain.repository.NetworkRepository +import dagger.hilt.android.lifecycle.HiltViewModel +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.flow.MutableSharedFlow +import kotlinx.coroutines.flow.asSharedFlow +import kotlinx.coroutines.launch +import javax.inject.Inject + +@HiltViewModel +class MainViewModel @Inject constructor( + private val networkRepository: NetworkRepository +) : ViewModel() { + + private val _resetCommand = MutableSharedFlow() + val resetCommand = _resetCommand.asSharedFlow() + + fun getHotCoffee() { + viewModelScope.launch(Dispatchers.Default) { + networkRepository.getHotCoffee() + } + } + + fun resetAndRestart() { + viewModelScope.launch { + _resetCommand.emit(Unit) + } + } +} \ No newline at end of file diff --git a/android/app/src/main/java/com/simformsolutions/bagelandroid/ui/theme/Color.kt b/android/app/src/main/java/com/simformsolutions/bagelandroid/ui/theme/Color.kt new file mode 100644 index 0000000..426d8bd --- /dev/null +++ b/android/app/src/main/java/com/simformsolutions/bagelandroid/ui/theme/Color.kt @@ -0,0 +1,11 @@ +package com.simformsolutions.bagelandroid.ui.theme + +import androidx.compose.ui.graphics.Color + +val Purple80 = Color(0xFFD0BCFF) +val PurpleGrey80 = Color(0xFFCCC2DC) +val Pink80 = Color(0xFFEFB8C8) + +val Purple40 = Color(0xFF6650a4) +val PurpleGrey40 = Color(0xFF625b71) +val Pink40 = Color(0xFF7D5260) \ No newline at end of file diff --git a/android/app/src/main/java/com/simformsolutions/bagelandroid/ui/theme/Theme.kt b/android/app/src/main/java/com/simformsolutions/bagelandroid/ui/theme/Theme.kt new file mode 100644 index 0000000..70e1391 --- /dev/null +++ b/android/app/src/main/java/com/simformsolutions/bagelandroid/ui/theme/Theme.kt @@ -0,0 +1,58 @@ +package com.simformsolutions.bagelandroid.ui.theme + +import android.app.Activity +import android.os.Build +import androidx.compose.foundation.isSystemInDarkTheme +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.darkColorScheme +import androidx.compose.material3.dynamicDarkColorScheme +import androidx.compose.material3.dynamicLightColorScheme +import androidx.compose.material3.lightColorScheme +import androidx.compose.runtime.Composable +import androidx.compose.ui.platform.LocalContext + +private val DarkColorScheme = darkColorScheme( + primary = Purple80, + secondary = PurpleGrey80, + tertiary = Pink80 +) + +private val LightColorScheme = lightColorScheme( + primary = Purple40, + secondary = PurpleGrey40, + tertiary = Pink40 + + /* Other default colors to override + background = Color(0xFFFFFBFE), + surface = Color(0xFFFFFBFE), + onPrimary = Color.White, + onSecondary = Color.White, + onTertiary = Color.White, + onBackground = Color(0xFF1C1B1F), + onSurface = Color(0xFF1C1B1F), + */ +) + +@Composable +fun BagelAndroidTheme( + darkTheme: Boolean = isSystemInDarkTheme(), + // Dynamic color is available on Android 12+ + dynamicColor: Boolean = true, + content: @Composable () -> Unit +) { + val colorScheme = when { + dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { + val context = LocalContext.current + if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context) + } + + darkTheme -> DarkColorScheme + else -> LightColorScheme + } + + MaterialTheme( + colorScheme = colorScheme, + typography = Typography, + content = content + ) +} \ No newline at end of file diff --git a/android/app/src/main/java/com/simformsolutions/bagelandroid/ui/theme/Type.kt b/android/app/src/main/java/com/simformsolutions/bagelandroid/ui/theme/Type.kt new file mode 100644 index 0000000..a9a6bf6 --- /dev/null +++ b/android/app/src/main/java/com/simformsolutions/bagelandroid/ui/theme/Type.kt @@ -0,0 +1,34 @@ +package com.simformsolutions.bagelandroid.ui.theme + +import androidx.compose.material3.Typography +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.sp + +// Set of Material typography styles to start with +val Typography = Typography( + bodyLarge = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Normal, + fontSize = 16.sp, + lineHeight = 24.sp, + letterSpacing = 0.5.sp + ) + /* Other default text styles to override + titleLarge = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Normal, + fontSize = 22.sp, + lineHeight = 28.sp, + letterSpacing = 0.sp + ), + labelSmall = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Medium, + fontSize = 11.sp, + lineHeight = 16.sp, + letterSpacing = 0.5.sp + ) + */ +) \ No newline at end of file diff --git a/android/app/src/main/res/drawable/ic_launcher_background.xml b/android/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/android/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android/app/src/main/res/drawable/ic_launcher_foreground.xml b/android/app/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/android/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/mipmap-anydpi/ic_launcher.xml b/android/app/src/main/res/mipmap-anydpi/ic_launcher.xml new file mode 100644 index 0000000..6f3b755 --- /dev/null +++ b/android/app/src/main/res/mipmap-anydpi/ic_launcher.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/mipmap-anydpi/ic_launcher_round.xml b/android/app/src/main/res/mipmap-anydpi/ic_launcher_round.xml new file mode 100644 index 0000000..6f3b755 --- /dev/null +++ b/android/app/src/main/res/mipmap-anydpi/ic_launcher_round.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/android/app/src/main/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 0000000..c209e78 Binary files /dev/null and b/android/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 0000000..b2dfe3d Binary files /dev/null and b/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/android/app/src/main/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 0000000..4f0f1d6 Binary files /dev/null and b/android/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp new file mode 100644 index 0000000..62b611d Binary files /dev/null and b/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 0000000..948a307 Binary files /dev/null and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..1b9a695 Binary files /dev/null and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp new file mode 100644 index 0000000..28d4b77 Binary files /dev/null and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9287f50 Binary files /dev/null and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 0000000..aa7d642 Binary files /dev/null and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9126ae3 Binary files /dev/null and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/android/app/src/main/res/values/colors.xml b/android/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..f8c6127 --- /dev/null +++ b/android/app/src/main/res/values/colors.xml @@ -0,0 +1,10 @@ + + + #FFBB86FC + #FF6200EE + #FF3700B3 + #FF03DAC5 + #FF018786 + #FF000000 + #FFFFFFFF + \ No newline at end of file diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..7ce6977 --- /dev/null +++ b/android/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + BagelAndroid + \ No newline at end of file diff --git a/android/app/src/main/res/values/themes.xml b/android/app/src/main/res/values/themes.xml new file mode 100644 index 0000000..448f151 --- /dev/null +++ b/android/app/src/main/res/values/themes.xml @@ -0,0 +1,5 @@ + + + +