Skip to content

Commit 01fc7e3

Browse files
committed
Merge remote-tracking branch 'origin/main'
# Conflicts: # app/build.gradle
2 parents 598d07c + 4be78f0 commit 01fc7e3

File tree

143 files changed

+4553
-48
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

143 files changed

+4553
-48
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@
1313
.externalNativeBuild
1414
.cxx
1515
local.properties
16+
path.properties

.idea/.name

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/compiler.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/git_toolbox_prj.xml

+15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gradle.xml

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/kotlinc.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+1-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

+41-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
plugins {
22
id 'com.android.application'
33
id 'org.jetbrains.kotlin.android'
4+
id 'kotlin-kapt'
5+
id 'kotlin-parcelize'
46
}
57

8+
def pathPropertiesFile = rootProject.file("path.properties")
9+
def pathProperties = new Properties()
10+
pathProperties.load(new FileInputStream(pathPropertiesFile))
11+
612
android {
713
namespace 'com.rodrigoapolo.gogarage'
814
compileSdk 33
@@ -14,6 +20,9 @@ android {
1420
versionCode 1
1521
versionName "1.0"
1622

23+
buildConfigField("String", "PATH", pathProperties['PATH'])
24+
buildConfigField("String", "PATHVIACEP", pathProperties['PATHVIACEP'])
25+
1726
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1827
}
1928

@@ -24,22 +33,49 @@ android {
2433
}
2534
}
2635
compileOptions {
27-
sourceCompatibility JavaVersion.VERSION_1_8
28-
targetCompatibility JavaVersion.VERSION_1_8
36+
sourceCompatibility JavaVersion.VERSION_17
37+
targetCompatibility JavaVersion.VERSION_17
38+
}
39+
viewBinding {
40+
enabled = true
2941
}
3042
kotlinOptions {
31-
jvmTarget = '1.8'
43+
jvmTarget = '17'
3244
}
3345
}
3446

3547
dependencies {
3648

37-
38-
implementation 'androidx.core:core-ktx:1.7.0'
49+
implementation 'androidx.core:core-ktx:1.9.0'
3950
implementation 'androidx.appcompat:appcompat:1.6.1'
4051
implementation 'com.google.android.material:material:1.8.0'
4152
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
53+
implementation 'androidx.core:core-ktx:1.9.0'
4254
testImplementation 'junit:junit:4.13.2'
4355
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
4456
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
57+
58+
//Retrofit
59+
implementation 'com.google.code.gson:gson:2.10.1'
60+
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
61+
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
62+
63+
//CardView
64+
implementation 'androidx.cardview:cardview:1.0.0'
65+
66+
//GooglePlay Services
67+
implementation 'com.google.android.gms:play-services-location:21.0.1'
68+
69+
//Coroutines
70+
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'
71+
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.0'
72+
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.0'
73+
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.6.0'
74+
75+
// ViewModel
76+
def lifecycle_version = "2.5.0-alpha02"
77+
def arch_version = "2.1.0"
78+
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
79+
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
80+
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
4581
}

app/src/main/AndroidManifest.xml

+36-2
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,51 @@
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:tools="http://schemas.android.com/tools">
44

5+
<uses-permission android:name="android.permission.INTERNET" />
6+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
7+
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
8+
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
9+
510
<application
611
android:allowBackup="true"
712
android:dataExtractionRules="@xml/data_extraction_rules"
813
android:fullBackupContent="@xml/backup_rules"
9-
android:icon="@mipmap/ic_launcher"
14+
android:icon="@mipmap/ic_logo_foreground"
1015
android:label="@string/app_name"
1116
android:supportsRtl="true"
1217
android:theme="@style/Theme.GoGarage"
18+
android:usesCleartextTraffic="true"
1319
tools:targetApi="31">
1420
<activity
15-
android:name=".MainActivity"
21+
android:name=".View.ReserveActivity"
22+
android:exported="false" />
23+
<activity
24+
android:name=".View.PerfilActivity"
25+
android:exported="false" />
26+
<activity
27+
android:name=".View.ShowGarageActivity"
28+
android:exported="false" />
29+
<activity
30+
android:name=".View.RegisterAddressGarageActivity"
31+
android:exported="false" />
32+
<activity
33+
android:name=".View.RegisterGaragemActivity"
34+
android:exported="false" />
35+
<activity
36+
android:name=".View.HomeActivity"
37+
android:exported="false">
38+
<meta-data
39+
android:name="android.app.lib_name"
40+
android:value="" />
41+
</activity>
42+
<activity
43+
android:name=".View.RegisterUserActivity"
44+
android:exported="false" />
45+
<activity
46+
android:name=".View.LoginActivity"
47+
android:exported="false" />
48+
<activity
49+
android:name=".View.MainActivity"
1650
android:exported="true">
1751
<intent-filter>
1852
<action android:name="android.intent.action.MAIN" />
35.5 KB
Loading

