diff --git a/android/app/src/main/java/app/organicmaps/bookmarks/data/BookmarkManager.java b/android/app/src/main/java/app/organicmaps/bookmarks/data/BookmarkManager.java index 79bdbeb25e..acdc25fcf6 100644 --- a/android/app/src/main/java/app/organicmaps/bookmarks/data/BookmarkManager.java +++ b/android/app/src/main/java/app/organicmaps/bookmarks/data/BookmarkManager.java @@ -30,38 +30,8 @@ import java.util.List; @MainThread public enum BookmarkManager { - // Used by JNI. - @Keep - @SuppressWarnings("unused") INSTANCE; - @Retention(RetentionPolicy.SOURCE) - @IntDef({ CLOUD_BACKUP, CLOUD_RESTORE }) - public @interface SynchronizationType {} - - public static final int CLOUD_BACKUP = 0; - public static final int CLOUD_RESTORE = 1; - - @Retention(RetentionPolicy.SOURCE) - @IntDef({ CLOUD_SUCCESS, CLOUD_AUTH_ERROR, CLOUD_NETWORK_ERROR, - CLOUD_DISK_ERROR, CLOUD_USER_INTERRUPTED, CLOUD_INVALID_CALL }) - public @interface SynchronizationResult {} - - public static final int CLOUD_SUCCESS = 0; - public static final int CLOUD_AUTH_ERROR = 1; - public static final int CLOUD_NETWORK_ERROR = 2; - public static final int CLOUD_DISK_ERROR = 3; - public static final int CLOUD_USER_INTERRUPTED = 4; - public static final int CLOUD_INVALID_CALL = 5; - - @Retention(RetentionPolicy.SOURCE) - @IntDef({ CLOUD_BACKUP_EXISTS, CLOUD_NO_BACKUP, CLOUD_NOT_ENOUGH_DISK_SPACE }) - public @interface RestoringRequestResult {} - - public static final int CLOUD_BACKUP_EXISTS = 0; - public static final int CLOUD_NO_BACKUP = 1; - public static final int CLOUD_NOT_ENOUGH_DISK_SPACE = 2; - @Retention(RetentionPolicy.SOURCE) @IntDef({ SORT_BY_TYPE, SORT_BY_DISTANCE, SORT_BY_TIME, SORT_BY_NAME }) public @interface SortingType {} @@ -76,7 +46,7 @@ public enum BookmarkManager public static final List ICONS = new ArrayList<>(); - static String[] BOOKMARKS_EXTENSIONS = Framework.nativeGetBookmarksFilesExts(); + private static final String[] BOOKMARKS_EXTENSIONS = Framework.nativeGetBookmarksFilesExts(); private static final String TAG = BookmarkManager.class.getSimpleName(); @@ -98,9 +68,6 @@ public enum BookmarkManager @NonNull private final List mSharingListeners = new ArrayList<>(); - @NonNull - private final List mCloudListeners = new ArrayList<>(); - @Nullable private OnElevationCurrentPositionChangedListener mOnElevationCurrentPositionChangedListener; @@ -268,49 +235,6 @@ public enum BookmarkManager listener.onPreparedFileForSharing(result); } - // Called from JNI. - @Keep - @SuppressWarnings("unused") - @MainThread - public void onSynchronizationStarted(@SynchronizationType int type) - { - for (BookmarksCloudListener listener : mCloudListeners) - listener.onSynchronizationStarted(type); - } - - // Called from JNI. - @Keep - @SuppressWarnings("unused") - @MainThread - public void onSynchronizationFinished(@SynchronizationType int type, - @SynchronizationResult int result, - @NonNull String errorString) - { - for (BookmarksCloudListener listener : mCloudListeners) - listener.onSynchronizationFinished(type, result, errorString); - } - - // Called from JNI. - @Keep - @SuppressWarnings("unused") - @MainThread - public void onRestoreRequested(@RestoringRequestResult int result, @NonNull String deviceName, - long backupTimestampInMs) - { - for (BookmarksCloudListener listener : mCloudListeners) - listener.onRestoreRequested(result, deviceName, backupTimestampInMs); - } - - // Called from JNI. - @Keep - @SuppressWarnings("unused") - @MainThread - public void onRestoredFilesPrepared() - { - for (BookmarksCloudListener listener : mCloudListeners) - listener.onRestoredFilesPrepared(); - } - // Called from JNI. @Keep @SuppressWarnings("unused") @@ -922,11 +846,6 @@ public enum BookmarkManager public static native void nativeRemoveElevationActiveChangedListener(); - public interface ElevationActivePointChangedListener - { - void onElevationActivePointChanged(); - } - public interface BookmarksLoadingListener { default void onBookmarksLoadingStarted() {} @@ -948,44 +867,6 @@ public enum BookmarkManager void onPreparedFileForSharing(@NonNull BookmarkSharingResult result); } - public interface BookmarksCloudListener - { - /** - * The method is called when the synchronization started. - * - * @param type determines type of synchronization (backup or restoring). - */ - void onSynchronizationStarted(@SynchronizationType int type); - - /** - * The method is called when the synchronization finished. - * - * @param type determines type of synchronization (backup or restoring). - * @param result is one of possible results of the synchronization. - * @param errorString contains detailed description in case of unsuccessful completion. - */ - void onSynchronizationFinished(@SynchronizationType int type, - @SynchronizationResult int result, - @NonNull String errorString); - - /** - * The method is called after restoring request. - * - * @param result By result you can determine if the restoring is possible. - * @param deviceName The name of device which was the source of the backup. - * @param backupTimestampInMs contains timestamp of the backup on the server (in milliseconds). - */ - void onRestoreRequested(@RestoringRequestResult int result, @NonNull String deviceName, - long backupTimestampInMs); - - /** - * Restored bookmark files are prepared to substitute for the current ones. - * After this callback any cached bookmarks data become invalid. Also after this - * callback the restoring process can not be cancelled. - */ - void onRestoredFilesPrepared(); - } - public interface OnElevationActivePointChangedListener { void onElevationActivePointChanged();