@Override public void refreshImage() { mRxPhotoNote .findByCategoryId(mCategoryId, mComparator) .map(photoNoteList -> photoNoteList.get(mPosition)) .observeOn(AndroidSchedulers.mainThread()) .subscribe(photoNote -> mZoomView.showImage(photoNote.getBigPhotoPathWithFile())); }
@Override public void attachView(IView iView) { mZoomView = (IZoomView) iView; mRxPhotoNote .findByCategoryId(mCategoryId, mComparator) .map(photoNoteList -> photoNoteList.get(mPosition)) .observeOn(AndroidSchedulers.mainThread()) .subscribe(photoNote -> mZoomView.showImage(photoNote.getBigPhotoPathWithFile())); PGEditSDK.instance().initSDK(mActivity.getApplication()); }
@Override public void jump2PGEditActivity() { int memoryClass = ((ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE)).getMemoryClass(); if (memoryClass <= 48) { ImageLoaderManager.clearMemoryCache(); } mRxPhotoNote .findByCategoryId(mCategoryId, mComparator) .map(photoNoteList -> photoNoteList.get(mPosition)) .observeOn(AndroidSchedulers.mainThread()) .subscribe( photoNote -> { String path = photoNote.getBigPhotoPathWithoutFile(); if (!path.endsWith(".jpg")) { mZoomView.showSnackBar( mContext.getResources().getString(R.string.toast_pgedit_not_support)); } else { mZoomView.jump2PGEditActivity(path); } }); }
@Override public void saveSmallImage(final Bitmap thumbNail) { mRxPhotoNote .findByCategoryId(mCategoryId, mComparator) .map(photoNoteList -> photoNoteList.get(mPosition)) .doOnSubscribe(() -> mZoomView.showProgressBar()) .subscribeOn(AndroidSchedulers.mainThread()) .subscribe( photoNote -> { FilePathUtils.saveSmallPhotoFromSDK(photoNote.getPhotoName(), thumbNail); photoNote.setPaletteColor( UiHelper.getPaletteColor( ImageLoaderManager.loadImageSync(photoNote.getBigPhotoPathWithFile()))); mRxPhotoNote .updatePhotoNote(photoNote) .observeOn(AndroidSchedulers.mainThread()) .subscribe( photoNoteList -> { sendBroadcast(); mZoomView.hideProgressBar(); mIsChanged = true; }); }); }
@Override public void finishActivity() { mZoomView.finishActivity(mIsChanged); }