Closed tha022 closed 8 years ago
Nice. The maven setup wasn't perfect though. Will fix it, and keep looking for other things. Looks good though till now. Have to still do a lot more refactoring (not your code though).
Thanks. Yes, there are a lot of other things that we could to make it even simpler to use.
Today it requires too much code to set up inside and activity. I will make a new pull request in not to distant future with my suggestions to improvements on that.
Best regards / Med vennlig hilsen
Thomas Vervik
Phone me: +1 6507139923 Phone me: +47 45037118 Phone me: +380 636977529 Skype me: [image: Skype/] tha022
On Sun, Sep 27, 2015 at 10:40 PM, Kumar Bibek notifications@github.com wrote:
Nice. The maven setup wasn't perfect though. Will fix it, and keep looking for other things. Looks good though till now. Have to do a lot more refactoring.
— Reply to this email directly or view it on GitHub https://github.com/coomar2841/image-chooser-library/pull/110#issuecomment-143589935 .
1) Espresso Intents test support - Made it possible to stub filePath when capturing image/video through a new class: UriFactory
Example: @Before public void setUp() throws Exception { super.setUp(); Bitmap bitmap = readBitmapFromFile(TEST_IMAGE_PATH); mImageUri = insertImage(bitmap); mCaptureFile = persistFile(TEST_IMAGE_FILE_NAME, bitmap); UriFactory.getInstance().setFilePathOriginal(filePathOriginal); }
During setup of my test I can insert / persist an image / video to disk or cp, and tell Image Chooser Library that it should use that value when it sets EXTRA_OUTPUT. Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, buildCaptureUri(filePathOriginal));
2) Cleaned up a lot of inconsistencies on how to open and close streams / cursors / etc. This new code also has null checks and throws exception if streams/cursors are null. Before the code threw just crashed and implicitly threw a NullPointerException, which was catched longer down the method.
3) As a consequence of point 2 - Made a consistent exception hierarchy. Have created a checked ChooserException which will be thrown instead if a mix between, IllegalArgument IOException, FileNotFound, etc etc https://source.android.com/source/code-style.html
4) Made build.gradle a bit more generic. Needed to move more properties to gradle.properties since Im using an inhouse repo for code changes I do on the fork.