package com.joe.print.mvp.print;

import android.content.Context;
import android.graphics.Bitmap;
import android.view.View;
import android.widget.LinearLayout;

import com.joe.print.R;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 測試頁打印
 */
public class PrintTest extends PrinterRoot {


    @Override
    public Map<String, List<Bitmap>> getPrintBitmap(Context mContext) {
        Map<String, List<Bitmap>> bitmapMaps = new HashMap<>();
        List<Bitmap> bitmaps = new ArrayList<>();
        bitmaps.add(getTestPrintBitmap(mContext));
        bitmapMaps.put("", bitmaps);
        return bitmapMaps;
    }

    @Override
    public int getPrintCount(Context context) {
        return 1;
    }


    /**
     * 獲取測試打印bitmap
     *
     * @param context
     * @return
     */
    private Bitmap getTestPrintBitmap(Context context) {
        View view = LinearLayout.inflate(context, R.layout.print_test, null);
        return viewToBitmap(context, view);
    }

}
