|
|
@ -23,9 +23,11 @@ import static androidx.room.ForeignKey.CASCADE;
|
|
|
|
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.SharedPreferences;
|
|
|
|
import android.content.SharedPreferences;
|
|
|
|
|
|
|
|
import android.net.Uri;
|
|
|
|
import android.text.TextUtils;
|
|
|
|
import android.text.TextUtils;
|
|
|
|
|
|
|
|
|
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
|
|
|
|
import androidx.core.content.FileProvider;
|
|
|
|
import androidx.preference.PreferenceManager;
|
|
|
|
import androidx.preference.PreferenceManager;
|
|
|
|
import androidx.room.Entity;
|
|
|
|
import androidx.room.Entity;
|
|
|
|
import androidx.room.ForeignKey;
|
|
|
|
import androidx.room.ForeignKey;
|
|
|
@ -153,6 +155,14 @@ public class EntityAttachment {
|
|
|
|
return (encryption != null);
|
|
|
|
return (encryption != null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Uri getUri(Context context) {
|
|
|
|
|
|
|
|
File file = getFile(context);
|
|
|
|
|
|
|
|
if (TextUtils.isEmpty(name))
|
|
|
|
|
|
|
|
return FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID, file);
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
return FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID, file, name);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
File getFile(Context context) {
|
|
|
|
File getFile(Context context) {
|
|
|
|
return getFile(context, id, name);
|
|
|
|
return getFile(context, id, name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|