diff --git a/Common Voice Android/app/src/main/AndroidManifest.xml b/Common Voice Android/app/src/main/AndroidManifest.xml
index 48219770..06a1f588 100644
--- a/Common Voice Android/app/src/main/AndroidManifest.xml
+++ b/Common Voice Android/app/src/main/AndroidManifest.xml
@@ -15,13 +15,13 @@
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="AllowBackup,GoogleAppIndexingWarning">
-
+
-
+
@@ -30,6 +30,18 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Common Voice Android/app/src/main/java/org/commonvoice/saverio/ListenActivity.kt b/Common Voice Android/app/src/main/java/org/commonvoice/saverio/ListenActivity.kt
new file mode 100644
index 00000000..905b09fd
--- /dev/null
+++ b/Common Voice Android/app/src/main/java/org/commonvoice/saverio/ListenActivity.kt
@@ -0,0 +1,41 @@
+package org.commonvoice.saverio
+
+import android.Manifest
+import android.content.Intent
+import android.content.SharedPreferences
+import android.content.pm.PackageInfo
+import android.content.pm.PackageManager
+import android.os.Bundle
+import androidx.appcompat.app.AppCompatActivity
+import androidx.core.app.ActivityCompat
+import androidx.core.content.ContextCompat
+
+
+class ListenActivity : AppCompatActivity() {
+
+ private val RECORD_REQUEST_CODE = 101
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContentView(R.layout.activity_listen)
+
+ checkRecordVoicePermission()
+ }
+
+ fun checkRecordVoicePermission() {
+ if (ContextCompat.checkSelfPermission(this, Manifest.permission.INTERNET)
+ != PackageManager.PERMISSION_GRANTED) {
+ ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.INTERNET), RECORD_REQUEST_CODE)
+ }
+ }
+
+ override fun onRequestPermissionsResult(requestCode: Int, permissions: Array, grantResults: IntArray) {
+ when (requestCode) {
+ RECORD_REQUEST_CODE -> {
+ if (grantResults.isEmpty() || grantResults[0] != PackageManager.PERMISSION_GRANTED) {
+ checkRecordVoicePermission()
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Common Voice Android/app/src/main/java/org/commonvoice/saverio/MainActivity.kt b/Common Voice Android/app/src/main/java/org/commonvoice/saverio/MainActivity.kt
index e2d61e63..0e3f207e 100644
--- a/Common Voice Android/app/src/main/java/org/commonvoice/saverio/MainActivity.kt
+++ b/Common Voice Android/app/src/main/java/org/commonvoice/saverio/MainActivity.kt
@@ -14,7 +14,8 @@ import androidx.navigation.ui.AppBarConfiguration
import androidx.navigation.ui.setupActionBarWithNavController
import androidx.navigation.ui.setupWithNavController
import com.google.android.material.bottomnavigation.BottomNavigationView
-import kotlinx.android.synthetic.main.fragment_settings.*
+import kotlinx.android.synthetic.main.fragment_home.*
+import java.net.URL
class MainActivity : AppCompatActivity() {
@@ -49,12 +50,25 @@ class MainActivity : AppCompatActivity() {
startActivity(it)
}
finish()
- }
- else {
+ } else {
checkRecordVoicePermission()
}
}
+ fun open_speak_section()
+ {
+ val intent = Intent(this, SpeakActivity::class.java).also {
+ startActivity(it)
+ }
+ }
+
+ fun open_listen_section()
+ {
+ val intent = Intent(this, ListenActivity::class.java).also {
+ startActivity(it)
+ }
+ }
+
fun checkRecordVoicePermission() {
if (ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO)
!= PackageManager.PERMISSION_GRANTED) {
diff --git a/Common Voice Android/app/src/main/java/org/commonvoice/saverio/SpeakActivity.kt b/Common Voice Android/app/src/main/java/org/commonvoice/saverio/SpeakActivity.kt
new file mode 100644
index 00000000..69e56052
--- /dev/null
+++ b/Common Voice Android/app/src/main/java/org/commonvoice/saverio/SpeakActivity.kt
@@ -0,0 +1,51 @@
+package org.commonvoice.saverio
+
+import android.Manifest
+import android.content.Intent
+import android.content.SharedPreferences
+import android.content.pm.PackageInfo
+import android.content.pm.PackageManager
+import android.os.Bundle
+import android.webkit.WebView
+import android.webkit.WebViewClient
+import androidx.appcompat.app.AppCompatActivity
+import androidx.core.app.ActivityCompat
+import androidx.core.content.ContextCompat
+import kotlinx.android.synthetic.main.activity_speak.*
+import java.net.HttpURLConnection
+import java.net.URL
+
+
+class SpeakActivity : AppCompatActivity() {
+
+ private val RECORD_REQUEST_CODE = 101
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ //setContentView(R.layout.activity_speak)
+ setContentView(R.layout.activity_speak)
+
+ //checkRecordVoicePermission()
+
+ this.btn_start_speak.setOnClickListener {
+ //
+ }
+ }
+
+ fun checkRecordVoicePermission() {
+ if (ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO)
+ != PackageManager.PERMISSION_GRANTED) {
+ ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.RECORD_AUDIO), RECORD_REQUEST_CODE)
+ }
+ }
+
+ override fun onRequestPermissionsResult(requestCode: Int, permissions: Array, grantResults: IntArray) {
+ when (requestCode) {
+ RECORD_REQUEST_CODE -> {
+ if (grantResults.isEmpty() || grantResults[0] != PackageManager.PERMISSION_GRANTED) {
+ checkRecordVoicePermission()
+ }
+ }
+ }
+ }
+}
diff --git a/Common Voice Android/app/src/main/java/org/commonvoice/saverio/TutorialActivity.kt b/Common Voice Android/app/src/main/java/org/commonvoice/saverio/TutorialActivity.kt
index e3473cd1..fa2617f5 100644
--- a/Common Voice Android/app/src/main/java/org/commonvoice/saverio/TutorialActivity.kt
+++ b/Common Voice Android/app/src/main/java/org/commonvoice/saverio/TutorialActivity.kt
@@ -6,7 +6,6 @@ import android.content.SharedPreferences
import android.content.pm.PackageManager
import android.os.Bundle
import android.webkit.WebView
-import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
@@ -33,14 +32,6 @@ class TutorialActivity : AppCompatActivity() {
this.btn_next.setOnClickListener{
tutorialStart()
}
-
- /*webView.webViewClient = object : WebViewClient() {
- override fun shouldOverrideUrlLoading(view: WebView?, url: String?): Boolean {
- view?.loadUrl(url)
- return true
- }
- }
- webView.loadUrl("https://voice.mozilla.org/it/")*/
}
fun tutorialStart() {
@@ -66,8 +57,8 @@ class TutorialActivity : AppCompatActivity() {
}
fun tutorialStart1() {
- this.textViewMessage.isVisible = false
- this.textViewMessage.text = ""
+ this.textTutorialMessage.isVisible = false
+ this.textTutorialMessage.text = ""
this.seekBar.progress = 1
this.textView_tutorial.text = getString(R.string.tutorial_text2)
if (ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO)
@@ -94,8 +85,8 @@ class TutorialActivity : AppCompatActivity() {
fun tutorialStartPermissionDenied()
{
// Permission is not granted
- this.textViewMessage.isVisible = true
- this.textViewMessage.text = "Error: permission fail"
+ this.textTutorialMessage.isVisible = true
+ this.textTutorialMessage.text = "Error: permission fail"
//Toast.makeText(this, "Error: permission fail", Toast.LENGTH_LONG).show()
this.btn_next.text = getString(R.string.btn_tutorial4) // try again
}
@@ -103,8 +94,8 @@ class TutorialActivity : AppCompatActivity() {
fun tutorialStartPermissionSuccessful()
{
// Permission is granted
- this.textViewMessage.isVisible = true
- this.textViewMessage.text = "Permission successful"
+ this.textTutorialMessage.isVisible = true
+ this.textTutorialMessage.text = "Permission successful"
//Toast.makeText(this,"Permission successful",Toast.LENGTH_SHORT).show()
this.btn_next.text = getString(R.string.btn_tutorial3) // next
this.status = 2
@@ -112,12 +103,13 @@ class TutorialActivity : AppCompatActivity() {
fun tutorialStart3() {
// finish
- this.textViewMessage.isVisible = false
- this.textViewMessage.text = ""
+ this.textTutorialMessage.isVisible = false
+ this.textTutorialMessage.text = ""
this.seekBar.progress = 2
this.textView_tutorial.text = getString(R.string.tutorial_text3)
this.btn_next.text = getString(R.string.btn_tutorial5)
this.status = 3
+ this.languageListTutorial.isVisible = true
}
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array, grantResults: IntArray) {
diff --git a/Common Voice Android/app/src/main/java/org/commonvoice/saverio/ui/dashboard/DashboardFragment.kt b/Common Voice Android/app/src/main/java/org/commonvoice/saverio/ui/dashboard/DashboardFragment.kt
index b503d857..59b24f19 100644
--- a/Common Voice Android/app/src/main/java/org/commonvoice/saverio/ui/dashboard/DashboardFragment.kt
+++ b/Common Voice Android/app/src/main/java/org/commonvoice/saverio/ui/dashboard/DashboardFragment.kt
@@ -1,18 +1,24 @@
package org.commonvoice.saverio.ui.dashboard
+import android.content.SharedPreferences
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
+import android.webkit.WebView
+import android.webkit.WebViewClient
import android.widget.TextView
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders
+import kotlinx.android.synthetic.main.fragment_webbrowser.*
import org.commonvoice.saverio.R
class DashboardFragment : Fragment() {
private lateinit var dashboardViewModel: DashboardViewModel
+ private lateinit var webView: WebView
+ private var language = "it"
override fun onCreateView(
inflater: LayoutInflater,
@@ -22,10 +28,10 @@ class DashboardFragment : Fragment() {
dashboardViewModel =
ViewModelProviders.of(this).get(DashboardViewModel::class.java)
val root = inflater.inflate(R.layout.fragment_dashboard, container, false)
- val textView: TextView = root.findViewById(R.id.text_dashboard)
- dashboardViewModel.text.observe(this, Observer {
- textView.text = it
- })
+ val textStatistics: TextView = root.findViewById(R.id.text_dashboardStatistics)
+ textStatistics.text = getText(R.string.dashboardStatistics)
+
+
return root
}
}
\ No newline at end of file
diff --git a/Common Voice Android/app/src/main/java/org/commonvoice/saverio/ui/home/HomeFragment.kt b/Common Voice Android/app/src/main/java/org/commonvoice/saverio/ui/home/HomeFragment.kt
index d7afc4f2..9255f8f1 100644
--- a/Common Voice Android/app/src/main/java/org/commonvoice/saverio/ui/home/HomeFragment.kt
+++ b/Common Voice Android/app/src/main/java/org/commonvoice/saverio/ui/home/HomeFragment.kt
@@ -9,7 +9,9 @@ import android.widget.Toast
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders
+import kotlinx.android.synthetic.main.fragment_home.*
import kotlinx.android.synthetic.main.fragment_settings.*
+import org.commonvoice.saverio.MainActivity
import org.commonvoice.saverio.R
class HomeFragment : Fragment() {
@@ -24,15 +26,18 @@ class HomeFragment : Fragment() {
homeViewModel =
ViewModelProviders.of(this).get(HomeViewModel::class.java)
val root = inflater.inflate(R.layout.fragment_home, container, false)
- /*val textView: TextView = root.findViewById(R.id.text_home)
- homeViewModel.text.observe(this, Observer {
- textView.text = it
- })*/
+
val btnSpeak: Button = root.findViewById(R.id.btn_speak)
val btnListen: Button = root.findViewById(R.id.btn_listen)
- return root
- }
+ btnSpeak.setOnClickListener{
+ (activity as MainActivity).open_speak_section()
+ }
+ btnListen.setOnClickListener{
+ (activity as MainActivity).open_listen_section()
+ }
+ return root
+ }
}
\ No newline at end of file
diff --git a/Common Voice Android/app/src/main/java/org/commonvoice/saverio/ui/settings/SettingsFragment.kt b/Common Voice Android/app/src/main/java/org/commonvoice/saverio/ui/settings/SettingsFragment.kt
index 42dd6134..b152dff5 100644
--- a/Common Voice Android/app/src/main/java/org/commonvoice/saverio/ui/settings/SettingsFragment.kt
+++ b/Common Voice Android/app/src/main/java/org/commonvoice/saverio/ui/settings/SettingsFragment.kt
@@ -4,12 +4,16 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
+import android.widget.ArrayAdapter
+import android.widget.MultiAutoCompleteTextView
+import android.widget.MultiAutoCompleteTextView.CommaTokenizer
import android.widget.TextView
import androidx.fragment.app.Fragment
-import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders
+import kotlinx.android.synthetic.main.fragment_settings.*
import org.commonvoice.saverio.R
+
class SettingsFragment : Fragment() {
private lateinit var settingsViewModel: SettingsViewModel
@@ -22,10 +26,10 @@ class SettingsFragment : Fragment() {
settingsViewModel =
ViewModelProviders.of(this).get(SettingsViewModel::class.java)
val root = inflater.inflate(R.layout.fragment_settings, container, false)
- /*val textView: TextView = root.findViewById(R.id.text_settings)
- settingsViewModel.text.observe(this, Observer {
- textView.text = it
- })*/
+ val textLanguage: TextView = root.findViewById(R.id.text_settingsLanguage)
+ textLanguage.text = getText(R.string.settingsLanguage)
+
+
return root
}
diff --git a/Common Voice Android/app/src/main/res/drawable/ic_commonvoice_background.xml b/Common Voice Android/app/src/main/res/drawable/ic_commonvoice_background.xml
index 2408e30d..7601a59f 100644
--- a/Common Voice Android/app/src/main/res/drawable/ic_commonvoice_background.xml
+++ b/Common Voice Android/app/src/main/res/drawable/ic_commonvoice_background.xml
@@ -5,70 +5,70 @@
android:viewportHeight="108"
android:viewportWidth="108"
xmlns:android="http://schemas.android.com/apk/res/android">
-
+ android:strokeColor="#000000FF" android:strokeWidth="0.8"/>
+ android:strokeColor="#000000FF" android:strokeWidth="0.8"/>
+ android:strokeColor="#000000FF" android:strokeWidth="0.8"/>
+ android:strokeColor="#000000FF" android:strokeWidth="0.8"/>
+ android:strokeColor="#000000FF" android:strokeWidth="0.8"/>
+ android:strokeColor="#000000FF" android:strokeWidth="0.8"/>
+ android:strokeColor="#000000FF" android:strokeWidth="0.8"/>
+ android:strokeColor="#000000FF" android:strokeWidth="0.8"/>
+ android:strokeColor="#000000FF" android:strokeWidth="0.8"/>
+ android:strokeColor="#000000FF" android:strokeWidth="0.8"/>
+ android:strokeColor="#000000FF" android:strokeWidth="0.8"/>
+ android:strokeColor="#000000FF" android:strokeWidth="0.8"/>
+ android:strokeColor="#000000FF" android:strokeWidth="0.8"/>
+ android:strokeColor="#000000FF" android:strokeWidth="0.8"/>
+ android:strokeColor="#000000FF" android:strokeWidth="0.8"/>
+ android:strokeColor="#000000FF" android:strokeWidth="0.8"/>
+ android:strokeColor="#000000FF" android:strokeWidth="0.8"/>
+ android:strokeColor="#000000FF" android:strokeWidth="0.8"/>
+ android:strokeColor="#000000FF" android:strokeWidth="0.8"/>
+ android:strokeColor="#000000FF" android:strokeWidth="0.8"/>
+ android:strokeColor="#000000FF" android:strokeWidth="0.8"/>
+ android:strokeColor="#000000FF" android:strokeWidth="0.8"/>
+ android:strokeColor="#000000FF" android:strokeWidth="0.8"/>
+ android:strokeColor="#000000FF" android:strokeWidth="0.8"/>
+ android:strokeColor="#000000FF" android:strokeWidth="0.8"/>
+ android:strokeColor="#000000FF" android:strokeWidth="0.8"/>
+ android:strokeColor="#000000FF" android:strokeWidth="0.8"/>
+ android:strokeColor="#000000FF" android:strokeWidth="0.8"/>
+ android:strokeColor="#000000FF" android:strokeWidth="0.8"/>
+ android:strokeColor="#000000FF" android:strokeWidth="0.8"/>
+ android:strokeColor="#000000FF" android:strokeWidth="0.8"/>
+ android:strokeColor="#000000FF" android:strokeWidth="0.8"/>
diff --git a/Common Voice Android/app/src/main/res/drawable/ic_launcher_background.xml b/Common Voice Android/app/src/main/res/drawable/ic_launcher_background.xml
index 0d025f9b..afbf791f 100644
--- a/Common Voice Android/app/src/main/res/drawable/ic_launcher_background.xml
+++ b/Common Voice Android/app/src/main/res/drawable/ic_launcher_background.xml
@@ -5,166 +5,166 @@
android:viewportWidth="108"
android:viewportHeight="108">
+ android:strokeColor="#000000FF" />
+ android:strokeColor="#000000FF" />
+ android:strokeColor="#000000FF" />
+ android:strokeColor="#000000FF" />
+ android:strokeColor="#000000FF" />
+ android:strokeColor="#000000FF" />
+ android:strokeColor="#000000FF" />
+ android:strokeColor="#000000FF" />
+ android:strokeColor="#000000FF" />
+ android:strokeColor="#000000FF" />
+ android:strokeColor="#000000FF" />
+ android:strokeColor="#000000FF" />
+ android:strokeColor="#000000FF" />
+ android:strokeColor="#000000FF" />
+ android:strokeColor="#000000FF" />
+ android:strokeColor="#000000FF" />
+ android:strokeColor="#000000FF" />
+ android:strokeColor="#000000FF" />
+ android:strokeColor="#000000FF" />
+ android:strokeColor="#000000FF" />
+ android:strokeColor="#000000FF" />
+ android:strokeColor="#000000FF" />
+ android:strokeColor="#000000FF" />
+ android:strokeColor="#000000FF" />
+ android:strokeColor="#000000FF" />
+ android:strokeColor="#000000FF" />
+ android:strokeColor="#000000FF" />
+ android:strokeColor="#000000FF" />
+ android:strokeColor="#000000FF" />
+ android:strokeColor="#000000FF" />
+ android:strokeColor="#000000FF" />
+ android:strokeColor="#000000FF" />
diff --git a/Common Voice Android/app/src/main/res/drawable/txt_rounded.xml b/Common Voice Android/app/src/main/res/drawable/txt_rounded.xml
new file mode 100644
index 00000000..e7daaaac
--- /dev/null
+++ b/Common Voice Android/app/src/main/res/drawable/txt_rounded.xml
@@ -0,0 +1,10 @@
+
+
+ -
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Common Voice Android/app/src/main/res/layout/activity_listen.xml b/Common Voice Android/app/src/main/res/layout/activity_listen.xml
new file mode 100644
index 00000000..bade8e57
--- /dev/null
+++ b/Common Voice Android/app/src/main/res/layout/activity_listen.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Common Voice Android/app/src/main/res/layout/activity_speak.xml b/Common Voice Android/app/src/main/res/layout/activity_speak.xml
new file mode 100644
index 00000000..d2fe64d2
--- /dev/null
+++ b/Common Voice Android/app/src/main/res/layout/activity_speak.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Common Voice Android/app/src/main/res/layout/activity_tutorial.xml b/Common Voice Android/app/src/main/res/layout/activity_tutorial.xml
index 5d7b7987..8c95498d 100644
--- a/Common Voice Android/app/src/main/res/layout/activity_tutorial.xml
+++ b/Common Voice Android/app/src/main/res/layout/activity_tutorial.xml
@@ -91,7 +91,7 @@
app:layout_constraintStart_toStartOf="parent" />
+
+
\ No newline at end of file
diff --git a/Common Voice Android/app/src/main/res/layout/fragment_dashboard.xml b/Common Voice Android/app/src/main/res/layout/fragment_dashboard.xml
index cc8e4dc7..247d92ee 100644
--- a/Common Voice Android/app/src/main/res/layout/fragment_dashboard.xml
+++ b/Common Voice Android/app/src/main/res/layout/fragment_dashboard.xml
@@ -1,19 +1,25 @@
+ app:layout_constraintTop_toTopOf="parent"
+ tools:text="@string/dashboardStatistics" />
+
\ No newline at end of file
diff --git a/Common Voice Android/app/src/main/res/layout/fragment_settings.xml b/Common Voice Android/app/src/main/res/layout/fragment_settings.xml
index 7efbde23..f60aa680 100644
--- a/Common Voice Android/app/src/main/res/layout/fragment_settings.xml
+++ b/Common Voice Android/app/src/main/res/layout/fragment_settings.xml
@@ -5,6 +5,23 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
+
+
+
+
+
\ No newline at end of file
diff --git a/Common Voice Android/app/src/main/res/layout/fragment_webbrowser.xml b/Common Voice Android/app/src/main/res/layout/fragment_webbrowser.xml
index 89ae6517..583c78d6 100644
--- a/Common Voice Android/app/src/main/res/layout/fragment_webbrowser.xml
+++ b/Common Voice Android/app/src/main/res/layout/fragment_webbrowser.xml
@@ -8,7 +8,7 @@
android:orientation="vertical">
-