-
Notifications
You must be signed in to change notification settings - Fork 1
Android Codebase Setup #150
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
Open
xleonx0x
wants to merge
22
commits into
main
Choose a base branch
from
android_setup
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
4ad1eb0
feat: update ci pipeline to trigger based on file changes in android/ios
xleonx0x 7566550
feat(android): setup basic android codebase
xleonx0x e310ffd
chore: added separate jobs for lint, build, tests
xleonx0x dd01548
Chore: added basic colors
ff73fee
refactor: refactored the project structure
PPigeon98 4d0e173
refactor: added a tests folder
PPigeon98 2e08344
feat(android): added graphql queries and schema
xleonx0x 315736a
feat(android): added graphql client
xleonx0x 80e0d1b
feat(android): added buildings model and repository
xleonx0x 819472f
feat(android): added simple building screen and view model
xleonx0x 8ad7b34
feat(android): added main UI entry
xleonx0x a61d9c2
chore(android): added gradle dependencies
xleonx0x bd16479
chore(android): removed Koin library, to now use manual dependency in…
xleonx0x 7d50b60
Merge branch 'main' of github.com:devsoc-unsw/freerooms-mobile into a…
xleonx0x 708d2a7
chore(android): ran formatter and fixed linting
xleonx0x 403c990
chore(android): fix ci
xleonx0x 9adb4e3
chore(android): fix test by mocking apollo exception
xleonx0x f66a4ce
feat: created proper icons for the app
PPigeon98 82a8dbf
chore: remove random .idea folder
xleonx0x eb919f1
refactor(android): split into multi-module app
xleonx0x 54b7e79
chore(android): run formatter
xleonx0x 9bc3c8f
feat(android): add git hooks for android codebase
xleonx0x File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| name: Android CI | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [ main ] | ||
| paths: | ||
| - 'android/**' | ||
| - '.github/workflows/android.yml' | ||
|
|
||
| jobs: | ||
| Lint: | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: android | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: set up JDK 17 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: '17' | ||
| distribution: 'temurin' | ||
| cache: gradle | ||
| - name: Run Linter and Formatter | ||
| run: ./gradlew detekt && ./gradlew ktfmtCheck | ||
| Build: | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: android | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: set up JDK 17 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: '17' | ||
| distribution: 'temurin' | ||
| cache: gradle | ||
| - name: Build Apk | ||
| run: ./gradlew assembleDebug | ||
| Tests: | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: android | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: set up JDK 17 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: '17' | ||
| distribution: 'temurin' | ||
| cache: gradle | ||
| - name: Run Tests | ||
| run: ./gradlew test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| *.iml | ||
| .gradle | ||
| /local.properties | ||
| /.idea/caches | ||
| /.idea/libraries | ||
| /.idea/modules.xml | ||
| /.idea/workspace.xml | ||
| /.idea/navEditor.xml | ||
| /.idea/assetWizardSettings.xml | ||
| .DS_Store | ||
| /build | ||
| /captures | ||
| .externalNativeBuild | ||
| .cxx | ||
| local.properties | ||
| # Gradle files | ||
| .gradle/ | ||
| build/ | ||
|
|
||
| # Local configuration file (sdk path, etc) | ||
| local.properties | ||
|
|
||
| # Log/OS Files | ||
| *.log | ||
|
|
||
| # Android Studio generated files and folders | ||
| captures/ | ||
| .externalNativeBuild/ | ||
| .cxx/ | ||
| *.aab | ||
| *.apk | ||
| output-metadata.json | ||
|
|
||
| # IntelliJ | ||
| *.iml | ||
| .idea/ | ||
| misc.xml | ||
| deploymentTargetDropDown.xml | ||
| render.experimental.xml | ||
|
|
||
| # Keystore files | ||
| *.jks | ||
| *.keystore | ||
|
|
||
| # Google Services (e.g. APIs or Firebase) | ||
| google-services.json | ||
|
|
||
| # Android Profiling | ||
| *.hprof |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| /build |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| plugins { | ||
| alias(libs.plugins.android.application) | ||
| alias(libs.plugins.kotlin.compose) | ||
| id("dev.detekt") version("2.0.0-alpha.2") | ||
| alias(libs.plugins.ktfmt) apply false | ||
| } | ||
|
|
||
| detekt { | ||
| buildUponDefaultConfig = true | ||
|
xleonx0x marked this conversation as resolved.
|
||
| } | ||
|
|
||
| android { | ||
| namespace = "com.devsoc.freerooms" | ||
| compileSdk { | ||
| version = release(36) { | ||
| minorApiLevel = 1 | ||
| } | ||
| } | ||
|
|
||
| defaultConfig { | ||
| applicationId = "com.devsoc.freerooms" | ||
| minSdk = 29 | ||
| targetSdk = 36 | ||
| versionCode = 1 | ||
| versionName = "1.0" | ||
|
|
||
| testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" | ||
| } | ||
|
|
||
| buildTypes { | ||
| release { | ||
| isMinifyEnabled = false | ||
| proguardFiles( | ||
| getDefaultProguardFile("proguard-android-optimize.txt"), | ||
| "proguard-rules.pro" | ||
| ) | ||
| } | ||
| } | ||
| compileOptions { | ||
| sourceCompatibility = JavaVersion.VERSION_11 | ||
| targetCompatibility = JavaVersion.VERSION_11 | ||
| } | ||
| buildFeatures { | ||
| compose = true | ||
| } | ||
| } | ||
|
|
||
| dependencies { | ||
| 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.compose.ui) | ||
| implementation(libs.androidx.compose.ui.graphics) | ||
| implementation(libs.androidx.compose.ui.tooling.preview) | ||
| implementation(libs.androidx.compose.material3) | ||
| testImplementation(libs.junit) | ||
| androidTestImplementation(libs.androidx.junit) | ||
| androidTestImplementation(libs.androidx.espresso.core) | ||
| androidTestImplementation(platform(libs.androidx.compose.bom)) | ||
| androidTestImplementation(libs.androidx.compose.ui.test.junit4) | ||
| debugImplementation(libs.androidx.compose.ui.tooling) | ||
| debugImplementation(libs.androidx.compose.ui.test.manifest) | ||
| detektPlugins(libs.detekt.compose.rules) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
| xmlns:tools="http://schemas.android.com/tools"> | ||
|
|
||
| <application | ||
| android:allowBackup="true" | ||
| android:dataExtractionRules="@xml/data_extraction_rules" | ||
| android:fullBackupContent="@xml/backup_rules" | ||
| android:icon="@mipmap/ic_launcher" | ||
| android:label="@string/app_name" | ||
| android:roundIcon="@mipmap/ic_launcher_round" | ||
| android:supportsRtl="true" | ||
| android:theme="@style/Theme.Freerooms"> | ||
| <activity | ||
| android:name=".MainActivity" | ||
| android:exported="true" | ||
| android:label="@string/app_name" | ||
| android:theme="@style/Theme.Freerooms"> | ||
| <intent-filter> | ||
| <action android:name="android.intent.action.MAIN" /> | ||
|
|
||
| <category android:name="android.intent.category.LAUNCHER" /> | ||
| </intent-filter> | ||
| </activity> | ||
| </application> | ||
|
|
||
| </manifest> |
47 changes: 47 additions & 0 deletions
47
android/app/src/main/java/com/devsoc/freerooms/MainActivity.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| package com.devsoc.freerooms | ||
|
|
||
| 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.material3.Text | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.tooling.preview.Preview | ||
| import com.devsoc.freerooms.ui.theme.FreeroomsTheme | ||
|
|
||
| class MainActivity : ComponentActivity() { | ||
| override fun onCreate(savedInstanceState: Bundle?) { | ||
| super.onCreate(savedInstanceState) | ||
| enableEdgeToEdge() | ||
| setContent { | ||
| FreeroomsTheme { | ||
| Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding -> | ||
| Greeting( | ||
| name = "Android", | ||
| modifier = Modifier.padding(innerPadding) | ||
| ) | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @Composable | ||
| fun Greeting(name: String, modifier: Modifier = Modifier) { | ||
| Text( | ||
| text = "Hello $name!", | ||
| modifier = modifier | ||
| ) | ||
| } | ||
|
|
||
| @Preview(showBackground = true) | ||
| @Composable | ||
| private fun GreetingPreview() { | ||
| FreeroomsTheme { | ||
| Greeting("Android") | ||
| } | ||
| } |
11 changes: 11 additions & 0 deletions
11
android/app/src/main/java/com/devsoc/freerooms/ui/theme/Color.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| package com.devsoc.freerooms.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) |
58 changes: 58 additions & 0 deletions
58
android/app/src/main/java/com/devsoc/freerooms/ui/theme/Theme.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| package com.devsoc.freerooms.ui.theme | ||
|
|
||
| import android.app.Activity | ||
|
xleonx0x marked this conversation as resolved.
Outdated
|
||
| 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 FreeroomsTheme( | ||
| 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 | ||
| ) | ||
| } | ||
34 changes: 34 additions & 0 deletions
34
android/app/src/main/java/com/devsoc/freerooms/ui/theme/Type.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| package com.devsoc.freerooms.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 | ||
| ) | ||
| */ | ||
| ) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.