package com.saki.ui;

import com.saki.sqv9.R;

import com.saki.ui.i.IDR;

import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Bitmap;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;

public class OtherWindow extends Dialog implements
        View.OnClickListener ,DialogInterface.OnDismissListener {

    private ImageView verifycode_img;
    private EditText verifycode_input;
    private Button ok;
    private IDR i;

    public OtherWindow(Context context, Bitmap bitmap, IDR i) {
        super(context);
        this.i = i;
        setContentView(R.layout.lay_verifycode);
        verifycode_img = (ImageView) findViewById(R.id.img_verifycode);
        verifycode_img.setImageBitmap(bitmap);
        verifycode_input = (EditText) findViewById(R.id.input_verifycode);
        ok = (Button) findViewById(R.id.ok);
        ok.setOnClickListener(this);
        setOnDismissListener(this);
        show();
    }

    @Override
    public void onClick(View v) {
        dismiss();
    }

    @Override
    public void onDismiss(DialogInterface dialog) {
        if (i != null) {
            i.result(verifycode_input.getText().toString());
        }
    }
}
