Skip to content

Commit

Permalink
Merge pull request #5 from rob-miller/3.2.0-submit
Browse files Browse the repository at this point in the history
3.2.0 submit
  • Loading branch information
rob-miller committed Feb 11, 2020
2 parents 4ae44cb + 0a5cf65 commit 0fcbf56
Show file tree
Hide file tree
Showing 31 changed files with 517 additions and 193 deletions.
48 changes: 31 additions & 17 deletions Classes/RootViewController.m
Expand Up @@ -881,10 +881,22 @@ - (void)userNotificationCenter:(UNUserNotificationCenter *)center

}

- (void) setViewMode {
[rTracker_resource setViewMode:self];
if (@available(iOS 13.0, *)) {
if (self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
// if darkMode
self.tableView.backgroundColor = [UIColor systemBackgroundColor];
return;
}
}

self.tableView.backgroundColor = [UIColor clearColor];
}

- (void)viewDidLoad {

[super viewDidLoad];

[UNUserNotificationCenter currentNotificationCenter].delegate = self;

#if ADVERSION
Expand All @@ -904,21 +916,9 @@ - (void)viewDidLoad {
self.refreshLock = 0;
self.readingFile=NO;


UIImage *img = [UIImage imageNamed:[rTracker_resource getLaunchImageName] ];
//DBGLog(@"set backround image to %@",[rTracker_resource getLaunchImageName]);
UIImageView *bg = [[UIImageView alloc] initWithImage:img];

CGSize vsize = [rTracker_resource get_visible_size:self];
CGFloat scal = bg.frame.size.width / vsize.width;

UIImage *img2 = [UIImage imageWithCGImage:img.CGImage scale:scal orientation:UIImageOrientationUp];
self.navigationController.view.backgroundColor = [UIColor colorWithPatternImage:img2];
[self.navigationController.navigationBar setBackgroundImage:img2 forBarMetrics:UIBarMetricsDefault];
[self.navigationController.toolbar setBackgroundImage:img2 forToolbarPosition:UIBarPositionAny barMetrics:UIBarMetricsDefault];


self.navigationItem.rightBarButtonItem = self.addBtn;
self.navigationItem.rightBarButtonItem = self.addBtn;
self.navigationItem.leftBarButtonItem = self.editBtn;

// toolbar setup
Expand Down Expand Up @@ -949,9 +949,14 @@ - (void)viewDidLoad {
self.tableView.dataSource = self;
self.tableView.delegate = self;

self.tableView.backgroundColor = [UIColor clearColor];
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;

UIImageView *bg = [[UIImageView alloc] initWithImage:[rTracker_resource get_background_image:self]];
bg.tag = BGTAG;
[self.view addSubview:bg];
[self.view sendSubviewToBack:bg];

[self setViewMode];
[self.view addSubview:self.tableView];

if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"9.0")) {
Expand All @@ -963,6 +968,12 @@ - (void)viewDidLoad {

}

- (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection {
[self setViewMode];
[self.tableView setNeedsDisplay];
[self.view setNeedsDisplay];
}

- (trackerList *) tlist {
if (nil == _tlist) {
trackerList *tmptlist = [[trackerList alloc] init];
Expand Down Expand Up @@ -1540,7 +1551,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];

cell.backgroundColor = [UIColor clearColor];
cell.backgroundColor = [UIColor clearColor]; // clear here so table background shows through
}

// Configure the cell.
Expand All @@ -1562,7 +1573,10 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N

}
//DBGLog(@"erc= %d src= %d",erc,src);
[cellLabel appendAttributedString:[[NSAttributedString alloc]initWithString:(self.tlist.topLayoutNames)[row]]];
//[cellLabel appendAttributedString:
// [[NSAttributedString alloc]initWithString:(self.tlist.topLayoutNames)[row] attributes:@{NSForegroundColorAttributeName: [UIColor blackColor]}]] ;
[cellLabel appendAttributedString:[[NSAttributedString alloc]initWithString:(self.tlist.topLayoutNames)[row]]] ;

cell.textLabel.attributedText = cellLabel;

return cell;
Expand Down
2 changes: 1 addition & 1 deletion Classes/addTrackerController.h
Expand Up @@ -37,7 +37,7 @@
@property (nonatomic) BOOL saving;

// UI element properties
@property (nonatomic, strong) IBOutlet UITableView *table;
@property (nonatomic, strong) IBOutlet UITableView *tableView;
@property (nonatomic, strong) IBOutlet UIButton *infoBtn;
@property (nonatomic, strong) IBOutlet UITextField *nameField;
@property (nonatomic, strong) IBOutlet UIButton *itemCopyBtn;
Expand Down
87 changes: 56 additions & 31 deletions Classes/addTrackerController.m
Expand Up @@ -41,7 +41,7 @@ @implementation addTrackerController

@synthesize tlist=_tlist;
@synthesize tempTrackerObj=_tempTrackerObj;
@synthesize table=_table;
@synthesize tableView=_tableView;
@synthesize nameField=_nameField;
@synthesize infoBtn=_infoBtn;
@synthesize itemCopyBtn=_itemCopyBtn;
Expand All @@ -62,6 +62,20 @@ - (void) dealloc {

//#define TEMPFILE @"tempTrackerObj_plist"

- (void) setViewMode {
[rTracker_resource setViewMode:self];

if (@available(iOS 13.0, *)) {
if (self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
// if darkMode
self.tableView.backgroundColor = [UIColor secondarySystemBackgroundColor];
return;
}
}

self.tableView.backgroundColor = [UIColor clearColor];
}

- (void) viewDidLoad {

DBGLog(@"atc: vdl tlist dbname= %@",_tlist.dbName); // use backing ivar because don't want dbg msg to instantiate
Expand Down Expand Up @@ -101,20 +115,19 @@ - (void) viewDidLoad {
self.toolbar.hidden = NO;
}

[self.table setEditing:YES animated:YES];
self.table.allowsSelection = NO;
self.table.separatorStyle = UITableViewCellSeparatorStyleNone;

// set graph paper background
UIImageView *bg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[rTracker_resource getLaunchImageName]]];
//self.table.backgroundView = bg;
//self.toolbar.backgroundColor = [UIColor clearColor];
[self.tableView setEditing:YES animated:YES];
self.tableView.allowsSelection = NO;
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;

//UIImageView *bg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bkgnd2-320-460.png"]];
self.view.backgroundColor=nil;
// set graph paper background - not seen if darkMode, but still there

UIImageView *bg = [[UIImageView alloc] initWithImage:[rTracker_resource get_background_image:self]];
bg.tag = BGTAG;
[self.view addSubview:bg];
[self.view sendSubviewToBack:bg];

[self setViewMode];

self.saving=FALSE;

UISwipeGestureRecognizer *swipe = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleViewSwipeRight:)];
Expand All @@ -124,6 +137,12 @@ - (void) viewDidLoad {
[super viewDidLoad];
}

