@@ -138,7 +138,11 @@ protected void onActivityResult(int requestCode, int resultCode, Intent intent)
138138 if (null == mUploadMessage && null == mFilePathCallback ) return ;
139139 Uri result = intent == null || resultCode != RESULT_OK ? null : intent .getData ();
140140 if (mFilePathCallback != null ) {
141- mFilePathCallback .onReceiveValue (WebChromeClient .FileChooserParams .parseResult (resultCode , intent ));
141+ if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .LOLLIPOP ) {
142+ mFilePathCallback .onReceiveValue (WebChromeClient .FileChooserParams .parseResult (resultCode , intent ));
143+ } else {
144+ mFilePathCallback .onReceiveValue (result != null ? new Uri []{result } : null );
145+ }
142146 mFilePathCallback = null ;
143147 } else if (mUploadMessage != null ) {
144148 mUploadMessage .onReceiveValue (result );
@@ -158,9 +162,9 @@ protected void onCreate(Bundle savedInstanceState) {
158162 super .onCreate (savedInstanceState );
159163 AdBlockerUtil adBlockerUtil = AdBlockerUtil .getInstance ();
160164 adBlockerUtil .initialize (this );
161- if (VIEW_MODE == "PORTRAIT" ) {
165+ if (VIEW_MODE . equals ( "PORTRAIT" ) ) {
162166 setRequestedOrientation (ActivityInfo .SCREEN_ORIENTATION_PORTRAIT );
163- } else if (VIEW_MODE == "LANDSCAPE" ) {
167+ } else if (VIEW_MODE . equals ( "LANDSCAPE" ) ) {
164168 setRequestedOrientation (ActivityInfo .SCREEN_ORIENTATION_LANDSCAPE );
165169 } else {
166170 setRequestedOrientation (ActivityInfo .SCREEN_ORIENTATION_UNSPECIFIED );
@@ -180,6 +184,7 @@ protected void onCreate(Bundle savedInstanceState) {
180184 webSettings .setDefaultTextEncodingName ("utf-8" );
181185 webSettings .setPluginState (PluginState .ON );
182186 webSettings .setAllowFileAccess (false );
187+ webSettings .setUserAgentString ("Mozilla/5.0 (Linux; Android 12; Pixel 6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Mobile Safari/537.36" );
183188 if (BLOCK_MEDIA ) {
184189 webSettings .setLoadsImagesAutomatically (false );
185190 }
@@ -208,9 +213,9 @@ public void onHideCustomView() {
208213 getWindow ().getDecorView ().setSystemUiVisibility (View .SYSTEM_UI_FLAG_VISIBLE );
209214 mCustomViewCallback .onCustomViewHidden ();
210215 mCustomViewCallback = null ;
211- if (VIEW_MODE == "PORTRAIT" ) {
216+ if (VIEW_MODE . equals ( "PORTRAIT" ) ) {
212217 setRequestedOrientation (ActivityInfo .SCREEN_ORIENTATION_PORTRAIT );
213- } else if (VIEW_MODE == "LANDSCAPE" ) {
218+ } else if (VIEW_MODE . equals ( "LANDSCAPE" ) ) {
214219 setRequestedOrientation (ActivityInfo .SCREEN_ORIENTATION_LANDSCAPE );
215220 } else {
216221 setRequestedOrientation (ActivityInfo .SCREEN_ORIENTATION_UNSPECIFIED );
@@ -351,7 +356,9 @@ public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError e
351356 @ Override
352357 public void onBackPressed () {
353358 if (mCustomView != null ) {
354- mWebView .getWebChromeClient ().onHideCustomView ();
359+ if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .O ) {
360+ mWebView .getWebChromeClient ().onHideCustomView ();
361+ }
355362 } else if (mWebView .canGoBack ()) {
356363 mWebView .goBack ();
357364 } else {
0 commit comments