diff --git a/package.json b/package.json index cf7abe82..962b31a3 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "2.2.2", + "version": "2.3.2", "name": "cordova-plugin-telerik-imagepicker", "cordova_name": "ImagePicker", "description": "This plugin allows selection of multiple images from the camera roll / gallery in a phonegap app", diff --git a/plugin.xml b/plugin.xml index c8e9debe..4c4251d5 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="2.3.2"> ImagePicker @@ -111,6 +111,7 @@ + diff --git a/src/android/Library/res/layout/actionbar_discard_button.xml b/src/android/Library/res/layout/actionbar_discard_button.xml index 2ab16037..3d77b03f 100644 --- a/src/android/Library/res/layout/actionbar_discard_button.xml +++ b/src/android/Library/res/layout/actionbar_discard_button.xml @@ -27,10 +27,10 @@ android:drawableStart="@drawable/ic_action_discard_light" android:drawablePadding="8dp" android:gravity="center_vertical" - android:paddingLeft="20dp" - android:paddingRight="20dp" - android:paddingStart="20dp" - android:paddingEnd="20dp" + android:paddingLeft="10dp" + android:paddingRight="10dp" + android:paddingStart="10dp" + android:paddingEnd="10dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" diff --git a/src/android/Library/res/layout/actionbar_done_button.xml b/src/android/Library/res/layout/actionbar_done_button.xml index 3f4f70a9..33387c2c 100644 --- a/src/android/Library/res/layout/actionbar_done_button.xml +++ b/src/android/Library/res/layout/actionbar_done_button.xml @@ -27,10 +27,10 @@ android:drawableStart="@drawable/ic_action_done_light" android:drawablePadding="8dp" android:gravity="center_vertical" - android:paddingLeft="20dp" - android:paddingRight="20dp" - android:paddingStart="20dp" - android:paddingEnd="20dp" + android:paddingLeft="10dp" + android:paddingRight="10dp" + android:paddingStart="10dp" + android:paddingEnd="10dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" diff --git a/src/android/Library/res/values-de/multiimagechooser_strings_de.xml b/src/android/Library/res/values-de/multiimagechooser_strings_de.xml index e9c435b2..ea2825f9 100644 --- a/src/android/Library/res/values-de/multiimagechooser_strings_de.xml +++ b/src/android/Library/res/values-de/multiimagechooser_strings_de.xml @@ -2,8 +2,8 @@ MultiImageChooser Freie Version - Nur noch %d Bilder können ausgewählt werden - Beim öffnen der Bilder-Datenbank ist ein Fehler augetreten. Bitte melden Sie dieses Problem. + Beim Öffnen der Bilder-Datenbank ist ein Fehler augetreten. Bitte melden Sie dieses Problem. Vorschaubilder werden geladen, bitte haben Sie etwas Geduld Bilder werden verarbeitet - Dies kann einen Momenent dauern + Dies kann einen Moment dauern diff --git a/src/android/Library/res/values-es/multiimagechooser_strings_es.xml b/src/android/Library/res/values-es/multiimagechooser_strings_es.xml index fe05862e..5a131cf9 100644 --- a/src/android/Library/res/values-es/multiimagechooser_strings_es.xml +++ b/src/android/Library/res/values-es/multiimagechooser_strings_es.xml @@ -4,4 +4,8 @@ Solicitando miniaturas. Por favor, espere… Versión gratuita - Imágenes restantes: %d Error al abrir la base de datos de imágenes. + Procesando imágenes + Esto puede tomar un momento + Cancelar + OK \ No newline at end of file diff --git a/src/android/Library/src/MultiImageChooserActivity.java b/src/android/Library/src/MultiImageChooserActivity.java index c3884d24..1e48bf07 100644 --- a/src/android/Library/src/MultiImageChooserActivity.java +++ b/src/android/Library/src/MultiImageChooserActivity.java @@ -608,7 +608,8 @@ protected void onPostExecute(ArrayList al) { res.putInt("TOTALFILES", imagecursor.getCount()); } - data.putExtras(res); + int sync = ResultIPC.get().setLargeData(res); + data.putExtra("bigdata:synccode", sync); setResult(RESULT_OK, data); } else { diff --git a/src/android/com/synconset/ImagePicker/ImagePicker.java b/src/android/com/synconset/ImagePicker/ImagePicker.java index c91f6a1d..b534736a 100644 --- a/src/android/com/synconset/ImagePicker/ImagePicker.java +++ b/src/android/com/synconset/ImagePicker/ImagePicker.java @@ -123,7 +123,11 @@ private void requestReadPermission() { public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == Activity.RESULT_OK && data != null) { - ArrayList fileNames = data.getStringArrayListExtra("MULTIPLEFILENAMES"); + int sync = data.getIntExtra("bigdata:synccode", -1); + final Bundle bigData = ResultIPC.get().getLargeData(sync); + + ArrayList fileNames = bigData.getStringArrayList("MULTIPLEFILENAMES"); + JSONArray res = new JSONArray(fileNames); callbackContext.success(res); diff --git a/src/android/com/synconset/ImagePicker/ResultIPC.java b/src/android/com/synconset/ImagePicker/ResultIPC.java new file mode 100644 index 00000000..714dd2e6 --- /dev/null +++ b/src/android/com/synconset/ImagePicker/ResultIPC.java @@ -0,0 +1,27 @@ +package com.synconset; + +import android.os.Bundle; + +public class ResultIPC { + + private static ResultIPC instance; + + public synchronized static ResultIPC get() { + if (instance == null) { + instance = new ResultIPC (); + } + return instance; + } + + private int sync = 0; + + private Bundle largeData; + public int setLargeData(Bundle largeData) { + this.largeData = largeData; + return ++sync; + } + + public Bundle getLargeData(int request) { + return (request == sync) ? largeData : null; + } +} \ No newline at end of file diff --git a/src/ios/GMImagePicker/GMAlbumsViewCell.m b/src/ios/GMImagePicker/GMAlbumsViewCell.m index ee1996ef..9eef1e93 100755 --- a/src/ios/GMImagePicker/GMAlbumsViewCell.m +++ b/src/ios/GMImagePicker/GMAlbumsViewCell.m @@ -30,6 +30,9 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus //self.textLabel.backgroundColor = self.backgroundColor; //self.detailTextLabel.backgroundColor = self.backgroundColor; + self.titleLabel.backgroundColor = self.backgroundColor; + self.infoLabel.backgroundColor = self.backgroundColor; + self.accessoryType = UITableViewCellAccessoryDisclosureIndicator; //Border width of 1 pixel: @@ -97,39 +100,53 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus //TextLabel - self.textLabel.font = [UIFont fontWithName:@"Helvetica" size:17.0]; - self.textLabel.numberOfLines = 1; - self.textLabel.translatesAutoresizingMaskIntoConstraints = NO; +// self.textLabel.font = [UIFont fontWithName:@"Helvetica" size:17.0]; +// self.textLabel.numberOfLines = 1; +// self.textLabel.translatesAutoresizingMaskIntoConstraints = NO; + + self.titleLabel = [UILabel new]; + self.titleLabel.font = [UIFont fontWithName:@"HelveticaNeue" size:17.0]; + self.titleLabel.numberOfLines = 1; + self.titleLabel.translatesAutoresizingMaskIntoConstraints = NO; + self.titleLabel.adjustsFontSizeToFitWidth = YES; + [self.contentView addSubview:self.titleLabel]; + +// self.detailTextLabel.font = [UIFont fontWithName:@"Helvetica" size:14.0]; +// self.detailTextLabel.numberOfLines = 1; +// self.detailTextLabel.translatesAutoresizingMaskIntoConstraints = NO; - self.detailTextLabel.font = [UIFont fontWithName:@"Helvetica" size:14.0]; - self.detailTextLabel.numberOfLines = 1; - self.detailTextLabel.translatesAutoresizingMaskIntoConstraints = NO; + self.infoLabel = [UILabel new]; + self.infoLabel.font = [UIFont fontWithName:@"HelveticaNeue" size:14.0]; + self.infoLabel.numberOfLines = 1; + self.infoLabel.translatesAutoresizingMaskIntoConstraints = NO; + self.infoLabel.adjustsFontSizeToFitWidth = YES; + [self.contentView addSubview:self.infoLabel]; //Set next text labels contraints : - [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[imageView1]-(offset)-[textLabel]-|" + [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[imageView1]-(offset)-[titleLabel]-|" options:0 metrics:@{@"offset": @(kAlbumImageToTextSpace)} - views:@{@"textLabel": self.textLabel, + views:@{@"titleLabel": self.titleLabel, @"imageView1": self.imageView1}]]; - [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[imageView1]-(offset)-[detailTextLabel]-|" + [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[imageView1]-(offset)-[infoLabel]-|" options:0 metrics:@{@"offset": @(kAlbumImageToTextSpace)} - views:@{@"detailTextLabel": self.detailTextLabel, + views:@{@"infoLabel": self.infoLabel, @"imageView1": self.imageView1}]]; - [self.contentView addConstraints:@[[NSLayoutConstraint constraintWithItem:self.textLabel + [self.contentView addConstraints:@[[NSLayoutConstraint constraintWithItem:self.titleLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual - toItem:self.textLabel.superview + toItem:self.titleLabel.superview attribute:NSLayoutAttributeCenterY multiplier:1.f constant:0.f]]]; - [self.contentView addConstraints:@[[NSLayoutConstraint constraintWithItem:self.detailTextLabel + [self.contentView addConstraints:@[[NSLayoutConstraint constraintWithItem:self.infoLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual - toItem:self.textLabel.superview + toItem:self.titleLabel.superview attribute:NSLayoutAttributeCenterY multiplier:1.f constant:+4.f]]]; } diff --git a/src/ios/GMImagePicker/GMAlbumsViewController.m b/src/ios/GMImagePicker/GMAlbumsViewController.m index 48bc0132..e791d3b6 100755 --- a/src/ios/GMImagePicker/GMAlbumsViewController.m +++ b/src/ios/GMImagePicker/GMAlbumsViewController.m @@ -262,7 +262,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N cell.tag = currentTag; //Set the label - cell.textLabel.text = (self.collectionsFetchResultsTitles[indexPath.section])[indexPath.row]; + cell.titleLabel.text = (self.collectionsFetchResultsTitles[indexPath.section])[indexPath.row]; //Retrieve the pre-fetched assets for this album: PHFetchResult *assetsFetchResult = (self.collectionsFetchResultsAssets[indexPath.section])[indexPath.row]; @@ -270,7 +270,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N //Display the number of assets if(self.picker.displayAlbumsNumberOfAssets) { - cell.detailTextLabel.text = [self tableCellSubtitle:assetsFetchResult]; + cell.infoLabel.text = [self tableCellSubtitle:assetsFetchResult]; } //Set the 3 images (if exists): @@ -353,12 +353,12 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; + GMAlbumsViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; //Init the GMGridViewController GMGridViewController *gridViewController = [[GMGridViewController alloc] initWithPicker:[self picker]]; //Set the title - gridViewController.title = cell.textLabel.text; + gridViewController.title = cell.titleLabel.text; //Use the prefetched assets! gridViewController.assetsFetchResults = [[_collectionsFetchResultsAssets objectAtIndex:indexPath.section] objectAtIndex:indexPath.row]; gridViewController.dic_asset_fetches = dic_asset_fetches; @@ -442,4 +442,4 @@ - (NSString *)tableCellSubtitle:(PHFetchResult*)assetsFetchResult -@end \ No newline at end of file +@end diff --git a/src/ios/GMImagePicker/GMGridViewCell.m b/src/ios/GMImagePicker/GMGridViewCell.m index 0e78d3a2..d7b5c0be 100755 --- a/src/ios/GMImagePicker/GMGridViewCell.m +++ b/src/ios/GMImagePicker/GMGridViewCell.m @@ -68,8 +68,8 @@ - (id)initWithFrame:(CGRect)frame _imageView.contentMode = UIViewContentModeScaleAspectFill; }*/ _imageView.clipsToBounds = YES; - _imageView.translatesAutoresizingMaskIntoConstraints = NO; - _imageView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; + //_imageView.translatesAutoresizingMaskIntoConstraints = NO; + //_imageView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; [self addSubview:_imageView]; @@ -214,4 +214,4 @@ -(NSString*)getDurationWithFormat:(NSTimeInterval)duration return [NSString stringWithFormat:@"%02ld:%02ld", (long)minutes, (long)seconds]; } -@end \ No newline at end of file +@end diff --git a/src/ios/GMImagePicker/ja.lproj/GMImagePicker.strings b/src/ios/GMImagePicker/ja.lproj/GMImagePicker.strings new file mode 100755 index 00000000..db4938c0 Binary files /dev/null and b/src/ios/GMImagePicker/ja.lproj/GMImagePicker.strings differ diff --git a/src/ios/SOSPicker.m b/src/ios/SOSPicker.m index 429966fb..0e2e00e7 100644 --- a/src/ios/SOSPicker.m +++ b/src/ios/SOSPicker.m @@ -163,7 +163,11 @@ - (void)imagePickerController:(UIImagePickerController *)picker didFinishPicking - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker { - [picker.presentingViewController dismissViewControllerAnimated:YES completion:nil]; + CDVPluginResult* pluginResult = nil; + NSArray* emptyArray = [NSArray array]; + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsArray:emptyArray]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:self.callbackId]; + [self.viewController dismissViewControllerAnimated:YES completion:nil]; NSLog(@"UIImagePickerController: User pressed cancel button"); } @@ -248,7 +252,12 @@ - (void)assetsPickerController:(GMImagePickerController *)picker didFinishPickin //Optional implementation: -(void)assetsPickerControllerDidCancel:(GMImagePickerController *)picker { - NSLog(@"GMImagePicker: User pressed cancel button"); + CDVPluginResult* pluginResult = nil; + NSArray* emptyArray = [NSArray array]; + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsArray:emptyArray]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:self.callbackId]; + [picker.presentingViewController dismissViewControllerAnimated:YES completion:nil]; + NSLog(@"GMImagePicker: User pressed cancel button"); }