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