@@ -0,0 +1,2751 @@
+package com.example.chicken_or_the_egg.manager;%0A%0Aimport android.content.Context;%0Aimport android.graphics.Bitmap;%0Aimport android.util.TypedValue;%0Aimport com.google.zxing.BarcodeFormat;%0Aimport com.google.zxing.EncodeHintType;%0Aimport com.google.zxing.MultiFormatWriter;%0Aimport com.google.zxing.WriterException;%0Aimport com.google.zxing.common.BitMatrix;%0A%0Aimport java.util.EnumMap;%0Aimport java.util.Map;%0A%0A/**%0A * Created by Konstantin on 16.06.2014.%0A */%0Apublic class ZxingManager implements AppManagerInitializer %7B%0A    private Context context;%0A    private final int WIDTH = 300;%0A    private final int HEIGHT = 300;%0A%0A    @Override%0A    public void init(Context context) %7B%0A        this.context = context;%0A%0A    %7D%0A%0A    public Bitmap encodeAsBitmap(String contents) throws WriterException %7B%0A        String contentsToEncode = contents;%0A        if (contentsToEncode == null) %7B%0A            return null;%0A        %7D%0A        Map%3CEncodeHintType, Object%3E hints = null;%0A        String encoding = guessAppropriateEncoding(contentsToEncode);%0A        if (encoding != null) %7B%0A            hints = new EnumMap%3CEncodeHintType, Object%3E(EncodeHintType.class);%0A            hints.put(EncodeHintType.CHARACTER_SET, encoding);%0A        %7D%0A        MultiFormatWriter writer = new MultiFormatWriter();%0A        BitMatrix result;%0A        try %7B%0A            result = writer.encode(contentsToEncode,%0A                    BarcodeFormat.QR_CODE,%0A                    (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, WIDTH, context.getResources().getDisplayMetrics()),%0A                    (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, HEIGHT, context.getResources().getDisplayMetrics()),%0A                    hints);%0A        %7D catch (IllegalArgumentException iae) %7B%0A            // Unsupported format%0A            return null;%0A        %7D%0A        int width = result.getWidth();%0A        int height = result.getHeight();%0A        int%5B%5D pixels = new int%5Bwidth * height%5D;%0A        for (int y = 0; y %3C height; y++) %7B%0A            int offset = y * width;%0A            for (int x = 0; x %3C width; x++) %7B%0A                pixels%5Boffset + x%5D = result.get(x, y) ? context.getResources().getColor(android.R.color.black) : context.getResources().getColor(android.R.color.white);%0A            %7D%0A        %7D%0A%0A        Bitmap bitmap = Bitmap.createBitmap(width, height,%0A                Bitmap.Config.ARGB_8888);%0A        bitmap.setPixels(pixels, 0, width, 0, 0, width, height);%0A        return bitmap;%0A    %7D%0A%0A    private static String guessAppropriateEncoding(CharSequence contents) %7B%0A        // Very crude at the moment%0A        for (int i = 0; i %3C contents.length(); i++) %7B%0A            if (contents.charAt(i) %3E 0xFF) %7B%0A                return %22UTF-8%22;%0A            %7D%0A        %7D%0A        return null;%0A    %7D%0A%0A%7D%0A

add qr code generator logic