package kr.co.compcarecompany.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.compcarecompany.MyApplication;
import kr.co.compcarecompany.R;

public class QRCodeActivity extends CaptureActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
        QRCustomActivity qrCustomActivity = new QRCustomActivity(this);
        addContentView(qrCustomActivity, layoutParams);
        MyApplication.myActivity = this;
    }

    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);
        }
    }
}
