forked from Sav22999/common-voice-android
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Improvements to UI - Added ListenActivity and SpeakActivity - Added Listen and Speak sections (pressing the relative icon) - Added 0.0.3a screenshots - Added 0.0.4a screenshots - Updated README.md - Fixed some problems with the icon
- Loading branch information
Showing
33 changed files
with
391 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
Common Voice Android/app/src/main/java/org/commonvoice/saverio/ListenActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<String>, grantResults: IntArray) { | ||
when (requestCode) { | ||
RECORD_REQUEST_CODE -> { | ||
if (grantResults.isEmpty() || grantResults[0] != PackageManager.PERMISSION_GRANTED) { | ||
checkRecordVoicePermission() | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
Common Voice Android/app/src/main/java/org/commonvoice/saverio/SpeakActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<String>, grantResults: IntArray) { | ||
when (requestCode) { | ||
RECORD_REQUEST_CODE -> { | ||
if (grantResults.isEmpty() || grantResults[0] != PackageManager.PERMISSION_GRANTED) { | ||
checkRecordVoicePermission() | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.