package net.micode.notes.utils;

import android.net.Uri;
import android.os.Build;
import android.support.v4.content.FileProvider;


import java.io.File;

public class UriUtils {
    public static Uri getUriForFile(String path) {
        return getUriForFile(new File(path));
    }

    public static Uri getUriForFile(File file) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
            return FileProvider.getUriForFile(ContextUtils.getContext(), ContextUtils.getContext().getPackageName() + ".FileProvider", file);
        } else {
            return Uri.fromFile(file);
        }
    }
}
