Releases: cmsc436/sheets436
Batch uploads, Image buffering, and more Enums
This release introduces new batch functions that can upload multiple data points/images with one method call. Usage of these functions are optional, although it is slightly more efficient to do all tasks in batch. The API for using these functions are the same as their non-batch counterparts, except you now pass in an array of the data points you'd like to upload.
public void writeDataBatch(TestType[] testTypes, String[] userIds, float[] values);
public void writeTrialsBatch(TestType[] testTypes, String[] userIds, float[][] trialsBatch);
public void uploadToDriveBatch(String[] folderIds, String[] fileNames, Bitmap[] images);
The second change is a bug fix with the buffering of image uploads. Before, if two calls to uploadToDrive
were chained together, the first call would be invalidated. (Thus the only way to get past this was to put the second method call inside a callback.) This release fixes that issue, making it safe to call uploadToDrive
multiple times back to back.
sheets.uploadToDrive("0B3RViSRC0aoYVDN6MWZUb1RDSVU", "first image", bitmap1);
sheets.uploadToDrive("0B3RViSRC0aoYVDN6MWZUb1RDSVU", "second image", bitmap2);
The last change is the addition of new foot curling enums.
Sheets.TestType.LF_CURL
Sheets.TestType.RF_CURL
Multiple Synchronous Image Uploads
This release fixes synchronization issues with uploading multiple images. You should be able to call upload methods back to back safely.
sheets.uploadToDrive("0B3RViSRC0aoYVDN6MWZUb1RDSVU", "first image", bitmap1);
sheet.suploadToDrive("0B3RViSRC0aoYVDN6MWZUb1RDSVU", "second image", bitmap2);
There are also new enums for foot curling.
Sheets.TestType.LF_CURL
Sheets.TestType.RF_CURL
The non-beta release is expected to have batch upload functions, so uploading multiple images/cells will only need a single method call that takes in a list of payloads.
Drive image upload fixes
This release mainly introduces various bug fixes with image uploads via the Google Drive API.
To support the Drive API, you will need to add some new configuration to the app's build.gradle
(which was missing from earlier documentation).
compile 'com.google.android.gms:play-services-drive:10.2.1'
compile('com.google.apis:google-api-services-drive:v3-rev69-1.22.0') {
exclude group: 'org.apache.httpcomponents'
exclude group: 'com.google.code.findbugs'
}
There should be no other required changes to your code. For reference, here is the image upload API.
public void uploadToDrive(String folderId, String fileName, Bitmap image);
It's a good idea for groups who save pictures to upload their pictures to Drive. These groups include the Spiral Test group, the Level Test, and the Swaying Test group.
Documentation and bug fix
This release contains a minor bug fix with image uploads and documentation detailing how to configure build.gradle
to support image uploads. For your apps, build.gradle
will need to compile Drive dependencies.
compile 'com.google.android.gms:play-services-drive:10.2.1'
compile('com.google.apis:google-api-services-drive:v3-rev69-1.22.0') {
exclude group: 'org.apache.httpcomponents'
exclude group: 'com.google.code.findbugs'
}
Outdoor walking enum
This release adds a new enum for outdoor walking.
Sheets.TestType.OUTDOOR_WALKING
Image Uploads to Drive
This release allows image uploads to Google Drive and adds support for the new app of the week.
You will need to enable the Drive API on the Google Developer Console. Instructions to do so are in a new section in the README.
Here are the API Changes.
- There's a new method to allow uploads to Drive. It takes in the folder ID, desired file name, and the image to upload as a bitmap.
public void uploadToDrive(String folderId, String fileName, Bitmap image);
- Due to the new public method, there is a new
Action
enum to support (REQUEST_CONNECTION_RESOLUTION
) when implementingHost.getRequestCode(Action action)
.
public enum Action {
REQUEST_PERMISSIONS,
REQUEST_ACCOUNT_NAME,
REQUEST_PLAY_SERVICES,
REQUEST_AUTHORIZATION,
REQUEST_CONNECTION_RESOLUTION
}
- There's also a new
TestType
enum for the new app.
Sheets.TestType.INDOOR_WALKING
The sample app has been adjusted to show the usage for the new API.
Trial Data to Private Sheets
This version of the library adds writing of individual trial data to private spreadsheets. It adds two new mandatory parameters to the Sheets
constructor and adds a new public API call.
The format of a private spreadsheet is more like the old spreadsheet organization. Each column is its own data point, and each row in a column has the PID, timestamp, and trials.
There are a few API changes to this version, but they are quite minor.
- There's a new constructor. The only difference is that it takes two new parameters, which are the host activity (most of you will just pass in
this
) and the ID of your private spreadsheet. Below are the old and new constructors.
public Sheets(Host host, String appName, String spreadsheetId);
public Sheets(Host host, Activity hostActivity, String appName, String spreadsheetId, String privateSpreadsheetId);
- The trial data is written by calling a new method
writeTrials
. It takes the same input aswriteData
, except it will need an array of floats (one for each trial). Unlike the beta version of this, you can call them back to back without worrying about any callbacks.
public void writeTrials(TestType testType, String userId, float[] trials);
- There are three new
enum
values for the new app (the head sway app) and the tapping app using feet.
Sheets.TestType.LF_TAP
Sheets.TestType.RF_TAP
Sheets.TestType.HEAD_SWAY
As usual, there's (updated) sample code that shows all of this in use.
Trial Data to Private Sheets (beta)
This version of the library adds writing of individual trial data to private spreadsheets. It's still beta (i.e. testing), so after some of you try it out and don't notice any issues, I'll update the README
and merge this into master.
The format of a private spreadsheet is more like the old spreadsheet organization. Each column is its own data point, and each row in a column has the PID, timestamp, and trials.
There are a few API changes to this version, but they are quite minor. Your preexisting code will not break (although you won't be able to use the new functionality either).
- There's a new constructor. The only difference is that it takes another parameter, which is the ID of your private spreadsheet. Below are the old and new constructors.
public Sheets(Host host, String appName, String spreadsheetId);
public Sheets(Host host, String appName, String spreadsheetId, String privateSpreadsheetId);
- The trial data is written by calling a new method
writeTrials
. It takes the same input aswriteData
, except it will need an array of floats (one for each trial). Do not call these two functions one after another. You'll want to make sure the first spreadsheet call has finished before you call the second. In other words, make sure thatnotifyFinished
has been successfully called before launching another spreadsheet call. (If you find this too inconvenient, let me know and I'll try to change the API).
public void writeTrials (TestType testType, String userId, float[] trials);
- There's a new
enum
value for the new app (the head sway app).
Sheets.TestType.HEAD_SWAY
As usual, there's (updated) sample code that shows all of this in use. Please test this out and point out any issues you find.
Release 0.0.2 @ 4/5/2017
This is a merging of the original library and the other activity that doesn't spawn an activity. There are a few major changes that should make the library smoother to use.
- Minimum SDK has been reduced to 22 from 25. (A lot of phones were not working because of the high API requirement, sorry.)
- Writing to Google Sheets no longer creates an activity. Instead it spawns an
AsyncTask
that writes to Sheets in the background. - There are MAJOR usage changes. Please refer to the Usage section of the README to see what changes you'll need to make to your app.
Please try out this version as soon as possible. I want to make sure there's minimal confusion and that this library works for everybody.
Sheets API probably-not-stable-beta-alpha release
Download the aar
and follow the instructions on the README
.