@Override public void onClick(View v) { if (isResumed() && !mIsProcessing) { if (mProgress != null) { mProgress.setVisibility(View.VISIBLE); } mIsProcessing = true; if (mReturnImmediately) { String token = UUID.randomUUID().toString(); EditorBitmapCache.getInstance() .put( token, EditorBitmapCache.getInstance().get(EditorBitmapCache.Keys.TRIMMED_BITMAP)); Intent intent = new Intent(); intent.setClass(getActivity(), ImojiCreateService.class); intent.putExtra(ImojiCreateService.CREATE_TOKEN_BUNDLE_ARG_KEY, token); getActivity().startService(intent); notifySuccess(token); } else { CreateTaskFragment f = (CreateTaskFragment) getFragmentManager().findFragmentByTag(CreateTaskFragment.FRAGMENT_TAG); if (f == null) { f = CreateTaskFragment.newInstance(getTags(), false); } getFragmentManager() .beginTransaction() .add(f, CreateTaskFragment.FRAGMENT_TAG) .commit(); } } }
@Override public void onOutlinedBitmapReady(Bitmap outlinedBitmap) { if (isAdded()) { if (outlinedBitmap == null) { notifyFailure(); return; } if (mImojiIv != null) { mImojiIv.setImageBitmap(outlinedBitmap); } // also save it to cache EditorBitmapCache.getInstance().put(EditorBitmapCache.Keys.OUTLINED_BITMAP, outlinedBitmap); } }