app/src/main/java/com/rodrigoapolo/gogarage/MainActivity.kt

-11
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
package com.rodrigoapolo.gogarage.View
2+
3+
import android.content.Intent
4+
import android.os.Bundle
5+
import android.util.Log
6+
import android.widget.Toast
7+
import androidx.appcompat.app.AppCompatActivity
8+
import androidx.core.content.ContextCompat
9+
import androidx.lifecycle.ViewModelProvider
10+
import androidx.recyclerview.widget.GridLayoutManager
11+
import com.rodrigoapolo.gogarage.R
12+
import com.rodrigoapolo.gogarage.ViewModel.HomeViewModel
13+
import com.rodrigoapolo.gogarage.databinding.ActivityHomeBinding
14+
import com.rodrigoapolo.gogarage.dto.GarageDTO
15+
import com.rodrigoapolo.gogarage.model.AgendamentoModel
16+
import com.rodrigoapolo.gogarage.model.GarageModel
17+
import com.rodrigoapolo.gogarage.recyclerview.garage.GarageAdapter
18+
import com.rodrigoapolo.gogarage.recyclerview.garage.OnItemClickListenerGarage
19+
import com.rodrigoapolo.gogarage.util.SecurityPreferences
20+
21+
22+
class HomeActivity : AppCompatActivity(), OnItemClickListenerGarage {
23+
24+
private lateinit var viewModel: HomeViewModel
25+
private lateinit var binding: ActivityHomeBinding
26+
27+
override fun onCreate(savedInstanceState: Bundle?) {
28+
super.onCreate(savedInstanceState)
29+
binding = ActivityHomeBinding.inflate(layoutInflater)
30+
val village = SecurityPreferences(applicationContext).getStoredString("village")
31+
viewModel = ViewModelProvider(this)[HomeViewModel::class.java]
32+
window.statusBarColor = ContextCompat.getColor(this, R.color.blue_500)
33+
34+
createListenerData()
35+
setRecyclerViewGarage()
36+
getRecyclerViewgarage()
37+
Log.i("village", village + " HOME")
38+
39+
if (village != "") {
40+
41+
42+
} else {
43+
Toast.makeText(this, "Não encontramos sua localização", Toast.LENGTH_LONG).show()
44+
}
45+
46+
47+
48+
return setContentView(binding.root)
49+
}
50+
51+
private fun createListenerData() {
52+
binding.imaUser.setOnClickListener{
53+
val intent = Intent(this, PerfilActivity::class.java)
54+
startActivity(intent)
55+
}
56+
}
57+
58+
private fun getRecyclerViewgarage() {
59+
val village = SecurityPreferences(applicationContext).getStoredString("village")
60+
viewModel.setGarage(village)
61+
}
62+
63+
private fun setRecyclerViewGarage() {
64+
viewModel.garages.observe(this){
65+
binding.recyclerView.apply {
66+
layoutManager = GridLayoutManager(applicationContext, 1)
67+
adapter = GarageAdapter(viewModel.garages.value!!, this@HomeActivity)
68+
}
69+
}
70+
}
71+
72+
override fun onItemClick(garage: GarageModel) {
73+
val garage: GarageDTO = GarageDTO(
74+
garage.id,
75+
garage.cobertura,
76+
garage.horarioInicio,
77+
garage.horarioTermino,
78+
garage.taxaHorario,
79+
garage.valorHora,
80+
garage.alturaVaga,
81+
garage.larguraVaga,
82+
"",
83+
"",
84+
garage.endereco,
85+
garage.pessoa.id
86+
)
87+
val intent = Intent(this, ShowGarageActivity::class.java)
88+
val putExtra = intent.putExtra("garage", garage)
89+
startActivities(arrayOf(intent))
90+
}
91+
}

0 commit comments

Comments
 (0)