Skip to content

Commit

Permalink
Adds file size information
Browse files Browse the repository at this point in the history
  • Loading branch information
EddyLB committed Dec 31, 2019
1 parent 21ab6c0 commit 1fa5710
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 15 deletions.
Expand Up @@ -21,19 +21,6 @@
@interface EditImageFilenameCollectionViewCell : UICollectionViewCell

@property (assign, nonatomic) NSInteger imageId;
@property (weak, nonatomic) IBOutlet UIImageView *imageThumbnail;
@property (weak, nonatomic) IBOutlet UIView *imageDetails;
@property (weak, nonatomic) IBOutlet UILabel *imageDate;
@property (weak, nonatomic) IBOutlet UILabel *imageSize;
@property (weak, nonatomic) IBOutlet UILabel *imageFile;
@property (weak, nonatomic) IBOutlet UILabel *imageTime;

@property (weak, nonatomic) IBOutlet UIView *editButtonView;
@property (weak, nonatomic) IBOutlet UIButton *editImageButton;

@property (weak, nonatomic) IBOutlet UIView *removeButtonView;
@property (weak, nonatomic) IBOutlet UIButton *removeImageButton;

@property (nonatomic, weak) id<EditImageFilenameDelegate> delegate;

-(void)setupWithImage:(PiwigoImageData *)imageData andRemoveOption:(BOOL)hasRemove;
Expand Down
Expand Up @@ -15,6 +15,19 @@

@interface EditImageFilenameCollectionViewCell() <UITextFieldDelegate>

@property (weak, nonatomic) IBOutlet UIImageView *imageThumbnail;
@property (weak, nonatomic) IBOutlet UIView *imageDetails;
@property (weak, nonatomic) IBOutlet UILabel *imageDate;
@property (weak, nonatomic) IBOutlet UILabel *imageSize;
@property (weak, nonatomic) IBOutlet UILabel *imageFile;
@property (weak, nonatomic) IBOutlet UILabel *imageTime;

@property (weak, nonatomic) IBOutlet UIView *editButtonView;
@property (weak, nonatomic) IBOutlet UIButton *editImageButton;

@property (weak, nonatomic) IBOutlet UIView *removeButtonView;
@property (weak, nonatomic) IBOutlet UIButton *removeImageButton;

@property (nonatomic, strong) UIAlertAction *renameFileNameAction;
@property (nonatomic, strong) NSString *oldFileName;

Expand Down Expand Up @@ -79,11 +92,20 @@ -(void)setupWithImage:(PiwigoImageData *)imageData andRemoveOption:(BOOL)hasRemo

// Image from Piwigo server…
if ((imageData.fullResWidth > 0) && (imageData.fullResHeight > 0)) {
self.imageSize.text = [NSString stringWithFormat:@"%ldx%ld pixels, %.2f MB", (long)imageData.fullResWidth, (long)imageData.fullResHeight, (double)imageData.fileSize / 1024.0];
if(self.contentView.bounds.size.width > 299) { // i.e. larger than iPhone 5 screen width
self.imageSize.text = [NSString stringWithFormat:@"%ldx%ld pixels, %.2f MB", (long)imageData.fullResWidth, (long)imageData.fullResHeight, (double)imageData.fileSize / 1024.0];
} else {
self.imageSize.text = [NSString stringWithFormat:@"%ldx%ld pixels", (long)imageData.fullResWidth, (long)imageData.fullResHeight];
}
}

self.imageDate.text = @"";
if (imageData.dateCreated != nil) {
self.imageDate.text = [NSDateFormatter localizedStringFromDate:imageData.dateCreated dateStyle:NSDateFormatterFullStyle timeStyle:NSDateFormatterNoStyle];
if(self.contentView.bounds.size.width > 320) { // i.e. larger than iPhone 5 screen width
self.imageDate.text = [NSDateFormatter localizedStringFromDate:imageData.dateCreated dateStyle:NSDateFormatterFullStyle timeStyle:NSDateFormatterNoStyle];
} else {
self.imageDate.text = [NSDateFormatter localizedStringFromDate:imageData.dateCreated dateStyle:NSDateFormatterLongStyle timeStyle:NSDateFormatterNoStyle];
}
self.imageTime.text = [NSDateFormatter localizedStringFromDate:imageData.dateCreated dateStyle:NSDateFormatterNoStyle timeStyle:NSDateFormatterMediumStyle];
}

Expand Down

0 comments on commit 1fa5710

Please sign in to comment.