Skip to content
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

Syncing or Downloading Reduced Size Images: Android Library #217

Open
wants to merge 4 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -357,5 +357,5 @@ interface IAidlSynchronizer {
* @throws IOException
*/
void downloadInstanceFileBatch(in List<CommonFileAttachmentTerms> filesToDownload,
in String serverInstanceFileUri, in String instanceId, in String tableId);
in String serverInstanceFileUri, in String instanceId, in String tableId, in boolean reduceImageSize);
}
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,9 @@ public final class CommonToolProperties {
// key used to store the timestamp of last successful sync in SyncFragment
public static final String KEY_LAST_SYNC_INFO = "common.last_sync_info";

// key used to store the AttachmentState of last sync that involved a download
public static final String KEY_PREV_SYNC_ATTACHMENT_STATE = "common.prev_sync_attachment_state";

// key used to store the sync type spinner's preference in SyncFragment
public static final String KEY_SYNC_ATTACHMENT_STATE = "common.sync_attachment_state";

Expand Down Expand Up @@ -284,6 +287,7 @@ public static void accumulateProperties(Context context,
deviceProperties.put(PropertiesSingleton.toolFirstRunPropertyName("sensors"), "");
deviceProperties.put(KEY_SURVEY_SORT_ORDER,"sortByName");
deviceProperties.put(KEY_PREF_TABLES_SORT_BY_ORDER,"SORT_ASC");
deviceProperties.put(KEY_PREV_SYNC_ATTACHMENT_STATE, "NONE");
}
// handle the secure properties. If these are in the incoming syncable general
// property file, those values will be used to initialize these fields (if there is not an
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import android.os.Parcelable;

public enum SyncAttachmentState implements Parcelable {
SYNC, UPLOAD, DOWNLOAD, NONE, REDUCED_SYNC, RE_DOWNLOAD;
SYNC, UPLOAD, DOWNLOAD, NONE, REDUCED_DOWNLOAD, SYNC_WITH_REDUCED_DOWNLOAD;

@Override
public int describeContents() {
Expand All @@ -42,4 +42,14 @@ public SyncAttachmentState[] newArray(int size) {
}
};

public static boolean involvesDownload(SyncAttachmentState state) {
return state == SYNC || state == DOWNLOAD || state == REDUCED_DOWNLOAD || state == SYNC_WITH_REDUCED_DOWNLOAD;
}
public static boolean involvesReducedImgDownload(SyncAttachmentState state) {
return state == REDUCED_DOWNLOAD || state == SYNC_WITH_REDUCED_DOWNLOAD;
}

public static boolean involvesFullSizeImgDownload(SyncAttachmentState state) {
return state == SYNC || state == DOWNLOAD;
}
}