package kr.co.compcareworker.Activity;

import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.LinearLayout;

import androidx.constraintlayout.widget.ConstraintLayout;

import com.journeyapps.barcodescanner.CaptureActivity;

import kr.co.compcareworker.MyApplication;
import kr.co.compcareworker.R;

public class QRCodeActivity extends CaptureActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        MyApplication.myActivity = this;
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
        QRCustomActivity qrCustomActivity = new QRCustomActivity(this);
        addContentView(qrCustomActivity, layoutParams);
    }

    class QRCustomActivity extends ConstraintLayout {

        public QRCustomActivity(Context context) {
            super(context);
            init(context);
        }

        private void init(Context context) {
            LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            inflater.inflate(R.layout.activity_qr_scan, this, true);
        }
    }
}
