Skip to content

Commit

Permalink
feat: MapBox Maps (Beta)
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
thekaailashsharma authored Sep 14, 2023
2 parents f36b0c8 + d69c332 commit b02cc56
Show file tree
Hide file tree
Showing 64 changed files with 2,832 additions and 246 deletions.
1 change: 1 addition & 0 deletions .idea/.name

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

10 changes: 0 additions & 10 deletions .idea/deploymentTargetDropDown.xml

This file was deleted.

20 changes: 20 additions & 0 deletions .idea/jarRepositories.xml

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

7 changes: 5 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ plugins {

android {
namespace = "app.waste2wealth.com"
compileSdk = 33
compileSdk = 34

lint {
abortOnError = false
}
defaultConfig {
applicationId = "app.waste2wealth.com"
minSdk = 27
targetSdk = 33
targetSdk = 34
versionCode = 1
versionName = "1.0"

Expand Down Expand Up @@ -153,4 +153,7 @@ dependencies {
//Barcode
implementation(libs.google.mlkit)

// MapBox
implementation("com.mapbox.maps:android:10.14.0")

}
96 changes: 89 additions & 7 deletions app/google-services.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,115 @@
{
"project_info": {
"project_number": "335998282585",
"project_id": "waste2wealth-225f8",
"storage_bucket": "waste2wealth-225f8.appspot.com"
"project_number": "1055081790867",
"project_id": "waste2wealth-v2",
"storage_bucket": "waste2wealth-v2.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:335998282585:android:4425df7537fd6d64b93a48",
"mobilesdk_app_id": "1:1055081790867:android:05771690be96afefd17c66",
"android_client_info": {
"package_name": "app.waste2wealth.com"
}
},
"oauth_client": [
{
"client_id": "335998282585-ffdp7jqlc8tqu56dqj2j7ifflp67tu12.apps.googleusercontent.com",
"client_id": "1055081790867-bv5pffgc40puurbnqgj2d3u8n7c031rh.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "app.waste2wealth.com",
"certificate_hash": "fd53562d082592940490b430b2c8266248ee095f"
}
},
{
"client_id": "1055081790867-58753m4f8ii68enihvr329gpabdktrq1.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyCRPEKLMu6Jx6NtB-iuReJM3UNzpb4x19c"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "1055081790867-58753m4f8ii68enihvr329gpabdktrq1.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:1055081790867:android:d4cafb34c8d9efe4d17c66",
"android_client_info": {
"package_name": "custom.push.notifications"
}
},
"oauth_client": [
{
"client_id": "1055081790867-crlj92qi0l5uvptctrm1g5hj7htfnp54.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "custom.push.notifications",
"certificate_hash": "fd53562d082592940490b430b2c8266248ee095f"
}
},
{
"client_id": "1055081790867-58753m4f8ii68enihvr329gpabdktrq1.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyCRPEKLMu6Jx6NtB-iuReJM3UNzpb4x19c"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "1055081790867-58753m4f8ii68enihvr329gpabdktrq1.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:1055081790867:android:b1bb445e0abb201ed17c66",
"android_client_info": {
"package_name": "enrich.waste.adminpage"
}
},
"oauth_client": [
{
"client_id": "1055081790867-l7ehn6lneg38cabfginsueamcgoda3sf.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "enrich.waste.adminpage",
"certificate_hash": "fd53562d082592940490b430b2c8266248ee095f"
}
},
{
"client_id": "1055081790867-58753m4f8ii68enihvr329gpabdktrq1.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyAK61PJcM4_3fXrsaMG_l07lOGgBhB2KJE"
"current_key": "AIzaSyCRPEKLMu6Jx6NtB-iuReJM3UNzpb4x19c"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "335998282585-ffdp7jqlc8tqu56dqj2j7ifflp67tu12.apps.googleusercontent.com",
"client_id": "1055081790867-58753m4f8ii68enihvr329gpabdktrq1.apps.googleusercontent.com",
"client_type": 3
}
]
Expand Down
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/app/waste2wealth/com/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class MainActivity : ComponentActivity() {
NavigationController(scaffoldState, locationViewModel, navController)
// CompleteProfile()


}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ import androidx.compose.material.Card
import androidx.compose.material.ExperimentalMaterialApi
import androidx.compose.material.Icon
import androidx.compose.material.Scaffold
import androidx.compose.material.Tab
import androidx.compose.material.TabRow
import androidx.compose.material.TabRowDefaults
import androidx.compose.material.Text
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBackIos
Expand All @@ -46,9 +49,13 @@ import androidx.compose.ui.unit.sp
import androidx.navigation.NavHostController
import app.waste2wealth.com.R
import app.waste2wealth.com.bottombar.BottomBar
import app.waste2wealth.com.challenges.Challenges
import app.waste2wealth.com.challenges.Clubs
import app.waste2wealth.com.challenges.Posts
import app.waste2wealth.com.components.permissions.PermissionDrawer
import app.waste2wealth.com.firebase.firestore.WasteItem
import app.waste2wealth.com.location.LocationViewModel
import app.waste2wealth.com.maps.MapScreen
import app.waste2wealth.com.navigation.Screens
import app.waste2wealth.com.ui.theme.CardColor
import app.waste2wealth.com.ui.theme.appBackground
Expand Down Expand Up @@ -143,60 +150,101 @@ fun CollectWaste(
}
}

Spacer(modifier = Modifier.height(30.dp))
if (allWastes != null) {
LazyColumn(
contentPadding = PaddingValues(
bottom = 150.dp,
top = 40.dp
)
val cList = listOf("List View", "Map View (Beta)")
var tabIndex by remember { mutableStateOf(0) }
Column(
modifier = Modifier
.fillMaxWidth()
.padding(start = 35.dp, end = 35.dp)
) {
TabRow(
selectedTabIndex = tabIndex,
backgroundColor = appBackground,
contentColor = textColor,
divider = {
TabRowDefaults.Divider(
color = Color(0xFFF37952),
thickness = 1.dp
)
},
) {
allWastes = allWastes?.sortedBy {
distance(
viewModel.latitude,
viewModel.longitude,
it.latitude,
it.longitude
cList.forEachIndexed { index, title ->
Tab(text = {
Text(
title,
softWrap = false,
fontSize = 13.sp,
)
},
selected = tabIndex == index,
onClick = { tabIndex = index }
)
}
itemsIndexed(allWastes ?: emptyList()) { index, wasteItem ->
WasteItemCard(
locationNo = "Location ${index + 1}",
address = wasteItem.address,
distance = "${
convertDistance(
distance(
viewModel.latitude,
viewModel.longitude,
wasteItem.latitude,
wasteItem.longitude

}

}
if (tabIndex == 0) {
Spacer(modifier = Modifier.height(30.dp))
if (allWastes != null) {
LazyColumn(
contentPadding = PaddingValues(
bottom = 150.dp,
top = 40.dp
)
) {
allWastes = allWastes?.sortedBy {
distance(
viewModel.latitude,
viewModel.longitude,
it.latitude,
it.longitude
)
}
itemsIndexed(allWastes ?: emptyList()) { index, wasteItem ->
WasteItemCard(
locationNo = "Location ${index + 1}",
address = wasteItem.address,
distance = "${
convertDistance(
distance(
viewModel.latitude,
viewModel.longitude,
wasteItem.latitude,
wasteItem.longitude
)
)
)
} away",
time = getTimeAgo(wasteItem.timeStamp),
) {
viewModel.locationNo.value = "Location ${index + 1}"
viewModel.address.value = wasteItem.address
viewModel.distance.value = "${
convertDistance(
distance(
viewModel.latitude,
viewModel.longitude,
wasteItem.latitude,
wasteItem.longitude
} away",
time = getTimeAgo(wasteItem.timeStamp),
) {
viewModel.locationNo.value = "Location ${index + 1}"
viewModel.address.value = wasteItem.address
viewModel.distance.value = "${
convertDistance(
distance(
viewModel.latitude,
viewModel.longitude,
wasteItem.latitude,
wasteItem.longitude
)
)
)
} away"
viewModel.time.value = getTimeAgo(wasteItem.timeStamp)
viewModel.wastePhoto.value = wasteItem.imagePath
viewModel.theirLatitude.value = wasteItem.latitude
viewModel.theirLongitude.value = wasteItem.longitude
println("Collected time ${viewModel.time.value}")
navController.navigate(Screens.CollectWasteInfo.route)
}
} away"
viewModel.time.value = getTimeAgo(wasteItem.timeStamp)
viewModel.wastePhoto.value = wasteItem.imagePath
viewModel.theirLatitude.value = wasteItem.latitude
viewModel.theirLongitude.value = wasteItem.longitude
println("Collected time ${viewModel.time.value}")
navController.navigate(Screens.CollectWasteInfo.route)
}

}
}
}
} else {
MapScreen(
navController = navController,
viewModel = viewModel,
)
}

}
Expand Down
Loading

0 comments on commit b02cc56

Please sign in to comment.