mirror of
https://github.com/nextcloud/android.git
synced 2024-11-24 22:25:44 +03:00
commit
2286981dbe
6 changed files with 18 additions and 12 deletions
|
@ -1 +1 @@
|
|||
427
|
||||
426
|
|
@ -119,7 +119,7 @@ public final class MediaProvider {
|
|||
MediaStore.MediaColumns.DATA));
|
||||
|
||||
// check if valid path and file exists
|
||||
if (filePath != null && filePath.lastIndexOf('/') > 0 && new File(filePath).exists()) {
|
||||
if (isValidAndExistingFilePath(filePath)) {
|
||||
mediaFolder.filePaths.add(filePath);
|
||||
mediaFolder.absolutePath = filePath.substring(0, filePath.lastIndexOf('/'));
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ public final class MediaProvider {
|
|||
cursorImages.close();
|
||||
|
||||
// only do further work if folder is not within the Nextcloud app itself
|
||||
if (mediaFolder.absolutePath != null && !mediaFolder.absolutePath.startsWith(dataPath)) {
|
||||
if (isFolderOutsideOfAppPath(dataPath, mediaFolder)) {
|
||||
|
||||
// count images
|
||||
Cursor count = contentResolver.query(
|
||||
|
@ -152,6 +152,14 @@ public final class MediaProvider {
|
|||
return mediaFolders;
|
||||
}
|
||||
|
||||
private static boolean isFolderOutsideOfAppPath(String dataPath, MediaFolder mediaFolder) {
|
||||
return mediaFolder.absolutePath != null && !mediaFolder.absolutePath.startsWith(dataPath);
|
||||
}
|
||||
|
||||
private static boolean isValidAndExistingFilePath(String filePath) {
|
||||
return filePath != null && filePath.lastIndexOf('/') > 0 && new File(filePath).exists();
|
||||
}
|
||||
|
||||
private static void checkPermissions(@Nullable Activity activity) {
|
||||
if (activity != null &&
|
||||
!PermissionUtil.checkSelfPermission(activity.getApplicationContext(),
|
||||
|
@ -229,7 +237,7 @@ public final class MediaProvider {
|
|||
cursorVideos.close();
|
||||
|
||||
// only do further work if folder is not within the Nextcloud app itself
|
||||
if (mediaFolder.absolutePath != null && !mediaFolder.absolutePath.startsWith(dataPath)) {
|
||||
if (isFolderOutsideOfAppPath(dataPath, mediaFolder)) {
|
||||
|
||||
// count images
|
||||
Cursor count = contentResolver.query(
|
||||
|
|
|
@ -89,6 +89,7 @@ public class FileContentProvider extends ContentProvider {
|
|||
private static final String UPGRADE_VERSION_MSG = "OUT of the ADD in onUpgrade; oldVersion == %d, newVersion == %d";
|
||||
private static final int SINGLE_PATH_SEGMENT = 1;
|
||||
public static final int ARBITRARY_DATA_TABLE_INTRODUCTION_VERSION = 20;
|
||||
public static final int MINIMUM_PATH_SEGMENTS_SIZE = 1;
|
||||
|
||||
private DataBaseHelper mDbHelper;
|
||||
private Context mContext;
|
||||
|
@ -186,7 +187,7 @@ public class FileContentProvider extends ContentProvider {
|
|||
children.close();
|
||||
}
|
||||
|
||||
if (uri.getPathSegments().size() > 1) {
|
||||
if (uri.getPathSegments().size() > MINIMUM_PATH_SEGMENTS_SIZE) {
|
||||
count += db.delete(ProviderTableMeta.FILE_TABLE_NAME,
|
||||
ProviderTableMeta._ID + "=" + uri.getPathSegments().get(1)
|
||||
+ (!TextUtils.isEmpty(where) ? " AND (" + where + ")" : ""), whereArgs);
|
||||
|
|
|
@ -170,7 +170,7 @@ public class SettingsActivity extends PreferenceActivity
|
|||
setupDetailsCategory(accentColor, preferenceScreen);
|
||||
|
||||
// More
|
||||
setupMoreCategory(accentColor, appVersion);
|
||||
setupMoreCategory(accentColor);
|
||||
|
||||
// About
|
||||
setupAboutCategory(accentColor, appVersion);
|
||||
|
@ -308,7 +308,7 @@ public class SettingsActivity extends PreferenceActivity
|
|||
}
|
||||
}
|
||||
|
||||
private void setupMoreCategory(int accentColor, String appVersion) {
|
||||
private void setupMoreCategory(int accentColor) {
|
||||
PreferenceCategory preferenceCategoryMore = (PreferenceCategory) findPreference("more");
|
||||
preferenceCategoryMore.setTitle(ThemeUtils.getColoredTitle(getString(R.string.prefs_category_more),
|
||||
accentColor));
|
||||
|
|
|
@ -81,11 +81,9 @@ public class PrintAsyncTask extends AsyncTask<Void, Void, Boolean> {
|
|||
try {
|
||||
int status = client.executeMethod(getMethod);
|
||||
if (status == HttpStatus.SC_OK) {
|
||||
if (file.exists()) {
|
||||
if (!file.delete()) {
|
||||
if (file.exists() && !file.delete()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
file.getParentFile().mkdirs();
|
||||
|
||||
|
|
|
@ -79,7 +79,6 @@ import javax.inject.Inject;
|
|||
import androidx.annotation.DrawableRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.StringRes;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
/**
|
||||
* This fragment shows a preview of a downloaded media file (audio or video).
|
||||
|
|
Loading…
Reference in a new issue