Commit e0ebd7ef authored by zhangzhe's avatar zhangzhe

Merge branch 'branch_1.0.1' of gitlab.huolea.com:lmi/shorthandmaster into branch_1.0.1

parents c375e223 d6dbfaf5
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
A924A84B251B842C00CB2947 /* SHRecordDetailsBottomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A924A84A251B842C00CB2947 /* SHRecordDetailsBottomView.swift */; }; A924A84B251B842C00CB2947 /* SHRecordDetailsBottomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A924A84A251B842C00CB2947 /* SHRecordDetailsBottomView.swift */; };
A924A853251B845900CB2947 /* SHRecordDetailsBottomView.xib in Resources */ = {isa = PBXBuildFile; fileRef = A924A852251B845900CB2947 /* SHRecordDetailsBottomView.xib */; }; A924A853251B845900CB2947 /* SHRecordDetailsBottomView.xib in Resources */ = {isa = PBXBuildFile; fileRef = A924A852251B845900CB2947 /* SHRecordDetailsBottomView.xib */; };
A924A858251B89D000CB2947 /* SHRecordDetailsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A924A857251B89D000CB2947 /* SHRecordDetailsCell.swift */; }; A924A858251B89D000CB2947 /* SHRecordDetailsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A924A857251B89D000CB2947 /* SHRecordDetailsCell.swift */; };
A924A860251C777E00CB2947 /* SHRecordMoveFileVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A924A85F251C777E00CB2947 /* SHRecordMoveFileVC.swift */; };
A94D935224F7502700A886C0 /* SHRecordExportAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A94D935124F7502700A886C0 /* SHRecordExportAlertView.swift */; }; A94D935224F7502700A886C0 /* SHRecordExportAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A94D935124F7502700A886C0 /* SHRecordExportAlertView.swift */; };
A94D935424F7503E00A886C0 /* SHRecordExportAlertView.xib in Resources */ = {isa = PBXBuildFile; fileRef = A94D935324F7503E00A886C0 /* SHRecordExportAlertView.xib */; }; A94D935424F7503E00A886C0 /* SHRecordExportAlertView.xib in Resources */ = {isa = PBXBuildFile; fileRef = A94D935324F7503E00A886C0 /* SHRecordExportAlertView.xib */; };
A94D935724F7958500A886C0 /* SHStoreManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A94D935624F7958500A886C0 /* SHStoreManager.swift */; }; A94D935724F7958500A886C0 /* SHStoreManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A94D935624F7958500A886C0 /* SHStoreManager.swift */; };
...@@ -161,6 +162,7 @@ ...@@ -161,6 +162,7 @@
A924A84A251B842C00CB2947 /* SHRecordDetailsBottomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SHRecordDetailsBottomView.swift; sourceTree = "<group>"; }; A924A84A251B842C00CB2947 /* SHRecordDetailsBottomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SHRecordDetailsBottomView.swift; sourceTree = "<group>"; };
A924A852251B845900CB2947 /* SHRecordDetailsBottomView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SHRecordDetailsBottomView.xib; sourceTree = "<group>"; }; A924A852251B845900CB2947 /* SHRecordDetailsBottomView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SHRecordDetailsBottomView.xib; sourceTree = "<group>"; };
A924A857251B89D000CB2947 /* SHRecordDetailsCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SHRecordDetailsCell.swift; sourceTree = "<group>"; }; A924A857251B89D000CB2947 /* SHRecordDetailsCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SHRecordDetailsCell.swift; sourceTree = "<group>"; };
A924A85F251C777E00CB2947 /* SHRecordMoveFileVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SHRecordMoveFileVC.swift; sourceTree = "<group>"; };
A94D935124F7502700A886C0 /* SHRecordExportAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SHRecordExportAlertView.swift; sourceTree = "<group>"; }; A94D935124F7502700A886C0 /* SHRecordExportAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SHRecordExportAlertView.swift; sourceTree = "<group>"; };
A94D935324F7503E00A886C0 /* SHRecordExportAlertView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SHRecordExportAlertView.xib; sourceTree = "<group>"; }; A94D935324F7503E00A886C0 /* SHRecordExportAlertView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SHRecordExportAlertView.xib; sourceTree = "<group>"; };
A94D935624F7958500A886C0 /* SHStoreManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SHStoreManager.swift; sourceTree = "<group>"; }; A94D935624F7958500A886C0 /* SHStoreManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SHStoreManager.swift; sourceTree = "<group>"; };
...@@ -747,6 +749,7 @@ ...@@ -747,6 +749,7 @@
A950F5A724F36F55007AB63E /* SHRecordListViewController.swift */, A950F5A724F36F55007AB63E /* SHRecordListViewController.swift */,
A950F5AB24F39EC1007AB63E /* SHRecordShowViewController.swift */, A950F5AB24F39EC1007AB63E /* SHRecordShowViewController.swift */,
A94EE11C251B7E510066B490 /* SHRecordDetailsVC.swift */, A94EE11C251B7E510066B490 /* SHRecordDetailsVC.swift */,
A924A85F251C777E00CB2947 /* SHRecordMoveFileVC.swift */,
); );
path = Record; path = Record;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -1047,6 +1050,7 @@ ...@@ -1047,6 +1050,7 @@
A95CDFDA24E0EBF10066DAE6 /* CRSnippetCode.swift in Sources */, A95CDFDA24E0EBF10066DAE6 /* CRSnippetCode.swift in Sources */,
A95CE01124E0F42F0066DAE6 /* MBProgressHUD+MJ.m in Sources */, A95CE01124E0F42F0066DAE6 /* MBProgressHUD+MJ.m in Sources */,
A95CE00924E0F42F0066DAE6 /* CRContactTools.swift in Sources */, A95CE00924E0F42F0066DAE6 /* CRContactTools.swift in Sources */,
A924A860251C777E00CB2947 /* SHRecordMoveFileVC.swift in Sources */,
A9A16C672519DD6900DE0FEE /* NSString+PinYin4Cocoa.m in Sources */, A9A16C672519DD6900DE0FEE /* NSString+PinYin4Cocoa.m in Sources */,
A9A16C702519DD6900DE0FEE /* HCSortString.m in Sources */, A9A16C702519DD6900DE0FEE /* HCSortString.m in Sources */,
A94DD58124FE37DF00B1B5A2 /* UILabel+FontAppearance.m in Sources */, A94DD58124FE37DF00B1B5A2 /* UILabel+FontAppearance.m in Sources */,
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "编组@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "编组@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "添加@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "添加@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "关闭@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "关闭@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
...@@ -23,6 +23,7 @@ class SHRecordModel: NSObject{ ...@@ -23,6 +23,7 @@ class SHRecordModel: NSObject{
@objc var delete: Bool = false @objc var delete: Bool = false
@objc var top: Bool = false @objc var top: Bool = false
@objc var selected: Bool = false
@objc var fileData: Data = Data() @objc var fileData: Data = Data()
......
This diff is collapsed.
...@@ -12,15 +12,31 @@ class SHRecordDetailsVC: SHBaseViewController { ...@@ -12,15 +12,31 @@ class SHRecordDetailsVC: SHBaseViewController {
@IBOutlet weak var tableView: UITableView? @IBOutlet weak var tableView: UITableView?
@IBOutlet weak var tableFooterView: UIView? @IBOutlet weak var tableFooterView: UIView?
@IBOutlet weak var tableFooterAlertBgView: UIView?
@IBOutlet weak var maskView: UIView?
@IBOutlet weak var bottomHeightConstraint: NSLayoutConstraint?
@IBOutlet weak var markAlertView: UIView?
let bottomView = SHRecordDetailsBottomView.loadFromNibAndClass(SHRecordDetailsBottomView.self) let bottomView = SHRecordDetailsBottomView.loadFromNibAndClass(SHRecordDetailsBottomView.self)
var edit: Bool = false var edit: Bool = false
var currentModel = SHRecordFolderModel() var currentModel = SHRecordFolderModel()
var selectRecordModels:[SHRecordModel] = []
let keyValueStore = NSUbiquitousKeyValueStore.default
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
setupUI() setupUI()
} }
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
bottomView?.isHidden = false
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
bottomView?.isHidden = true
}
override func setupUI() { override func setupUI() {
self.navigationItem.title = currentModel.name self.navigationItem.title = currentModel.name
...@@ -33,10 +49,48 @@ class SHRecordDetailsVC: SHBaseViewController { ...@@ -33,10 +49,48 @@ class SHRecordDetailsVC: SHBaseViewController {
tableView?.separatorStyle = .none tableView?.separatorStyle = .none
bottomView?.frame = CGRect.init(x: -tableFooterView!.frame.width, y: 0, width: tableFooterView!.frame.width*2, height: tableFooterView!.frame.height) bottomView?.frame = CGRect.init(x: -tableFooterView!.frame.width, y: 0, width: tableFooterView!.frame.width*2, height: tableFooterView!.frame.height)
tableFooterView?.addSubview(bottomView!) tableFooterAlertBgView?.addSubview(bottomView!)
bottomView?.selectCallBack = { [self] (index, selected) in
switch index {
case 100:
for (_, model) in currentModel.dataSources.enumerated(){
model.selected = selected
if selected == true {
if selectRecordModels.contains(model) != true{
selectRecordModels.append(model)
}
}else{
if selectRecordModels.contains(model) == true{
if let index = selectRecordModels.firstIndex(of: model) {
selectRecordModels.remove(at: index)
}
}
}
// currentModel.dataSources[index] = model
}
tableView?.reloadData()
break
case 101:
self.moveFile()
break
case 102:
self.deleteFile()
break
case 103:
self.markAlertViewShow(selected)
break
default:
break
}
}
} }
@objc func editClick(){ @objc func editClick(){
if currentModel.dataSources.count == 0 {
return
}
edit = !edit edit = !edit
if edit { if edit {
self.navigationItem.rightBarButtonItem = UIBarButtonItem.init(title: "完成", style: .done, target: self, action: #selector(editClick)) self.navigationItem.rightBarButtonItem = UIBarButtonItem.init(title: "完成", style: .done, target: self, action: #selector(editClick))
...@@ -51,13 +105,153 @@ class SHRecordDetailsVC: SHBaseViewController { ...@@ -51,13 +105,153 @@ class SHRecordDetailsVC: SHBaseViewController {
self.bottomView?.frame = CGRect.init(x: -self.tableFooterView!.frame.width, y: 0, width: self.tableFooterView!.frame.width*2, height: self.tableFooterView!.frame.height) self.bottomView?.frame = CGRect.init(x: -self.tableFooterView!.frame.width, y: 0, width: self.tableFooterView!.frame.width*2, height: self.tableFooterView!.frame.height)
} }
} }
self.navigationItem.rightBarButtonItem?.tintColor = UIColor.init(hexStr: "4183F4")
self.tableView?.reloadData() self.tableView?.reloadData()
} }
} }
//MARK:bottomSelector
extension SHRecordDetailsVC {
//MARK:选中Models
func selectModel(_ index:NSInteger, selected:Bool){
let model = currentModel.dataSources[index]
model.selected = selected
if model.selected == true {
selectRecordModels.append(model)
}else{
if let index = selectRecordModels.firstIndex(where: { $0.pathFile == model.pathFile}) {
selectRecordModels.remove(at: index)
}
}
if selectRecordModels.count == currentModel.dataSources.count {
bottomView?.deleteSelected = true
} else {
bottomView?.deleteSelected = false
}
}
//MARK:转移Models
func moveFile(){
if selectRecordModels.count == 0 {
return
}
let move = UIStoryboard.init(name: "Record", bundle: nil).instantiateViewController(withIdentifier: "SHRecordMoveFileVC") as! SHRecordMoveFileVC
move.currentModel = currentModel
move.moveFiles = selectRecordModels
let nav = SHBaseNavigationController.init(rootViewController: move)
self.navigationController?.present(nav, animated: true, completion: nil)
move.saveSuccessCallBack = { model in
self.currentModel = model
self.tableView?.reloadData()
}
}
//MARK:删除Models
func deleteFile(){
if selectRecordModels.count == 0 {
return
}
let nowDate = Date()
for model in selectRecordModels {
if currentModel.dataSources.contains(model) {
if let index = currentModel.dataSources.firstIndex(where: { $0.pathFile == model.pathFile}) {
currentModel.dataSources.remove(at: index)
}
}
}
var list = CRUserDefaults.recordList
if var recordList = list{
for (index, subDict) in recordList.enumerated(){
let subFolderModel:SHRecordFolderModel = getDataDictWith(dict: subDict)
if subFolderModel.id == currentModel.id {
subFolderModel.modifyDate = nowDate
subFolderModel.dataSources = currentModel.dataSources
let dic = getDictWith(obj: subFolderModel)
recordList[index] = dic
break
}
}
CRUserDefaults.recordList = recordList
}
list = keyValueStore.object(forKey: "Folderlist") as? [Dictionary<String, Any>]
if var recordList = list{
for (index, subDict) in recordList.enumerated(){
let subFolderModel:SHRecordFolderModel = getDataDictWith(dict: subDict)
if subFolderModel.id == currentModel.id {
subFolderModel.modifyDate = nowDate
subFolderModel.dataSources = currentModel.dataSources
let dic = getDictWith(obj: subFolderModel)
recordList[index] = dic
break
}
}
keyValueStore.set(recordList, forKey: "Folderlist")
keyValueStore.synchronize()
}
if currentModel.dataSources.count == 0 {
self.navigationItem.rightBarButtonItem = UIBarButtonItem.init(title: "编辑", style: .done, target: self, action: #selector(editClick))
self.navigationItem.rightBarButtonItem?.tintColor = UIColor.init(hexStr: "4183F4")
UIView.animate(withDuration: 0.25) {
self.bottomView?.frame = CGRect.init(x: -self.tableFooterView!.frame.width, y: 0, width: self.tableFooterView!.frame.width*2, height: self.tableFooterView!.frame.height)
}
self.markAlertViewShow(false)
bottomView?.cancel = true
}
selectRecordModels = []
edit = false
tableView?.reloadData()
}
//MARK:笔记弹框
func markAlertViewShow(_ selected:Bool){
self.view.layoutIfNeeded()
if selected == false {
UIView.animate(withDuration: 0.25) {
self.bottomHeightConstraint?.constant = 60
self.view.layoutIfNeeded()
}
}else{
UIView.animate(withDuration: 0.25) {
self.bottomHeightConstraint?.constant = 120
self.view.layoutIfNeeded()
}
}
}
//MARK:笔记弹框入口
@IBAction func markAlertBtnClick(_ sender:UIButton){
self.markAlertViewShow(false)
bottomView?.cancel = true
switch sender.tag {
case 200:
break
default:
let record = UIStoryboard.init(name: "Record", bundle: nil).instantiateViewController(withIdentifier: "SHRecordViewController") as! SHRecordViewController
record.folderModel = currentModel
self.navigationController?.pushViewController(record, animated: true)
record.saveSuccessCallBack = { model in
self.currentModel = model
self.tableView?.reloadData()
}
break
}
}
}
extension SHRecordDetailsVC: UITableViewDelegate, UITableViewDataSource{ extension SHRecordDetailsVC: UITableViewDelegate, UITableViewDataSource{
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if currentModel.dataSources.count == 0 {
self.view.bringSubviewToFront(maskView!)
self.view.bringSubviewToFront(tableFooterView!)
}else {
self.view.sendSubviewToBack(maskView!)
}
bottomView?.recordCount = self.currentModel.dataSources.count
return currentModel.dataSources.count return currentModel.dataSources.count
} }
...@@ -71,6 +265,10 @@ extension SHRecordDetailsVC: UITableViewDelegate, UITableViewDataSource{ ...@@ -71,6 +265,10 @@ extension SHRecordDetailsVC: UITableViewDelegate, UITableViewDataSource{
cell.model = currentModel.dataSources[indexPath.row] cell.model = currentModel.dataSources[indexPath.row]
cell.edit = edit cell.edit = edit
cell.selectCallBack = { selected in
self.selectModel(indexPath.row, selected: selected)
}
cell.selectionStyle = .none cell.selectionStyle = .none
return cell return cell
} }
......
This diff is collapsed.
...@@ -15,6 +15,9 @@ class SHRecordViewController: SHBaseViewController{ ...@@ -15,6 +15,9 @@ class SHRecordViewController: SHBaseViewController{
private var waveView: SHRecordWaveView! private var waveView: SHRecordWaveView!
var folderModel: SHRecordFolderModel = SHRecordFolderModel()
var saveSuccessCallBack:((SHRecordFolderModel)->Void)?
@IBOutlet var recordTextView: UITextView! @IBOutlet var recordTextView: UITextView!
@IBOutlet var waveBgView: UIView! @IBOutlet var waveBgView: UIView!
@IBOutlet var secondsLabel: UILabel! @IBOutlet var secondsLabel: UILabel!
...@@ -93,6 +96,10 @@ class SHRecordViewController: SHBaseViewController{ ...@@ -93,6 +96,10 @@ class SHRecordViewController: SHBaseViewController{
} }
} }
override func goback() {
super.goback()
saveSuccessCallBack?(folderModel)
}
override func setupUI() { override func setupUI() {
super.setupUI() super.setupUI()
...@@ -153,6 +160,8 @@ class SHRecordViewController: SHBaseViewController{ ...@@ -153,6 +160,8 @@ class SHRecordViewController: SHBaseViewController{
saveContent() saveContent()
saveSuccessCallBack?(folderModel)
let export = SHRecordExportAlertView.loadFromNibAndClass(SHRecordExportAlertView.self)! let export = SHRecordExportAlertView.loadFromNibAndClass(SHRecordExportAlertView.self)!
export.frame = UIApplication.shared.keyWindow!.bounds export.frame = UIApplication.shared.keyWindow!.bounds
UIApplication.shared.keyWindow!.addSubview(export) UIApplication.shared.keyWindow!.addSubview(export)
...@@ -467,8 +476,10 @@ class SHRecordViewController: SHBaseViewController{ ...@@ -467,8 +476,10 @@ class SHRecordViewController: SHBaseViewController{
return return
} }
let nowDate = Date()
let model = SHRecordModel() let model = SHRecordModel()
model.createDate = Date() model.createDate = nowDate
model.modifyDate = nowDate
model.address = currentAddress ?? "" model.address = currentAddress ?? ""
model.rename = currentAddress ?? "" model.rename = currentAddress ?? ""
model.txt = recognitionTaskText.first ?? (self.currentTxt ?? "") model.txt = recognitionTaskText.first ?? (self.currentTxt ?? "")
...@@ -476,26 +487,41 @@ class SHRecordViewController: SHBaseViewController{ ...@@ -476,26 +487,41 @@ class SHRecordViewController: SHBaseViewController{
model.pcmPathFile = pcm_file_path! model.pcmPathFile = pcm_file_path!
model.during = seconds model.during = seconds
let dic = ["time":model.createDate, "address":model.address, "txt":model.txt, "pathFile":model.pathFile, "during":model.during, "delete":model.delete, "rename":model.rename] as [String : Any] var contains = false
if folderModel.dataSources.count != 0 {
var list = CRUserDefaults.recordList
if list == nil { for (index, subModel) in folderModel.dataSources.enumerated() {
list = [dic] if subModel.pathFile == model.pathFile {
}else{
var contains = false
for (index, subDic) in list!.enumerated(){
if (subDic["pathFile"] as! String) == model.pathFile {
contains = true contains = true
list![index] = dic folderModel.dataSources[index] = model
break break
} }
} }
if contains == false { if contains == false{
list?.append(dic) folderModel.dataSources.append(model)
} }
}else{
folderModel.dataSources.append(model)
} }
CRUserDefaults.recordList = list
let list = CRUserDefaults.recordList
if var recordList = list{
for (index, subDict) in recordList.enumerated(){
let subFolderModel:SHRecordFolderModel = getDataDictWith(dict: subDict)
if subFolderModel.id == folderModel.id {
contains = true
subFolderModel.modifyDate = nowDate
subFolderModel.dataSources = folderModel.dataSources
let dic = getDictWith(obj: subFolderModel)
recordList[index] = dic
break
}
}
if contains == true {
CRUserDefaults.recordList = recordList
}
}
currentModel = model currentModel = model
do{ do{
...@@ -505,28 +531,37 @@ class SHRecordViewController: SHBaseViewController{ ...@@ -505,28 +531,37 @@ class SHRecordViewController: SHBaseViewController{
model.fileData = data model.fileData = data
let dic = ["time":model.createDate, "address":model.address, "txt":model.txt, "pathFile":model.pathFile, "during":model.during, "delete":model.delete, "fileData":model.fileData, "rename":model.rename] as [String : Any] if folderModel.dataSources.count != 0 {
for (index, subModel) in folderModel.dataSources.enumerated() {
if subModel.pathFile == model.pathFile {
folderModel.dataSources[index] = model
break
}
}
}else{
folderModel.dataSources.append(model)
}
let keyValueStore = NSUbiquitousKeyValueStore.default let keyValueStore = NSUbiquitousKeyValueStore.default
var list = keyValueStore.object(forKey: "list") as? [Dictionary<String, Any>] let list = keyValueStore.object(forKey: "Folderlist") as? [Dictionary<String, Any>]
if list == nil {
list = [dic] if var recordList = list{
}else{ for (index, subDict) in recordList.enumerated(){
var contains = false let subFolderModel:SHRecordFolderModel = getDataDictWith(dict: subDict)
for (index, subDic) in list!.enumerated(){ if subFolderModel.id == folderModel.id {
if (subDic["pathFile"] as! String) == model.pathFile {
contains = true contains = true
list![index] = dic subFolderModel.modifyDate = nowDate
subFolderModel.dataSources = folderModel.dataSources
let dic = getDictWith(obj: subFolderModel)
recordList[index] = dic
break break
} }
} }
if contains == false { if contains == true {
list!.append(dic) keyValueStore.set(recordList, forKey: "Folderlist")
keyValueStore.synchronize()
} }
} }
keyValueStore.set(list, forKey: "list")
keyValueStore.synchronize()
currentModel = model currentModel = model
} catch { } catch {
......
...@@ -9,7 +9,76 @@ ...@@ -9,7 +9,76 @@
import UIKit import UIKit
class SHRecordDetailsBottomView: UIView { class SHRecordDetailsBottomView: UIView {
@IBOutlet var countLab: UILabel?
var recordCount: NSInteger = 0 {
didSet{
countLab?.text = "总笔记本数:\(recordCount)"
}
}
var cancel: Bool = false {
didSet{
if cancel == true {
let btn:UIButton = self.viewWithTag(103) as! UIButton
btn.isSelected = false
let rotationAnimation = CABasicAnimation(keyPath: "transform.rotation")
rotationAnimation.fromValue = btn.isSelected ? 0 : Float.pi * 0.25
rotationAnimation.toValue = btn.isSelected ? Float.pi * 0.25 : 0
rotationAnimation.duration = 0.25
rotationAnimation.repeatCount = 0
//保持结束后不还原
rotationAnimation.fillMode = CAMediaTimingFillMode.forwards
rotationAnimation.isRemovedOnCompletion = false
btn.layer.add(rotationAnimation, forKey: nil)
}
}
}
var deleteSelected: Bool = false {
didSet{
let btn:UIButton = self.viewWithTag(100) as! UIButton
if deleteSelected == true {
btn.isSelected = true
}else{
btn.isSelected = false
}
}
}
var selectCallBack: ((NSInteger, Bool)->Void)?
@IBAction func btnClick(_ sender:UIButton!){
switch sender.tag {
case 100:
sender.isSelected = !sender.isSelected
break
case 101:
break
case 102:
break
case 103:
cancel = false
sender.isSelected = !sender.isSelected
let rotationAnimation = CABasicAnimation(keyPath: "transform.rotation")
rotationAnimation.fromValue = sender.isSelected ? 0 : Float.pi * 0.25
rotationAnimation.toValue = sender.isSelected ? Float.pi * 0.25 : 0
rotationAnimation.duration = 0.25
rotationAnimation.repeatCount = 0
//保持结束后不还原
rotationAnimation.fillMode = CAMediaTimingFillMode.forwards
rotationAnimation.isRemovedOnCompletion = false
sender.layer.add(rotationAnimation, forKey: nil)
break
default:
break
}
selectCallBack?(sender.tag, sender.isSelected)
}
} }
...@@ -21,21 +21,35 @@ ...@@ -21,21 +21,35 @@
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="y8M-FY-Nf5"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="y8M-FY-Nf5">
<rect key="frame" x="0.0" y="0.0" width="409.5" height="159"/> <rect key="frame" x="0.0" y="0.0" width="409.5" height="159"/>
<subviews> <subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="e2v-Fo-Qp5"> <button opaque="NO" tag="100" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="e2v-Fo-Qp5">
<rect key="frame" x="20" y="64.5" width="75" height="30"/> <rect key="frame" x="20" y="62.5" width="87" height="34"/>
<state key="normal" title="全选 "/> <state key="normal" title="全选 ">
<color key="titleColor" red="0.25490196079999999" green="0.51372549020000002" blue="0.95686274510000002" alpha="1" colorSpace="calibratedRGB"/>
</state>
<state key="selected" title="取消 "/>
<connections>
<action selector="btnClick:" destination="xFb-3q-Fyi" eventType="touchUpInside" id="K4b-Fq-SL0"/>
</connections>
</button> </button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="EIy-6f-IqZ"> <button opaque="NO" tag="101" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="EIy-6f-IqZ">
<rect key="frame" x="173.5" y="64.5" width="63" height="30"/> <rect key="frame" x="168" y="62.5" width="74" height="34"/>
<state key="normal" title=" 移动 "/> <state key="normal" title=" 移动 ">
<color key="titleColor" red="0.25490196079999999" green="0.51372549020000002" blue="0.95686274510000002" alpha="1" colorSpace="calibratedRGB"/>
</state>
<connections>
<action selector="btnClick:" destination="xFb-3q-Fyi" eventType="touchUpInside" id="bhW-nT-2Pt"/>
</connections>
</button> </button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="jmd-yJ-G2t"> <button opaque="NO" tag="102" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="jmd-yJ-G2t">
<rect key="frame" x="355.5" y="57.5" width="44" height="44"/> <rect key="frame" x="355.5" y="57.5" width="44" height="44"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="44" id="2jT-uF-Odm"/> <constraint firstAttribute="height" constant="44" id="2jT-uF-Odm"/>
<constraint firstAttribute="width" constant="44" id="j2N-nd-hDr"/> <constraint firstAttribute="width" constant="44" id="j2N-nd-hDr"/>
</constraints> </constraints>
<state key="normal" image="recordDetails_bottom_delete"/> <state key="normal" image="recordDetails_bottom_delete"/>
<connections>
<action selector="btnClick:" destination="xFb-3q-Fyi" eventType="touchUpInside" id="YXZ-kj-QuM"/>
</connections>
</button> </button>
</subviews> </subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/> <color key="backgroundColor" systemColor="systemBackgroundColor"/>
...@@ -51,15 +65,18 @@ ...@@ -51,15 +65,18 @@
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="dzZ-KN-iG7"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="dzZ-KN-iG7">
<rect key="frame" x="409.5" y="0.0" width="409.5" height="159"/> <rect key="frame" x="409.5" y="0.0" width="409.5" height="159"/>
<subviews> <subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="CsG-LQ-Eeb"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="笔记本总数:0" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="CsG-LQ-Eeb">
<rect key="frame" x="184" y="69.5" width="41.5" height="20.5"/> <rect key="frame" x="157.5" y="71" width="94.5" height="17"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/> <fontDescription key="fontDescription" type="system" pointSize="14"/>
<nil key="textColor"/> <color key="textColor" red="0.58431372550000005" green="0.62745098040000002" blue="0.72156862749999995" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="0yn-aJ-wzE"> <button opaque="NO" tag="103" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="0yn-aJ-wzE">
<rect key="frame" x="339.5" y="64.5" width="46" height="30"/> <rect key="frame" x="344.5" y="59" width="41" height="41"/>
<state key="normal" title="Button"/> <state key="normal" image="recordDetails_bottom_add"/>
<connections>
<action selector="btnClick:" destination="xFb-3q-Fyi" eventType="touchUpInside" id="XbR-L8-DbQ"/>
</connections>
</button> </button>
</subviews> </subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/> <color key="backgroundColor" systemColor="systemBackgroundColor"/>
...@@ -82,10 +99,14 @@ ...@@ -82,10 +99,14 @@
<constraint firstItem="pYr-gn-BWK" firstAttribute="top" secondItem="xFb-3q-Fyi" secondAttribute="top" id="swH-uV-E3R"/> <constraint firstItem="pYr-gn-BWK" firstAttribute="top" secondItem="xFb-3q-Fyi" secondAttribute="top" id="swH-uV-E3R"/>
</constraints> </constraints>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/> <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<connections>
<outlet property="countLab" destination="CsG-LQ-Eeb" id="L71-fF-D7Y"/>
</connections>
<point key="canvasLocation" x="-23.913043478260871" y="-121.54017857142857"/> <point key="canvasLocation" x="-23.913043478260871" y="-121.54017857142857"/>
</view> </view>
</objects> </objects>
<resources> <resources>
<image name="recordDetails_bottom_add" width="41" height="41"/>
<image name="recordDetails_bottom_delete" width="18" height="19"/> <image name="recordDetails_bottom_delete" width="18" height="19"/>
<systemColor name="systemBackgroundColor"> <systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
......
...@@ -31,7 +31,7 @@ class SHRecordDetailsCell: UITableViewCell { ...@@ -31,7 +31,7 @@ class SHRecordDetailsCell: UITableViewCell {
timeLab?.text = Date.getShortTimeByStamp_record(timestamp: Int64(newValue.modifyDate.timeIntervalSince1970)) timeLab?.text = Date.getShortTimeByStamp_record(timestamp: Int64(newValue.modifyDate.timeIntervalSince1970))
txtLab?.text = newValue.txt txtLab?.text = newValue.txt
duringLab?.text = countSecond(newValue.during) duringLab?.text = countSecond(newValue.during)
selectedBtn?.isSelected = model.selected
} }
get{ get{
return _model! return _model!
......
...@@ -10,14 +10,21 @@ import UIKit ...@@ -10,14 +10,21 @@ import UIKit
class SHRecordRenameAlertView: UIView { class SHRecordRenameAlertView: UIView {
@IBOutlet var bgView: UIView! @IBOutlet private var bgView: UIView?
@IBOutlet var textField: UITextField! @IBOutlet private var textField: UITextField?
@IBOutlet private var titleLab: UILabel?
var title: String = "重命名" {
didSet{
titleLab?.text = title
}
}
private var _placeHolder: String? private var _placeHolder: String?
var placeHolder: String { var placeHolder: String {
set{ set{
_placeHolder = newValue _placeHolder = newValue
textField.placeholder = newValue textField?.placeholder = newValue
} }
get{ get{
return _placeHolder! return _placeHolder!
...@@ -37,11 +44,11 @@ class SHRecordRenameAlertView: UIView { ...@@ -37,11 +44,11 @@ class SHRecordRenameAlertView: UIView {
super.awakeFromNib() super.awakeFromNib()
self.backgroundColor = UIColor.init(red: 0, green: 0, blue: 0, alpha: 0.3) self.backgroundColor = UIColor.init(red: 0, green: 0, blue: 0, alpha: 0.3)
bgView.layer.cornerRadius = 8 bgView?.layer.cornerRadius = 8
} }
@objc @IBAction func cleanBtnClick(_ sender:UIButton){ @objc @IBAction func cleanBtnClick(_ sender:UIButton){
self.textField.text = "" self.textField?.text = ""
} }
@objc @IBAction func cancelBtnClick(_ sender:UIButton){ @objc @IBAction func cancelBtnClick(_ sender:UIButton){
...@@ -50,8 +57,8 @@ class SHRecordRenameAlertView: UIView { ...@@ -50,8 +57,8 @@ class SHRecordRenameAlertView: UIView {
@objc @IBAction func confirmBtnClick(_ sender:UIButton){ @objc @IBAction func confirmBtnClick(_ sender:UIButton){
if let text = textField.text, text.length > 0{ if let text = textField?.text, text.length > 0{
confirmCallBack?(textField.text ?? "") confirmCallBack?(textField?.text ?? "")
self.removeFromSuperview() self.removeFromSuperview()
} }
} }
......
...@@ -116,6 +116,7 @@ ...@@ -116,6 +116,7 @@
<connections> <connections>
<outlet property="bgView" destination="qte-rS-SOz" id="DBx-na-7o1"/> <outlet property="bgView" destination="qte-rS-SOz" id="DBx-na-7o1"/>
<outlet property="textField" destination="4On-7k-axI" id="FyQ-l0-gSd"/> <outlet property="textField" destination="4On-7k-axI" id="FyQ-l0-gSd"/>
<outlet property="titleLab" destination="2Yi-xr-CGL" id="j2Y-T9-fEJ"/>
</connections> </connections>
<point key="canvasLocation" x="47.826086956521742" y="71.651785714285708"/> <point key="canvasLocation" x="47.826086956521742" y="71.651785714285708"/>
</view> </view>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment