Skip to content

Commit

Permalink
Merge pull request #1 from AdityaBavadekar/dev
Browse files Browse the repository at this point in the history
Merge Dev
  • Loading branch information
AdityaBavadekar authored Aug 8, 2024
2 parents 1530312 + 422749b commit 69b51c1
Show file tree
Hide file tree
Showing 224 changed files with 19,196 additions and 299 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @AdityaBavadekar
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ build/

# Local configuration file (sdk path, etc)
local.properties
sec.properties

# Log/OS Files
*.log
Expand All @@ -18,8 +19,7 @@ output.json
.DS_Store

# IntelliJ
*.iml
.idea/
#.idea/
misc.xml
deploymentTargetDropDown.xml
render.experimental.xml
Expand Down
7 changes: 7 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# “Harmony” - Gemini API Developer Competition Solution App

<img src="/screenshots/cap_1.png" height="500"></img> <img src="/screenshots/cap_2.png" height="500"></img> <img src="/screenshots/cap_3.png" height="500"></img> <img src="/screenshots/cap_4.png" height="500"></img>


Competition - https://ai.google.dev/competition

Last date of submission - August 12, 2024
Expand Down
82 changes: 81 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,39 @@
import java.io.FileInputStream
import java.util.Properties

/*
* Copyright 2024 Aditya Bavadekar
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.jetbrains.kotlin.android)
alias(libs.plugins.google.devtools.ksp)
alias(libs.plugins.google.gms.google.services)
id("kotlin-parcelize")
}


val secProperties = Properties()
val secPropertiesFile = rootProject.file("sec.properties")
if (secPropertiesFile.exists()) {
secProperties.load(FileInputStream(secPropertiesFile))
}

fun wrap(s: String): String {
return "\"" + s + "\""
}

android {
Expand All @@ -12,12 +45,22 @@ android {
minSdk = 24
targetSdk = 34
versionCode = 1
versionName = "1.0.0-alpha01"
versionName = "0.0.2-alpha01"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary = true
}

if (secPropertiesFile.exists()) {
buildConfigField(
"String",
"WEATHER_API_KEY",
wrap(secProperties.getProperty("weather_api_key"))
)
} else {
buildConfigField("String", "WEATHER_API_KEY", wrap("<apikey>"))
}
}

buildTypes {
Expand All @@ -42,6 +85,7 @@ android {
buildFeatures {
compose = true
viewBinding = true
buildConfig = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.5.1"
Expand All @@ -63,11 +107,47 @@ dependencies {
implementation(libs.androidx.ui.graphics)
implementation(libs.androidx.ui.tooling.preview)
implementation(libs.androidx.material3)
implementation(libs.androidx.compose.material.iconsExtended)
implementation(libs.androidx.core.splashscreen)
implementation(libs.androidx.navigation.compose)
implementation(libs.androidx.lifecycle.viewmodel.compose)
implementation(libs.androidx.credentials)
implementation(libs.androidx.credentials.play.services.auth)

implementation(platform(libs.firebase.bom))
implementation(libs.firebase.auth)
implementation(libs.firebase.firestore)

runtimeOnly(libs.kotlinx.coroutines.play.services)
implementation(libs.kotlinx.coroutines.core)
implementation(libs.kotlinx.coroutines.android)

testImplementation(libs.junit)
testImplementation(libs.jetbrains.kotlinx.coroutines.test)
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)

implementation(libs.snapper)
implementation(libs.volley)
implementation(libs.numberpicker)
implementation(libs.vico.compose.m3)
implementation(libs.vico.core)
implementation(libs.osmdroid.android)
implementation(libs.lottie.compose)
implementation(libs.play.services.auth)
implementation(libs.googleid)
implementation(libs.play.services.location)

implementation(libs.androidx.room.runtime)
ksp(libs.androidx.room.compiler)
implementation(libs.androidx.room.ktx)
implementation(libs.google.code.gson)
implementation(libs.retrofit)
implementation(libs.retrofit.converter.gson)


}
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
/*
* Copyright 2024 Aditya Bavadekar
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.adityabavadekar.harmony

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
Expand Down
102 changes: 99 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2024 Aditya Bavadekar
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION" />

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />

<uses-feature
android:name="android.hardware.sensor.stepcounter"
android:required="false" />

<uses-feature
android:name="android.hardware.location"
android:required="false" />

<uses-feature
android:name="android.hardware.sensor.compass"
android:required="false" />

<queries>
<intent>
<action android:name="android.intent.action.TTS_SERVICE" />
</intent>
</queries>

<application
android:name=".HarmonyApplication"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
Expand All @@ -13,16 +61,64 @@
android:theme="@style/Theme.Harmony"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:name=".ui.LauncherActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.Harmony">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

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

<activity
android:name=".ui.signin.SigninActivity"
android:exported="false"
android:theme="@style/Theme.Harmony" />

<activity
android:name=".ui.main.MainActivity"
android:exported="false"
android:theme="@style/Theme.Harmony" />

<activity
android:name=".ui.settings.SettingsActivity"
android:exported="false"
android:theme="@style/Theme.Harmony" />


<activity
android:name=".ui.common.PseudoFrontActivity"
android:exported="false"
android:theme="@style/Theme.Harmony" />

<activity
android:name=".ui.livetracking.LiveTrackingActivity"
android:exported="false"
android:theme="@style/Theme.Harmony" />

<activity
android:name=".ui.livetracking.LiveTrackingActivityV2"
android:exported="false"
android:theme="@style/Theme.Harmony" />

<activity
android:name=".ui.wdetails.WorkoutDetailActivity"
android:exported="false"
android:theme="@style/Theme.Harmony" />

<activity
android:name=".ui.permissions.PermissionsRationaleActivity"
android:theme="@style/Theme.Transparent" />

<service
android:name=".ui.livetracking.service.LiveTrackerService"
android:foregroundServiceType="location" />

<service
android:name=".ui.livetracking.service.LiveTrackerForegroundService"
android:foregroundServiceType="location" />

</application>

</manifest>
Binary file added app/src/main/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
* Copyright 2024 Aditya Bavadekar
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.adityabavadekar.harmony

import android.app.Application
import android.app.NotificationChannel
import android.app.NotificationManager
import android.content.Context
import android.os.Build
import android.util.Log
import androidx.annotation.RequiresApi
import com.adityabavadekar.harmony.database.HarmonyRoomDatabase
import com.adityabavadekar.harmony.database.repo.AccountRepository
import com.adityabavadekar.harmony.database.repo.WorkoutsRepository
import com.adityabavadekar.harmony.ui.livetracking.service.LiveTrackerService

class HarmonyApplication : Application() {

private lateinit var database: HarmonyRoomDatabase

override fun onCreate() {
super.onCreate()
Log.d(TAG, "onCreate: Application")

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
createNotificationChannels()
Log.d(TAG, "onCreate: NotificationChannels Created")
}

database = HarmonyRoomDatabase.getDatabase(this)
Log.d(TAG, "onCreate: Database initialised")
}

fun getDatabase() = database

fun getAccountRepository(): AccountRepository {
return AccountRepository.getInstance(database.accountDao())
}

fun getWorkoutRepository(): WorkoutsRepository {
return WorkoutsRepository.getInstance(database.workoutsDao())
}


@RequiresApi(Build.VERSION_CODES.O)
private fun createNotificationChannels() {
val locationServiceChannel = NotificationChannel(
LiveTrackerService.LOCATION_NOTIFICATION_CHANNEL_ID,
"Location notifier service",
NotificationManager.IMPORTANCE_LOW
)

val notificationManager =
getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
notificationManager.createNotificationChannel(locationServiceChannel)
}

companion object {
private const val TAG = "[HarmonyApplication]"
}

}
Loading

0 comments on commit 69b51c1

Please sign in to comment.