package com.plugin.capture;

import android.app.Activity;
import android.content.Intent;
import android.provider.ContactsContract;
import android.util.Log;
import android.view.WindowManager;


public class Capture {

    public String echo(String value) {
        Log.i("Echo", value);
        return value;
    }

    /**
     * 스크린 캡쳐 방지
     *
     * @param activity
     * @param disable : 캡쳐 방지
     */
    public void setScreenCaptureDisable(Activity activity, String disable) {
        Log.i("CapturePlugin", "disabled: " + disable);
        if(disable.equalsIgnoreCase("true")) {
            Log.i("CapturePlugin", "setFlags: FLAG_SECURE");
            activity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
        } else {
            Log.i("CapturePlugin", "clearFlags: FLAG_SECURE");
            activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_SECURE);
        }
    }
}