- (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection {
[self setViewMode];
[self.tableView setNeedsDisplay];
[self.view setNeedsDisplay];
}

#if ADVERSION
// handle rtPurchasedNotification
- (void) updatePurchased:(NSNotification*)n {
Expand All @@ -135,7 +154,7 @@ - (void)viewWillAppear:(BOOL)animated {

DBGLog(@"atc: viewWillAppear, valObjTable count= %lu", (unsigned long)[self.tempTrackerObj.valObjTable count]);

[self.table reloadData];
[self.tableView reloadData];
[self toggleEdit:self.segcEditTrackerEditItems];

#if ADVERSION
Expand Down Expand Up @@ -215,7 +234,7 @@ - (IBAction)btnCopy:(id)sender {
valueObj *newVO = [[valueObj alloc] initWithDict:self.tempTrackerObj dict:[lastVO dictFromVO]];
newVO.vid = [self.tempTrackerObj getUnique];
[self.tempTrackerObj addValObj:newVO];
[self.table reloadData];
[self.tableView reloadData];

}
/*
Expand Down Expand Up @@ -315,16 +334,16 @@ - (IBAction) toggleEdit:(id) sender {
editMode = (int) [sender selectedSegmentIndex];
//[table reloadData];
if (editMode == 0) {
[self.table setEditing:YES animated:YES];
[self.tableView setEditing:YES animated:YES];
self.itemCopyBtn.enabled = YES;
} else {
[self.table setEditing:NO animated:YES];
[self.tableView setEditing:NO animated:YES];
self.itemCopyBtn.enabled = NO;
}

//[table reloadRowsAtIndexPaths:[table indexPathsForVisibleRows] withRowAnimation:UITableViewRowAnimationFade];
dispatch_async(dispatch_get_main_queue(), ^(void){
[self.table reloadSections:[NSIndexSet indexSetWithIndex:1] withRowAnimation:UITableViewRowAnimationFade];
[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:1] withRowAnimation:UITableViewRowAnimationFade];
});
}

Expand Down Expand Up @@ -440,7 +459,7 @@ - (IBAction) nameFieldDone:(id)sender {
- (void) delVOlocal:(NSUInteger) row
{
[self.tempTrackerObj.valObjTable removeObjectAtIndex:row];
[self.table deleteRowsAtIndexPaths:@[self.deleteIndexPath]
[self.tableView deleteRowsAtIndexPaths:@[self.deleteIndexPath]
withRowAnimation:UITableViewRowAnimationFade];
}

Expand All @@ -463,7 +482,7 @@ - (void) handleCheckValObjDelete:(NSInteger)choice {
[self delVOlocal:row];
} else {
//DBGLog(@"check valobjdelete cancelled");
[self.table reloadRowsAtIndexPaths:@[self.deleteIndexPath] withRowAnimation:UITableViewRowAnimationRight];
[self.tableView reloadRowsAtIndexPaths:@[self.deleteIndexPath] withRowAnimation:UITableViewRowAnimationRight];
}
self.deleteIndexPath=nil;

Expand Down Expand Up @@ -571,13 +590,17 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
cell.selectionStyle = UITableViewCellSelectionStyleNone;
self.nameField.font = PrefBodyFont;
self.nameField.text = self.tempTrackerObj.trackerName;
self.nameField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"Name this Tracker" attributes:@{NSForegroundColorAttributeName : [UIColor darkGrayColor]}]; // @"Name this Tracker"
#if !RELEASE
// debug layout:
//self.nameField.backgroundColor=[UIColor redColor];
#else
self.nameField.backgroundColor=[UIColor whiteColor];
#endif

if (@available(iOS 13.0, *)) {
self.nameField.textColor = [UIColor labelColor];
self.nameField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"Name this Tracker" attributes:@{NSForegroundColorAttributeName : [UIColor labelColor]}]; // @"Name this Tracker"
self.nameField.backgroundColor=[UIColor systemBackgroundColor];
} else {
self.nameField.textColor = [UIColor blackColor];
self.nameField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"Name this Tracker" attributes:@{NSForegroundColorAttributeName : [UIColor darkGrayColor]}]; // @"Name this Tracker"
self.nameField.backgroundColor=[UIColor whiteColor];
}

[self.view bringSubviewToFront:self.nameField];
// no help! self.nameField.layer.zPosition=10;
//DBGLog(@"loaded section 0, %@ = %@",self.nameField.text , self.tempTrackerObj.trackerName);
Expand Down Expand Up @@ -614,11 +637,6 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
cell = [[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleSubtitle
reuseIdentifier: valCellID];
//cell.backgroundColor=nil;
#if !RELEASE
// debug layout:
//cell.backgroundColor = [UIColor greenColor];
#endif
}
NSInteger row = [indexPath row];
if (row == [self.tempTrackerObj.valObjTable count] ) {
Expand Down Expand Up @@ -652,6 +670,13 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
(vo.vos.voGraphSet)[vo.vGraphType],
[rTracker_resource colorNames][vo.vcolor]];
}

cell.backgroundColor = [UIColor clearColor];
if (@available(iOS 13.0, *)) {
cell.textLabel.textColor = [UIColor labelColor];
cell.detailTextLabel.textColor = [UIColor labelColor];
}

//DBGLog(@"loaded section 1 row %i : .%@. : .%@.",row, cell.textLabel.text, cell.detailTextLabel.text);
}

Expand Down Expand Up @@ -689,7 +714,7 @@ - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *) fr
[self.tempTrackerObj.valObjTable insertObject:vo atIndex:toRow];

// fail
[self.table reloadData];
[self.tableView reloadData];
}

- (UITableViewCellEditingStyle)tableView:(UITableView *)tableview editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
Expand Down
20 changes: 10 additions & 10 deletions Classes/addTrackerController.xib
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15705" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment version="4608" identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand All @@ -13,7 +13,7 @@
<outlet property="infoBtn" destination="kEQ-7V-i6C" id="xGi-Qg-2An"/>
<outlet property="itemCopyBtn" destination="nx8-xo-d9x" id="GTb-gQ-wwv"/>
<outlet property="segcEditTrackerEditItems" destination="DhU-EG-a8M" id="N9d-dj-0IW"/>
<outlet property="table" destination="0iX-Di-6MG" id="Yyi-sv-PW8"/>
<outlet property="tableView" destination="0iX-Di-6MG" id="y9p-HT-jBx"/>
<outlet property="toolbar" destination="bbp-An-je1" id="eQb-Bz-sZd"/>
<outlet property="view" destination="iN0-l3-epB" id="i1S-sk-CTi"/>
</connections>
Expand All @@ -24,20 +24,20 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="grouped" separatorStyle="default" allowsSelectionDuringEditing="YES" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" translatesAutoresizingMaskIntoConstraints="NO" id="0iX-Di-6MG">
<rect key="frame" x="0.0" y="44" width="414" height="774"/>
<rect key="frame" x="0.0" y="44" width="414" height="769"/>
<color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="sectionIndexBackgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<connections>
<outlet property="dataSource" destination="-1" id="eXs-XX-he5"/>
<outlet property="delegate" destination="-1" id="38o-tO-uhL"/>
<outlet property="dataSource" destination="-1" id="PH2-TD-9Kf"/>
<outlet property="delegate" destination="-1" id="KY6-uJ-Ow3"/>
</connections>
</tableView>
<toolbar hidden="YES" opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="bbp-An-je1">
<rect key="frame" x="10" y="818" width="414" height="44"/>
<rect key="frame" x="10" y="813" width="414" height="49"/>
<items>
<barButtonItem style="plain" id="0Ne-YN-lUj">
<button key="customView" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="kEQ-7V-i6C">
<rect key="frame" x="20" y="7" width="30" height="30"/>
<rect key="frame" x="20" y="12" width="30" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" title="">
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
Expand All @@ -50,7 +50,7 @@
<barButtonItem style="plain" systemItem="flexibleSpace" id="LIr-Pk-ics"/>
<barButtonItem style="plain" id="q3f-Df-ahD">
<segmentedControl key="customView" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="bar" selectedSegmentIndex="0" id="DhU-EG-a8M">
<rect key="frame" x="113.5" y="6" width="187" height="32"/>
<rect key="frame" x="113.5" y="11" width="187" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<segments>
<segment title="Edit Tracker"/>
Expand All @@ -64,7 +64,7 @@
<barButtonItem style="plain" systemItem="flexibleSpace" id="sb5-pF-fyy"/>
<barButtonItem style="plain" id="Apx-RX-c3D">
<button key="customView" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="nx8-xo-d9x">
<rect key="frame" x="358" y="7" width="36" height="30"/>
<rect key="frame" x="358" y="12" width="36" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" title="Copy">
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
Expand Down

0 comments on commit 0fcbf56

Please sign in to comment.