package jp.agentec.abook.abv.ui.home.activity;

import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.WindowManager;

/**
 * QRコードリーダー画面（タブレット用）
 */
public class CaptureQRCodeActivityDialog extends CaptureQRCodeActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        DisplayMetrics metrics = getResources().getDisplayMetrics();
        int dialogWidth;

        if (metrics.widthPixels > metrics.heightPixels) {
            dialogWidth = (int) (metrics.heightPixels * 0.9);
        } else {
            dialogWidth = (int) (metrics.widthPixels * 0.9);
        }

        WindowManager.LayoutParams lp = getWindow().getAttributes();
        lp.width = dialogWidth;
        lp.height = dialogWidth;
        getWindow().setAttributes(lp);
    }
}
