Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small UI Fixes #4

Merged
merged 3 commits into from
Aug 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions SmartWallet/AddRecordViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ Go to Settings > Categories and add an 'Income' category.
categoryPicker.selectRow(model.expenseIndex, inComponent: 0, animated: false)
// }
prefixLabel.text = "-" + getCurrencyLabel()
prefixLabel.textColor = UIColor.myAppRed
prefixLabel.textColor = UIColor.myAppBlack
} else {
categoryTextField.text = (incomeCategoriesList.count > 0) ? incomeCategoriesList[model.incomeIndex].name : ""
// if model.incomeIndex <= categoryPicker.numberOfRows(inComponent: 0) {
Expand Down Expand Up @@ -288,7 +288,7 @@ Go to Settings > Categories and add an 'Income' category.
if directionSegmentedControl.selectedSegmentIndex == 0 {
categoryTextField.text = expenseCategoriesList[model.expenseIndex].name
prefixLabel.text = "-" + getCurrencyLabel()
prefixLabel.textColor = UIColor.myAppRed
prefixLabel.textColor = UIColor.myAppBlack

categoryPicker.selectRow(model.expenseIndex, inComponent: 0, animated: false)
} else {
Expand Down
3 changes: 0 additions & 3 deletions SmartWallet/ChooseCurrencyTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ class ChooseCurrencyTableViewController: UITableViewController {

if currencyCurrencySymbol == currencyItem.currencySymbol {
cell.textLabel?.text = currencyItem.currencyName! + " ✓"

cell.backgroundColor = UIColor.myAppLightGreen
// cell.detailTextLabel?.textColor = UIColor.myAppGreen
// cell.textLabel?.textColor = UIColor.myAppGreen
} else {
cell.textLabel?.text = currencyItem.currencyName
}
Expand Down
9 changes: 8 additions & 1 deletion SmartWallet/DashboardViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ class DashboardViewController: UITableViewController {
let monthlyTotal = monthlyTotalIncome - monthlyTotalCost
let dailyAverage = dailyAverageIncome - dailyAverageCost

overalInfo.append(("Total", getRecordString(monthlyTotal, .recordTypeAll)))
overalInfo.append(("Total Cost", getRecordString(monthlyTotalCost, .recordTypeCost)))
overalInfo.append(("Total Income", getRecordString(monthlyTotalIncome, .recordTypeIncome)))
overalInfo.append(("Total", getRecordString(monthlyTotal, .recordTypeAll)))

if totalBudget > 0 {
let monthlyTotalSave = totalBudget - monthlyTotalCost
Expand Down Expand Up @@ -185,12 +185,16 @@ class DashboardViewController: UITableViewController {
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.section == 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: "dashboardCell", for: indexPath)
cell.selectionStyle = .none

cell.textLabel?.text = overalInfo[indexPath.row].label
cell.detailTextLabel?.text = overalInfo[indexPath.row].value

return cell
} else if indexPath.section == 1 {
let cell = tableView.dequeueReusableCell(withIdentifier: "dashboardCostCell", for: indexPath) as! BudgetTableViewCell
cell.selectionStyle = .none

let calc = budgetInfo[indexPath.row]

cell.categoryLabel.text = costInfo[indexPath.row].label
Expand Down Expand Up @@ -225,11 +229,14 @@ class DashboardViewController: UITableViewController {
return cell
} else if indexPath.section == 2 {
let cell = tableView.dequeueReusableCell(withIdentifier: "dashboardCell", for: indexPath)
cell.selectionStyle = .none

cell.textLabel?.text = incomeInfo[indexPath.row].label
cell.detailTextLabel?.text = incomeInfo[indexPath.row].value
return cell
} else {
let cell = tableView.dequeueReusableCell(withIdentifier: "dashboardCell", for: indexPath)
cell.selectionStyle = .none
return cell
}
}
Expand Down
2 changes: 1 addition & 1 deletion SmartWallet/DisplayRecordViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class DisplayRecordViewController: UIViewController {
if model.direction == 0 {
self.categoryLabel.text = (expenseCategoriesList.count > 0) ? expenseCategoriesList[model.expenseIndex].name : ""
prefixLabel.text = "-" + getCurrencyLabel()
prefixLabel.textColor = UIColor.myAppRed
prefixLabel.textColor = UIColor.myAppBlack
} else {
self.categoryLabel.text = (incomeCategoriesList.count > 0) ? incomeCategoriesList[model.incomeIndex].name : ""
prefixLabel.text = "+" + getCurrencyLabel()
Expand Down
8 changes: 2 additions & 6 deletions SmartWallet/General/GeneralHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,8 @@ func getMonthDuration(year: Int, month: Int, considerCurrent: Bool) -> Int {
let range = calendar.range(of: .day, in: .month, for: date)!
var numDays = range.count

if considerCurrent {
if year == Date().year() && month == Date().month() {
numDays = Date().day()
}
if considerCurrent, year == Date().year() && month == Date().month() {
numDays = Date().day()
}

return numDays
Expand Down Expand Up @@ -122,8 +120,6 @@ func getRecordString(_ value: Double, _ type: RecordType, preciseDecimal: Int =
if formatting {
return "\(prefix) \(getCurrencyLabel()) \(absValue.format(formatString: ".\(preciseDecimal)"))"
} else {

// return String(format:"\(prefix) \(getCurrencyLabel()) %g", absValue)
return "\(prefix) \(getCurrencyLabel()) \(formatter.string(from: NSNumber(value: absValue))!)"
}

Expand Down
6 changes: 5 additions & 1 deletion SmartWallet/General/Style+MyApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ private extension Style.TextStyle {
case .body:
return Style.TextAttributes(font: .myAppBody, color: .black, backgroundColor: .white)
case .button:
return Style.TextAttributes(font: .myAppSubtitle, color: .white, backgroundColor: .myAppRed)
return Style.TextAttributes(font: .myAppSubtitle, color: .white, backgroundColor: .myAppBlack)
}
}
}
Expand All @@ -51,6 +51,10 @@ extension UIColor {
static var myAppLightOrange: UIColor {
return UIColor(red: 1.000, green: 0.924, blue: 0.804, alpha: 1.0)
}

static var myAppBlack: UIColor {
return .black
}
}

extension UIFont {
Expand Down
21 changes: 1 addition & 20 deletions SmartWallet/RecordsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ class RecordsViewController: UITableViewController, NSFetchedResultsControllerDe
override func viewDidLoad() {
super.viewDidLoad()

applyStyle()

// if there is any need to load data from server #ONLINE
// performSelector(inBackground: #selector(fetchRecords), with:nil)

self.loadSavedData()
}

Expand All @@ -38,21 +33,7 @@ class RecordsViewController: UITableViewController, NSFetchedResultsControllerDe
self.loadSavedData()
}

func applyStyle() {
// view.backgroundColor = style.backgroundColor

// style.apply(textStyle: .title, to: tableView.visibleCells)
// style.apply(textStyle: .subtitle, to: subtitleLabel)
// style.apply(textStyle: .body, to: bodyLabel)
// style.apply(to: actionButton)

// if let navBar = navigationController?.navigationBar {
// style.apply(to: navBar)
// }
}

override func numberOfSections(in tableView: UITableView) -> Int {
// print(fetchedResultsController.sections?.count ?? 1100)
return fetchedResultsController.sections?.count ?? 0
}

Expand Down Expand Up @@ -95,7 +76,7 @@ class RecordsViewController: UITableViewController, NSFetchedResultsControllerDe
cell.amountLabel.text = getRecordString(record.amount, .recordTypeIncome, formatting: false)
} else {
cell.icon.image = UIImage(named: "DownIcon")
cell.amountLabel.textColor = UIColor.myAppRed
cell.amountLabel.textColor = UIColor.myAppBlack
cell.amountLabel.text = getRecordString(record.amount, .recordTypeCost, formatting: false)
}
cell.titleLabel.text = record.relatedCategory.name
Expand Down