@@ -0,0 +1,2255 @@
+package by.vshkl.pxlsrt.core.utils;%0A%0Aimport android.graphics.Bitmap;%0Aimport android.graphics.BitmapFactory;%0A%0Aimport java.io.FileOutputStream;%0Aimport java.io.IOException;%0A%0Aimport by.vshkl.pxlsrt.mvp.presenter.CameraPresenter;%0Aimport io.reactivex.Observable;%0Aimport io.reactivex.ObservableEmitter;%0Aimport io.reactivex.ObservableOnSubscribe;%0Aimport io.reactivex.functions.Consumer;%0Aimport io.reactivex.schedulers.Schedulers;%0A%0Apublic class BitmapUtils %7B%0A%0A    public static Observable%3CString%3E saveTempBitmap(final FileOutputStream fos, final String fname, final byte%5B%5D data) %7B%0A        return Observable.create(new ObservableOnSubscribe%3CString%3E() %7B%0A            @Override%0A            public void subscribe(final ObservableEmitter%3CString%3E emitter) throws Exception %7B%0A                Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length);%0A                bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getWidth());%0A                bitmap = Bitmap.createScaledBitmap(%0A                        bitmap, CameraPresenter.IMAGE_SIZE_PX, CameraPresenter.IMAGE_SIZE_PX, false);%0A                storeFile(fos, bitmap)%0A                        .subscribeOn(Schedulers.io())%0A                        .subscribe(new Consumer%3CBoolean%3E() %7B%0A                            @Override%0A                            public void accept(Boolean aBoolean) throws Exception %7B%0A                                if (aBoolean) %7B%0A                                    emitter.onNext(fname);%0A                                %7D%0A                            %7D%0A                        %7D);%0A            %7D%0A        %7D);%0A    %7D%0A%0A    static Observable%3CBoolean%3E storeFile(final FileOutputStream fos, final Bitmap bitmap) %7B%0A        return Observable.create(new ObservableOnSubscribe%3CBoolean%3E() %7B%0A            @Override%0A            public void subscribe(ObservableEmitter%3CBoolean%3E emitter) throws Exception %7B%0A                bitmap.compress(Bitmap.CompressFormat.PNG, 100, fos);%0A                bitmap.recycle();%0A                try %7B%0A                    fos.close();%0A                    emitter.onNext(true);%0A                %7D catch (IOException e) %7B%0A                    e.printStackTrace();%0A                    emitter.onError(e);%0A                %7D%0A            %7D%0A        %7D);%0A    %7D%0A%7D%0A

Create BitmapUtils for storing taked picture