Skip to content

Commit

Permalink
improve tip
Browse files Browse the repository at this point in the history
  • Loading branch information
fancymax committed Oct 24, 2016
1 parent f0201b8 commit cdacaac
Show file tree
Hide file tree
Showing 12 changed files with 144 additions and 280 deletions.
2 changes: 1 addition & 1 deletion 12306ForMac-Swift.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#define _Train12306_Swift_h

#import "MASPreferences.h"
#import "DJProgressHUD.h"
#import "DJTipHUD.h"
#import "DJLayerView.h"
#import <CommonCrypto/CommonCrypto.h>

#endif
12 changes: 6 additions & 6 deletions 12306ForMac.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@
F13E9C981D0AA9760011F7E2 /* TrainInfoTableCellView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F13E9C971D0AA9760011F7E2 /* TrainInfoTableCellView.swift */; };
F13E9C9A1D0AB3310011F7E2 /* TrainTableRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F13E9C991D0AB3310011F7E2 /* TrainTableRowView.swift */; };
F14243141DB610FF0012B5E4 /* DJActivityIndicator.m in Sources */ = {isa = PBXBuildFile; fileRef = F14243111DB610FF0012B5E4 /* DJActivityIndicator.m */; };
F14243151DB610FF0012B5E4 /* DJProgressHUD.m in Sources */ = {isa = PBXBuildFile; fileRef = F14243131DB610FF0012B5E4 /* DJProgressHUD.m */; };
F142431B1DB628CB0012B5E4 /* DJTipHUD.m in Sources */ = {isa = PBXBuildFile; fileRef = F142431A1DB628CB0012B5E4 /* DJTipHUD.m */; };
F147763E1D6B2B2E002FD6AF /* InfoButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = F147763D1D6B2B2E002FD6AF /* InfoButton.swift */; };
F14D6BE41D86E91C00CBD36C /* FilterTrainCodeTransformer.swift in Sources */ = {isa = PBXBuildFile; fileRef = F14D6BE31D86E91C00CBD36C /* FilterTrainCodeTransformer.swift */; };
F159C9D51DBDD76A00202143 /* DJLayerView.m in Sources */ = {isa = PBXBuildFile; fileRef = F159C9D41DBDD76A00202143 /* DJLayerView.m */; };
F17AB1CC1C95630E00FEB221 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = F17AB1CB1C95630E00FEB221 /* Credits.rtf */; };
F1AF72B81DAA24FB0047486B /* DataManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1AF72B71DAA24FB0047486B /* DataManager.swift */; };
F1C075211D83F97A006EFABB /* TicketConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1C075201D83F97A006EFABB /* TicketConstants.swift */; };
Expand Down Expand Up @@ -181,13 +181,13 @@
F13E9C991D0AB3310011F7E2 /* TrainTableRowView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TrainTableRowView.swift; sourceTree = "<group>"; };
F14243101DB610FF0012B5E4 /* DJActivityIndicator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DJActivityIndicator.h; sourceTree = "<group>"; };
F14243111DB610FF0012B5E4 /* DJActivityIndicator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DJActivityIndicator.m; sourceTree = "<group>"; };
F14243121DB610FF0012B5E4 /* DJProgressHUD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DJProgressHUD.h; sourceTree = "<group>"; };
F14243131DB610FF0012B5E4 /* DJProgressHUD.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DJProgressHUD.m; sourceTree = "<group>"; };
F14243191DB628CB0012B5E4 /* DJTipHUD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DJTipHUD.h; sourceTree = "<group>"; };
F142431A1DB628CB0012B5E4 /* DJTipHUD.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DJTipHUD.m; sourceTree = "<group>"; };
F147763D1D6B2B2E002FD6AF /* InfoButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InfoButton.swift; sourceTree = "<group>"; };
F14D6BE31D86E91C00CBD36C /* FilterTrainCodeTransformer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FilterTrainCodeTransformer.swift; sourceTree = "<group>"; };
F15277071DAB78D3002BAF17 /* 12306ForMac.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = 12306ForMac.entitlements; path = 12306ForMac/12306ForMac.entitlements; sourceTree = "<group>"; };
F159C9D31DBDD76A00202143 /* DJLayerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DJLayerView.h; sourceTree = "<group>"; };
F159C9D41DBDD76A00202143 /* DJLayerView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DJLayerView.m; sourceTree = "<group>"; };
F17AB1CB1C95630E00FEB221 /* Credits.rtf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.rtf; name = Credits.rtf; path = 12306ForMac/Resources/Credits.rtf; sourceTree = SOURCE_ROOT; };
F1AF72B71DAA24FB0047486B /* DataManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DataManager.swift; sourceTree = "<group>"; };
F1C075201D83F97A006EFABB /* TicketConstants.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TicketConstants.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -427,12 +427,12 @@
F142430F1DB610FF0012B5E4 /* DJProgressHUD */ = {
isa = PBXGroup;
children = (
F159C9D31DBDD76A00202143 /* DJLayerView.h */,
F159C9D41DBDD76A00202143 /* DJLayerView.m */,
F14243191DB628CB0012B5E4 /* DJTipHUD.h */,
F142431A1DB628CB0012B5E4 /* DJTipHUD.m */,
F14243101DB610FF0012B5E4 /* DJActivityIndicator.h */,
F14243111DB610FF0012B5E4 /* DJActivityIndicator.m */,
F14243121DB610FF0012B5E4 /* DJProgressHUD.h */,
F14243131DB610FF0012B5E4 /* DJProgressHUD.m */,
);
path = DJProgressHUD;
sourceTree = "<group>";
Expand Down Expand Up @@ -610,6 +610,7 @@
F111549F1C8D929200FA6059 /* Service+Login.swift in Sources */,
F1CA120D1D1135E2003EFD0B /* Theme.swift in Sources */,
F1CA12051D10F546003EFD0B /* TrainCodeDetailHeaderCell.swift in Sources */,
F159C9D51DBDD76A00202143 /* DJLayerView.m in Sources */,
F1CCA2DE1D0D4A1400B6853E /* TrainCodeDetail.swift in Sources */,
F1C075211D83F97A006EFABB /* TicketConstants.swift in Sources */,
F11154981C8D927C00FA6059 /* StationData.swift in Sources */,
Expand Down Expand Up @@ -642,7 +643,6 @@
F11154721C8D921400FA6059 /* LeftTicketParam.swift in Sources */,
F1FEE7A21D8D464900B02C84 /* NotifySpeaker.swift in Sources */,
F1FCFF4B1D386F8F0070A32C /* URLButton.swift in Sources */,
F14243151DB610FF0012B5E4 /* DJProgressHUD.m in Sources */,
F11154A11C8D929200FA6059 /* Service+QueryOrder.swift in Sources */,
F11154A21C8D929200FA6059 /* Service+QueryTicket.swift in Sources */,
F11154A91C8D92A700FA6059 /* LoginWindowController.swift in Sources */,
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "12306ForMac/OrderViewControllers/OrderViewController.swift"
timestampString = "498559506.056539"
timestampString = "498981115.057717"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "130"
endingLineNumber = "130"
startingLineNumber = "139"
endingLineNumber = "139"
landmarkName = "queryAllOrder()"
landmarkType = "5">
</BreakpointContent>
Expand All @@ -42,11 +42,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "12306ForMac/OrderViewControllers/OrderViewController.swift"
timestampString = "498559506.056539"
timestampString = "498981115.057717"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "93"
endingLineNumber = "93"
startingLineNumber = "102"
endingLineNumber = "102"
landmarkName = "queryHistoryOrder()"
landmarkType = "5">
</BreakpointContent>
Expand All @@ -58,11 +58,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "12306ForMac/OrderViewControllers/OrderViewController.swift"
timestampString = "498559506.056539"
timestampString = "498981115.057717"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "118"
endingLineNumber = "118"
startingLineNumber = "127"
endingLineNumber = "127"
landmarkName = "queryAllOrder()"
landmarkType = "5">
</BreakpointContent>
Expand All @@ -74,11 +74,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "12306ForMac/OrderViewControllers/OrderViewController.swift"
timestampString = "498559506.056539"
timestampString = "498981115.057717"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "102"
endingLineNumber = "102"
startingLineNumber = "111"
endingLineNumber = "111"
landmarkName = "queryHistoryOrder()"
landmarkType = "5">
</BreakpointContent>
Expand Down Expand Up @@ -211,34 +211,18 @@
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "DJProgressHUD/DJTipHUD.m"
timestampString = "498563564.481737"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "65"
endingLineNumber = "65"
landmarkName = "-showViewAnimated"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "DJProgressHUD/DJTipHUD.m"
timestampString = "498563564.481737"
timestampString = "498988164.484067"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "54"
endingLineNumber = "54"
startingLineNumber = "64"
endingLineNumber = "64"
landmarkName = "@implementation DJTipHUD"
landmarkType = "3">
</BreakpointContent>
Expand Down Expand Up @@ -266,7 +250,7 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "12306ForMac/TicketViewControllers/TicketQueryViewController.swift"
timestampString = "498643637.085131"
timestampString = "498988230.929609"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "451"
Expand All @@ -282,7 +266,7 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "12306ForMac/TicketViewControllers/TicketQueryViewController.swift"
timestampString = "498562034.070445"
timestampString = "498988230.929609"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "330"
Expand All @@ -298,27 +282,27 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "DJProgressHUD/DJTipHUD.m"
timestampString = "498563564.481737"
timestampString = "498988164.484067"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "82"
endingLineNumber = "82"
startingLineNumber = "79"
endingLineNumber = "79"
landmarkName = "-updateLayout"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "DJProgressHUD/DJTipHUD.m"
timestampString = "498563564.481737"
timestampString = "498988164.484067"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "53"
endingLineNumber = "53"
startingLineNumber = "63"
endingLineNumber = "63"
landmarkName = "-showStatus:FromView:"
landmarkType = "5">
</BreakpointContent>
Expand Down
27 changes: 18 additions & 9 deletions 12306ForMac/OrderViewControllers/OrderViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ class OrderViewController: NSViewController{
DJTipHUD.showStatus(tip, fromView: self.view)
}

func startLoadingTip(tip:String)
{
DJLayerView.showStatus(tip, fromView: self.view)
}

func stopLoadingTip(){
DJLayerView.dismiss()
}

func receiveLogoutMessageNotification(notification: NSNotification) {
MainModel.noCompleteOrderList.removeAll()
self.orderList.removeAll()
Expand All @@ -61,18 +70,18 @@ class OrderViewController: NSViewController{
alert.beginSheetModalForWindow(self.view.window!, completionHandler: { reponse in
if reponse == NSAlertFirstButtonReturn {
if let sequence_no = MainModel.noCompleteOrderList[0].sequence_no {
DJProgressHUD.showStatus("正在取消...", fromView: self.view)
self.startLoadingTip("正在取消...")

let successHandler = {
MainModel.noCompleteOrderList.removeAll()
self.orderList = MainModel.historyOrderList
self.orderListTable.reloadData()
DJProgressHUD.dismiss()
self.stopLoadingTip()
self.showTip("取消订单成功")
self.hasOrder = false
}
let failureHandler = {(error:NSError)->() in
DJProgressHUD.dismiss()
self.stopLoadingTip()
self.showTip(translate(error))
}
self.service.cancelOrderWith(sequence_no, success: successHandler, failure:failureHandler)
Expand All @@ -86,17 +95,17 @@ class OrderViewController: NSViewController{
}

func queryHistoryOrder(){
DJProgressHUD.showStatus("正在查询...", fromView: self.view)
self.startLoadingTip("正在查询...")

let successHandler = {
self.orderList.appendContentsOf(MainModel.historyOrderList)
self.orderListTable.reloadData()

DJProgressHUD.dismiss()
self.stopLoadingTip()
}

let failureHandler = {
DJProgressHUD.dismiss()
self.stopLoadingTip()
}
service.queryHistoryOrderFlow((success: successHandler, failure: failureHandler))
}
Expand All @@ -111,13 +120,13 @@ class OrderViewController: NSViewController{
self.orderListTable.reloadData()

hasQuery = true
DJProgressHUD.showStatus("正在查询...", fromView: self.view)
self.startLoadingTip("正在查询...")

let successHandler = {
self.orderList = MainModel.noCompleteOrderList
self.orderListTable.reloadData()

DJProgressHUD.dismiss()
self.stopLoadingTip()

if self.orderList.count > 0 {
self.hasOrder = true
Expand All @@ -130,7 +139,7 @@ class OrderViewController: NSViewController{
}

let failureHandler = {
DJProgressHUD.dismiss()
self.stopLoadingTip()
self.hasOrder = false
}
service.queryNoCompleteOrderFlow(success: successHandler, failure: failureHandler)
Expand Down
4 changes: 2 additions & 2 deletions 12306ForMac/Sheets/LoginWindowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ class LoginWindowController: NSWindowController{

func startLoadingTip(tip:String)
{
DJProgressHUD.showStatus(tip, fromView: self.window?.contentView)
DJLayerView.showStatus(tip, fromView: self.window?.contentView)
}

func stopLoadingTip(){
DJProgressHUD.dismiss()
DJLayerView.dismiss()
}


Expand Down
4 changes: 2 additions & 2 deletions 12306ForMac/Sheets/SubmitWindowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ class SubmitWindowController: NSWindowController{

func startLoadingTip(tip:String)
{
DJProgressHUD.showStatus(tip, fromView: self.window?.contentView)
DJLayerView.showStatus(tip, fromView: self.window?.contentView)
}

func stopLoadingTip(){
DJProgressHUD.dismiss()
DJLayerView.dismiss()
}

func showTip(tip:String){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,16 +394,16 @@ class TicketQueryViewController: NSViewController {
}

func showTip(tip:String){
DJTipHUD.showStatus(tip, fromView: self.secondSearchView)
DJTipHUD.showStatus(tip, fromView: self.view)
}

func startLoadingTip(tip:String)
{
DJProgressHUD.showStatus(tip, fromView: self.view)
DJLayerView.showStatus(tip, fromView: self.view)
}

func stopLoadingTip(){
DJProgressHUD.dismiss()
DJLayerView.dismiss()
}

func queryLeftTicket(summitHandler:()->() = {}) {
Expand Down
32 changes: 32 additions & 0 deletions DJProgressHUD/DJLayerView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// DJLayerView.h
// Playground
//
// Created by fancymax on 16/10/24.
// Copyright © 2016年 Daniel Jackson. All rights reserved.
//

#import <Cocoa/Cocoa.h>

@interface DJLayerView : NSView

+(void)showStatus:(NSString*)status FromView:(NSView *)view;
+(void)dismiss;

// Customization
#define pMaxWidth1 250
#define pMaxHeight1 200

//General Popup Values
@property (nonatomic) CGVector pOffset;
@property (nonatomic) CGFloat pAlpha;

//Padding
@property (nonatomic) CGFloat pPadding;

@property (nonatomic) CGSize indicatorSize;
@property (nonatomic) CGVector indicatorOffset;
@property (nonatomic) CGSize labelSize;
@property (nonatomic) CGVector labelOffset;

@end
Loading

0 comments on commit cdacaac

Please sign in to comment.