diff options
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt index 3c3c063a..12df8000 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt @@ -1,7 +1,27 @@ +/* + * Copyright 2018 Allan Wang + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ package com.pitchedapps.frost.web import android.net.Uri -import android.webkit.* +import android.webkit.ConsoleMessage +import android.webkit.GeolocationPermissions +import android.webkit.ValueCallback +import android.webkit.WebChromeClient +import android.webkit.WebView import ca.allanwang.kau.permissions.PERMISSION_ACCESS_FINE_LOCATION import ca.allanwang.kau.permissions.kauRequestPermissions import com.pitchedapps.frost.R @@ -12,7 +32,6 @@ import com.pitchedapps.frost.views.FrostWebView import io.reactivex.subjects.BehaviorSubject import io.reactivex.subjects.Subject - /** * Created by Allan Wang on 2017-05-31. * @@ -45,9 +64,13 @@ class FrostChromeClient(web: FrostWebView) : WebChromeClient() { progress.onNext(newProgress) } - override fun onShowFileChooser(webView: WebView, filePathCallback: ValueCallback<Array<Uri>?>, fileChooserParams: FileChooserParams): Boolean { + override fun onShowFileChooser( + webView: WebView, + filePathCallback: ValueCallback<Array<Uri>?>, + fileChooserParams: FileChooserParams + ): Boolean { activity?.openFileChooser(filePathCallback, fileChooserParams) - ?: webView.frostSnackbar(R.string.file_chooser_not_found) + ?: webView.frostSnackbar(R.string.file_chooser_not_found) return activity != null } @@ -58,6 +81,4 @@ class FrostChromeClient(web: FrostWebView) : WebChromeClient() { callback(origin, granted, true) } } - - -}
\ No newline at end of file +} |