package com.icod.yk_printer_test;

import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.RelativeLayout;

import com.icod.yk_printer_test.utils.PrintParamManager;

public class SetParamActivity extends AppCompatActivity {
    private RelativeLayout rlPrinterType;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_set_param);
        rlPrinterType = (RelativeLayout) findViewById(R.id.rl_printer_type);
        rlPrinterType.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                new AlertDialog.Builder(SetParamActivity.this).setTitle(R.string.printer_type)
                        .setSingleChoiceItems(new String[]{"58", "80"}, 0, new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                com.szsicod.print.log.Logger.i("item :",which);
                                PrintParamManager.getInstance().setIs58Printer(which==0?true:false);
                                dialog.dismiss();
                            }
                        }).setNegativeButton("取消", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                    }
                }).create().show();
            }
        });
    }
}
