package com.yyrh.ui.dialog;


import android.app.Dialog;
import android.content.Context;

import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.Log;
import android.webkit.JavascriptInterface;


import com.yyrh.constant.SDKSettings;
import com.yyrh.utils.YYLog;

import org.json.JSONException;
import org.json.JSONObject;

import java.net.URISyntaxException;

import static com.yyrh.constant.SDKSettings.isLandscape;


public class BaseDialog extends Dialog {


    public BaseDialog(@NonNull Context context) {
        super(context);
    }

    public BaseDialog(@NonNull Context context, int themeResId) {
        super(context, themeResId);
    }

    protected BaseDialog(@NonNull Context context, boolean cancelable, @Nullable OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
    }

    public void zfColse() {   //提供给js调用的方法
        YYLog.i("zfColse");
    }


    public void usrRn(String message) {
        YYLog.i("usrRn:" + message);
    }

    public void showJsMsg(String message) {
        YYLog.i("showJsMsg:" + message);
    }

    public void modifyPwd(String message) {
        YYLog.i("modifyPwd:" + message);
    }

    public void zfOrder(String message) {   //提供给js调用的方法
        YYLog.i("zfOrder:" + message);
    }

    public void openq0q0(String url)  {

        YYLog.i("openq0q0:" + url);

    }
    public void switchAccount()  {

        YYLog.i("switchAccount");

    }
    @JavascriptInterface
    public String webExt(){

        JSONObject json = new JSONObject();


        try {
            if (isLandscape){

                json.put("orientation","landscape");

            }else{

                json.put("orientation","portrait");

            }

            json.put("version", SDKSettings.SDK_VERSION);

        } catch (JSONException e) {
            e.printStackTrace();
        }

        YYLog.i("webExt : " + json.toString());
        return json.toString();
    }
}
