Create "warming up" stage when server is requested to start
This commit is contained in:
@@ -122,7 +122,12 @@ class MainActivity : DaggerAppCompatActivity() {
|
||||
fun controlServer(view: View) {
|
||||
serverControlButton.isEnabled = false
|
||||
when (ForegroundService.state) {
|
||||
ServiceState.STOPPED -> actionOnService(ForegroundService.START)
|
||||
ServiceState.STOPPED -> {
|
||||
serverControlButton.setImageResource(R.drawable.ic_power_warmingup)
|
||||
serverStatus.text = getString(R.string.main_activity_server_status_warming_up)
|
||||
promptText.text = getString(R.string.main_activity_prompt_warming_up)
|
||||
actionOnService(ForegroundService.START)
|
||||
}
|
||||
ServiceState.RUNNING -> actionOnService(ForegroundService.STOP)
|
||||
}
|
||||
}
|
||||
|
||||
5
app/src/main/res/drawable/ic_power_warmingup.xml
Normal file
5
app/src/main/res/drawable/ic_power_warmingup.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<vector android:height="200dp" android:tint="@color/yellow"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="200dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M13,3h-2v10h2L13,3zM17.83,5.17l-1.42,1.42C17.99,7.86 19,9.81 19,12c0,3.87 -3.13,7 -7,7s-7,-3.13 -7,-7c0,-2.19 1.01,-4.14 2.58,-5.42L6.17,5.17C4.23,6.82 3,9.26 3,12c0,4.97 4.03,9 9,9s9,-4.03 9,-9c0,-2.74 -1.23,-5.18 -3.17,-6.83z"/>
|
||||
</vector>
|
||||
@@ -4,6 +4,7 @@
|
||||
<color name="primary_dark">#512DA8</color>
|
||||
<color name="primary_light">#D1C4E9</color>
|
||||
<color name="accent">#8BC34A</color>
|
||||
<color name="yellow">#FFEB3B</color>
|
||||
<color name="primary_text">#212121</color>
|
||||
<color name="secondary_text">#757575</color>
|
||||
<color name="icons">#FFFFFF</color>
|
||||
|
||||
@@ -5,8 +5,10 @@
|
||||
<string name="permission_http_server_description">Allows application to run HTTP server which provides a TTS services.</string>
|
||||
|
||||
<string name="main_activity_server_status_down">The server is down</string>
|
||||
<string name="main_activity_server_status_warming_up">The server is starting</string>
|
||||
<string name="main_activity_server_status_up">The server is up: %1$s</string>
|
||||
<string name="main_activity_prompt_to_run">Tap power on button to run the server</string>
|
||||
<string name="main_activity_prompt_warming_up">Please wait…</string>
|
||||
<string name="main_activity_prompt_to_stop">Tap power off button to stop the server</string>
|
||||
|
||||
<string name="service_notification_category_name">HTTP Server</string>
|
||||
|
||||
Reference in New Issue
Block a user