diff --git a/RandoTracker/.gitignore b/RandoTracker/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..aa724b77071afcbd9bb398053e05adaf7ac9405a --- /dev/null +++ b/RandoTracker/.gitignore @@ -0,0 +1,15 @@ +*.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 diff --git a/RandoTracker/.idea/.gitignore b/RandoTracker/.idea/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..eaf91e2ac647df635a09f01b8a2a254252aae8d7 --- /dev/null +++ b/RandoTracker/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/RandoTracker/.idea/compiler.xml b/RandoTracker/.idea/compiler.xml new file mode 100644 index 0000000000000000000000000000000000000000..7d7ec2eaff970ea468433aae59edca2f9f6ae6a5 --- /dev/null +++ b/RandoTracker/.idea/compiler.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="CompilerConfiguration"> + <bytecodeTargetLevel target="11" /> + </component> +</project> \ No newline at end of file diff --git a/RandoTracker/.idea/gradle.xml b/RandoTracker/.idea/gradle.xml new file mode 100644 index 0000000000000000000000000000000000000000..93e6e10c08288d11149e4b6f2ec65a13c2443269 --- /dev/null +++ b/RandoTracker/.idea/gradle.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="GradleMigrationSettings" migrationVersion="1" /> + <component name="GradleSettings"> + <option name="linkedExternalProjectsSettings"> + <GradleProjectSettings> + <option name="testRunner" value="GRADLE" /> + <option name="distributionType" value="DEFAULT_WRAPPED" /> + <option name="externalProjectPath" value="$PROJECT_DIR$" /> + <option name="modules"> + <set> + <option value="$PROJECT_DIR$" /> + <option value="$PROJECT_DIR$/app" /> + </set> + </option> + <option name="resolveModulePerSourceSet" value="false" /> + </GradleProjectSettings> + </option> + </component> +</project> \ No newline at end of file diff --git a/RandoTracker/.idea/misc.xml b/RandoTracker/.idea/misc.xml new file mode 100644 index 0000000000000000000000000000000000000000..554909a0df80290735d4dc5d3e982402112440dd --- /dev/null +++ b/RandoTracker/.idea/misc.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="DesignSurface"> + <option name="filePathToZoomLevelMap"> + <map> + <entry key="..\:/Users/benja/AndroidStudioProjects/RandoTracker/app/src/main/res/drawable-v24/ic_launcher_foreground.xml" value="0.1734375" /> + <entry key="..\:/Users/benja/AndroidStudioProjects/RandoTracker/app/src/main/res/drawable/ic_baseline_directions_walk_24.xml" value="0.3828125" /> + <entry key="..\:/Users/benja/AndroidStudioProjects/RandoTracker/app/src/main/res/drawable/ic_baseline_map_24.xml" value="0.1734375" /> + <entry key="..\:/Users/benja/AndroidStudioProjects/RandoTracker/app/src/main/res/drawable/ic_launcher_background.xml" value="0.1734375" /> + <entry key="..\:/Users/benja/AndroidStudioProjects/RandoTracker/app/src/main/res/drawable/map_black.xml" value="0.1734375" /> + <entry key="..\:/Users/benja/AndroidStudioProjects/RandoTracker/app/src/main/res/drawable/marker.xml" value="0.22135416666666666" /> + <entry key="..\:/Users/benja/AndroidStudioProjects/RandoTracker/app/src/main/res/drawable/walk.xml" value="0.22135416666666666" /> + <entry key="..\:/Users/benja/AndroidStudioProjects/RandoTracker/app/src/main/res/drawable/walk_black.xml" value="0.1734375" /> + <entry key="..\:/Users/benja/AndroidStudioProjects/RandoTracker/app/src/main/res/layout/activity_maps.xml" value="0.34057971014492755" /> + <entry key="..\:/Users/benja/AndroidStudioProjects/RandoTracker/app/src/main/res/layout/add_marker_dialog.xml" value="0.36666666666666664" /> + <entry key="..\:/Users/benja/AndroidStudioProjects/RandoTracker/app/src/main/res/layout/fragment_map.xml" value="0.33" /> + <entry key="..\:/Users/benja/AndroidStudioProjects/RandoTracker/app/src/main/res/layout/fragment_rando.xml" value="0.36666666666666664" /> + <entry key="..\:/Users/benja/AndroidStudioProjects/RandoTracker/app/src/main/res/layout/fragment_randon.xml" value="0.36666666666666664" /> + <entry key="..\:/Users/benja/AndroidStudioProjects/RandoTracker/app/src/main/res/layout/item_run.xml" value="0.31657608695652173" /> + <entry key="..\:/Users/benja/AndroidStudioProjects/RandoTracker/app/src/main/res/layout/main_fragment.xml" value="0.25" /> + <entry key="..\:/Users/benja/AndroidStudioProjects/RandoTracker/app/src/main/res/layout/rando_activity.xml" value="0.34057971014492755" /> + <entry key="..\:/Users/benja/AndroidStudioProjects/RandoTracker/app/src/main/res/layout/save.xml" value="0.28541666666666665" /> + <entry key="..\:/Users/benja/AndroidStudioProjects/RandoTracker/app/src/main/res/menu/menu.xml" value="0.5" /> + <entry key="..\:/Users/benja/AndroidStudioProjects/RandoTracker/app/src/main/res/menu/menu_bottom_nav.xml" value="0.35260416666666666" /> + </map> + </option> + </component> + <component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> + <output url="file://$PROJECT_DIR$/build/classes" /> + </component> + <component name="ProjectType"> + <option name="id" value="Android" /> + </component> +</project> \ No newline at end of file diff --git a/RandoTracker/app/.gitignore b/RandoTracker/app/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..42afabfd2abebf31384ca7797186a27a4b7dbee8 --- /dev/null +++ b/RandoTracker/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/RandoTracker/app/build.gradle b/RandoTracker/app/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..a07dc94d7077d3a9acb9d4a186898d3a540c5400 --- /dev/null +++ b/RandoTracker/app/build.gradle @@ -0,0 +1,89 @@ +plugins { + id 'com.android.application' + id 'kotlin-android' + id 'kotlin-kapt' +} +apply plugin: 'kotlin-kapt' +apply plugin: 'com.android.application' +apply plugin: 'dagger.hilt.android.plugin' + +android { + compileSdk 31 + + defaultConfig { + applicationId "com.example.randotracker" + minSdk 21 + targetSdk 31 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + 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 { + viewBinding true + } +} + +dependencies { + + + // Activity KTX for viewModels() + implementation "androidx.activity:activity-ktx:1.4.0" + + // Dagger - Hilt + implementation 'com.google.dagger:hilt-android:2.39.1' + kapt 'com.google.dagger:hilt-compiler:2.39.1' + + kapt "androidx.room:room-compiler:2.4.1" + implementation 'androidx.room:room-common:2.4.1' + implementation 'androidx.room:room-ktx:2.4.1' + + implementation 'androidx.fragment:fragment-ktx:1.4.1' + implementation 'androidx.core:core-ktx:1.7.0' + implementation 'androidx.appcompat:appcompat:1.4.1' + implementation 'com.google.android.material:material:1.5.0' + implementation 'com.google.android.gms:play-services-maps:18.0.2' + implementation 'androidx.constraintlayout:constraintlayout:2.1.3' + implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.0' + implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0' + implementation 'androidx.navigation:navigation-runtime-ktx:2.4.0' + implementation 'androidx.legacy:legacy-support-v4:1.0.0' + implementation 'com.google.android.gms:play-services-location:19.0.1' + implementation 'androidx.lifecycle:lifecycle-service:2.4.0' + + implementation 'javax.inject:javax.inject:1' + implementation 'junit:junit:4.13.2' + implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0" + testImplementation 'junit:junit:' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' + + implementation 'com.google.dagger:hilt-android:2.40.5' + kapt 'com.google.dagger:hilt-compiler:2.40.5' + + // For instrumentation tests + androidTestImplementation 'com.google.dagger:hilt-android-testing:2.40.5' + kaptAndroidTest 'com.google.dagger:hilt-compiler:2.40.5' + + // For local unit tests + testImplementation 'com.google.dagger:hilt-android-testing:2.40.5' + kaptTest 'com.google.dagger:hilt-compiler:2.40.5' +} + +kapt { + correctErrorTypes true +} \ No newline at end of file diff --git a/RandoTracker/app/proguard-rules.pro b/RandoTracker/app/proguard-rules.pro new file mode 100644 index 0000000000000000000000000000000000000000..481bb434814107eb79d7a30b676d344b0df2f8ce --- /dev/null +++ b/RandoTracker/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/RandoTracker/app/src/androidTest/java/com/example/randotracker/ExampleInstrumentedTest.kt b/RandoTracker/app/src/androidTest/java/com/example/randotracker/ExampleInstrumentedTest.kt new file mode 100644 index 0000000000000000000000000000000000000000..2c9b2be95c5551e6594f4197d20abe72955085b9 --- /dev/null +++ b/RandoTracker/app/src/androidTest/java/com/example/randotracker/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package com.example.randotracker + +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.example.randotracker", appContext.packageName) + } +} \ No newline at end of file diff --git a/RandoTracker/app/src/debug/res/values/google_maps_api.xml b/RandoTracker/app/src/debug/res/values/google_maps_api.xml new file mode 100644 index 0000000000000000000000000000000000000000..aec78fedc6bcd970055209300198987b240c3bea --- /dev/null +++ b/RandoTracker/app/src/debug/res/values/google_maps_api.xml @@ -0,0 +1,24 @@ +<resources> + <!-- + TODO: Before you run your application, you need a Google Maps API key. + + To get one, follow this link, follow the directions and press "Create" at the end: + + https://console.developers.google.com/flows/enableapi?apiid=maps_android_backend&keyType=CLIENT_SIDE_ANDROID&r=47:20:1E:37:B4:EB:31:C6:E5:19:C3:DC:30:6C:F3:86:A9:DD:94:26%3Bcom.example.randotracker + + You can also add your credentials to an existing key, using these values: + + Package name: + com.example.randotracker + + SHA-1 certificate fingerprint: + 47:20:1E:37:B4:EB:31:C6:E5:19:C3:DC:30:6C:F3:86:A9:DD:94:26 + + Alternatively, follow the directions here: + https://developers.google.com/maps/documentation/android/start#get-key + + Once you have your key (it starts with "AIza"), replace the "google_maps_key" + string in this file. + --> + <string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">AIzaSyA4XEr53RNiJ40hSYSJJ4d-5nDUZGK8Bbc</string> +</resources> \ No newline at end of file diff --git a/RandoTracker/app/src/main/AndroidManifest.xml b/RandoTracker/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000000000000000000000000000000000000..2dcdf710a0378ced0d894cb9975ce24eb853c994 --- /dev/null +++ b/RandoTracker/app/src/main/AndroidManifest.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + package="com.example.randotracker"> + + <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> + <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> + <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" /> + <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> + + + <application + android:name =".MainActi" + android:allowBackup="true" + android:icon="@mipmap/ic_launcher" + android:label="@string/app_name" + android:roundIcon="@mipmap/ic_launcher_round" + android:supportsRtl="true" + android:theme="@style/Theme.RandoTracker" + tools:ignore="AllowBackup"> + + <service + android:name=".service.NavigationService" + android:enabled="true" + android:exported="false" /> + + <meta-data + android:name="com.google.android.geo.API_KEY" + android:value="@string/google_maps_key" /> + + <activity + android:name=".Randonne" + android:exported="true" + android:label="Rando"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + </application> + +</manifest> \ No newline at end of file diff --git a/RandoTracker/app/src/main/java/com/example/randotracker/AppModule.kt b/RandoTracker/app/src/main/java/com/example/randotracker/AppModule.kt new file mode 100644 index 0000000000000000000000000000000000000000..df6dd7d592d267c632bd6cff97259e6581856479 --- /dev/null +++ b/RandoTracker/app/src/main/java/com/example/randotracker/AppModule.kt @@ -0,0 +1,30 @@ +package com.example.randotracker + +import android.content.Context +import androidx.room.Room +import com.example.randotracker.database.RandoDb +import dagger.Module +import dagger.Provides +import dagger.hilt.InstallIn +import dagger.hilt.components.SingletonComponent +import dagger.hilt.android.qualifiers.ApplicationContext +import javax.inject.Singleton + +@Module +@InstallIn(SingletonComponent::class) +object AppModule { + + @Singleton + @Provides + fun provideRandoDatabase( + @ApplicationContext app: Context + ) = Room.databaseBuilder( + app, + RandoDb::class.java, + "RandoDb" + ).build() + + @Singleton + @Provides + fun provideRunDB(db: RandoDb) = db.getDB() +} \ No newline at end of file diff --git a/RandoTracker/app/src/main/java/com/example/randotracker/Constants.kt b/RandoTracker/app/src/main/java/com/example/randotracker/Constants.kt new file mode 100644 index 0000000000000000000000000000000000000000..9f1e7560a9d7c921b3e26ed9b8e3d262b30a170a --- /dev/null +++ b/RandoTracker/app/src/main/java/com/example/randotracker/Constants.kt @@ -0,0 +1,17 @@ +package com.example.randotracker + +object Constants { + + const val NOTIFICATION_CHANNEL_ID = "Walker_channel" + const val NOTIFICATION_CHANNEL_NAME = "Walker" + const val NOTIFICATION_ID = 1 + + const val ACTION_START_OR_RESUME_SERVICE = "ACTION_START_OR_RESUME_SERVICE" + const val ACTION_PAUSE_SERVICE = "ACTION_START_OR_RESUME_SERVICE" + const val ACTION_STOP_SERVICE = "ACTION_START_OR_RESUME_SERVICE" + + + const val LOCATION_UPDATE_INTERVAL = 3000L + const val SHORTEST_UPDATE_INTERVAL = 2000L + +} \ No newline at end of file diff --git a/RandoTracker/app/src/main/java/com/example/randotracker/Data.kt b/RandoTracker/app/src/main/java/com/example/randotracker/Data.kt new file mode 100644 index 0000000000000000000000000000000000000000..6b6d109b29b44585931c7df476369e53bd17c75f --- /dev/null +++ b/RandoTracker/app/src/main/java/com/example/randotracker/Data.kt @@ -0,0 +1,10 @@ +package com.example.randotracker + + +class Data constructor(t: String, tim: Long, dist: Int) { + + var title: String = t + var time: Long = tim + var distance: Int = dist + +} \ No newline at end of file diff --git a/RandoTracker/app/src/main/java/com/example/randotracker/MainActi.kt b/RandoTracker/app/src/main/java/com/example/randotracker/MainActi.kt new file mode 100644 index 0000000000000000000000000000000000000000..2d7244f380685e4301a01195d3133ddbcb5e1a06 --- /dev/null +++ b/RandoTracker/app/src/main/java/com/example/randotracker/MainActi.kt @@ -0,0 +1,15 @@ +package com.example.randotracker + +import android.app.Application +import androidx.room.Room +import com.example.randotracker.database.RandoDb +import dagger.hilt.android.HiltAndroidApp + + +@HiltAndroidApp +class MainActi: Application() { + + override fun onCreate() { + super.onCreate() + } +} \ No newline at end of file diff --git a/RandoTracker/app/src/main/java/com/example/randotracker/RandoViewModel.kt b/RandoTracker/app/src/main/java/com/example/randotracker/RandoViewModel.kt new file mode 100644 index 0000000000000000000000000000000000000000..0d200e20328340d7c991a457b43842dec3f44120 --- /dev/null +++ b/RandoTracker/app/src/main/java/com/example/randotracker/RandoViewModel.kt @@ -0,0 +1,53 @@ +package com.example.randotracker + +import androidx.lifecycle.* +import com.example.randotracker.database.RandoTable +import com.example.randotracker.service.NavigationService +import com.example.randotracker.ui.main.Requests +import dagger.hilt.android.lifecycle.HiltViewModel +import kotlinx.coroutines.launch +import javax.inject.Inject + +@HiltViewModel +class RandoViewModel @Inject constructor( + private val req: Requests, + + ) : ViewModel(){ + + val isTracking = NavigationService.isTracking + val pathPoints = NavigationService.pathPoints + + val randos = MediatorLiveData<List<RandoTable>>() + + + + + fun deleteRando(rando: RandoTable) { + viewModelScope.launch { + req.deleteRando(rando) + } + } + + fun insertRando(rando: RandoTable) { + viewModelScope.launch { + req.insertRando(rando) + } + } + + /*fun getAllRandos() { + viewModelScope.launch { + var l: ArrayList<RandoTable> = ArrayList<RandoTable>() + for(item in req.getAllRandos().value!!) { + l.add(item) + } + randos.postValue(l) + } + } + + + init { + randos.addSource(req.getAllRandos()){res -> + res.let { randos.value = it } + } + }*/ +} diff --git a/RandoTracker/app/src/main/java/com/example/randotracker/Randonne.kt b/RandoTracker/app/src/main/java/com/example/randotracker/Randonne.kt new file mode 100644 index 0000000000000000000000000000000000000000..7381c94b41b0ceaabbf86fd299504c90bb4a0192 --- /dev/null +++ b/RandoTracker/app/src/main/java/com/example/randotracker/Randonne.kt @@ -0,0 +1,84 @@ +package com.example.randotracker + +import android.Manifest +import android.content.pm.PackageManager +import android.os.Build +import androidx.appcompat.app.AppCompatActivity +import android.os.Bundle +import android.util.Log +import androidx.annotation.RequiresApi +import androidx.core.app.ActivityCompat +import androidx.core.content.ContextCompat +import androidx.fragment.app.Fragment +import androidx.room.Room +import com.example.randotracker.database.RandoRequest +import com.example.randotracker.fragments.MapFragment +import com.example.randotracker.databinding.RandoActivityBinding +import com.example.randotracker.fragments.Randon +import dagger.hilt.android.AndroidEntryPoint +import javax.inject.Inject + +@AndroidEntryPoint +class Randonne : AppCompatActivity() { + + @Inject + lateinit var Db:RandoRequest + + + + private val mapFrag = MapFragment() + private val randonFrag = Randon() + private lateinit var binding : RandoActivityBinding; + + @RequiresApi(Build.VERSION_CODES.Q) + override fun onCreate(savedInstanceState: Bundle?) { + + + + super.onCreate(savedInstanceState) + binding = RandoActivityBinding.inflate(layoutInflater) + setContentView(binding.root) + switchFragment(randonFrag) + + binding.bottomNavigation.setOnItemSelectedListener { + when(it.itemId){ + R.id.walk -> { + switchFragment(randonFrag) + it.setIcon(R.drawable.walk_black) + } + R.id.map -> { + switchFragment(mapFrag) + it.setIcon(R.drawable.map_black) + } + } + true + } + + requestPermission(Manifest.permission.ACCESS_FINE_LOCATION) + requestPermission(Manifest.permission.ACCESS_COARSE_LOCATION) + requestPermission(Manifest.permission.ACCESS_BACKGROUND_LOCATION) + + + + + //ContextCompat.startForegroundService(this, Intent(this, NavigationService::class.java)) + } + + + + private fun switchFragment(fragment : Fragment){ + + val transaction = supportFragmentManager.beginTransaction() + transaction.replace(R.id.container,fragment) + transaction.commit() + + } + + fun hasPermission(permission:String) = ContextCompat.checkSelfPermission(this,permission)==PackageManager.PERMISSION_GRANTED + + fun requestPermission(permission: String){ + if(!hasPermission(permission)){ + ActivityCompat.requestPermissions(this, arrayOf(permission),0) + } + } +} \ No newline at end of file diff --git a/RandoTracker/app/src/main/java/com/example/randotracker/adapter/RandoAdapter.kt b/RandoTracker/app/src/main/java/com/example/randotracker/adapter/RandoAdapter.kt new file mode 100644 index 0000000000000000000000000000000000000000..6e447d4e935681444ecaf08c27059b2737f0f620 --- /dev/null +++ b/RandoTracker/app/src/main/java/com/example/randotracker/adapter/RandoAdapter.kt @@ -0,0 +1,42 @@ +package com.example.randotracker.adapter + +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.recyclerview.widget.RecyclerView +import com.example.randotracker.Data +import com.example.randotracker.R +import com.example.randotracker.database.RandoTable +import com.google.android.material.textview.MaterialTextView +import java.util.* +import kotlin.collections.ArrayList + +class RandoAdapter(private var itemList: ArrayList<Data>) : RecyclerView.Adapter<RandoAdapter.RandoViewHolder>() { + class RandoViewHolder(itemView : View) : RecyclerView.ViewHolder(itemView){ + val title:MaterialTextView = itemView.findViewById<MaterialTextView>(R.id.tvTitle) + val distance:MaterialTextView = itemView.findViewById<MaterialTextView>(R.id.tvTime) + val time:MaterialTextView = itemView.findViewById<MaterialTextView>(R.id.tvDistance) + } + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RandoViewHolder { + val itemView = LayoutInflater.from(parent.context).inflate(R.layout.item_run,parent,false) + return RandoViewHolder(itemView) + } + + override fun onBindViewHolder(holder: RandoViewHolder, position: Int) { + val currentItem = itemList[position] + holder.title.setText(currentItem.title) + holder.distance.setText(currentItem.distance.toString()) + holder.time.setText(currentItem.time.toString()) + } + + fun submitItems(newItem: Data){ + itemList.add(newItem) + } + + override fun getItemCount(): Int { + return itemList.size + } + + +} \ No newline at end of file diff --git a/RandoTracker/app/src/main/java/com/example/randotracker/database/RandoDb.kt b/RandoTracker/app/src/main/java/com/example/randotracker/database/RandoDb.kt new file mode 100644 index 0000000000000000000000000000000000000000..ca9bad346ad612ccc37953daa055c3113d25e23c --- /dev/null +++ b/RandoTracker/app/src/main/java/com/example/randotracker/database/RandoDb.kt @@ -0,0 +1,14 @@ +package com.example.randotracker.database + + +import androidx.room.Database +import androidx.room.RoomDatabase + +@Database( + entities = [RandoTable::class], + version = 1 +) +abstract class RandoDb : RoomDatabase() { + + abstract fun getDB(): RandoRequest +} \ No newline at end of file diff --git a/RandoTracker/app/src/main/java/com/example/randotracker/database/RandoRequest.kt b/RandoTracker/app/src/main/java/com/example/randotracker/database/RandoRequest.kt new file mode 100644 index 0000000000000000000000000000000000000000..9f16a222348e8b683525ebbadd52d8a61e25f723 --- /dev/null +++ b/RandoTracker/app/src/main/java/com/example/randotracker/database/RandoRequest.kt @@ -0,0 +1,18 @@ +package com.example.randotracker.database + +import androidx.lifecycle.LiveData +import androidx.room.* + +@Dao +interface RandoRequest { + + @Insert(onConflict = OnConflictStrategy.REPLACE) + suspend fun insertRando(run: RandoTable) + + @Delete + suspend fun deleteRando(run: RandoTable) + + @Query("SELECT * FROM rando_table") + fun getAllRandos(): LiveData<List<RandoTable>> + +} \ No newline at end of file diff --git a/RandoTracker/app/src/main/java/com/example/randotracker/database/RandoTable.kt b/RandoTracker/app/src/main/java/com/example/randotracker/database/RandoTable.kt new file mode 100644 index 0000000000000000000000000000000000000000..370975b1201692799f16efb60570b7042d8496b4 --- /dev/null +++ b/RandoTracker/app/src/main/java/com/example/randotracker/database/RandoTable.kt @@ -0,0 +1,17 @@ +package com.example.randotracker.database + +import androidx.room.Entity +import androidx.room.PrimaryKey +import com.example.randotracker.service.Polyline + +@Entity(tableName = "rando_table") +data class RandoTable( + var title:String, + var distanceInMeters: Int = 0, + var timeInMillis: Long = 0L, + var index: Int +) { + + @PrimaryKey(autoGenerate = true) + var id: Int? = null +} diff --git a/RandoTracker/app/src/main/java/com/example/randotracker/database/TypeConverter.kt b/RandoTracker/app/src/main/java/com/example/randotracker/database/TypeConverter.kt new file mode 100644 index 0000000000000000000000000000000000000000..ff91e3ed50979c4aaf4a481160767297e718e9d6 --- /dev/null +++ b/RandoTracker/app/src/main/java/com/example/randotracker/database/TypeConverter.kt @@ -0,0 +1,44 @@ +package com.example.randotracker.database + +import android.graphics.Bitmap +import android.graphics.BitmapFactory +import androidx.room.TypeConverter +import com.example.randotracker.service.Polyline +import com.google.android.gms.maps.model.LatLng + +class Converters { + + @TypeConverter + fun toPolyline(listLocation:String): MutableList<LatLng>{ + var poly: MutableList<LatLng> = mutableListOf() + var list = listLocation.split(" ") + var count: Boolean = true + var lat:Double = 0.0 + var long:Double = 0.0 + + for(location in list){ + if(count){ + lat = location.toDouble() + count = false + } + else{ + long = location.toDouble() + poly.add(LatLng(lat,long)) + count = true + } + } + + return poly + } + + @TypeConverter + fun fromPolyline(poly:List<LatLng>): String { + var ret : String = "" + for(location in poly){ + ret += location.latitude.toString() + ret += " " + ret += location.longitude.toString() + } + return ret + } +} \ No newline at end of file diff --git a/RandoTracker/app/src/main/java/com/example/randotracker/dialog/markerDialog.kt b/RandoTracker/app/src/main/java/com/example/randotracker/dialog/markerDialog.kt new file mode 100644 index 0000000000000000000000000000000000000000..4ddd090581151851716eb5ca7f884d8b4bead837 --- /dev/null +++ b/RandoTracker/app/src/main/java/com/example/randotracker/dialog/markerDialog.kt @@ -0,0 +1,71 @@ +package com.example.randotracker.dialog + +import android.app.AlertDialog +import android.app.Dialog +import android.content.Context +import android.content.DialogInterface +import android.graphics.Bitmap +import android.graphics.Canvas +import android.os.Bundle +import android.util.Log +import android.view.View +import android.widget.EditText +import android.widget.LinearLayout +import androidx.core.content.ContextCompat +import androidx.fragment.app.DialogFragment +import androidx.fragment.app.Fragment +import com.example.randotracker.R +import com.google.android.gms.maps.GoogleMap +import com.google.android.gms.maps.MapFragment +import com.google.android.gms.maps.model.BitmapDescriptor +import com.google.android.gms.maps.model.BitmapDescriptorFactory +import com.google.android.gms.maps.model.LatLng +import com.google.android.gms.maps.model.MarkerOptions +import com.example.randotracker.fragments.MapFragment.Companion.mapa +import com.example.randotracker.fragments.MapFragment.Companion.markerPos + +class markerDialog: DialogFragment() { + + + override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { + return activity?.let { + val builder = AlertDialog.Builder(it) + + val inflater = requireActivity().layoutInflater; + val inf = inflater.inflate(R.layout.add_marker_dialog,null) + + + builder.setView(inf) + + .setPositiveButton("Ajouter", + DialogInterface.OnClickListener { dialog, id -> + val title = inf.findViewById<EditText>(R.id.marker_title) + markerPos?.let { pos -> mapa?.let { map -> setMarker(map, pos,title.text.toString()) } } + }) + .setNegativeButton("Annuler", + DialogInterface.OnClickListener { dialog, id -> + + getDialog()?.cancel() + }) + builder.create() + } ?: throw IllegalStateException("Activity cannot be null") + } + + + private fun setMarker(map :GoogleMap,pos:LatLng,title:String){ + map.addMarker(MarkerOptions() + .position(pos) + .title(title) + .icon(bitmapDescriptorFromVector(activity, R.drawable.marker))) + } + + + private fun bitmapDescriptorFromVector(context: Context?, vectorResId: Int): BitmapDescriptor { + val vectorDrawable = ContextCompat.getDrawable(requireContext(), vectorResId) + vectorDrawable!!.setBounds(0, 0, vectorDrawable.intrinsicWidth, vectorDrawable.intrinsicHeight) + val bitmap = Bitmap.createBitmap(vectorDrawable.intrinsicWidth, vectorDrawable.intrinsicHeight, Bitmap.Config.ARGB_8888) + val canvas = Canvas(bitmap) + vectorDrawable.draw(canvas) + return BitmapDescriptorFactory.fromBitmap(bitmap) + } +} \ No newline at end of file diff --git a/RandoTracker/app/src/main/java/com/example/randotracker/dialog/saveDialog.kt b/RandoTracker/app/src/main/java/com/example/randotracker/dialog/saveDialog.kt new file mode 100644 index 0000000000000000000000000000000000000000..f4461f15e9b49a5039c6b88a30b8f79c14a8abd3 --- /dev/null +++ b/RandoTracker/app/src/main/java/com/example/randotracker/dialog/saveDialog.kt @@ -0,0 +1,43 @@ +package com.example.randotracker.dialog + +import android.app.AlertDialog +import android.app.Dialog +import android.content.DialogInterface +import android.os.Bundle +import android.widget.EditText +import androidx.fragment.app.DialogFragment +import com.example.randotracker.R +import com.example.randotracker.fragments.MapFragment.Companion.isSaved +import com.example.randotracker.fragments.MapFragment.Companion.title + + +class saveDialog: DialogFragment() { + + + + + override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { + return activity?.let { + val builder = AlertDialog.Builder(it) + + val inflater = requireActivity().layoutInflater; + val inf = inflater.inflate(R.layout.save,null) + + + builder.setView(inf) + + .setPositiveButton("Sauver", + DialogInterface.OnClickListener { dialog, id -> + val mytitle = inf.findViewById<EditText>(R.id.save_name) + title = mytitle.text.toString() + isSaved = true + }) + .setNegativeButton("Annuler", + DialogInterface.OnClickListener { dialog, id -> + isSaved = false + getDialog()?.cancel() + }) + builder.create() + } ?: throw IllegalStateException("Activity cannot be null") + } +} \ No newline at end of file diff --git a/RandoTracker/app/src/main/java/com/example/randotracker/fragments/MapFragment.kt b/RandoTracker/app/src/main/java/com/example/randotracker/fragments/MapFragment.kt new file mode 100644 index 0000000000000000000000000000000000000000..847ed2e800ff5ba2528955a0a4a5a9176678df80 --- /dev/null +++ b/RandoTracker/app/src/main/java/com/example/randotracker/fragments/MapFragment.kt @@ -0,0 +1,157 @@ +package com.example.randotracker.fragments + + +import android.content.Context +import android.content.Intent + +import android.os.Bundle +import androidx.fragment.app.Fragment +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import com.example.randotracker.R +import com.google.android.gms.maps.CameraUpdateFactory +import com.google.android.gms.maps.GoogleMap +import com.google.android.gms.maps.SupportMapFragment +import android.graphics.Bitmap +import android.graphics.Canvas +import android.graphics.Color +import android.os.Build +import android.widget.Button +import androidx.annotation.RequiresApi +import androidx.core.content.ContextCompat +import androidx.lifecycle.Observer +import com.example.randotracker.Constants.ACTION_START_OR_RESUME_SERVICE +import com.example.randotracker.Constants.ACTION_STOP_SERVICE +import com.example.randotracker.dialog.markerDialog +import com.google.android.gms.maps.model.* +import com.example.randotracker.service.NavigationService +import com.example.randotracker.service.NavigationService.Companion.pathPoints +import com.example.randotracker.service.NavigationService.Companion.runNumber +import com.example.randotracker.database.RandoTable +import com.example.randotracker.RandoViewModel + +import androidx.fragment.app.viewModels +import androidx.room.InvalidationTracker +import com.example.randotracker.dialog.saveDialog +import dagger.hilt.android.AndroidEntryPoint + + +@AndroidEntryPoint +class MapFragment : Fragment() { + + private var poly: Polyline? = null + + private val Db : RandoViewModel by viewModels() + private var ob = Observer<LatLng> {} + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + } + + companion object{ + var isSaved = false + var title = "" + var mapa : GoogleMap? = null + var markerPos: LatLng? = null + var mark: Marker? = null + } + + + + @RequiresApi(Build.VERSION_CODES.M) + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { + // Inflate the layout for this fragment + val rootView = inflater.inflate(R.layout.fragment_map, container, false) + + val mapFragment = childFragmentManager.findFragmentById(R.id.map_frag) as SupportMapFragment? + mapFragment!!.getMapAsync { mMap -> + mapa = mMap + mMap.mapType = GoogleMap.MAP_TYPE_NORMAL + mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(46.207,6.14234),16.0F)) + + mMap.clear() //clear old markers + mMap.setOnMapLongClickListener { + markerPos = it + markerDialog().show(childFragmentManager,"oui") + } + + + NavigationService.latlong.observe(viewLifecycleOwner, Observer { + mark?.remove() + poly?.remove() + + mMap.animateCamera(CameraUpdateFactory.newLatLng(it)) + mark = mMap.addMarker(MarkerOptions().position(it).title("You").icon(bitmapDescriptorFromVector(activity, R.drawable.walk_black))) + poly = drawRando() + }) + } + + + + return rootView + } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + requireActivity().findViewById<Button>(R.id.stop_button).visibility = View.INVISIBLE + + requireActivity().findViewById<Button>(R.id.start_button).setOnClickListener { + requireActivity().findViewById<Button>(R.id.stop_button).visibility = View.VISIBLE + it.visibility = View.INVISIBLE + NavigationService.isTracking.postValue(true) + NavigationService.isFirstRun = true + sendCommandToService(ACTION_START_OR_RESUME_SERVICE) + + } + + requireActivity().findViewById<Button>(R.id.stop_button).setOnClickListener { + requireActivity().findViewById<Button>(R.id.start_button).visibility = View.VISIBLE + requireActivity().findViewById<Button>(R.id.stop_button).visibility = View.INVISIBLE + NavigationService.isTracking.postValue(false) + NavigationService.isFirstRun = false + sendCommandToService(ACTION_STOP_SERVICE) + requireActivity().stopService(Intent(requireActivity(),NavigationService::class.java)) + + poly?.remove() + + saveDialog().show(childFragmentManager,"oui") + if(isSaved){ + Db.insertRando(RandoTable(title,1,1, NavigationService.runNumber)) + } + + NavigationService.latlong.removeObservers(viewLifecycleOwner) + + } + + } + + + private fun drawRando(): Polyline? { + val polylineOptions = PolylineOptions() + .color(Color.RED) + .width(10.0F) + + for (location in pathPoints.value?.get(runNumber)!!){ + polylineOptions.add(location) + } + + return mapa?.addPolyline(polylineOptions) + + } + + + private fun sendCommandToService(action:String) = Intent(requireContext(),NavigationService::class.java).also { + it.action = action + requireContext().startService(it) + } + + private fun bitmapDescriptorFromVector(context: Context?, vectorResId: Int): BitmapDescriptor { + val vectorDrawable = ContextCompat.getDrawable(requireContext(), vectorResId) + vectorDrawable!!.setBounds(0, 0, vectorDrawable.intrinsicWidth, vectorDrawable.intrinsicHeight) + val bitmap = Bitmap.createBitmap(vectorDrawable.intrinsicWidth, vectorDrawable.intrinsicHeight, Bitmap.Config.ARGB_8888) + val canvas = Canvas(bitmap) + vectorDrawable.draw(canvas) + return BitmapDescriptorFactory.fromBitmap(bitmap) + } +} \ No newline at end of file diff --git a/RandoTracker/app/src/main/java/com/example/randotracker/fragments/Randon.kt b/RandoTracker/app/src/main/java/com/example/randotracker/fragments/Randon.kt new file mode 100644 index 0000000000000000000000000000000000000000..2e359bd2ecbfb9409d3849c3356fa04aeff26221 --- /dev/null +++ b/RandoTracker/app/src/main/java/com/example/randotracker/fragments/Randon.kt @@ -0,0 +1,58 @@ +package com.example.randotracker.fragments + +import android.os.Bundle +import androidx.fragment.app.Fragment +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.lifecycle.Observer +import androidx.recyclerview.widget.LinearLayoutManager +import androidx.recyclerview.widget.RecyclerView +import com.example.randotracker.Data +import com.example.randotracker.R +import com.example.randotracker.adapter.RandoAdapter +import com.example.randotracker.database.RandoTable +import com.example.randotracker.service.NavigationService +import dagger.hilt.android.AndroidEntryPoint + +@AndroidEntryPoint +class Randon : Fragment() { + + private lateinit var randoAdapter: RandoAdapter + //private val Db : RandoViewModel by viewModels() + var itemList :ArrayList<Data> = arrayListOf() + + + private fun setupRecyclerView() { + var recyclerViewRandos:RecyclerView = requireActivity().findViewById(R.id.recyclerViewRandos) + + recyclerViewRandos.apply{ + randoAdapter = RandoAdapter(itemList) + adapter = randoAdapter + layoutManager = LinearLayoutManager(requireContext()) + } + } + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + } + + override fun onCreateView( + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + // Inflate the layout for this fragment + return inflater.inflate(R.layout.fragment_randon, container, false) + } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + NavigationService.isTracking.observe(viewLifecycleOwner, Observer { + if(!it){ + Data("oui",NavigationService.stop_time -NavigationService.stop_time,0) + } + + }) + setupRecyclerView() + } +} \ No newline at end of file diff --git a/RandoTracker/app/src/main/java/com/example/randotracker/service/NavigationService.kt b/RandoTracker/app/src/main/java/com/example/randotracker/service/NavigationService.kt new file mode 100644 index 0000000000000000000000000000000000000000..3090ae6d70c1a5063003d4c3bfd6db7a3662c10a --- /dev/null +++ b/RandoTracker/app/src/main/java/com/example/randotracker/service/NavigationService.kt @@ -0,0 +1,180 @@ +package com.example.randotracker.service + +import android.annotation.SuppressLint +import android.app.NotificationChannel +import android.app.NotificationManager +import android.app.NotificationManager.IMPORTANCE_LOW +import android.app.PendingIntent +import android.app.PendingIntent.FLAG_UPDATE_CURRENT +import android.content.Intent +import android.content.pm.PackageManager +import android.location.Location +import android.os.Build +import android.os.IBinder +import android.os.Looper +import android.util.Log +import androidx.annotation.RequiresApi +import androidx.core.app.NotificationCompat +import androidx.core.content.ContextCompat +import androidx.lifecycle.LifecycleService +import androidx.lifecycle.MutableLiveData +import com.example.randotracker.Constants.LOCATION_UPDATE_INTERVAL +import com.example.randotracker.Constants.NOTIFICATION_CHANNEL_ID +import com.example.randotracker.Constants.NOTIFICATION_ID +import com.example.randotracker.Constants.NOTIFICATION_CHANNEL_NAME +import com.example.randotracker.Constants.SHORTEST_UPDATE_INTERVAL +import com.example.randotracker.R + +import com.example.randotracker.Randonne +import com.google.android.gms.location.FusedLocationProviderClient +import com.google.android.gms.location.LocationCallback +import com.google.android.gms.location.LocationResult +import com.google.android.gms.maps.model.LatLng +import com.google.android.gms.location.LocationRequest +import com.google.android.gms.location.LocationRequest.PRIORITY_HIGH_ACCURACY + + +typealias Polyline = MutableList<LatLng> +typealias Polylines = MutableList<Polyline> + +class NavigationService : LifecycleService() { + + lateinit var fusedLocationProviderClient: FusedLocationProviderClient + + var isBegin = false + + companion object{ + var isFirstRun = true + var runNumber = 0 + var start_time:Long = 0L + var stop_time:Long = 0L + var dist:Int = 0 + var latlong = MutableLiveData<LatLng>() + val isTracking = MutableLiveData<Boolean>() + val pathPoints = MutableLiveData<Polylines>() + } + + override fun onCreate() { + super.onCreate() + postInitValues() + fusedLocationProviderClient = FusedLocationProviderClient(this) + + isTracking.observe(this, androidx.lifecycle.Observer { + updateLocationTracking(it) + }) + } + + override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { + super.onStartCommand(intent, flags, startId) + if(isFirstRun){ + startForegroundService() + isFirstRun = false + } + + return START_STICKY + } + + override fun onBind(intent: Intent): IBinder? { + super.onBind(intent) + return null + } + + override fun onDestroy() { + super.onDestroy() + isBegin = false + Log.d("Points", pathPoints.value.toString()) + + } + + + + fun hasPermission(permission:String) = ContextCompat.checkSelfPermission(this,permission)== PackageManager.PERMISSION_GRANTED + + private fun postInitValues(){ + isTracking.postValue(false) + pathPoints.postValue(mutableListOf()) + } + + @SuppressLint("MissingPermission") + private fun updateLocationTracking(isTracking: Boolean){ + if(isTracking){ + val request = LocationRequest().apply{ + interval = LOCATION_UPDATE_INTERVAL + fastestInterval = SHORTEST_UPDATE_INTERVAL + priority = PRIORITY_HIGH_ACCURACY + } + fusedLocationProviderClient.requestLocationUpdates(request,locationCallback, Looper.getMainLooper()) + }else{ + fusedLocationProviderClient.removeLocationUpdates(locationCallback) + } + } + + val locationCallback = object : LocationCallback(){ + override fun onLocationResult(result: LocationResult) { + super.onLocationResult(result) + if(isTracking.value!!){ + result?.locations?.let{locations -> + for(location in locations){ + addPathPoint(location) + latlong.postValue(LatLng(location.latitude,location.longitude)) + if(!isBegin){ + isBegin = true + start_time = location.time + } + stop_time = location.time + } + } + } + } + } + + private fun addPathPoint(location: Location?) { + location?.let { + pathPoints.value?.last()?.add(LatLng(location.latitude,location.longitude)) + pathPoints.postValue(pathPoints.value) + } + } + + private fun addEmptyPolyline() = pathPoints.value?.apply{ + add(mutableListOf()) + pathPoints.postValue(this) + } ?: pathPoints.postValue(mutableListOf(mutableListOf())) + + + + private fun startForegroundService(){ + + addEmptyPolyline() + + isTracking.postValue(true) + + val notificationManager = getSystemService(NOTIFICATION_SERVICE) as NotificationManager + if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O){ + createNotificationChannel(notificationManager) + + } + val notificationBuilder = NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID) + .setAutoCancel(false) + .setOngoing(true) + .setSmallIcon(R.drawable.walk) + .setContentTitle("RandoTracker") + .setContentText("App is running") + .setContentIntent(getMainActivityPendingIntent()) + + startForeground(NOTIFICATION_ID,notificationBuilder.build()) + } + + + private fun getMainActivityPendingIntent() = PendingIntent.getActivity(this,0,Intent(this,Randonne::class.java).also{ + it.action = "ShowFragment" + },FLAG_UPDATE_CURRENT) + + + + + @RequiresApi(Build.VERSION_CODES.O) + private fun createNotificationChannel(notificationManager: NotificationManager){ + val channel = NotificationChannel(NOTIFICATION_CHANNEL_ID,NOTIFICATION_CHANNEL_NAME,IMPORTANCE_LOW) + notificationManager.createNotificationChannel(channel) + } +} \ No newline at end of file diff --git a/RandoTracker/app/src/main/java/com/example/randotracker/ui/main/Requests.kt b/RandoTracker/app/src/main/java/com/example/randotracker/ui/main/Requests.kt new file mode 100644 index 0000000000000000000000000000000000000000..f78eef110b85c4251196f1ac8227b980be5893d0 --- /dev/null +++ b/RandoTracker/app/src/main/java/com/example/randotracker/ui/main/Requests.kt @@ -0,0 +1,19 @@ +package com.example.randotracker.ui.main + + +import com.example.randotracker.database.RandoRequest +import com.example.randotracker.database.RandoTable +import javax.inject.Inject + +class Requests @Inject constructor(val rando: RandoRequest) { + + suspend fun insertRando(run: RandoTable) = rando.insertRando(run) + + suspend fun deleteRando(run: RandoTable) = rando.insertRando(run) + + fun getAllRandos() = rando.getAllRandos() + + + + +} diff --git a/RandoTracker/app/src/main/res/drawable/ic_launcher_background.xml b/RandoTracker/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000000000000000000000000000000000000..75ea723b2d533bf660cd5dc216d1245561584717 --- /dev/null +++ b/RandoTracker/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="108dp" + android:height="108dp" + android:viewportWidth="108" + android:viewportHeight="108"> + <path + android:fillColor="#F44336" + android:pathData="M0,0h108v108h-108z" /> + +</vector> diff --git a/RandoTracker/app/src/main/res/drawable/ic_launcher_foreground.xml b/RandoTracker/app/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 0000000000000000000000000000000000000000..b29ed3fdec2b3934d9d9435de0802359b7c962d7 --- /dev/null +++ b/RandoTracker/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,5 @@ +<vector android:height="6dp" android:tint="#FFFFFF" + android:viewportHeight="24" android:viewportWidth="24" + android:width="6dp" xmlns:android="http://schemas.android.com/apk/res/android"> + <path android:fillColor="@android:color/white" android:pathData="M13.5,5.5c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM9.8,8.9L7,23h2.1l1.8,-8 2.1,2v6h2v-7.5l-2.1,-2 0.6,-3C14.8,12 16.8,13 19,13v-2c-1.9,0 -3.5,-1 -4.3,-2.4l-1,-1.6c-0.4,-0.6 -1,-1 -1.7,-1 -0.3,0 -0.5,0.1 -0.8,0.1L6,8.3V13h2V9.6l1.8,-0.7"/> +</vector> diff --git a/RandoTracker/app/src/main/res/drawable/map.xml b/RandoTracker/app/src/main/res/drawable/map.xml new file mode 100644 index 0000000000000000000000000000000000000000..ffd9dd90c5b45dff6468ea4995e28bc6718b2c91 --- /dev/null +++ b/RandoTracker/app/src/main/res/drawable/map.xml @@ -0,0 +1,5 @@ +<vector android:height="24dp" android:tint="#FFFFFF" + android:viewportHeight="24" android:viewportWidth="24" + android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> + <path android:fillColor="@android:color/white" android:pathData="M20.5,3l-0.16,0.03L15,5.1 9,3 3.36,4.9c-0.21,0.07 -0.36,0.25 -0.36,0.48V20.5c0,0.28 0.22,0.5 0.5,0.5l0.16,-0.03L9,18.9l6,2.1 5.64,-1.9c0.21,-0.07 0.36,-0.25 0.36,-0.48V3.5c0,-0.28 -0.22,-0.5 -0.5,-0.5zM15,19l-6,-2.11V5l6,2.11V19z"/> +</vector> diff --git a/RandoTracker/app/src/main/res/drawable/map_black.xml b/RandoTracker/app/src/main/res/drawable/map_black.xml new file mode 100644 index 0000000000000000000000000000000000000000..e7b0374ca99e7600af6e803089306ec6dcfd60f7 --- /dev/null +++ b/RandoTracker/app/src/main/res/drawable/map_black.xml @@ -0,0 +1,5 @@ +<vector android:height="24dp" android:tint="#000000" + android:viewportHeight="24" android:viewportWidth="24" + android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> + <path android:fillColor="@android:color/black" android:pathData="M20.5,3l-0.16,0.03L15,5.1 9,3 3.36,4.9c-0.21,0.07 -0.36,0.25 -0.36,0.48V20.5c0,0.28 0.22,0.5 0.5,0.5l0.16,-0.03L9,18.9l6,2.1 5.64,-1.9c0.21,-0.07 0.36,-0.25 0.36,-0.48V3.5c0,-0.28 -0.22,-0.5 -0.5,-0.5zM15,19l-6,-2.11V5l6,2.11V19z"/> +</vector> diff --git a/RandoTracker/app/src/main/res/drawable/marker.xml b/RandoTracker/app/src/main/res/drawable/marker.xml new file mode 100644 index 0000000000000000000000000000000000000000..f2e71d580a615b71c4d38f2a636003524fd21f45 --- /dev/null +++ b/RandoTracker/app/src/main/res/drawable/marker.xml @@ -0,0 +1,5 @@ +<vector android:height="40dp" android:tint="#FFD500" + android:viewportHeight="24" android:viewportWidth="24" + android:width="40dp" xmlns:android="http://schemas.android.com/apk/res/android"> + <path android:fillColor="@android:color/white" android:pathData="M11.99,2C6.47,2 2,6.48 2,12c0,5.52 4.47,10 9.99,10C17.52,22 22,17.52 22,12C22,6.48 17.52,2 11.99,2zM8.5,8C9.33,8 10,8.67 10,9.5S9.33,11 8.5,11S7,10.33 7,9.5S7.67,8 8.5,8zM12,18c-2.28,0 -4.22,-1.66 -5,-4h10C16.22,16.34 14.28,18 12,18zM15.5,11c-0.83,0 -1.5,-0.67 -1.5,-1.5S14.67,8 15.5,8S17,8.67 17,9.5S16.33,11 15.5,11z"/> +</vector> diff --git a/RandoTracker/app/src/main/res/drawable/walk.xml b/RandoTracker/app/src/main/res/drawable/walk.xml new file mode 100644 index 0000000000000000000000000000000000000000..ded01eb4cedf14b78cf833b3e5b5ed3b0cdc859b --- /dev/null +++ b/RandoTracker/app/src/main/res/drawable/walk.xml @@ -0,0 +1,5 @@ +<vector android:height="24dp" android:tint="#FFFFFF" + android:viewportHeight="24" android:viewportWidth="24" + android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> + <path android:fillColor="@android:color/white" android:pathData="M13.5,5.5c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM9.8,8.9L7,23h2.1l1.8,-8 2.1,2v6h2v-7.5l-2.1,-2 0.6,-3C14.8,12 16.8,13 19,13v-2c-1.9,0 -3.5,-1 -4.3,-2.4l-1,-1.6c-0.4,-0.6 -1,-1 -1.7,-1 -0.3,0 -0.5,0.1 -0.8,0.1L6,8.3V13h2V9.6l1.8,-0.7"/> +</vector> diff --git a/RandoTracker/app/src/main/res/drawable/walk_black.xml b/RandoTracker/app/src/main/res/drawable/walk_black.xml new file mode 100644 index 0000000000000000000000000000000000000000..6463f84765d793e66ce0c01a6659f914f5335ab0 --- /dev/null +++ b/RandoTracker/app/src/main/res/drawable/walk_black.xml @@ -0,0 +1,5 @@ +<vector android:height="24dp" android:tint="#000000" + android:viewportHeight="24" android:viewportWidth="24" + android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> + <path android:fillColor="@android:color/black" android:pathData="M13.5,5.5c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM9.8,8.9L7,23h2.1l1.8,-8 2.1,2v6h2v-7.5l-2.1,-2 0.6,-3C14.8,12 16.8,13 19,13v-2c-1.9,0 -3.5,-1 -4.3,-2.4l-1,-1.6c-0.4,-0.6 -1,-1 -1.7,-1 -0.3,0 -0.5,0.1 -0.8,0.1L6,8.3V13h2V9.6l1.8,-0.7"/> +</vector> diff --git a/RandoTracker/app/src/main/res/layout/add_marker_dialog.xml b/RandoTracker/app/src/main/res/layout/add_marker_dialog.xml new file mode 100644 index 0000000000000000000000000000000000000000..3a2a82141abbf42384a43a18d900e8982236560f --- /dev/null +++ b/RandoTracker/app/src/main/res/layout/add_marker_dialog.xml @@ -0,0 +1,24 @@ +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:orientation="vertical" + android:layout_width="wrap_content" + android:layout_height="wrap_content"> + + + <TextView + android:id="@+id/textView" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:textSize="30dp" + android:text="Voulez-vous ajouter un repère ?" /> + + <EditText + android:id="@+id/marker_title" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="16dp" + android:layout_marginLeft="4dp" + android:layout_marginRight="4dp" + android:layout_marginBottom="4dp" + android:hint="Title" /> +</LinearLayout> \ No newline at end of file diff --git a/RandoTracker/app/src/main/res/layout/fragment_map.xml b/RandoTracker/app/src/main/res/layout/fragment_map.xml new file mode 100644 index 0000000000000000000000000000000000000000..272fbaacfb1a38eaf1cc8e6e4ff375a79f97cf01 --- /dev/null +++ b/RandoTracker/app/src/main/res/layout/fragment_map.xml @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="utf-8"?> +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:context=".fragments.MapFragment"> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="MAP" + android:textSize="36sp" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + + /> + + <fragment + android:name="com.google.android.gms.maps.SupportMapFragment" + android:id="@+id/map_frag" + android:layout_width="match_parent" + android:layout_height="match_parent"/> + + <Button + android:id="@+id/start_button" + android:layout_width="100sp" + android:layout_height="50sp" + android:text="start" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintHorizontal_bias="0.784" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.845" /> + + + <Button + android:id="@+id/stop_button" + android:layout_width="100sp" + android:layout_height="50sp" + android:text="stop" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintHorizontal_bias="0.212" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.845" /> + + +</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/RandoTracker/app/src/main/res/layout/fragment_randon.xml b/RandoTracker/app/src/main/res/layout/fragment_randon.xml new file mode 100644 index 0000000000000000000000000000000000000000..169d1b40a18471523276ea35df9a72cf8c19912c --- /dev/null +++ b/RandoTracker/app/src/main/res/layout/fragment_randon.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:context=".fragments.MapFragment"> + + + <androidx.recyclerview.widget.RecyclerView + android:id="@+id/recyclerViewRandos" + android:layout_width="415dp" + android:layout_height="733dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.5" + app:layout_constraintStart_toStartOf="parent" /> + +</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/RandoTracker/app/src/main/res/layout/item_run.xml b/RandoTracker/app/src/main/res/layout/item_run.xml new file mode 100644 index 0000000000000000000000000000000000000000..3cff308a595bb562fc80501f764e8c417c84096f --- /dev/null +++ b/RandoTracker/app/src/main/res/layout/item_run.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:padding="8dp"> + + <com.google.android.material.textview.MaterialTextView + android:id="@+id/tvTitle" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="TITLE" + + tools:ignore="MissingConstraints" + tools:layout_editor_absoluteX="247dp" + tools:layout_editor_absoluteY="16dp" /> + + <com.google.android.material.textview.MaterialTextView + android:id="@+id/tvTime" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="TIME" + tools:ignore="MissingConstraints" + tools:layout_editor_absoluteX="174dp" + tools:layout_editor_absoluteY="16dp" /> + + <com.google.android.material.textview.MaterialTextView + android:id="@+id/tvDistance" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="DISTANCE" + + tools:ignore="MissingConstraints" + tools:layout_editor_absoluteX="71dp" + tools:layout_editor_absoluteY="16dp" /> + +</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/RandoTracker/app/src/main/res/layout/main_fragment.xml b/RandoTracker/app/src/main/res/layout/main_fragment.xml new file mode 100644 index 0000000000000000000000000000000000000000..cf087357980f8c79203cc95baa156ae2fe98a068 --- /dev/null +++ b/RandoTracker/app/src/main/res/layout/main_fragment.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:id="@+id/rando" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:context=".ui.main.RandoFragment"> + + + + +</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/RandoTracker/app/src/main/res/layout/rando_activity.xml b/RandoTracker/app/src/main/res/layout/rando_activity.xml new file mode 100644 index 0000000000000000000000000000000000000000..beb367f67e56aea7b9f23c534e0ca11e4057503c --- /dev/null +++ b/RandoTracker/app/src/main/res/layout/rando_activity.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:id="@+id/container" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:context=".Randonne"> + + <com.google.android.material.bottomnavigation.BottomNavigationView + android:id="@+id/bottom_navigation" + android:layout_width="match_parent" + android:layout_height="wrap_content" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + android:background="#F44336" + app:menu="@menu/menu" + app:itemIconTint="#fff" + app:itemTextColor="#fff"/> + + +</androidx.constraintlayout.widget.ConstraintLayout> + + + + diff --git a/RandoTracker/app/src/main/res/layout/save.xml b/RandoTracker/app/src/main/res/layout/save.xml new file mode 100644 index 0000000000000000000000000000000000000000..b454f7577e0f1aeb3d452b1a1e92faa9f2ab84bd --- /dev/null +++ b/RandoTracker/app/src/main/res/layout/save.xml @@ -0,0 +1,25 @@ +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:layout_width="wrap_content" + android:layout_height="wrap_content"> + + <TextView + android:id="@+id/save" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:textSize="30dp" + android:text="Sauvegarder la Randonnée ?" /> + + <EditText + android:id="@+id/save_name" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="16dp" + android:layout_marginLeft="4dp" + android:layout_marginRight="4dp" + android:layout_marginBottom="4dp" + + android:hint="nom" /> + + +</LinearLayout> \ No newline at end of file diff --git a/RandoTracker/app/src/main/res/menu/menu.xml b/RandoTracker/app/src/main/res/menu/menu.xml new file mode 100644 index 0000000000000000000000000000000000000000..1c8af3167779db96eb30c8082fff6d200dcf0dad --- /dev/null +++ b/RandoTracker/app/src/main/res/menu/menu.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<menu xmlns:android="http://schemas.android.com/apk/res/android"> + + <item + android:title="Rando" + android:icon="@drawable/walk" + android:id="@+id/walk"/> + <item + android:title="Carte" + android:id="@+id/map" + android:icon="@drawable/map"/> +</menu> \ No newline at end of file diff --git a/RandoTracker/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/RandoTracker/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000000000000000000000000000000000000..eca70cfe52eac1ba66ba280a68ca7be8fcf88a16 --- /dev/null +++ b/RandoTracker/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> + <background android:drawable="@drawable/ic_launcher_background" /> + <foreground android:drawable="@drawable/ic_launcher_foreground" /> +</adaptive-icon> \ No newline at end of file diff --git a/RandoTracker/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/RandoTracker/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000000000000000000000000000000000000..eca70cfe52eac1ba66ba280a68ca7be8fcf88a16 --- /dev/null +++ b/RandoTracker/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> + <background android:drawable="@drawable/ic_launcher_background" /> + <foreground android:drawable="@drawable/ic_launcher_foreground" /> +</adaptive-icon> \ No newline at end of file diff --git a/RandoTracker/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/RandoTracker/app/src/main/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 0000000000000000000000000000000000000000..c209e78ecd372343283f4157dcfd918ec5165bb3 Binary files /dev/null and b/RandoTracker/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/RandoTracker/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/RandoTracker/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 0000000000000000000000000000000000000000..b2dfe3d1ba5cf3ee31b3ecc1ced89044a1f3b7a9 Binary files /dev/null and b/RandoTracker/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/RandoTracker/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/RandoTracker/app/src/main/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 0000000000000000000000000000000000000000..4f0f1d64e58ba64d180ce43ee13bf9a17835fbca Binary files /dev/null and b/RandoTracker/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/RandoTracker/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/RandoTracker/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp new file mode 100644 index 0000000000000000000000000000000000000000..62b611da081676d42f6c3f78a2c91e7bcedddedb Binary files /dev/null and b/RandoTracker/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/RandoTracker/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/RandoTracker/app/src/main/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 0000000000000000000000000000000000000000..948a3070fe34c611c42c0d3ad3013a0dce358be0 Binary files /dev/null and b/RandoTracker/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/RandoTracker/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/RandoTracker/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp new file mode 100644 index 0000000000000000000000000000000000000000..1b9a6956b3acdc11f40ce2bb3f6efbd845cc243f Binary files /dev/null and b/RandoTracker/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/RandoTracker/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/RandoTracker/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp new file mode 100644 index 0000000000000000000000000000000000000000..28d4b77f9f036a47549d47db79c16788749dca10 Binary files /dev/null and b/RandoTracker/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/RandoTracker/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/RandoTracker/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000000000000000000000000000000000000..9287f5083623b375139afb391af71cc533a7dd37 Binary files /dev/null and b/RandoTracker/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/RandoTracker/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/RandoTracker/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 0000000000000000000000000000000000000000..aa7d6427e6fa1074b79ccd52ef67ac15c5637e85 Binary files /dev/null and b/RandoTracker/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/RandoTracker/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/RandoTracker/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000000000000000000000000000000000000..9126ae37cbc3587421d6889eadd1d91fbf1994d4 Binary files /dev/null and b/RandoTracker/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/RandoTracker/app/src/main/res/values-night/themes.xml b/RandoTracker/app/src/main/res/values-night/themes.xml new file mode 100644 index 0000000000000000000000000000000000000000..5de2d0c52c7f44b4a7b9e8139ba0c2a8c367d6cd --- /dev/null +++ b/RandoTracker/app/src/main/res/values-night/themes.xml @@ -0,0 +1,16 @@ +<resources xmlns:tools="http://schemas.android.com/tools"> + <!-- Base application theme. --> + <style name="Theme.RandoTracker" parent="Theme.MaterialComponents.DayNight.DarkActionBar"> + <!-- Primary brand color. --> + <item name="colorPrimary">@color/purple_200</item> + <item name="colorPrimaryVariant">@color/purple_700</item> + <item name="colorOnPrimary">@color/black</item> + <!-- Secondary brand color. --> + <item name="colorSecondary">@color/teal_200</item> + <item name="colorSecondaryVariant">@color/teal_200</item> + <item name="colorOnSecondary">@color/black</item> + <!-- Status bar color. --> + <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item> + <!-- Customize your theme here. --> + </style> +</resources> \ No newline at end of file diff --git a/RandoTracker/app/src/main/res/values/colors.xml b/RandoTracker/app/src/main/res/values/colors.xml new file mode 100644 index 0000000000000000000000000000000000000000..f8c6127d327620c93d2b2d00342a68e97b98a48d --- /dev/null +++ b/RandoTracker/app/src/main/res/values/colors.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <color name="purple_200">#FFBB86FC</color> + <color name="purple_500">#FF6200EE</color> + <color name="purple_700">#FF3700B3</color> + <color name="teal_200">#FF03DAC5</color> + <color name="teal_700">#FF018786</color> + <color name="black">#FF000000</color> + <color name="white">#FFFFFFFF</color> +</resources> \ No newline at end of file diff --git a/RandoTracker/app/src/main/res/values/strings.xml b/RandoTracker/app/src/main/res/values/strings.xml new file mode 100644 index 0000000000000000000000000000000000000000..da880446758cce715c767fe8c369cbce64112d16 --- /dev/null +++ b/RandoTracker/app/src/main/res/values/strings.xml @@ -0,0 +1,7 @@ +<resources> + <string name="app_name">RandoTracker</string> + <string name="title_activity_maps">MapsActivity</string> + <string name="item">Item</string> + <!-- TODO: Remove or change this placeholder text --> + <string name="hello_blank_fragment">Hello blank fragment</string> +</resources> \ No newline at end of file diff --git a/RandoTracker/app/src/main/res/values/themes.xml b/RandoTracker/app/src/main/res/values/themes.xml new file mode 100644 index 0000000000000000000000000000000000000000..65845bc7c707555b571dd164e55f784067f5e179 --- /dev/null +++ b/RandoTracker/app/src/main/res/values/themes.xml @@ -0,0 +1,16 @@ +<resources xmlns:tools="http://schemas.android.com/tools"> + <!-- Base application theme. --> + <style name="Theme.RandoTracker" parent="Theme.MaterialComponents.DayNight.NoActionBar"> + <!-- Primary brand color. --> + <item name="colorPrimary">@android:color/holo_red_light</item> + <item name="colorPrimaryVariant">#F44336</item> + <item name="colorOnPrimary">@color/white</item> + <!-- Secondary brand color. --> + <item name="colorSecondary">#E91E63</item> + <item name="colorSecondaryVariant">#E91E63</item> + <item name="colorOnSecondary">@color/black</item> + <!-- Status bar color. --> + <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item> + <!-- Customize your theme here. --> + </style> +</resources> \ No newline at end of file diff --git a/RandoTracker/app/src/release/res/values/google_maps_api.xml b/RandoTracker/app/src/release/res/values/google_maps_api.xml new file mode 100644 index 0000000000000000000000000000000000000000..d81bc19bcc7ba378071a305ff23c936d870b8872 --- /dev/null +++ b/RandoTracker/app/src/release/res/values/google_maps_api.xml @@ -0,0 +1,20 @@ +<resources> + <!-- + TODO: Before you release your application, you need a Google Maps API key. + + To do this, you can either add your release key credentials to your existing + key, or create a new key. + + Note that this file specifies the API key for the release build target. + If you have previously set up a key for the debug target with the debug signing certificate, + you will also need to set up a key for your release certificate. + + Follow the directions here: + + https://developers.google.com/maps/documentation/android/signup + + Once you have your key (it starts with "AIza"), replace the "google_maps_key" + string in this file. + --> + <string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">YOUR_KEY_HERE</string> +</resources> \ No newline at end of file diff --git a/RandoTracker/app/src/test/java/com/example/randotracker/ExampleUnitTest.kt b/RandoTracker/app/src/test/java/com/example/randotracker/ExampleUnitTest.kt new file mode 100644 index 0000000000000000000000000000000000000000..98919753d0222677ac1019f2bbe51bcea6c57e53 --- /dev/null +++ b/RandoTracker/app/src/test/java/com/example/randotracker/ExampleUnitTest.kt @@ -0,0 +1,17 @@ +package com.example.randotracker + +import org.junit.Test + +import org.junit.Assert.* + +/** + * Example local unit test, which will execute on the development machine (host). + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +class ExampleUnitTest { + @Test + fun addition_isCorrect() { + assertEquals(4, 2 + 2) + } +} \ No newline at end of file diff --git a/RandoTracker/build.gradle b/RandoTracker/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..87e34eb253eadaf939f9b5f1a93cb6a839c82761 --- /dev/null +++ b/RandoTracker/build.gradle @@ -0,0 +1,20 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +buildscript { + repositories { + google() + mavenCentral() + } + dependencies { + classpath "com.android.tools.build:gradle:7.0.4" + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31" + classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.4.0" + classpath 'com.google.dagger:hilt-android-gradle-plugin:2.40.5' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +} \ No newline at end of file diff --git a/RandoTracker/gradle.properties b/RandoTracker/gradle.properties new file mode 100644 index 0000000000000000000000000000000000000000..98bed167dc90ffee72b7affb37a659966b1bd114 --- /dev/null +++ b/RandoTracker/gradle.properties @@ -0,0 +1,21 @@ +# Project-wide Gradle settings. +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app"s APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn +android.useAndroidX=true +# Automatically convert third-party libraries to use AndroidX +android.enableJetifier=true +# Kotlin code style for this project: "official" or "obsolete": +kotlin.code.style=official \ No newline at end of file diff --git a/RandoTracker/gradle/wrapper/gradle-wrapper.jar b/RandoTracker/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..e708b1c023ec8b20f512888fe07c5bd3ff77bb8f Binary files /dev/null and b/RandoTracker/gradle/wrapper/gradle-wrapper.jar differ diff --git a/RandoTracker/gradle/wrapper/gradle-wrapper.properties b/RandoTracker/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..50a45ed05dcd77ad52bcf533eab485d5088513e4 --- /dev/null +++ b/RandoTracker/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Mon Dec 27 12:08:39 CET 2021 +distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip +distributionPath=wrapper/dists +zipStorePath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME diff --git a/RandoTracker/gradlew b/RandoTracker/gradlew new file mode 100644 index 0000000000000000000000000000000000000000..4f906e0c811fc9e230eb44819f509cd0627f2600 --- /dev/null +++ b/RandoTracker/gradlew @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# 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 +# +# https://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. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/RandoTracker/gradlew.bat b/RandoTracker/gradlew.bat new file mode 100644 index 0000000000000000000000000000000000000000..ac1b06f93825db68fb0c0b5150917f340eaa5d02 --- /dev/null +++ b/RandoTracker/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/RandoTracker/settings.gradle b/RandoTracker/settings.gradle new file mode 100644 index 0000000000000000000000000000000000000000..c4d82aa6bb3594f73a4cd3eaae516294cfc6e134 --- /dev/null +++ b/RandoTracker/settings.gradle @@ -0,0 +1,10 @@ +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + jcenter() // Warning: this repository is going to shut down soon + } +} +rootProject.name = "RandoTracker" +include ':app'