package com.kozen.printerhelper.activity;

import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.view.View;

import androidx.annotation.Nullable;

import com.kozen.printerhelper.R;
import com.kozen.printerhelper.helper.KozenPrintHelper;

public class LcdActivity extends BaseActivity {


    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_lcd);
        setMyTitle(R.string.lcd_title);
        setBack();

        //init lcd 、light up lcd and clear screen
        KozenPrintHelper.getInstance().controlLcd(1);
        KozenPrintHelper.getInstance().controlLcd(2);
        KozenPrintHelper.getInstance().controlLcd(4);
    }


    public void text(View view) {
        KozenPrintHelper.getInstance().sendTextToLcd();
    }

    public void texts(View view) {
        KozenPrintHelper.getInstance().sendTextsToLcd();
    }

    public void pic(View view) {
        BitmapFactory.Options options = new BitmapFactory.Options();
        //No scaling
        options.inScaled = false;
        //Make the bitmap have the current device's dpi
        options.inDensity = getResources().getDisplayMetrics().densityDpi;

        KozenPrintHelper.getInstance().sendPicToLcd(BitmapFactory.decodeResource(getResources(),
                R.drawable.mini, options));
    }
}
