forked from upstream-mirrors/OpenTracks
Pictures: removed MediaScanner.
This commit is contained in:
@@ -53,7 +53,6 @@ import de.dennisguse.opentracks.fragments.ConfirmDeleteDialogFragment;
|
||||
import de.dennisguse.opentracks.fragments.StatsFragment;
|
||||
import de.dennisguse.opentracks.services.TrackRecordingServiceConnection;
|
||||
import de.dennisguse.opentracks.settings.SettingsActivity;
|
||||
import de.dennisguse.opentracks.util.FileUtils;
|
||||
import de.dennisguse.opentracks.util.IntentUtils;
|
||||
import de.dennisguse.opentracks.util.PreferencesUtils;
|
||||
import de.dennisguse.opentracks.util.TrackIconUtils;
|
||||
@@ -108,10 +107,6 @@ public class TrackDetailActivity extends AbstractListActivity implements ChooseA
|
||||
if (hasPhoto && photoUri != null) {
|
||||
hasPhoto = false;
|
||||
long markerId = trackRecordingServiceConnection.addMarker(TrackDetailActivity.this, null, null, null, photoUri.toString());
|
||||
if (markerId != -1L) {
|
||||
//TODO: Make configurable.
|
||||
FileUtils.updateMediaScanner(TrackDetailActivity.this, photoUri);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -229,13 +229,11 @@ public class ContentProviderUtils {
|
||||
* @param dir the directory
|
||||
*/
|
||||
private void deleteDirectoryRecurse(Context context, File dir) {
|
||||
// TODO Does not work with
|
||||
if (dir.exists() && dir.isDirectory()) {
|
||||
for (File child : dir.listFiles()) {
|
||||
deleteDirectoryRecurse(context, child);
|
||||
}
|
||||
dir.delete();
|
||||
FileUtils.updateMediaScanner(context, Uri.fromFile(dir));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -458,7 +456,6 @@ public class ContentProviderUtils {
|
||||
if (file.exists()) {
|
||||
File parent = file.getParentFile();
|
||||
file.delete();
|
||||
FileUtils.updateMediaScanner(context, uri);
|
||||
if (parent.listFiles().length == 0) {
|
||||
parent.delete();
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package de.dennisguse.opentracks.io.file.importer;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
@@ -113,7 +112,6 @@ public class KmzTrackImporter implements TrackImporter {
|
||||
file.delete();
|
||||
}
|
||||
dir.delete();
|
||||
FileUtils.updateMediaScanner(context, Uri.fromFile(dir));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -168,8 +166,6 @@ public class KmzTrackImporter implements TrackImporter {
|
||||
while ((count = zipInputStream.read(buffer)) != -1) {
|
||||
fileOutputStream.write(buffer, 0, count);
|
||||
}
|
||||
|
||||
FileUtils.updateMediaScanner(context, Uri.fromFile(file));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
package de.dennisguse.opentracks.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Environment;
|
||||
|
||||
import androidx.documentfile.provider.DocumentFile;
|
||||
@@ -109,13 +107,6 @@ public class FileUtils {
|
||||
return fileName.substring(index + 1);
|
||||
}
|
||||
|
||||
// TODO Make user configurable!
|
||||
public static void updateMediaScanner(Context context, Uri uri) {
|
||||
Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
|
||||
mediaScanIntent.setData(uri);
|
||||
context.sendBroadcast(mediaScanIntent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a filename with the given base and the given extension, possibly adding a suffix to ensure the file doesn't exist.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user