refactor: Remove old sesmic layout and controller

This commit is contained in:
Andrea Busi
2020-09-26 12:55:00 +02:00
parent 672982d7d5
commit 3b5e8e395f
9 changed files with 0 additions and 647 deletions
@@ -51,7 +51,6 @@
8CA46BA12194532E00C63C16 /* SismaAnnotation.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CA46BA02194532E00C63C16 /* SismaAnnotation.m */; };
8CADAA9421B2627D0044E256 /* LogViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CADAA9321B2627D0044E256 /* LogViewController.m */; };
8CAFD7C521825E4A00F8BD29 /* EQNSisma.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CAFD7C421825E4A00F8BD29 /* EQNSisma.m */; };
8CAFD7C82182648600F8BD29 /* EQNRetiSismiViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CAFD7C72182648600F8BD29 /* EQNRetiSismiViewController.m */; };
8CBD3DC72149B9AD0070C963 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CBD3DC62149B9AD0070C963 /* AppDelegate.m */; };
8CBD3DCA2149B9AD0070C963 /* ReteSmartphone.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CBD3DC92149B9AD0070C963 /* ReteSmartphone.m */; };
8CBD3DCD2149B9AD0070C963 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8CBD3DCB2149B9AD0070C963 /* Main.storyboard */; };
@@ -65,9 +64,6 @@
8CCE165521EA378800173CD9 /* SettingsUserReportAlertsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CCE165421EA378800173CD9 /* SettingsUserReportAlertsViewController.m */; };
8CCE165821EB1E0000173CD9 /* SettingsSeismicNetworkAlertsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CCE165721EB1E0000173CD9 /* SettingsSeismicNetworkAlertsViewController.m */; };
8CCE166121EBA37500173CD9 /* EQNNotificheTsunami.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CCE166021EBA37500173CD9 /* EQNNotificheTsunami.m */; };
8CD0862E218A41930000CB5E /* CellDettagliMappaTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CD0862D218A41930000CB5E /* CellDettagliMappaTableViewCell.m */; };
8CD08631218ADFCA0000CB5E /* Cell_Reti_sismicheTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CD08630218ADFCA0000CB5E /* Cell_Reti_sismicheTableViewCell.m */; };
8CD08635218AF6030000CB5E /* Cell_Meteo_TableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CD08634218AF6030000CB5E /* Cell_Meteo_TableViewCell.m */; };
8CD08638218B3BEE0000CB5E /* ReteSismicaAnnotation.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CD08637218B3BEE0000CB5E /* ReteSismicaAnnotation.m */; };
8CF05B51218C41FB0055012B /* PickerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CF05B4B218C41F90055012B /* PickerViewController.m */; };
8CF05B53218C41FB0055012B /* PickerViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8CF05B4F218C41FA0055012B /* PickerViewController.xib */; };
@@ -229,8 +225,6 @@
8CADAA9321B2627D0044E256 /* LogViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LogViewController.m; sourceTree = "<group>"; };
8CAFD7C321825E4A00F8BD29 /* EQNSisma.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EQNSisma.h; sourceTree = "<group>"; };
8CAFD7C421825E4A00F8BD29 /* EQNSisma.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EQNSisma.m; sourceTree = "<group>"; };
8CAFD7C62182648600F8BD29 /* EQNRetiSismiViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EQNRetiSismiViewController.h; sourceTree = "<group>"; };
8CAFD7C72182648600F8BD29 /* EQNRetiSismiViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EQNRetiSismiViewController.m; sourceTree = "<group>"; };
8CBD3DC22149B9AD0070C963 /* Earthquake Network.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Earthquake Network.app"; sourceTree = BUILT_PRODUCTS_DIR; };
8CBD3DC52149B9AD0070C963 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
8CBD3DC62149B9AD0070C963 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
@@ -254,12 +248,6 @@
8CCE165721EB1E0000173CD9 /* SettingsSeismicNetworkAlertsViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SettingsSeismicNetworkAlertsViewController.m; sourceTree = "<group>"; };
8CCE165F21EBA37500173CD9 /* EQNNotificheTsunami.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EQNNotificheTsunami.h; sourceTree = "<group>"; };
8CCE166021EBA37500173CD9 /* EQNNotificheTsunami.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EQNNotificheTsunami.m; sourceTree = "<group>"; };
8CD0862C218A41930000CB5E /* CellDettagliMappaTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CellDettagliMappaTableViewCell.h; sourceTree = "<group>"; };
8CD0862D218A41930000CB5E /* CellDettagliMappaTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CellDettagliMappaTableViewCell.m; sourceTree = "<group>"; };
8CD0862F218ADFCA0000CB5E /* Cell_Reti_sismicheTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Cell_Reti_sismicheTableViewCell.h; sourceTree = "<group>"; };
8CD08630218ADFCA0000CB5E /* Cell_Reti_sismicheTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Cell_Reti_sismicheTableViewCell.m; sourceTree = "<group>"; };
8CD08633218AF6030000CB5E /* Cell_Meteo_TableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Cell_Meteo_TableViewCell.h; sourceTree = "<group>"; };
8CD08634218AF6030000CB5E /* Cell_Meteo_TableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Cell_Meteo_TableViewCell.m; sourceTree = "<group>"; };
8CD08636218B3BEE0000CB5E /* ReteSismicaAnnotation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ReteSismicaAnnotation.h; sourceTree = "<group>"; };
8CD08637218B3BEE0000CB5E /* ReteSismicaAnnotation.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ReteSismicaAnnotation.m; sourceTree = "<group>"; };
8CF05B4B218C41F90055012B /* PickerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PickerViewController.m; sourceTree = "<group>"; };
@@ -403,15 +391,12 @@
children = (
8C602247218D9DBF00C799C2 /* Dettagli mappa */,
8CF05B4A218C41E60055012B /* inputView */,
8CD08632218AF5C80000CB5E /* cellTableView */,
8CBD3DC82149B9AD0070C963 /* ReteSmartphone.h */,
8CBD3DC92149B9AD0070C963 /* ReteSmartphone.m */,
8CF4F4DC2175352E0057110B /* WaitViewController.h */,
8CF4F4DD2175352E0057110B /* WaitViewController.m */,
8C5EA23B2177B51C002DC156 /* SegnalazioniViewController.h */,
8C5EA23C2177B51C002DC156 /* SegnalazioniViewController.m */,
8CAFD7C62182648600F8BD29 /* EQNRetiSismiViewController.h */,
8CAFD7C72182648600F8BD29 /* EQNRetiSismiViewController.m */,
8CADAA9221B2627D0044E256 /* LogViewController.h */,
8CADAA9321B2627D0044E256 /* LogViewController.m */,
);
@@ -503,19 +488,6 @@
name = Frameworks;
sourceTree = "<group>";
};
8CD08632218AF5C80000CB5E /* cellTableView */ = {
isa = PBXGroup;
children = (
8CD0862F218ADFCA0000CB5E /* Cell_Reti_sismicheTableViewCell.h */,
8CD08630218ADFCA0000CB5E /* Cell_Reti_sismicheTableViewCell.m */,
8CD0862C218A41930000CB5E /* CellDettagliMappaTableViewCell.h */,
8CD0862D218A41930000CB5E /* CellDettagliMappaTableViewCell.m */,
8CD08633218AF6030000CB5E /* Cell_Meteo_TableViewCell.h */,
8CD08634218AF6030000CB5E /* Cell_Meteo_TableViewCell.m */,
);
path = cellTableView;
sourceTree = "<group>";
};
8CF05B4A218C41E60055012B /* inputView */ = {
isa = PBXGroup;
children = (
@@ -1094,7 +1066,6 @@
8CF4F4D5216D336B0057110B /* EQNDatoGrafico.m in Sources */,
8CF66058214C566B009F4314 /* ServerRequest.m in Sources */,
8CD08638218B3BEE0000CB5E /* ReteSismicaAnnotation.m in Sources */,
8CD0862E218A41930000CB5E /* CellDettagliMappaTableViewCell.m in Sources */,
DCF9E14D24F6D1AA002B6B1D /* EQNData.swift in Sources */,
DC52B8A524FCCD6900ABEBA6 /* AppTheme.swift in Sources */,
DC27EB2F24F6EBE000ACBFE0 /* SettingsSeismicNetworksViewController.swift in Sources */,
@@ -1113,8 +1084,6 @@
8CF05B51218C41FB0055012B /* PickerViewController.m in Sources */,
DC99A50324E66E270071BC9F /* EQNCommandProtocol.swift in Sources */,
8CF4F4DE2175352E0057110B /* WaitViewController.m in Sources */,
8CD08635218AF6030000CB5E /* Cell_Meteo_TableViewCell.m in Sources */,
8CD08631218ADFCA0000CB5E /* Cell_Reti_sismicheTableViewCell.m in Sources */,
DCB45BC8250E86E100DB2D0C /* SeismicSettingsViewController.swift in Sources */,
DCF10DC624D2B8C7009F34C3 /* EQNPurchaseUtility.swift in Sources */,
8C2B251121938BFD00E0E25E /* SegnalazioniUtenteDettagliMappa.m in Sources */,
@@ -1143,7 +1112,6 @@
DCB28CEE24FB8400001F557E /* SettingsViewController.swift in Sources */,
DC3CE50A250EB7A8005A7DD5 /* EQNGenericPickerViewController.swift in Sources */,
8C602246218D9DB200C799C2 /* PastquakesDettagliMappa.m in Sources */,
8CAFD7C82182648600F8BD29 /* EQNRetiSismiViewController.m in Sources */,
DCEFF21A24F587E3009D3FE1 /* SettingItem.swift in Sources */,
8C8EBBA721540039002784BA /* EQNUser.m in Sources */,
8CADAA9421B2627D0044E256 /* LogViewController.m in Sources */,
@@ -1,15 +0,0 @@
//
// EQNRetiSismiViewController.h
// Earthquake Network
//
// Created by Luca Beretta on 25/10/18.
// Copyright © 2018 Luca Beretta. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "EQNBaseViewController.h"
@interface EQNRetiSismiViewController : EQNBaseViewController
@end
@@ -1,255 +0,0 @@
//
// EQNRetiSismiViewController.m
// Earthquake Network
//
// Created by Luca Beretta on 25/10/18.
// Copyright © 2018 Luca Beretta. All rights reserved.
//
#import "EQNRetiSismiViewController.h"
#import "EQNManager.h"
#import "EQNSisma.h"
#import "Costanti.h"
#import "CellDettagliMappaTableViewCell.h"
#import "Cell_Reti_sismicheTableViewCell.h"
#import "Cell_Meteo_TableViewCell.h"
#import "ReteSismiDettagliMappa.h"
#import "SismaAnnotation.h"
#import <GoogleMaps/GoogleMaps.h>
#import <QuartzCore/QuartzCore.h>
@interface EQNRetiSismiViewController () <UITableViewDelegate, UITableViewDataSource, SeismicSettingsViewControllerDelegate, SeismicSettingsNetworksViewControllerDelegate, SeismicFiltersViewControllerDelegate>
@property (nonatomic, strong) NSArray *listaSismi;
@property (nonatomic, strong) IBOutlet UITableView *tableView;
@property (nonatomic, strong) NSIndexPath *selectIndex;
@property (nonatomic, assign) EQNReteSismicaCell tipoCell;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *fooTable;
@end
@implementation EQNRetiSismiViewController
static NSString * const SegueIdentifierFilters = @"FiltriEntiSismici";
static NSString * const SegueIdentifierSettings = @"impostazioniEntiSismi";
static NSString * const SegueIdentifierSeismicNetworks = @"elencoRetiSismiche";
#pragma mark - View Lifecycle
- (void)viewDidLoad
{
[super viewDidLoad];
self.title = NSLocalizedString(@"tab_official", nil);
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(refreshUI) name:NOTIFICA_DOWNLOAD_TERMINATO object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(setupView) name:IAPHelperPurchaseNotification object:nil];
[self setupView];
[self refreshUI];
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"apri_mappa_dettagli"]) {
EQNSisma *sisma = (EQNSisma *)sender;
UINavigationController *nav = (UINavigationController *)segue.destinationViewController;
ReteSismiDettagliMappa *mappaDett = (ReteSismiDettagliMappa *)nav.topViewController;
mappaDett.sisma = sisma;
} else if ([segue.identifier isEqualToString:SegueIdentifierFilters]) {
SeismicFiltersViewController *controller = (SeismicFiltersViewController *)segue.destinationViewController;
controller.delegate = self;
} else if ([segue.identifier isEqualToString:SegueIdentifierSettings]) {
SeismicSettingsViewController *controller = segue.destinationViewController;
controller.delegate = self;
} else if([segue.identifier isEqualToString:SegueIdentifierSeismicNetworks]){
UINavigationController *navController = (UINavigationController *)segue.destinationViewController;
SeismicSettingsNetworksViewController *controller = (SeismicSettingsNetworksViewController *)navController.topViewController;
controller.delegate = self;
}
}
#pragma mark - Private
- (void)setupView
{
if ([EQNPurchaseUtility isProVersionEnabled]) {
self.fooTable.constant = 0;
}
}
- (void)refreshUI
{
[super refreshUI];
self.listaSismi = [EQNSeismic.shared filterSeismicList:[EQNManager defaultManager].retiSismiche];
dispatch_async(dispatch_get_main_queue(), ^{
[self.tableView reloadData];
});
}
-(void)apriDettagli:(id)sender{
UIButton *button = (UIButton *)sender;
UITableViewCell *cell = (UITableViewCell *)[[[button superview] superview] superview];
self.selectIndex = [self.tableView indexPathForCell:cell];
switch (button.tag) {
case 12:
self.tipoCell = mappaCell;
break;
case 14:
self.tipoCell = meteoCell;
break;
default:
self.tipoCell = defaultCell;
[self chiudiMappa];
return;
break;
}
[self.tableView reloadRowsAtIndexPaths:@[self.selectIndex] withRowAnimation:UITableViewRowAnimationNone];
[self.tableView scrollToRowAtIndexPath:self.selectIndex
atScrollPosition:UITableViewScrollPositionTop animated:YES];
}
-(void)apriDettagliMappa:(id)sender{
UIButton *button = (UIButton *)sender;
UITableViewCell *cell = (UITableViewCell *)[[button superview] superview];
NSIndexPath *index = [self.tableView indexPathForCell:cell];
EQNSisma *sisma = self.listaSismi[index.row];
[self performSegueWithIdentifier:@"apri_mappa_dettagli" sender:sisma];
}
-(void)chiudiMappa{
NSIndexPath *indexDelete = [self.selectIndex copy];
self.selectIndex = nil;
[self.tableView reloadRowsAtIndexPaths:@[indexDelete] withRowAnimation:UITableViewRowAnimationNone];
indexDelete = nil;
self.tipoCell = defaultCell;
[self.tableView scrollToRowAtIndexPath:indexDelete
atScrollPosition:UITableViewScrollPositionTop animated:NO];
}
#pragma mark - Actions
- (IBAction)refreshDataTapped:(id)sender
{
[[EQNManager defaultManager] sincronizza];
}
- (IBAction)openFilterTapped:(id)sender
{
// apriManu
[self performSegueWithIdentifier:SegueIdentifierFilters sender:nil];
}
- (IBAction)openSettingsTapped:(id)sender
{
// apriImpostazioni
[self performSegueWithIdentifier:SegueIdentifierSettings sender:nil];
}
#pragma table view
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return self.listaSismi.count;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
if (self.selectIndex && self.selectIndex.row == indexPath.row)
return 368;
return 180;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
EQNSisma *sisma = self.listaSismi[indexPath.row];
Cell_Reti_sismicheTableViewCell *cell;
if (self.selectIndex && self.selectIndex.row == indexPath.row){
switch (self.tipoCell)
case mappaCell:{
cell = (CellDettagliMappaTableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"sismaCell_mappa" forIndexPath:indexPath];
break;
default:
cell = (Cell_Meteo_TableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"sismaCell_meteo" forIndexPath:indexPath];
break;
}
[cell createOtherButton];
}
else
cell = [tableView dequeueReusableCellWithIdentifier:@"sismaCell" forIndexPath:indexPath];
cell.sisma = sisma;
[cell setupView];
[cell.chiudi addTarget:self action:@selector(chiudiMappa) forControlEvents:UIControlEventTouchDown];
[cell.mappaButton addTarget:self action:@selector(apriDettagli:) forControlEvents:UIControlEventTouchDown];
[cell.meteoButton addTarget:self action:@selector(apriDettagli:) forControlEvents:UIControlEventTouchDown];
[cell.dettagliMappa addTarget:self action:@selector(apriDettagliMappa:) forControlEvents:UIControlEventTouchDown];
[cell.clickMappa addTarget:self action:@selector(apriDettagliMappa:) forControlEvents:UIControlEventTouchDown];
[cell.condividi addTarget:self action:@selector(condividiView:) forControlEvents:UIControlEventTouchDown];
return cell;
}
-(void)condividiView:(id)sender{
UIButton *button = (UIButton *)sender;
CellDettagliMappaTableViewCell *cell = (CellDettagliMappaTableViewCell *)button.superview.superview.superview;
[self presentViewController:[EQNUtility shareFileWithPath:[cell condividiViewPath]] animated:YES completion:^{}];
}
-(void)dealloc{
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
#pragma mark - SeismicFiltersViewControllerDelegate
- (void)seismicFiltersControllerDidUpdateFilters:(SeismicFiltersViewController *)controller
{
if (controller.needsDataUpdate) {
[[EQNManager defaultManager] sincronizza];
}
[self refreshUI];
}
#pragma mark - SeismicSettingsViewControllerDelegate
- (void)seismicSettingsController:(SeismicSettingsViewController *)controller didSelect:(EQNSeismicFilter)filter
{
[[NSUserDefaults standardUserDefaults] setInteger:filter forKey:IMPOSTAZIONE_TIPO_FILTRO_RETI_SISMICHEI];
[self refreshUI];
}
- (void)seismicSettingsControllerWillOpenProviders:(SeismicSettingsViewController *)controller
{
[self performSegueWithIdentifier:SegueIdentifierSeismicNetworks sender:nil];
}
#pragma mark - SeismicSettingsNetworksViewControllerDelegate
- (void)seismicSettingsNetworksController:(SeismicSettingsNetworksViewController *)controller didSelect:(EQNSeismicFilter)filter
{
[[NSUserDefaults standardUserDefaults] setInteger:filter forKey:IMPOSTAZIONE_TIPO_FILTRO_RETI_SISMICHEI];
[self refreshUI];
}
@end
@@ -1,19 +0,0 @@
//
// CellDettagliMappaTableViewCell.h
// Earthquake Network
//
// Created by Luca Beretta on 31/10/18.
// Copyright © 2018 Luca Beretta. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "Cell_Reti_sismicheTableViewCell.h"
#import <GoogleMaps/GoogleMaps.h>
#import "EQNSisma.h"
#import <MapKit/MapKit.h>
@interface CellDettagliMappaTableViewCell : Cell_Reti_sismicheTableViewCell <MKMapViewDelegate>
@property (nonatomic, strong) IBOutlet MKMapView *mapView;
-(UIImage *)condividiViewPath;
@end
@@ -1,53 +0,0 @@
//
// CellDettagliMappaTableViewCell.m
// Earthquake Network
//
// Created by Luca Beretta on 31/10/18.
// Copyright © 2018 Luca Beretta. All rights reserved.
//
#import "CellDettagliMappaTableViewCell.h"
#import "Costanti.h"
#import <QuartzCore/QuartzCore.h>
@implementation CellDettagliMappaTableViewCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
[self setupView];
}
-(void)setupView{
[super setupView];
MKCoordinateSpan span = MKCoordinateSpanMake(0.5, 0.5);
MKCoordinateRegion region = MKCoordinateRegionMake(self.sisma.coordinate.coordinate, span);
[self.mapView setCenterCoordinate:self.sisma.coordinate.coordinate animated:NO];
[self.mapView setRegion:region animated:YES];
self.mapView.scrollEnabled = NO;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
-(UIImage *)condividiViewPath{
// define the size and grab a UIImage from it
UIGraphicsBeginImageContextWithOptions(self.bounds.size, self.opaque, 0.0);
[self.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
@end
@@ -1,13 +0,0 @@
//
// Cell_Meteo_TableViewCell.h
// Earthquake Network
//
// Created by Luca Beretta on 01/11/18.
// Copyright © 2018 Luca Beretta. All rights reserved.
//
#import "Cell_Reti_sismicheTableViewCell.h"
@interface Cell_Meteo_TableViewCell : Cell_Reti_sismicheTableViewCell
@end
@@ -1,85 +0,0 @@
//
// Cell_Meteo_TableViewCell.m
// Earthquake Network
//
// Created by Luca Beretta on 01/11/18.
// Copyright © 2018 Luca Beretta. All rights reserved.
//
#import "Cell_Meteo_TableViewCell.h"
#import <CoreText/CoreText.h>
@implementation Cell_Meteo_TableViewCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
-(void)setupView{
[super setupView];
NSString *temp = NSLocalizedString(@"Temperatura: ", @"");
NSString *valueTemp = [NSString stringWithFormat:@"%1.f °C", [self.sisma.weatherTemperature floatValue]-273];
NSString *tempDesc = [NSString stringWithFormat:@"%@%@", temp, valueTemp];
NSString *pres = NSLocalizedString(@"Pressione:", @"");
NSString *valuePre = [NSString stringWithFormat:@"%@mb", self.sisma.weatherPressure];
NSString *presDesc = [NSString stringWithFormat:@"%@%@",pres, valuePre];
NSString *vent = NSLocalizedString(@"Velocità vento: ", @"");
NSString *valueVento = [NSString stringWithFormat:@"%@m/s", self.sisma.weatherWindSpeed];
NSString *ventoDesc = [NSString stringWithFormat:@"%@%@", vent, valueVento];
NSString *umi = NSLocalizedString(@"Umidità : ", @"");
NSString *umiValue = [NSString stringWithFormat:@"%@%%", self.sisma.weatherHumidity];
NSString *umiditaDesc = [NSString stringWithFormat:@"%@%@", umi, umiValue];
NSString *nuv = NSLocalizedString(@"Copertura nuvolosa : ", @"");
NSString *nuvValue = [NSString stringWithFormat:@"%@%%", self.sisma.weatherCloud];
NSString *nuvolDesc = [NSString stringWithFormat:@"%@%@",nuv, nuvValue];
UILabel *titolo = (UILabel *)[self viewWithTag:20];
titolo.text = NSLocalizedString(@"Meteo al momento del sisma", @"");
UILabel *temperatura = (UILabel *)[self viewWithTag:21];
temperatura.attributedText = [self getAttributeString:tempDesc withRange:NSMakeRange(temp.length, valueTemp.length)];
UILabel *pressione = (UILabel *)[self viewWithTag:22];
pressione.attributedText = [self getAttributeString:presDesc withRange:NSMakeRange(pres.length, valuePre.length)];
UILabel *vento = (UILabel *)[self viewWithTag:23];
vento.attributedText = [self getAttributeString:ventoDesc withRange:NSMakeRange(vent.length, valueVento.length)];
UILabel *umidita = (UILabel *)[self viewWithTag:24];
umidita.attributedText = [self getAttributeString:umiditaDesc withRange:NSMakeRange(umi.length, umiValue.length)];
UILabel *nuvolosita = (UILabel *)[self viewWithTag:25];
nuvolosita.attributedText = [self getAttributeString:nuvolDesc withRange:NSMakeRange(nuv.length, nuvValue.length)];
UIImageView *icona = (UIImageView *)[self viewWithTag:26];
NSString *imagName = [NSString stringWithFormat:@"weather_%@.png", self.sisma.weatherIcon];
icona.image = [UIImage imageNamed:imagName];
}
-(NSMutableAttributedString *)getAttributeString:(NSString *)string withRange:(NSRange )range{
NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:string];
[attrString beginEditing];
[attrString addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:17] range:range];
[attrString endEditing];
return attrString;
}
@end
@@ -1,26 +0,0 @@
//
// Cell_Reti_sismicheTableViewCell.h
// Earthquake Network
//
// Created by Luca Beretta on 01/11/18.
// Copyright © 2018 Luca Beretta. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "Costanti.h"
#import "EQNSisma.h"
@interface Cell_Reti_sismicheTableViewCell : UITableViewCell
@property (nonatomic, strong) EQNSisma *sisma;
@property (nonatomic, weak) UIButton *mappaButton;
@property (nonatomic, weak) UIButton *meteoButton;
@property (nonatomic, weak) UIButton *chiudi;
@property (nonatomic, weak) UIButton *condividi;
@property (nonatomic, weak) UIButton *dettagliMappa;
@property (nonatomic, weak) UIButton *clickMappa;
-(void)setupView;
-(void)createOtherButton;
-(void)condividiView;
@end
@@ -1,149 +0,0 @@
//
// Cell_Reti_sismicheTableViewCell.m
// Earthquake Network
//
// Created by Luca Beretta on 01/11/18.
// Copyright © 2018 Luca Beretta. All rights reserved.
//
#import "Cell_Reti_sismicheTableViewCell.h"
@implementation Cell_Reti_sismicheTableViewCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
-(void)setupView{
UILabel *place = (UILabel *)[self viewWithTag:1];
place.text = self.sisma.place;
UILabel *provider = (UILabel *)[self viewWithTag:2];
provider.text = self.sisma.provider;
UILabel *magnitudo = (UILabel *)[self viewWithTag:3];
magnitudo.text = NSLocalizedString(@"Magnitudo", @"");
UILabel *magnitudoValore = (UILabel *)[self viewWithTag:4];
magnitudoValore.text = [NSString stringWithFormat:@"%@ mb", self.sisma.magnitude];
UILabel *profondita = (UILabel *)[self viewWithTag:5];
profondita.text = [NSString stringWithFormat:@"%@: %.2f Km", NSLocalizedString(@"Profondità", @""), [self.sisma.depth floatValue]];
UILabel *data = (UILabel *)[self viewWithTag:6];
int tempo = 0;
if (self.sisma.timeDifference > 60) {
tempo = ((int)self.sisma.timeDifference)/60;
data.text = [NSString stringWithFormat:@"%@ %@",NSLocalizedString(@"Data(Ora tua):", @"") , [NSString stringWithFormat:@"%@ - %d %@", self.sisma.date, tempo, NSLocalizedString(@"ore fa", @"")]];
}else{
data.text = [NSString stringWithFormat:@"%@ %@",NSLocalizedString(@"Data(Ora tua):", @"") , [NSString stringWithFormat:@"%@ - %i %@", self.sisma.date, (int)self.sisma.timeDifference, NSLocalizedString(@"minuti fa", @"")]];
}
// UILabel *dataValue = (UILabel *)[self viewWithTag:8];
// dataValue.text = ;
UILabel *distanza = (UILabel *)[self viewWithTag:9];
distanza.text = [NSString stringWithFormat:@"%@: %@", NSLocalizedString(@"Distanza", @""), [NSString stringWithFormat:@"%i km %@", (int)self.sisma.userDistance, NSLocalizedString(@"dalla tua posizione", @"")]];
// UILabel *distanzaValue = (UILabel *)[self viewWithTag:11];
// distanzaValue.text = ;
self.mappaButton = (UIButton *)[self viewWithTag:12];
[self.mappaButton setTitle:NSLocalizedString(@"MAPPA", @"") forState:UIControlStateNormal];
self.mappaButton.layer.borderWidth = 1;
self.mappaButton.layer.borderColor = [UIColor blackColor].CGColor;
self.mappaButton.layer.cornerRadius = 5;
// [mappa addTarget:self action:@selector(apriMappa:) forControlEvents:UIControlEventTouchDown];
UIButton *trend = (UIButton *)[self viewWithTag:13];
[trend setTitle:NSLocalizedString(@"TRENS", @"") forState:UIControlStateNormal];
trend.layer.borderWidth = 1;
trend.layer.borderColor = [UIColor blackColor].CGColor;
trend.layer.cornerRadius = 5;
self.meteoButton = (UIButton *)[self viewWithTag:14];
[self.meteoButton setTitle:NSLocalizedString(@"METEO", @"") forState:UIControlStateNormal];
self.meteoButton.layer.borderWidth = 1;
self.meteoButton.layer.borderColor = [UIColor blackColor].CGColor;
self.meteoButton.layer.cornerRadius = 5;
UIButton *config = (UIButton *)[self viewWithTag:15];
[config setTitle:NSLocalizedString(@"CONFIG", @"") forState:UIControlStateNormal];
config.layer.borderWidth = 1;
config.layer.borderColor = [UIColor blackColor].CGColor;
config.layer.cornerRadius = 5;
self.dettagliMappa = (UIButton *)[self viewWithTag:300];
self.clickMappa = (UIButton *)[self viewWithTag:112];
UIView *containerView = (UIView *)[self viewWithTag:100];
if([self.sisma.magnitude doubleValue] > 4.0){
containerView.backgroundColor = COLORE_CELLA_MAGNITUTE_FORTE;
provider.backgroundColor = COLORE_CELLA_MAGNITUTE_FORTE_ETI;
self.mappaButton.backgroundColor = COLORE_CELLA_MAGNITUTE_FORTE_ETI;
trend.backgroundColor = COLORE_CELLA_MAGNITUTE_FORTE_ETI;
self.meteoButton.backgroundColor = COLORE_CELLA_MAGNITUTE_FORTE_ETI;
config.backgroundColor = COLORE_CELLA_MAGNITUTE_FORTE_ETI;
magnitudoValore.textColor = COLORE_CELLA_MAGNITUTE_FORTE_TESTO;
}else if ([self.sisma.magnitude doubleValue] < 3.0){
containerView.backgroundColor = COLORE_CELLA_MAGNITUTE_LEGGERA;
provider.backgroundColor = COLORE_CELLA_MAGNITUTE_LEGGERA_ETI;
self.mappaButton.backgroundColor = COLORE_CELLA_MAGNITUTE_LEGGERA_ETI;
trend.backgroundColor = COLORE_CELLA_MAGNITUTE_LEGGERA_ETI;
self.meteoButton.backgroundColor = COLORE_CELLA_MAGNITUTE_LEGGERA_ETI;
config.backgroundColor = COLORE_CELLA_MAGNITUTE_LEGGERA_ETI;
magnitudoValore.textColor = COLORE_CELLA_MAGNITUTE_LEGGERA_TESTO;
}else{
containerView.backgroundColor = COLORE_CELLA_MAGNITUTE_MEDIA;
provider.backgroundColor = COLORE_CELLA_MAGNITUTE_MEDIA_ETI;
self.mappaButton.backgroundColor = COLORE_CELLA_MAGNITUTE_MEDIA_ETI;
trend.backgroundColor = COLORE_CELLA_MAGNITUTE_MEDIA_ETI;
self.meteoButton.backgroundColor = COLORE_CELLA_MAGNITUTE_MEDIA_ETI;
config.backgroundColor = COLORE_CELLA_MAGNITUTE_MEDIA_ETI;
magnitudoValore.textColor = COLORE_CELLA_MAGNITUTE_MEDIA_TESTO;
}
containerView.layer.cornerRadius = 2;
containerView.layer.masksToBounds = NO;
containerView.layer.shadowOffset = CGSizeMake(0.0, 2);
containerView.layer.shadowRadius = 5;
containerView.layer.shadowOpacity = 0.5;
}
-(void)createOtherButton{
self.condividi = (UIButton *)[self viewWithTag:17];
[self.condividi setTitle:NSLocalizedString(@"CONDIVIDI", @"") forState:UIControlStateNormal];
self.condividi.layer.borderWidth = 1;
self.condividi.layer.borderColor = [UIColor blackColor].CGColor;
self.condividi.layer.cornerRadius = 5;
// [self.condividi addTarget:self action:@selector(condividiView) forControlEvents:UIControlEventTouchUpInside];
self.chiudi = (UIButton *)[self viewWithTag:18];
[self.chiudi setTitle:NSLocalizedString(@"CHIUDI", @"") forState:UIControlStateNormal];
self.chiudi.layer.borderWidth = 1;
self.chiudi.layer.borderColor = [UIColor blackColor].CGColor;
self.chiudi.layer.cornerRadius = 5;
}
-(void)condividiView{
}
@end