-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Image EXIF/XMP metadata removal routine #2863
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
63a09d6
[WIP] Added preferences for EXIF tags
VitalyVPinchuk 32d981b
[WIP] Added arrays, keys, strings to support EXIF preferences
VitalyVPinchuk 15dbe90
[WIP] Updated SettingsFragment to setup summary of added preferences(…
VitalyVPinchuk 08da024
[WIP] Added methods getStringSet()in BasicKvStore, KeyValueStore to s…
VitalyVPinchuk eb5ae30
[WIP] Added methods for removing EXIF tags and anonimyzing location c…
VitalyVPinchuk 9ee28b9
[WIP] Fixed errors in preferences EXIF tags, added XMP removal routine
VitalyVPinchuk 11aee92
Merge branch 'master' into pr-1712
VitalyVPinchuk 8cf6cfd
[WIP] Removed erroneous location accuracy handling
VitalyVPinchuk d654110
Merge branch 'master' into pr-1712
VitalyVPinchuk 65afb07
[WIP] Fixed mistyped GPS Tags
VitalyVPinchuk ff6606c
Reverted BasicKvStore. Removed Set<String> support in BasicKvStore as…
VitalyVPinchuk 4516704
FileProcessor: Replaced throwing runtime exception with warning if EX…
VitalyVPinchuk 18e6bc1
FileMetadataUtils: Javadoc added
VitalyVPinchuk a0312b6
[WIP] Removed XMP metadata due to unusable handling
VitalyVPinchuk 9d660c1
[WIP] FileMetadataUtilsTest added
VitalyVPinchuk 419c6e6
[WIP] FileMetadataUtilsTest: added javadoc
VitalyVPinchuk a570062
[WIP] FileMetadataUtilsTest: added javadoc
VitalyVPinchuk 82100ce
[WIP] FileProcessor: fixed disposing observables
VitalyVPinchuk 88c67cd
[WIP] FileMetadataUtils.getTagsFromPref: changed return type from obs…
VitalyVPinchuk b385a29
[WIP] FileProcessorTest: added test for redactExifTags
VitalyVPinchuk 29e9964
Merge branch 'master' into pr-1712
VitalyVPinchuk 06f2bad
Merge branch 'master' into pr-1712
VitalyVPinchuk 6ab1bff
[WIP] FileProcessorTest: redactExifTags() doesn't work properly
VitalyVPinchuk 6d040fd
Merge branch 'master' into pr-1712
VitalyVPinchuk 2fbecab
Merge branch 'master' into pr-1712
VitalyVPinchuk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
.../java/fr/free/nrw/commons/ui/LongTitlePreferences/LongTitleMultiSelectListPreference.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| package fr.free.nrw.commons.ui.LongTitlePreferences; | ||
|
|
||
| import android.content.Context; | ||
| import android.preference.MultiSelectListPreference; | ||
| import android.util.AttributeSet; | ||
| import android.view.View; | ||
| import android.widget.TextView; | ||
|
|
||
| public class LongTitleMultiSelectListPreference extends MultiSelectListPreference { | ||
| /* | ||
| public LongTitleMultiSelectListPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { | ||
| super(context, attrs, defStyleAttr, defStyleRes); | ||
| } | ||
|
|
||
| public LongTitleMultiSelectListPreference(Context context, AttributeSet attrs, int defStyleAttr) { | ||
| super(context, attrs, defStyleAttr); | ||
| } | ||
| */ | ||
| public LongTitleMultiSelectListPreference(Context context, AttributeSet attrs) { | ||
| super(context, attrs); | ||
| } | ||
|
|
||
| public LongTitleMultiSelectListPreference(Context context) { | ||
| super(context); | ||
| } | ||
|
|
||
| @Override | ||
| protected void onBindView(View view) | ||
| { | ||
| super.onBindView(view); | ||
|
|
||
| TextView title= view.findViewById(android.R.id.title); | ||
| if (title != null) { | ||
| title.setSingleLine(false); | ||
| } | ||
| } | ||
|
|
||
| } |
43 changes: 43 additions & 0 deletions
43
app/src/main/java/fr/free/nrw/commons/upload/FileMetadataUtils.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| package fr.free.nrw.commons.upload; | ||
|
|
||
| import timber.log.Timber; | ||
|
|
||
| import static androidx.exifinterface.media.ExifInterface.*; | ||
|
|
||
| /** | ||
| * Support utils for EXIF metadata handling | ||
| * | ||
| */ | ||
| public class FileMetadataUtils { | ||
VitalyVPinchuk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| /** | ||
| * Takes EXIF label from sharedPreferences as input and returns relevant EXIF tags | ||
| * | ||
| * @param pref EXIF sharedPreference label | ||
| * @return EXIF tags | ||
| */ | ||
| public static String[] getTagsFromPref(String pref) { | ||
| Timber.d("Retuning tags for pref:%s", pref); | ||
| switch (pref) { | ||
| case "Author": | ||
| return new String[]{TAG_ARTIST, TAG_CAMARA_OWNER_NAME}; | ||
| case "Copyright": | ||
| return new String[]{TAG_COPYRIGHT}; | ||
| case "Location": | ||
| return new String[]{TAG_GPS_LATITUDE, TAG_GPS_LATITUDE_REF, | ||
| TAG_GPS_LONGITUDE, TAG_GPS_LONGITUDE_REF, | ||
| TAG_GPS_ALTITUDE, TAG_GPS_ALTITUDE_REF}; | ||
| case "Camera Model": | ||
| return new String[]{TAG_MAKE, TAG_MODEL}; | ||
| case "Lens Model": | ||
| return new String[]{TAG_LENS_MAKE, TAG_LENS_MODEL, TAG_LENS_SPECIFICATION}; | ||
| case "Serial Numbers": | ||
| return new String[]{TAG_BODY_SERIAL_NUMBER, TAG_LENS_SERIAL_NUMBER}; | ||
| case "Software": | ||
| return new String[]{TAG_SOFTWARE}; | ||
| default: | ||
| return new String[]{}; | ||
| } | ||
| } | ||
|
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions
23
app/src/test/kotlin/fr/free/nrw/commons/upload/FileMetadataUtilsTest.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| package fr.free.nrw.commons.upload | ||
|
|
||
| import androidx.exifinterface.media.ExifInterface.* | ||
| import junit.framework.Assert.assertTrue | ||
| import org.junit.Test | ||
| import java.util.* | ||
|
|
||
| /** | ||
| * Test cases for FileMetadataUtils | ||
| */ | ||
| class FileMetadataUtilsTest { | ||
|
|
||
| /** | ||
| * Test method to verify EXIF tags | ||
| */ | ||
| @Test | ||
| fun getTagsFromPref() { | ||
| val author = FileMetadataUtils.getTagsFromPref("Author") | ||
| val authorRef = arrayOf(TAG_ARTIST, TAG_CAMARA_OWNER_NAME); | ||
|
|
||
| assertTrue(Arrays.deepEquals(author, authorRef)) | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add unit test cases.