package com.youra.qlicker.Acitvitys.EER.KYC;

import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;

import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.github.gcacace.signaturepad.views.SignaturePad;
import com.youra.qlicker.Classes.Globals;
import com.youra.qlicker.R;

public class KYCsingCertifAEOIActivity extends AppCompatActivity {

    private WebView webView;
    private String pathDoc = "file:///android_asset/AEOI.html";

    private LinearLayout ly_bottom ;

    @RequiresApi(api = Build.VERSION_CODES.M)
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_kycsing_certif_aeoi);

        ImageView img_clear = (ImageView) findViewById(R.id.img_clear);
        TextView btn_next = (TextView) findViewById(R.id.btn_next);

        ly_bottom = (LinearLayout)findViewById(R.id.ly_bottom);

        ly_bottom.setVisibility(View.GONE);

        SignaturePad signpad =(SignaturePad) findViewById(R.id.signaturePad);


        /////
        webView = findViewById(R.id.webView);
        webView.setWebViewClient(new WebViewClient());
        webView.loadUrl(pathDoc);
        WebSettings webSettings = webView.getSettings();
        webSettings.setJavaScriptEnabled(true);

        webView.setOnScrollChangeListener(
                (view, scrollX, scrollY, oldScrollX, oldScrollY) ->
                        // calling function rhe tecteed scroll
                        Globals.isScrolling(getApplicationContext() , ly_bottom , view , scrollY   ));




        ///clear signaturepad
        img_clear.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                signpad.clear();

            }
        });

        btn_next.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                finish();
            }
        });
    }


}