From dded376db176c9dd79402d09dea7e73c7b2f9c38 Mon Sep 17 00:00:00 2001 From: k3b <1374583+k3b@users.noreply.github.com> Date: Tue, 19 Jan 2021 18:17:04 +0100 Subject: [PATCH] #169: Introduced visibility "hidden" --- .../PhotoPropertiesMediaDBContentValues.java | 10 ++---- .../media/PhotoPropertiesMediaDBCursor.java | 5 +-- .../androFotoFinder/queries/FotoSql.java | 35 +++++++++++++++++-- .../android/androFotoFinder/tagDB/TagSql.java | 3 ++ .../tagDB/TagSqlQueryParserTests.java | 5 +++ .../src/main/java/de/k3b/io/VISIBILITY.java | 27 ++++++++++---- .../transactionlog/TransactionLoggerBase.java | 2 +- .../k3b/media/PhotoPropertiesUtilTests.java | 4 +++ 8 files changed, 69 insertions(+), 22 deletions(-) diff --git a/app/src/main/java/de/k3b/android/androFotoFinder/media/PhotoPropertiesMediaDBContentValues.java b/app/src/main/java/de/k3b/android/androFotoFinder/media/PhotoPropertiesMediaDBContentValues.java index 15f65690..ac58b38d 100644 --- a/app/src/main/java/de/k3b/android/androFotoFinder/media/PhotoPropertiesMediaDBContentValues.java +++ b/app/src/main/java/de/k3b/android/androFotoFinder/media/PhotoPropertiesMediaDBContentValues.java @@ -161,10 +161,7 @@ public IPhotoProperties setRating(Integer value) { public VISIBILITY getVisibility() { Integer ty = mData.getAsInteger(TagSql.SQL_COL_EXT_MEDIA_TYPE); if (ty != null) { - if (ty.intValue() == FotoSql.MEDIA_TYPE_IMAGE_PRIVATE) - return VISIBILITY.PRIVATE; - - return VISIBILITY.PUBLIC; + return FotoSql.mediaType2Visibility(ty.intValue()); } return null; } @@ -172,10 +169,7 @@ public VISIBILITY getVisibility() { @Override public IPhotoProperties setVisibility(VISIBILITY value) { if (VISIBILITY.isChangingValue(value)) { - int iValue = (value.equals(VISIBILITY.PRIVATE)) - ? FotoSql.MEDIA_TYPE_IMAGE_PRIVATE - : FotoSql.MEDIA_TYPE_IMAGE; - mData.put(TagSql.SQL_COL_EXT_MEDIA_TYPE, iValue); + mData.put(TagSql.SQL_COL_EXT_MEDIA_TYPE, FotoSql.mediaTypeFromVisibility(value)); setLastXmpFileModifyDate(); } return this; diff --git a/app/src/main/java/de/k3b/android/androFotoFinder/media/PhotoPropertiesMediaDBCursor.java b/app/src/main/java/de/k3b/android/androFotoFinder/media/PhotoPropertiesMediaDBCursor.java index 1f379dcf..380a852f 100644 --- a/app/src/main/java/de/k3b/android/androFotoFinder/media/PhotoPropertiesMediaDBCursor.java +++ b/app/src/main/java/de/k3b/android/androFotoFinder/media/PhotoPropertiesMediaDBCursor.java @@ -119,10 +119,7 @@ public VISIBILITY getVisibility() { if (colType == -1) return null; Integer ty = cursor.getInt(colType); if (ty != null) { - if (ty.intValue() == FotoSql.MEDIA_TYPE_IMAGE_PRIVATE) - return VISIBILITY.PRIVATE; - - return VISIBILITY.PUBLIC; + return FotoSql.mediaType2Visibility(ty.intValue()); } return null; } diff --git a/app/src/main/java/de/k3b/android/androFotoFinder/queries/FotoSql.java b/app/src/main/java/de/k3b/android/androFotoFinder/queries/FotoSql.java index 34bbc5f8..57284602 100644 --- a/app/src/main/java/de/k3b/android/androFotoFinder/queries/FotoSql.java +++ b/app/src/main/java/de/k3b/android/androFotoFinder/queries/FotoSql.java @@ -151,12 +151,16 @@ public class FotoSql extends FotoSqlBase { private static final int LAST_MODIFIED_FACTOR = 1000; public static final int MEDIA_TYPE_IMAGE_PRIVATE = 1000 + MEDIA_TYPE_IMAGE; // 1001 APhoto manager specific - public static final int MEDIA_TYPE_ALBUM_FILE = 0; + public static final int MEDIA_TYPE_IMAGE_HIDDEN = 1100 + MEDIA_TYPE_IMAGE; // 1101 APhoto manager specific + public static final int MEDIA_TYPE_ALBUM_FILE = 0; protected static final String FILTER_EXPR_PRIVATE = "(" + SQL_COL_EXT_MEDIA_TYPE + " = " + MEDIA_TYPE_IMAGE_PRIVATE + ")"; + protected static final String FILTER_EXPR_HIDDEN + = "(" + SQL_COL_EXT_MEDIA_TYPE + " = " + MEDIA_TYPE_IMAGE_HIDDEN + ")"; + public static final String FILTER_EXPR_PRIVATE_PUBLIC - = "(" + SQL_COL_EXT_MEDIA_TYPE + " in (" + MEDIA_TYPE_IMAGE_PRIVATE + "," + MEDIA_TYPE_IMAGE +"))"; + = "(" + SQL_COL_EXT_MEDIA_TYPE + " in (" + MEDIA_TYPE_IMAGE_PRIVATE + "," + MEDIA_TYPE_IMAGE + "))"; protected static final String FILTER_EXPR_PUBLIC = "(" + SQL_COL_EXT_MEDIA_TYPE + " = " + MEDIA_TYPE_IMAGE + ")"; @@ -1329,6 +1333,31 @@ private static List getFileNamesImpl(QueryParameter parameters, List