Skip to content

Instantly share code, notes, and snippets.

View schreiby's full-sized avatar

schreiby

View GitHub Profile
- (IBAction)addDocumentTapped:(id)sender {
UIDocumentMenuViewController *viewController = [[UIDocumentMenuViewController alloc] initWithDocumentTypes:@[(NSString *)kUTTypeImage] inMode:UIDocumentPickerModeOpen];
viewController.delegate = self;
viewController.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentViewController:viewController animated:YES completion:^{
}];
}
- (void)documentMenu:(UIDocumentMenuViewController *)documentMenu didPickDocumentPicker:(UIDocumentPickerViewController *)documentPicker {
@schreiby
schreiby / CountingFileRequestBody.java
Created May 10, 2016 17:50 — forked from eduardb/CountingFileRequestBody.java
Uploading a file with a progress displayed using OkHttp
public class CountingFileRequestBody extends RequestBody {
private static final int SEGMENT_SIZE = 2048; // okio.Segment.SIZE
private final File file;
private final ProgressListener listener;
private final String contentType;
public CountingFileRequestBody(File file, String contentType, ProgressListener listener) {
this.file = file;