Skip to content

Commit 37ba469

Browse files
Merge conflicts resolved
2 parents d992dfb + 4e1690e commit 37ba469

11 files changed

Lines changed: 153 additions & 141 deletions

File tree

.idea/misc.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
android:allowBackup="true"
2727
android:icon="@drawable/adclogored"
2828
android:label="@string/app_name"
29-
android:roundIcon="@drawable/adclogo"
29+
android:roundIcon="@drawable/adclogo2"
3030
android:supportsRtl="true"
3131
android:networkSecurityConfig="@xml/network_security_config"
3232
android:theme="@style/AppTheme">

app/src/main/java/com/example/autodoorctrl/autodoorctrlandroid/Bluetooth.kt

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import android.widget.Toast
55
import androidx.appcompat.app.AppCompatActivity
66
import app.akexorcist.bluetotohspp.library.BluetoothSPP
77
import app.akexorcist.bluetotohspp.library.BluetoothState
8-
import app.akexorcist.bluetotohspp.library.BluetoothSPP.BluetoothStateListener
98

109

1110

@@ -14,33 +13,28 @@ import app.akexorcist.bluetotohspp.library.BluetoothSPP.BluetoothStateListener
1413

1514

1615
class Bluetooth:AppCompatActivity(){
17-
var bluetooth: BluetoothSPP? = BluetoothSPP(this)
16+
private var bluetooth: BluetoothSPP? = BluetoothSPP(this)
1817
override fun onCreate(savedInstanceState: Bundle?) {
1918
super.onCreate(savedInstanceState)
2019
bluetooth?.setBluetoothStateListener(
2120
fun (state:Int) {
22-
if(state == BluetoothState.STATE_CONNECTED)
23-
Toast.makeText(applicationContext, "Connected to the Arduino", Toast.LENGTH_SHORT)
21+
when(state)
22+
{
23+
BluetoothState.STATE_CONNECTED->Toast.makeText(applicationContext, "Connected to the Arduino", Toast.LENGTH_SHORT)
2424
.show()
25-
// Do something when successfully connected
26-
else if(state == BluetoothState.STATE_CONNECTING)
27-
Toast.makeText(applicationContext, "Connecting to the Arduino", Toast.LENGTH_SHORT)
25+
BluetoothState.STATE_CONNECTING->Toast.makeText(applicationContext, "Connecting to the Arduino", Toast.LENGTH_SHORT)
2826
.show()
29-
// Do something while connecting
30-
else if(state == BluetoothState.STATE_LISTEN)
31-
Toast.makeText(applicationContext, "Waiting for connection to the Arduino", Toast.LENGTH_SHORT)
27+
BluetoothState.STATE_LISTEN->Toast.makeText(applicationContext, "Waiting for connection to the Arduino", Toast.LENGTH_SHORT)
3228
.show()
33-
// Do something when device is waiting for connection
34-
else if(state == BluetoothState.STATE_NONE)
35-
Toast.makeText(applicationContext, "No connection", Toast.LENGTH_SHORT)
29+
BluetoothState.STATE_NONE->Toast.makeText(applicationContext, "No connection", Toast.LENGTH_SHORT)
3630
.show()
37-
// Do something when device don't have any connectio
31+
}
3832
}
3933
)
4034
}
4135
public override fun onStart() {
4236
super.onStart()
43-
if (bluetooth?.isBluetoothEnabled()!!) {
37+
if (bluetooth?.isBluetoothEnabled!!) {
4438
bluetooth?.enable()
4539
} else {
4640
if (bluetooth?.isServiceAvailable!!) {

app/src/main/java/com/example/autodoorctrl/autodoorctrlandroid/ContactFixx.kt

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@ package com.example.autodoorctrl.autodoorctrlandroid
22

33
import android.content.Intent
44
import android.os.Bundle
5-
import android.os.CancellationSignal
65
import android.util.Log
76
import android.view.View
8-
import android.view.animation.AlphaAnimation
97
import android.widget.Button
108
import android.widget.EditText
11-
import android.widget.ImageView
129
import android.widget.Toast
1310
import androidx.appcompat.app.AppCompatActivity
1411

@@ -24,18 +21,18 @@ class ContactFixx : AppCompatActivity() {
2421
// get reference to button
2522
val btn = findViewById<Button>(R.id.fixx_send)
2623
val name= findViewById<EditText>(R.id.name)
27-
val email = findViewById<EditText>(R.id.rpiemail)
24+
// val email = findViewById<EditText>(R.id.rpiemail)
2825
val msg = findViewById<EditText>(R.id.msg_fixx)
2926
btn.setOnClickListener {
30-
val username = name.text.toString()
31-
val rpi_email = email.text.toString()
32-
val msg = msg.text.toString()
27+
// val username = name.text.toString()
28+
// val rpi_email = email.text.toString()
29+
val msgStr = msg.text.toString()
3330

3431
val fixx = "fixx@rpi.edu"
3532
val email = Intent(Intent.ACTION_SEND)
3633
email.putExtra(Intent.EXTRA_EMAIL, arrayOf(fixx))
3734
email.putExtra(Intent.EXTRA_SUBJECT, "Issue with Automatic Door")
38-
email.putExtra(Intent.EXTRA_TEXT, msg)
35+
email.putExtra(Intent.EXTRA_TEXT, msgStr)
3936

4037
email.type = "message/rfc822"
4138
startActivity(Intent.createChooser(email, "Choose an Email client :"))
@@ -45,7 +42,7 @@ class ContactFixx : AppCompatActivity() {
4542

4643

4744
}
48-
fun hideNavBar() {
45+
private fun hideNavBar() {
4946
this.window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_FULLSCREEN or
5047
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY or
5148
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or

app/src/main/java/com/example/autodoorctrl/autodoorctrlandroid/Login.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class Login : AppCompatActivity() {
5050
startActivity(loginIntent)
5151
}
5252

53-
fun goToSettings() {
53+
private fun goToSettings() {
5454
val intent = Intent(this@Login, Settings::class.java)
5555
startActivity(intent)
5656
}

app/src/main/java/com/example/autodoorctrl/autodoorctrlandroid/MainLogin.kt

Lines changed: 9 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,15 @@
11
package com.example.autodoorctrl.autodoorctrlandroid
22

3-
import android.Manifest
4-
import android.annotation.TargetApi
5-
import android.app.KeyguardManager
6-
import android.content.Context
7-
import android.content.DialogInterface
83
import android.content.Intent
9-
import android.content.pm.PackageManager
10-
import android.hardware.biometrics.BiometricPrompt
11-
import android.os.Build
124
import android.os.Bundle
135
import android.view.View
146
import android.view.animation.AlphaAnimation
157
import android.widget.ImageView
168
import android.widget.Toast
179
import androidx.appcompat.app.AppCompatActivity
1810
import org.json.JSONException
19-
import androidx.core.app.ActivityCompat
20-
import androidx.core.hardware.fingerprint.FingerprintManagerCompat
21-
import android.os.CancellationSignal
2211
import android.widget.Button
2312
import java.io.*
24-
import com.google.android.material.textfield.TextInputEditText
2513
import okhttp3.OkHttpClient
2614
import okhttp3.Callback
2715
import okhttp3.Response
@@ -32,7 +20,6 @@ import org.json.JSONObject
3220

3321
class MainLogin : AppCompatActivity() {
3422
private val opacityClick: AlphaAnimation = AlphaAnimation(0.8f, 0.4f)
35-
private val cancellationSignal: CancellationSignal = CancellationSignal()
3623
private var client = OkHttpClient()
3724
private var request = OkHttpRequest(client)
3825
private val url = "http://69.55.54.25:80/api/login"
@@ -56,15 +43,15 @@ class MainLogin : AppCompatActivity() {
5643
}
5744

5845
private fun loginUser(map:HashMap<String,String>) {
59-
request.POST(url,map,object: Callback {
46+
request.post(url,map,object: Callback {
6047
override fun onResponse(call: Call, response: Response)
6148
{
6249
try
6350
{
64-
var jsonArray = JSONObject(response.body?.string())
51+
val jsonArray = JSONObject(response.body?.string())
6552
println(jsonArray)
6653
if(jsonArray.getString("SESSIONID").compareTo("") != 0)
67-
sendToMap(map.get("RCSid"))
54+
sendToMap(map["RCSid"])
6855
else {
6956
runOnUiThread{
7057
Toast.makeText(applicationContext, "User does not exist", Toast.LENGTH_SHORT)
@@ -86,77 +73,23 @@ class MainLogin : AppCompatActivity() {
8673
}
8774
})
8875
}
89-
fun hideNavBar() {
76+
private fun hideNavBar() {
9077
this.window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_FULLSCREEN or
9178
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY or
9279
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or
9380
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
9481
}
95-
private fun sendCredentials( RCS:String,password:String){
9682

97-
}
83+
9884
private fun goToSettings() {
9985
val intent = Intent(this@MainLogin, Settings::class.java)
10086
startActivity(intent)
10187
}
10288

103-
fun notifyUser(message: String) {
104-
Toast.makeText(
105-
this,
106-
message,
107-
Toast.LENGTH_LONG
108-
).show()
109-
}
110-
private fun sendToMap(RCSid: String?) {
111-
var Maps = Intent(this, MapsActivity::class.java)
112-
Maps.putExtra("RCSid",RCSid)
113-
startActivity(Maps)
114-
}
115-
116-
@TargetApi(Build.VERSION_CODES.P)
117-
fun getAuthenticationCallback(): BiometricPrompt.AuthenticationCallback {
118-
119-
return object : BiometricPrompt.AuthenticationCallback() {
120-
override fun onAuthenticationError(
121-
errorCode: Int,
122-
errString: CharSequence
123-
) {
124-
notifyUser("Authentication error: $errString")
125-
super.onAuthenticationError(errorCode, errString)
126-
}
127-
128-
override fun onAuthenticationFailed() {
129-
super.onAuthenticationFailed()
130-
}
131-
132-
override fun onAuthenticationSucceeded(
133-
result: BiometricPrompt.AuthenticationResult
134-
) {
135-
notifyUser("Authentication Succeeded")
136-
super.onAuthenticationSucceeded(result)
137-
val intent = Intent(this@MainLogin , MapsActivity::class.java)
138-
startActivity(intent)
139-
}
140-
}
141-
}
142-
143-
private fun getCancellationSignal(): CancellationSignal {
144-
145-
cancellationSignal.setOnCancelListener(CancellationSignal.OnCancelListener { notifyUser("Cancelled via signal") })
146-
return cancellationSignal
147-
}
148-
@TargetApi(Build.VERSION_CODES.P)
149-
private fun authenticateUser() {
150-
val biometricPrompt = BiometricPrompt.Builder(this)
151-
.setTitle("Biometric Login")
152-
.setSubtitle("Authentication is required to continue")
153-
.setDescription("Use Fingerprint to login to Automatic Door Control.")
154-
.setNegativeButton("Cancel", this.mainExecutor,
155-
DialogInterface.OnClickListener { dialogInterface, i -> notifyUser("Authentication cancelled") })
156-
.build()
157-
158-
biometricPrompt.authenticate(getCancellationSignal(), getMainExecutor(),
159-
getAuthenticationCallback());
89+
private fun sendToMap(RCSid: String?) {
90+
val maps = Intent(this, MapsActivity::class.java)
91+
maps.putExtra("RCSid", RCSid)
92+
startActivity(maps)
16093
}
16194
}
16295

0 commit comments

Comments
 (0)