ArronJo / sample-webview

This project is a sample for developing android applications using webview.
20 stars 11 forks source link

Add an image to the white loading screen #4

Open alexeyrosspage opened 2 years ago

alexeyrosspage commented 2 years ago

Hello.

First of all, I want to say thank you for the app. It's the best I've found. Unfortunately, I do not understand Java, but I write in php / JavaScript. Therefore, your application has become a real salvation for me.

If you have time, could you give me a minute?

I'm trying to insert an image or text into a white loading screen (when the site is loading). I know that you can make a SplashScreen in front of a white screen, but this will only increase the time, as it seems to me. I thought it would be nice to use a white screen to put something useful on it - a logo or text.

I tried to insert a text (or picture) into your code, everything worked out in activity_main.xml, but after the appearance of the site content, the text (or picture) does not disappear as I did not try.

    <TextView
        android:id="@+id/textView"
        android:layout_width="match_parent"
        android:layout_height="300dp"
        android:text="Test Text"
        android:background="@color/colorPrimaryDark"
        android:textColor="@color/colorAccent"
        />

Result on the emulator screen: https://user-images.githubusercontent.com/106796573/171825999-ab4a7fc9-7e28-4336-b1a5-9a02aa545f4c.PNG

I even tried to remove the text by analogy with how you remove the webViewProgressBar by giving it an id (textView), but I don’t understand something and it gives an error (Calling findViewById() on the Activity object ).

Could you tell me how to do this: insert a picture or text?

Thank you. Sorry for this English, Google helps me.)

alexeyrosspage commented 2 years ago

Two more errors appeared when I uploaded it on Google Pay:

  1. Safety Warning for onReceivedSslError

    SSL Error Handler For more information on how to address WebView SSL Error Handler alerts, please see this [Google Help Center article]

In the CSWebViewClient.java file, in the onReceivedSslError method, I commented out all the lines, and uncommented this line: super.onReceivedSslError(view, handler, error);

More Google did not swear.

  1. Two icons applications on the desktop. Eliminated by removing the repeating piece of code (bottom block) in the AndroidManifest.xml file.
    <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
ArronJo commented 2 years ago

If you want to raise an event during page loading, it is recommended to handle it in onProgressChanged() .

public void onProgressChanged(WebView view, int newProgress)

If you look at the code that is currently implemented, a progress bar is applied at the top of the page.

Let me know if you need more work

2022년 6월 3일 (금) 오후 3:40, Alex @.***>님이 작성:

Hello.

First of all, I want to say thank you for the app. It's the best I've found. Unfortunately, I do not understand Java, but I write in php / JavaScript. Therefore, your application has become a real salvation for me.

If you have time, could you give me a minute. I'm trying to insert an image or text into a white loading screen (when the site is loading). I know that you can make a SplashScreen in front of a white screen, but this will only increase the time, as it seems to me. I thought it would be nice to use a white screen to put something useful on it - a logo or text.

I tried to insert a picture into your code, everything worked out in Activity_main.xml, but after the appearance of the site content, the picture does not disappear as I did not try.

Could you suggest how to do it?

Thank you. Sorry for this English, Google helps me.)

— Reply to this email directly, view it on GitHub https://github.com/ArronJo/sample-webview/issues/4, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEXTPPH4AL65V3UMUKRZAMDVNGSFPANCNFSM5XXQD47Q . You are receiving this because you are subscribed to this thread.Message ID: @.***>

ArronJo commented 2 years ago

Please see below for error correction

-SSL error handler In the function below, you can handle it according to the status SslError status. public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error)

2022년 6월 6일 (월) 오후 6:12, Alex @.***>님이 작성:

Two more errors appeared when I uploaded it on Google Pay:

  1. Safety Warning

SSL Error Handler For more information on how to address WebView SSL Error Handler alerts, please see this [Google Help Center article]

  1. Two tkonka applications on the desktop. Eliminated by removing the repeating piece of code (top) in the AndroidManifest.xml file.

— Reply to this email directly, view it on GitHub https://github.com/ArronJo/sample-webview/issues/4#issuecomment-1147234057, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEXTPPHIOCY4JQM4PWUGAODVNW6IRANCNFSM5XXQD47Q . You are receiving this because you are subscribed to this thread.Message ID: @.***>