Enable opening TTS settings from MainActivity
This commit is contained in:
@@ -4,6 +4,8 @@ import android.content.Intent
|
|||||||
import android.os.Build
|
import android.os.Build
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.provider.Settings
|
||||||
|
import android.provider.Settings.*
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import io.bartek.service.ForegroundService
|
import io.bartek.service.ForegroundService
|
||||||
|
|
||||||
@@ -20,6 +22,8 @@ class MainActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
fun stopServer(view: View) = actionOnService(ForegroundService.STOP)
|
fun stopServer(view: View) = actionOnService(ForegroundService.STOP)
|
||||||
|
|
||||||
|
fun openTTSSettings(view: View) = startActivity(Intent("com.android.settings.TTS_SETTINGS"))
|
||||||
|
|
||||||
private fun actionOnService(action: String) {
|
private fun actionOnService(action: String) {
|
||||||
Intent(this, ForegroundService::class.java).also {
|
Intent(this, ForegroundService::class.java).also {
|
||||||
it.action = action
|
it.action = action
|
||||||
|
|||||||
@@ -44,5 +44,6 @@
|
|||||||
android:id="@+id/ttsSettings"
|
android:id="@+id/ttsSettings"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:onClick="openTTSSettings"
|
||||||
android:text="@string/main_activity_tts_settings" />
|
android:text="@string/main_activity_tts_settings" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
Reference in New Issue
Block a user