This commit is contained in:
ligi 2015-03-03 00:14:04 +01:00
parent 76f2f0f12d
commit 3adf5e946d
2 changed files with 5 additions and 4 deletions

View file

@ -15,11 +15,11 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
public class ImageFromIntentUriExtractor {
public class ImageFromIntentUriToFileConverter {
final Context context;
public ImageFromIntentUriExtractor(final Context context) {
public ImageFromIntentUriToFileConverter(final Context context) {
this.context = context;
}
@ -45,6 +45,7 @@ public class ImageFromIntentUriExtractor {
}
} else { // it is a regular local image file
String filePath = cursor.getString(columnIndex);
// taken from http://stackoverflow.com/questions/20067508/get-real-path-from-uri-android-kitkat-new-storage-access-framework
if (filePath == null && Build.VERSION.SDK_INT >= 19) {
filePath = getFilePathForKITKAT(selectedImage);

View file

@ -11,7 +11,7 @@ import android.view.ViewGroup;
import com.google.common.io.Files;
import org.ligi.passandroid.App;
import org.ligi.passandroid.ImageFromIntentUriExtractor;
import org.ligi.passandroid.ImageFromIntentUriToFileConverter;
import org.ligi.passandroid.R;
import org.ligi.passandroid.events.PassRefreshEvent;
import org.ligi.passandroid.model.PassImpl;
@ -100,7 +100,7 @@ public class ImageEditFragment extends Fragment {
}
private void extractImage(Intent imageReturnedIntent, String name) {
final File extract = new ImageFromIntentUriExtractor(getActivity()).extract(imageReturnedIntent.getData());
final File extract = new ImageFromIntentUriToFileConverter(getActivity()).extract(imageReturnedIntent.getData());
try {
Files.copy(extract, new File(getPass().getPath() + "/" + name + PassImpl.FILETYPE_IMAGES));
} catch (IOException e) {