diff --git a/app/build.gradle b/app/build.gradle index d51b437d..8e3ffd5e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -12,8 +12,8 @@ android { applicationId = "info.dvkr.screenstream" minSdkVersion(21) targetSdkVersion(31) - versionCode = 30804 - versionName = "3.8.4" + versionCode = 30805 + versionName = "3.8.5" resConfigs("en", "ru", "pt-rBR", "zh-rTW", "fr-rFR", "fa", "it", "pl", "hi", "de", "sk", "es", "ar", "ja", "gl", "ca", "uk", "nl") vectorDrawables.useSupportLibrary = true diff --git a/app/src/main/kotlin/info/dvkr/screenstream/ui/fragment/SettingsInterfaceFragment.kt b/app/src/main/kotlin/info/dvkr/screenstream/ui/fragment/SettingsInterfaceFragment.kt index fcc573b3..22ee6ed7 100644 --- a/app/src/main/kotlin/info/dvkr/screenstream/ui/fragment/SettingsInterfaceFragment.kt +++ b/app/src/main/kotlin/info/dvkr/screenstream/ui/fragment/SettingsInterfaceFragment.kt @@ -137,6 +137,13 @@ class SettingsInterfaceFragment : Fragment(R.layout.fragment_settings_interface) binding.clFragmentSettingsHtmlButtons.setOnClickListener { performClick() } } + // Interface - Web page show "Press START on device" + with(binding.cbFragmentSettingsHtmlPressStart) { + isChecked = settings.htmlShowPressStart + setOnClickListener { settings.htmlShowPressStart = isChecked } + binding.clFragmentSettingsHtmlPressStart.setOnClickListener { performClick() } + } + // Interface - Web page HTML Back color binding.vFragmentSettingsHtmlBackColor.color = settings.htmlBackColor binding.vFragmentSettingsHtmlBackColor.border = diff --git a/app/src/main/res/drawable/ic_settings_html_show_press_start_24dp.xml b/app/src/main/res/drawable/ic_settings_html_show_press_start_24dp.xml new file mode 100644 index 00000000..37d951b0 --- /dev/null +++ b/app/src/main/res/drawable/ic_settings_html_show_press_start_24dp.xml @@ -0,0 +1,9 @@ + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_settings_interface.xml b/app/src/main/res/layout/fragment_settings_interface.xml index ca37f469..fd8dc150 100644 --- a/app/src/main/res/layout/fragment_settings_interface.xml +++ b/app/src/main/res/layout/fragment_settings_interface.xml @@ -456,6 +456,73 @@ app:layout_constraintTop_toTopOf="parent" /> + + + + + + + + + + + + + Определять и уведомлять о медленных клиентах Включить кнопки веб-страницы Показывать кнопки управления на веб-странице + Показывать \"Нажмите СТАРТ для старта трансляции\" + Показывать \"Нажмите СТАРТ для старта трансляции\" на веб-странице Цвет фона веб-страницы Выбрать цвет фона веб-странцы Выберите цвет фона diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index 74e4b168..d59bd724 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -85,7 +85,9 @@ Повідомляти про повільне з\'єднання Визначати та повідомляти про повільні підключення клієнтів Увімкнути кнопки веб сторінки - Показати кнопки веб сторінки + Показувати кнопки веб сторінки + Показувати \"Натисніть ПОЧАТИ щоб почати передачу\" + Показувати \"Натисніть ПОЧАТИ щоб почати передачу\" на веб сторінці Задній фон веб сторінки Встановити задній фон веб сторінки Вибрати задній фон diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 0907b862..018da6b9 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -88,6 +88,8 @@ Detect and notify for slow client connections Enable web page buttons Show control buttons on web page + Show \"Press START on device\" + Show \"Press START on device\" on web page Web page background color Set web page background color Select background color diff --git a/data/src/main/kotlin/info/dvkr/screenstream/data/image/NotificationBitmap.kt b/data/src/main/kotlin/info/dvkr/screenstream/data/image/NotificationBitmap.kt index 2d719a54..59ac9b3b 100644 --- a/data/src/main/kotlin/info/dvkr/screenstream/data/image/NotificationBitmap.kt +++ b/data/src/main/kotlin/info/dvkr/screenstream/data/image/NotificationBitmap.kt @@ -7,9 +7,10 @@ import info.dvkr.screenstream.data.R import info.dvkr.screenstream.data.httpserver.HttpServerFiles import info.dvkr.screenstream.data.other.getFileFromAssets import info.dvkr.screenstream.data.other.getLog +import info.dvkr.screenstream.data.settings.SettingsReadOnly -class NotificationBitmap(context: Context) { +class NotificationBitmap(context: Context, private val settingsReadOnly: SettingsReadOnly) { enum class Type { START, RELOAD_PAGE, NEW_ADDRESS, ADDRESS_BLOCKED } @@ -38,18 +39,25 @@ class NotificationBitmap(context: Context) { } private fun generateImage(message: String, logo: Bitmap): Bitmap { - val bitmap: Bitmap = Bitmap.createBitmap(640, 400, Bitmap.Config.ARGB_8888) - val canvas = Canvas(bitmap) - canvas.drawRGB(25, 118, 159) - val paint = Paint(Paint.ANTI_ALIAS_FLAG) - canvas.drawBitmap(logo, 192f, 16f, paint) - - paint.textSize = 24f - paint.color = Color.WHITE - val bounds = Rect() - paint.getTextBounds(message, 0, message.length, bounds) - val x = (bitmap.width - bounds.width()) / 2f - canvas.drawText(message, x, 324f, paint) + val bitmap: Bitmap + if (settingsReadOnly.htmlShowPressStart) { + bitmap = Bitmap.createBitmap(640, 400, Bitmap.Config.ARGB_8888) + val canvas = Canvas(bitmap) + canvas.drawRGB(25, 118, 159) + val paint = Paint(Paint.ANTI_ALIAS_FLAG) + canvas.drawBitmap(logo, 192f, 16f, paint) + + paint.textSize = 24f + paint.color = Color.WHITE + val bounds = Rect() + paint.getTextBounds(message, 0, message.length, bounds) + val x = (bitmap.width - bounds.width()) / 2f + canvas.drawText(message, x, 324f, paint) + } else { + bitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888) + val canvas = Canvas(bitmap) + canvas.drawColor(settingsReadOnly.htmlBackColor) + } return bitmap } } \ No newline at end of file diff --git a/data/src/main/kotlin/info/dvkr/screenstream/data/settings/Settings.kt b/data/src/main/kotlin/info/dvkr/screenstream/data/settings/Settings.kt index e4479179..3d4fa98b 100644 --- a/data/src/main/kotlin/info/dvkr/screenstream/data/settings/Settings.kt +++ b/data/src/main/kotlin/info/dvkr/screenstream/data/settings/Settings.kt @@ -12,6 +12,7 @@ interface Settings : SettingsReadOnly { const val NOTIFY_SLOW_CONNECTIONS = "PREF_KEY_NOTIFY_SLOW_CONNECTIONS" const val HTML_ENABLE_BUTTONS = "PREF_KEY_HTML_ENABLE_BUTTONS" + const val HTML_SHOW_PRESS_START = "PREF_KEY_HTML_SHOW_PRESS_START" const val HTML_BACK_COLOR = "PREF_KEY_HTML_BACK_COLOR" const val VR_MODE = "PREF_KEY_VR_MODE" @@ -51,6 +52,7 @@ interface Settings : SettingsReadOnly { const val NOTIFY_SLOW_CONNECTIONS = true const val HTML_ENABLE_BUTTONS = false + const val HTML_SHOW_PRESS_START = true const val HTML_BACK_COLOR = -16777216 // "ff000000".toLong(radix = 16).toInt() const val VR_MODE_DISABLE = 0 @@ -100,6 +102,7 @@ interface Settings : SettingsReadOnly { override var notifySlowConnections: Boolean override var htmlEnableButtons: Boolean + override var htmlShowPressStart: Boolean override var htmlBackColor: Int override var vrMode: Int diff --git a/data/src/main/kotlin/info/dvkr/screenstream/data/settings/SettingsImpl.kt b/data/src/main/kotlin/info/dvkr/screenstream/data/settings/SettingsImpl.kt index a9850b2a..1d192d97 100644 --- a/data/src/main/kotlin/info/dvkr/screenstream/data/settings/SettingsImpl.kt +++ b/data/src/main/kotlin/info/dvkr/screenstream/data/settings/SettingsImpl.kt @@ -31,6 +31,9 @@ class SettingsImpl(private val preferences: Preferences) : Settings { override var htmlEnableButtons: Boolean by bindPreference(preferences, Settings.Key.HTML_ENABLE_BUTTONS, Settings.Default.HTML_ENABLE_BUTTONS) + override var htmlShowPressStart: Boolean + by bindPreference(preferences, Settings.Key.HTML_SHOW_PRESS_START, Settings.Default.HTML_SHOW_PRESS_START) + override var htmlBackColor: Int by bindPreference(preferences, Settings.Key.HTML_BACK_COLOR, Settings.Default.HTML_BACK_COLOR) diff --git a/data/src/main/kotlin/info/dvkr/screenstream/data/settings/SettingsReadOnly.kt b/data/src/main/kotlin/info/dvkr/screenstream/data/settings/SettingsReadOnly.kt index 33314985..2528bd0f 100644 --- a/data/src/main/kotlin/info/dvkr/screenstream/data/settings/SettingsReadOnly.kt +++ b/data/src/main/kotlin/info/dvkr/screenstream/data/settings/SettingsReadOnly.kt @@ -11,6 +11,7 @@ interface SettingsReadOnly { val notifySlowConnections: Boolean val htmlEnableButtons: Boolean + val htmlShowPressStart: Boolean val htmlBackColor: Int val vrMode: Int diff --git a/data/src/main/kotlin/info/dvkr/screenstream/data/state/AppStateMachineImpl.kt b/data/src/main/kotlin/info/dvkr/screenstream/data/state/AppStateMachineImpl.kt index a5f11196..88bacabd 100644 --- a/data/src/main/kotlin/info/dvkr/screenstream/data/state/AppStateMachineImpl.kt +++ b/data/src/main/kotlin/info/dvkr/screenstream/data/state/AppStateMachineImpl.kt @@ -48,7 +48,7 @@ class AppStateMachineImpl( private val broadcastHelper = BroadcastHelper.getInstance(context) private val connectivityHelper: ConnectivityHelper = ConnectivityHelper.getInstance(context) private val networkHelper = NetworkHelper(context) - private val notificationBitmap = NotificationBitmap(context) + private val notificationBitmap = NotificationBitmap(context, settingsReadOnly) private val httpServer = HttpServer( context, coroutineScope, settingsReadOnly, bitmapStateFlow.asStateFlow(), notificationBitmap.getNotificationBitmap(NotificationBitmap.Type.ADDRESS_BLOCKED)