From db0e0f61ea0a665dd230369bbc60a6715dcbd74d Mon Sep 17 00:00:00 2001 From: Fedir Tsapana Date: Fri, 31 May 2019 00:50:32 +0300 Subject: [PATCH] v1.4.5 bugfix (by crashlogs) --- app/build.gradle | 6 +-- app/src/main/AndroidManifest.xml | 1 + .../activity/downloads/DownloadsActivity.kt | 3 +- .../activity/main/MainActivity.kt | 46 +++++++++++++------ .../activity/main/dialogs/FavoritesDialog.kt | 2 +- .../service/downloads/DownloadService.kt | 3 +- .../main/res/layout/view_favorite_item.xml | 3 +- app/src/main/res/values-ru/strings.xml | 1 + app/src/main/res/values-uk/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + latest_version.json | 17 ++++--- 11 files changed, 56 insertions(+), 28 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 3086ed6..15387c8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -21,8 +21,8 @@ android { applicationId "com.phlox.tvwebbrowser" minSdkVersion 21 targetSdkVersion 28 - versionCode 31 - versionName "1.4.4" + versionCode 32 + versionName "1.4.5" } signingConfigs { release { @@ -75,5 +75,5 @@ dependencies { implementation 'de.halfbit:pinned-section-listview:1.0.0' crashlyticsImplementation 'com.google.firebase:firebase-core:16.0.9' - crashlyticsImplementation 'com.crashlytics.sdk.android:crashlytics:2.10.0' + crashlyticsImplementation 'com.crashlytics.sdk.android:crashlytics:2.10.1' } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 9c0cc45..74b1932 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -10,6 +10,7 @@ + (neededPermissions.size) - neededPermissions.toTypedArray() - requestPermissions(permissionsArr, + requestPermissions(neededPermissions.toTypedArray(), MY_PERMISSIONS_REQUEST_WEB_PAGE_PERMISSIONS) } else { if (reuestedResourcesForAlreadyGrantedPermissions!!.isEmpty()) { webPermissionsRequest.deny() } else { - val grantedResourcesArr = arrayOfNulls(reuestedResourcesForAlreadyGrantedPermissions!!.size) - reuestedResourcesForAlreadyGrantedPermissions!!.toTypedArray() - webPermissionsRequest.grant(grantedResourcesArr) + webPermissionsRequest.grant(reuestedResourcesForAlreadyGrantedPermissions!!.toTypedArray()) } } } else { @@ -750,6 +767,8 @@ class MainActivity : AppCompatActivity(), CoroutineScope by MainScope() { onDownloadRequested(url, DownloadUtils.guessFileName(url, contentDisposition, mimetype), userAgent ?: tab.webView?.settings?.userAgentString) } + + return true } private fun showCertificateErrorHint(error: SslError) { @@ -787,6 +806,7 @@ class MainActivity : AppCompatActivity(), CoroutineScope by MainScope() { override fun onRequestPermissionsResult(requestCode: Int, permissions: Array, grantResults: IntArray) { + if (grantResults.isEmpty()) return when (requestCode) { MY_PERMISSIONS_REQUEST_WEB_PAGE_PERMISSIONS -> { if (webPermissionsRequest == null) { @@ -807,9 +827,7 @@ class MainActivity : AppCompatActivity(), CoroutineScope by MainScope() { if (resources.isEmpty()) { webPermissionsRequest!!.deny() } else { - val resourcesArr = arrayOfNulls(resources.size) - resources.toTypedArray() - webPermissionsRequest!!.grant(resourcesArr) + webPermissionsRequest!!.grant(resources.toTypedArray()) } webPermissionsRequest = null return diff --git a/app/src/main/java/com/phlox/tvwebbrowser/activity/main/dialogs/FavoritesDialog.kt b/app/src/main/java/com/phlox/tvwebbrowser/activity/main/dialogs/FavoritesDialog.kt index 729292e..5912974 100644 --- a/app/src/main/java/com/phlox/tvwebbrowser/activity/main/dialogs/FavoritesDialog.kt +++ b/app/src/main/java/com/phlox/tvwebbrowser/activity/main/dialogs/FavoritesDialog.kt @@ -22,7 +22,7 @@ import java.util.ArrayList /** * Created by PDT on 09.09.2016. */ -class FavoritesDialog(context: Context, private val callback: Callback, private val currentPageTitle: String, private val currentPageUrl: String) : Dialog(context), FavoriteItemView.Listener { +class FavoritesDialog(context: Context, private val callback: Callback, private val currentPageTitle: String?, private val currentPageUrl: String?) : Dialog(context), FavoriteItemView.Listener { private var items: MutableList = ArrayList() private val adapter: FavoritesListAdapter = FavoritesListAdapter(items, this) private val asql: ASQL diff --git a/app/src/main/java/com/phlox/tvwebbrowser/service/downloads/DownloadService.kt b/app/src/main/java/com/phlox/tvwebbrowser/service/downloads/DownloadService.kt index f727aac..9a78f69 100644 --- a/app/src/main/java/com/phlox/tvwebbrowser/service/downloads/DownloadService.kt +++ b/app/src/main/java/com/phlox/tvwebbrowser/service/downloads/DownloadService.kt @@ -77,7 +77,8 @@ class DownloadService : Service() { super.onDestroy() } - override fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int { + override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { + if (intent == null) return START_STICKY val download = intent.getSerializableExtra("download") as Download val userAgent = intent.getStringExtra("userAgent") try { diff --git a/app/src/main/res/layout/view_favorite_item.xml b/app/src/main/res/layout/view_favorite_item.xml index c33a643..c54a508 100644 --- a/app/src/main/res/layout/view_favorite_item.xml +++ b/app/src/main/res/layout/view_favorite_item.xml @@ -19,8 +19,7 @@ android:padding="6dp" android:gravity="center_vertical" android:layout_weight="1" - android:id="@+id/llContent" - android:background="@drawable/favorite_item_view_bg_selector"> + android:id="@+id/llContent"> Предупреждение Веб-браузер, оптимизированный для телевизоров (https://github.com/truefedex/tv-bro) Доступна новая версия: %s + Не могу найти WebView компонент. Попробуйте сперва установить Chrome (или другую версию Chrome, если уже стоит). \ No newline at end of file diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index da0082e..2c495d5 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -79,4 +79,5 @@ Увага Веб-браузер, оптимізований для телевізорів (https://github.com/truefedex/tv-bro) Доступна нова версія: %s + Не можу знайти WebView компонент. Спробуйте спочатку встановити Chrome (або новішу версію Chrome, якщо вже є). \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3254180..24ec104 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -80,4 +80,5 @@ Web browser optimized for TVs ( https://github.com/truefedex/tv-bro ) Warning Unprotected connection + Can not link to WebView component. Try to install chrome (or other version of chrome if already). diff --git a/latest_version.json b/latest_version.json index c422424..c18a2fd 100644 --- a/latest_version.json +++ b/latest_version.json @@ -2,19 +2,24 @@ "channels": [ { "name": "release", - "latestVersionName": "v1.3.0", - "latestVersionCode": 25, - "url": "https://github.com/truefedex/tv-bro/releases/download/v1.3.0-alpha/tvbro1.3.0alpha.apk" + "latestVersionName": "v1.4.5", + "latestVersionCode": 32, + "url": "https://github.com/truefedex/tv-bro/releases/download/v1.4.5/tvbro1.4.5.apk" }, { "name": "beta", - "latestVersionName": "v1.4.4", - "latestVersionCode": 31, - "url": "https://github.com/truefedex/tv-bro/releases/download/v1.4.4/tvbro1.4.4.apk" + "latestVersionName": "v1.4.5", + "latestVersionCode": 32, + "url": "https://github.com/truefedex/tv-bro/releases/download/v1.4.5/tvbro1.4.5.apk" } ], "changelog": [ + { + "versionCode": 32, + "versionName": "v1.4.5", + "changes": "-Fixed several bugs" + }, { "versionCode": 31, "versionName": "v1.4.4",