package com.xplora.xpsettings.Activity;

import android.app.Activity;
import android.os.Build;
import android.os.Bundle;
//import android.os.SystemProperties;
import android.widget.ImageView;

import com.xplora.xpsettings.Data.DataManager;
import com.xplora.xpsettings.Data.ScreenOnUtils;
import com.xplora.xpsettings.R;
import com.xplora.xpsettings.Utils.QRCodeUtil;

import java.nio.charset.StandardCharsets;
import java.util.Base64;

public class QRActivity extends BaseActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_qr);
        ImageView qrIv = findViewById(R.id.qr);

        String host = "https://start.myxplora.com/";
        String qr = "qr=" + DataManager.getIMEI();
        String c = "c=sikey";
        String t = "t=X6";
        String bt = "bt=" + DataManager.getBTMac();
        String content = host + "?" + qr + "&" + c + "&" + t + "&" + bt;
        //content = Base64.getEncoder().encodeToString(content.getBytes(StandardCharsets.UTF_8));

        qrIv.setImageBitmap(QRCodeUtil.createQRCodeBitmap(content, 240, 240));
    }

    @Override
    protected void onResume() {
        super.onResume();
        ScreenOnUtils.addScreenOn(getWindow());
    }

    @Override
    protected void onPause() {
        super.onPause();
        ScreenOnUtils.clearScreenOn(getWindow());
    }
}
