allow to delete voice recordings
This commit is contained in:
parent
d844ce4ffb
commit
de0de48448
|
@ -101,7 +101,10 @@ public class FileBackend {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isInDirectoryThatShouldNotBeScanned(Context context, File file) {
|
private static boolean isInDirectoryThatShouldNotBeScanned(Context context, File file) {
|
||||||
String path = file.getAbsolutePath();
|
return isInDirectoryThatShouldNotBeScanned(context, file.getAbsolutePath());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isInDirectoryThatShouldNotBeScanned(Context context, String path) {
|
||||||
for(String type : new String[]{RecordingActivity.STORAGE_DIRECTORY_TYPE_NAME, "Files"}) {
|
for(String type : new String[]{RecordingActivity.STORAGE_DIRECTORY_TYPE_NAME, "Files"}) {
|
||||||
if (path.startsWith(getConversationsDirectory(context, type))) {
|
if (path.startsWith(getConversationsDirectory(context, type))) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -280,7 +283,6 @@ public class FileBackend {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isPathBlacklisted(String path) {
|
public static boolean isPathBlacklisted(String path) {
|
||||||
Environment.getDataDirectory();
|
|
||||||
final String androidDataPath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/data/";
|
final String androidDataPath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/data/";
|
||||||
return path.startsWith(androidDataPath);
|
return path.startsWith(androidDataPath);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1113,7 +1113,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
|
||||||
}
|
}
|
||||||
if (m.isFileOrImage() && !deleted) {
|
if (m.isFileOrImage() && !deleted) {
|
||||||
String path = m.getRelativeFilePath();
|
String path = m.getRelativeFilePath();
|
||||||
if (path == null || !path.startsWith("/")) {
|
if (path == null || !path.startsWith("/") || FileBackend.isInDirectoryThatShouldNotBeScanned(getActivity(), path) ) {
|
||||||
deleteFile.setVisible(true);
|
deleteFile.setVisible(true);
|
||||||
deleteFile.setTitle(activity.getString(R.string.delete_x_file, UIHelper.getFileDescriptionString(activity, m)));
|
deleteFile.setTitle(activity.getString(R.string.delete_x_file, UIHelper.getFileDescriptionString(activity, m)));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue