Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content provider in cache directory #135

Open
strangegt opened this issue Aug 10, 2018 · 1 comment
Open

Content provider in cache directory #135

strangegt opened this issue Aug 10, 2018 · 1 comment

Comments

@strangegt
Copy link

No description provided.

@strangegt strangegt changed the title Content provider in chac Content provider in cache directory Aug 10, 2018
@strangegt
Copy link
Author

I dont save crop image in external storage, i use file provider in chache dir

<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
    <cache-path name="cache" path="." />
</paths>

the code for crop
mCropView.startCrop(createSaveUri(), mCropCallback, mSaveCallback);

public Uri createSaveUri() {
	mCropView.setCompressFormat(Bitmap.CompressFormat.PNG);
	String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
	String imageFileName = "PNG_" + timeStamp + "_.png";

	return getFileProviderUri(new File(getActivity().getCacheDir(), imageFileName));
}

private Uri getFileProviderUri(File photoFile) {
	Uri photoURI;
	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
		photoURI = FileProvider.getUriForFile(getActivity(),
				"com.strangegt.crop.fileprovider",
				photoFile);
	} else {
		photoURI = Uri.fromFile(new File(photoFile.getAbsolutePath()));
	}
	return photoURI;
}

This code works on 1.1.4,, i get the grop image in the content uri, and can use it
but in 1.1.7 stop working, the file is saved but this call fail, in saveImage method, and dont get success crop
Utils.updateGalleryInfo(getContext(), uri);
I think fail because i dont save in external storage

@strangegt strangegt reopened this Aug 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant