Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .idea/misc.xml

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

3 changes: 3 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ dependencies {
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.0'
implementation 'androidx.activity:activity-compose:1.4.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
Expand Down
5 changes: 4 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ucmobiledevelopment.freeways">

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

<application
android:name=".IncidentApplication"
Expand All @@ -12,6 +12,9 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.FreeWays">
<activity
android:name=".ReportIncidentActivity"
android:exported="false" />
<activity
android:name=".MainActivity"
android:exported="true"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
package com.ucmobiledevelopment.freeways

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.Toast
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material.*
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import com.ucmobiledevelopment.freeways.ui.theme.FreeWaysTheme
import com.ucmobiledevelopment.freeways.ui.theme.Purple200

class ReportIncidentActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
FreeWaysTheme {
Surface(
color = Purple200,
modifier = Modifier.fillMaxWidth()) {
reportDataFields()
}
}
}
}
}

@Composable
fun reportDataFields(){
var stateId by remember { mutableStateOf("")}
var StateName by remember { mutableStateOf("")}
var countyId by remember { mutableStateOf("")}
var countyName by remember { mutableStateOf("")}
var cityName by remember { mutableStateOf("")}
var latitude by remember { mutableStateOf("")}
var longitude by remember { mutableStateOf("")}
var way1 by remember { mutableStateOf("")}
var way2 by remember { mutableStateOf("")}
var vehiclesInvolved by remember { mutableStateOf("")}
val context = LocalContext.current

Column {
OutlinedTextField(
value = stateId,
onValueChange = { stateId = it },
label = { Text(stringResource(R.string.stateID)) },
modifier = Modifier.fillMaxWidth()
)
OutlinedTextField(
value = StateName,
onValueChange = { StateName = it },
label = { Text(stringResource(R.string.StateName)) },
modifier = Modifier.fillMaxWidth()
)
OutlinedTextField(
value = countyId,
onValueChange = { countyId = it },
label = { Text(stringResource(R.string.CountyID)) },
modifier = Modifier.fillMaxWidth()
)
OutlinedTextField(
value = countyName,
onValueChange = { countyName = it },
label = { Text(stringResource(R.string.CountyName)) },
modifier = Modifier.fillMaxWidth()
)
OutlinedTextField(
value = cityName,
onValueChange = { cityName = it },
label = { Text(stringResource(R.string.CityName)) },
modifier = Modifier.fillMaxWidth()
)
OutlinedTextField(
value = latitude,
onValueChange = { latitude = it },
label = { Text(stringResource(R.string.Latitude)) },
modifier = Modifier.fillMaxWidth()
)
OutlinedTextField(
value = longitude,
onValueChange = { longitude = it },
label = { Text(stringResource(R.string.Longitude)) },
modifier = Modifier.fillMaxWidth()
)
OutlinedTextField(
value = way1,
onValueChange = { way1 = it },
label = { Text(stringResource(R.string.Way1)) },
modifier = Modifier.fillMaxWidth()
)
OutlinedTextField(
value = way2,
onValueChange = { way2 = it },
label = { Text(stringResource(R.string.Way2)) },
modifier = Modifier.fillMaxWidth()
)
OutlinedTextField(
value = vehiclesInvolved,
onValueChange = { vehiclesInvolved = it },
label = { Text(stringResource(R.string.VehiclesInvolved)) },
modifier = Modifier.fillMaxWidth()
)
Button(
onClick = {
Toast.makeText(context, "$stateId $StateName $countyId $countyName $cityName $latitude $longitude $way1 $way2 $vehiclesInvolved",
Toast.LENGTH_LONG).show()
}
) {
Text(text = "Save")
}
}
}

@Preview
@Composable
fun DefaultPreview2() {
FreeWaysTheme {
reportDataFields()
}
}
10 changes: 10 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
<resources>
<string name="app_name">FreeWays</string>
<string name="stateID">State ID</string>
<string name="StateName">State Name</string>
<string name="CountyID">County ID</string>
<string name="CountyName">County Name</string>
<string name="CityName">City Name</string>
<string name="Latitude">Latitude</string>
<string name="Longitude">Longitude</string>
<string name="Way1">Way 1</string>
<string name="Way2">Way 2</string>
<string name="VehiclesInvolved">Number of Vehicles Involved</string>
</resources>
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ buildscript {
plugins {
id 'com.android.application' version '7.1.0' apply false
id 'com.android.library' version '7.1.0' apply false
id 'org.jetbrains.kotlin.android' version '1.5.31' apply false
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
}

task clean(type: Delete) {
Expand Down