Skip to content

Commit

Permalink
Merge pull request #89 from debz-g/develop
Browse files Browse the repository at this point in the history
Added Global Strings and removed hardcoded strings for directions.
  • Loading branch information
avivijay19 authored Dec 14, 2021
2 parents d84956c + 28bf469 commit b129e5a
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 30 deletions.
3 changes: 1 addition & 2 deletions .idea/gradle.xml

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

8 changes: 8 additions & 0 deletions .idea/misc.xml

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

12 changes: 0 additions & 12 deletions .idea/runConfigurations.xml

This file was deleted.

1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

lintOptions {
abortOnError false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,23 +109,23 @@ class Main3Activity : BluetoothActivity() {


if (item.value == "L") {
sendMessage("L")
sendMessage(getString(R.string.left_direction))
Toast.makeText(applicationContext, "Done Left", Toast.LENGTH_SHORT).show()
startActivity(i)
finish()
} else if (item.value == "R") {
sendMessage("R")
sendMessage(getString(R.string.right_direction))
Toast.makeText(applicationContext, "Done Right", Toast.LENGTH_SHORT).show()
startActivity(i)
finish()
}
if (item.value == "F") {
sendMessage("F")
sendMessage(getString(R.string.forward_direction))
Toast.makeText(applicationContext, "Done Forwerd", Toast.LENGTH_SHORT).show()
startActivity(i)
finish()
} else if (item.value == "S") {
sendMessage("S")
sendMessage(getString(R.string.stop_direction))
Toast.makeText(applicationContext, "Done ", Toast.LENGTH_SHORT).show()
startActivity(i)
finish()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,31 @@ class ManualControlActivity : BluetoothActivity() {
var t = findViewById<TextView>(R.id.STT)
right.setOnClickListener(View.OnClickListener {
if (global_variables.bT == 1) {
sendMessage("R")
t.text = "R"
sendMessage(getString(R.string.right_direction))
}
t.text = "R"
})
left.setOnClickListener(View.OnClickListener {
if (global_variables.bT == 1) {
sendMessage("L")
sendMessage(getString(R.string.left_direction))
}
t.text = "L"
})
forward.setOnClickListener(View.OnClickListener {
if (global_variables.bT == 1) {
sendMessage("F")
sendMessage(getString(R.string.forward_direction))
}
t.text = "F"
})
backward.setOnClickListener(View.OnClickListener {
if (global_variables.bT == 1) {
sendMessage("B")
sendMessage(getString(R.string.backward_direction))
}
t.text = "B"
})
stop.setOnClickListener(View.OnClickListener {
if (global_variables.bT == 1) {
sendMessage("S")
sendMessage(getString(R.string.stop_direction))
}
t.text = "S"
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class VoiceControlActivity : BluetoothActivity() {
b.setOnClickListener { startActivityForResult(intent, 1) }
s.setOnClickListener {
if (global_variables.bT == 1) {
sendMessage("S")
sendMessage(getString(R.string.stop_direction))
}
}
}
Expand All @@ -50,31 +50,31 @@ class VoiceControlActivity : BluetoothActivity() {
for (s in str) {
if (s.contains("forward")) {
if (global_variables.bT == 1) {
sendMessage("F")
sendMessage(getString(R.string.forward_direction))
}
Log.d("TAG", s)
break
} else if (s.contains("backward")) {
if (global_variables.bT == 1) {
sendMessage("B")
sendMessage(getString(R.string.backward_direction))
}
Log.d("TAG", s)
break
} else if (s.contains("left")) {
if (global_variables.bT == 1) {
sendMessage("L")
sendMessage(getString(R.string.left_direction))
}
Log.d("TAG", s)
break
} else if (s.contains("right")) {
if (global_variables.bT == 1) {
sendMessage("R")
sendMessage(getString(R.string.right_direction))
}
Log.d("TAG", s)
break
} else if (s.contains("stop")) {
if (global_variables.bT == 1) {
sendMessage("S")
sendMessage(getString(R.string.stop_direction))
}
Log.d("TAG", s)
break
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/res/values-night/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,11 @@
<string name="hello_world">Hello World!</string>
<!-- content_main3-->

<!--Direction Strings-->
<string name="stop_direction">S</string>
<string name="forward_direction">F</string>
<string name="backward_direction">B</string>
<string name="left_direction">L</string>
<string name="right_direction">R</string>

</resources>
9 changes: 9 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,13 @@
<string name="hello_world">Hello World!</string>
<!-- content_main3-->

<!--Direction Strings-->
<string name="stop_direction">S</string>
<string name="forward_direction">F</string>
<string name="backward_direction">B</string>
<string name="left_direction">L</string>
<string name="right_direction">R</string>



</resources>

0 comments on commit b129e5a

Please sign in to comment.