Create preferences

This commit is contained in:
2020-05-09 14:48:39 +02:00
parent bb0a2a94ed
commit 0850390635
13 changed files with 177 additions and 51 deletions

View File

@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M19.1,12.9a2.8,2.8 0,0 0,0.1 -0.9,2.8 2.8,0 0,0 -0.1,-0.9l2.1,-1.6a0.7,0.7 0,0 0,0.1 -0.6L19.4,5.5a0.7,0.7 0,0 0,-0.6 -0.2l-2.4,1a6.5,6.5 0,0 0,-1.6 -0.9l-0.4,-2.6a0.5,0.5 0,0 0,-0.5 -0.4H10.1a0.5,0.5 0,0 0,-0.5 0.4L9.3,5.4a5.6,5.6 0,0 0,-1.7 0.9l-2.4,-1a0.4,0.4 0,0 0,-0.5 0.2l-2,3.4c-0.1,0.2 0,0.4 0.2,0.6l2,1.6a2.8,2.8 0,0 0,-0.1 0.9,2.8 2.8,0 0,0 0.1,0.9L2.8,14.5a0.7,0.7 0,0 0,-0.1 0.6l1.9,3.4a0.7,0.7 0,0 0,0.6 0.2l2.4,-1a6.5,6.5 0,0 0,1.6 0.9l0.4,2.6a0.5,0.5 0,0 0,0.5 0.4h3.8a0.5,0.5 0,0 0,0.5 -0.4l0.3,-2.6a5.6,5.6 0,0 0,1.7 -0.9l2.4,1a0.4,0.4 0,0 0,0.5 -0.2l2,-3.4c0.1,-0.2 0,-0.4 -0.2,-0.6ZM12,15.6A3.6,3.6 0,1 1,15.6 12,3.6 3.6,0 0,1 12,15.6Z"/>
</vector>

View File

@@ -1,30 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:app="http://schemas.android.com/apk/res-auto"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/control_server_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:onClick="controlServer"
android:text="@string/main_activity_run" />
</LinearLayout>
android:orientation="vertical"
tools:context=".MainActivity">
<Button
android:id="@+id/ttsSettings"
android:id="@+id/control_server_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="openTTSSettings"
android:text="@string/main_activity_tts_settings" />
</LinearLayout>
android:layout_height="0dp"
android:layout_weight="2"
android:onClick="controlServer"
android:text="@string/main_activity_run" />
</LinearLayout>

View File

@@ -0,0 +1,9 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/preferences"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:id="@+id/open_preferences" android:icon="@drawable/ic_settings" app:showAsAction="always" android:title="Preferences" />
</menu>

View File

@@ -1,12 +1,23 @@
<resources>
<string name="app_name">TTS Server</string>
<string name="main_activity_run">Run</string>
<string name="main_activity_stop">Stop</string>
<string name="service_notification_category_name">HTTP Server</string>
<string name="service_notification_category_description">The fixed notification keeping the HTTP server alive</string>
<string name="service_notification_title">Server is running</string>
<string name="service_notification_text">The HTTP server is listening on port %1$d</string>
<string name="main_activity_server_port">Server port</string>
<string name="main_activity_run">Run</string>
<string name="main_activity_stop">Stop</string>
<string name="main_activity_tts_settings">TTS Settings</string>
<string name="title_activity_preferences">Settings</string>
<string name="preference_port_summary">The desired port on which HTTP server is intended to listening</string>
<string name="preference_port_title">Server port</string>
<string name="preference_enable_say_endpoint_summary">Allow HTTP clients to use /say endpoint which enables them to say message using builtin speakers or external ones connected to the device</string>
<string name="preference_enable_say_endpoint_title">Enable /say endpoint</string>
<string name="preference_enable_wave_endpoint_summary">Allow HTTP clients to use /wave endpoint which enables them to retrieve TTS message as wave file</string>
<string name="preference_enable_wave_endpoint_title">Enable /wave endpoint</string>
<string name="preference_tts_summary">Go to platform\'s TTS engine settings and adjust its parameters</string>
<string name="preference_tts_title">TTS engine settings</string>
<string name="preference_category_tts">TTS engine</string>
<string name="preference_category_server">Server</string>
</resources>

View File

@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<PreferenceCategory android:title="@string/preference_category_server" app:iconSpaceReserved="false">
<EditTextPreference
android:defaultValue="8080"
android:inputType="number"
android:key="preference_port"
android:summary="@string/preference_port_summary"
android:title="@string/preference_port_title"
app:iconSpaceReserved="false" />
<SwitchPreference
android:defaultValue="true"
android:key="preference_enable_say_endpoint"
android:summary="@string/preference_enable_say_endpoint_summary"
android:title="@string/preference_enable_say_endpoint_title"
app:iconSpaceReserved="false" />
<SwitchPreference
android:defaultValue="true"
android:key="preference_enable_wave_endpoint"
android:summary="@string/preference_enable_wave_endpoint_summary"
android:title="@string/preference_enable_wave_endpoint_title"
app:iconSpaceReserved="false" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/preference_category_tts" app:iconSpaceReserved="false">
<Preference
android:key="preference_tts"
android:summary="@string/preference_tts_summary"
android:title="@string/preference_tts_title"
app:iconSpaceReserved="false" />
</PreferenceCategory>
</androidx.preference.PreferenceScreen>