This commit is contained in:
Sergio De la torre 2023-08-08 10:01:34 +02:00
parent 00030ae266
commit 5523041678
2 changed files with 15 additions and 4 deletions

View File

@ -2,11 +2,14 @@ package es.verdnatura.presentation.view.feature.controlador.fragment
import android.content.Context import android.content.Context
import android.content.Intent
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.net.Uri
import android.os.Build import android.os.Build
import android.print.PrintAttributes import android.print.PrintAttributes
import android.print.PrintManager import android.print.PrintManager
import android.webkit.WebChromeClient import android.webkit.WebChromeClient
import android.webkit.WebSettings
import android.webkit.WebView import android.webkit.WebView
import android.widget.ImageView import android.widget.ImageView
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
@ -42,7 +45,7 @@ class WebFragment(
private fun setWeb() { private fun setWeb() {
binding.webView.setWebChromeClient(WebChromeClient()) binding.webView.webChromeClient = WebChromeClient()
//binding.webView.getSettings (). setJavaScriptEnabled (true) //binding.webView.getSettings (). setJavaScriptEnabled (true)
// sergio:deprecated // sergio:deprecated
@ -55,12 +58,20 @@ class WebFragment(
webSettings.builtInZoomControls = true webSettings.builtInZoomControls = true
webSettings.displayZoomControls = false webSettings.displayZoomControls = false
webSettings.setSupportZoom(true) webSettings.setSupportZoom(true)
webSettings.allowFileAccess = true
//webSettings.defaultTextEncodingName = "utf-8" //webSettings.defaultTextEncodingName = "utf-8"
var dataScanned = JSONObject(entryPoint) var dataScanned = JSONObject(entryPoint)
binding.webView.loadUrl(dataScanned.get("web").toString())
if (dataScanned.toString().contains("cmr?")){
val pdfUrl = "${dataScanned.get("web")}"
val googleDocsViewerUrl = "https://docs.google.com/gview?embedded=true&url=$pdfUrl"
binding.webView.loadUrl(googleDocsViewerUrl)
}else{
binding.webView.loadUrl(dataScanned.get("web").toString())
}
} }
private fun setToolbar() { private fun setToolbar() {

View File

@ -19,8 +19,8 @@ class CmrExpeditionPalletViewModel(val context: Context) : BaseViewModel(context
get() = _responsescan get() = _responsescan
fun cmrExpeditionPallet_add(vExpeditionPallet: Int, vCmrId: Int) { fun cmrExpeditionPallet_add(vExpeditionPallet: Int, cmrFk: Int) {
silex.cmrExpeditionPallet_add(vExpeditionPallet, vCmrId) silex.cmrExpeditionPallet_add(vExpeditionPallet, cmrFk)
.enqueue(object : SilexCallback<Void>(context) { .enqueue(object : SilexCallback<Void>(context) {
override fun onError(t: Throwable) { override fun onError(t: Throwable) {
_responsescan.value = ResponseItemVO( _responsescan.value = ResponseItemVO(