-
Notifications
You must be signed in to change notification settings - Fork 4
/
Utils.UI.pas
119 lines (100 loc) · 3.18 KB
/
Utils.UI.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
unit Utils.UI;
interface
uses
Classes, SysUtils, UITypes, FMX.Graphics, IOUtils;
type
TUIUtils = class
private
class var _Instance: TUIUtils;
protected
class function GetInstance: TUIUtils; static;
public
constructor Create; virtual;
destructor Destroy; override;
class property Instance: TUIUtils read GetInstance;
class destructor ClassDestroy;
private
FFatturaInviataImageIndex: Integer;
FFatturaRicevutaImageIndex: Integer;
FFatturaPreviewImageIndex: Integer;
FChangePasswordImageIndex: Integer;
FBackImageIndex: Integer;
FFatturaID: string;
function GetFatturaInviataImageIndex: Integer;
function GetFatturaRicevutaImageIndex: Integer;
function GetBackImageIndex: Integer;
function GetFatturaPreviewImageIndex: Integer;
function GetChangePasswordImageIndex: Integer;
public
property ChangePasswordImageIndex: Integer read GetChangePasswordImageIndex;
property FatturaRicevutaImageIndex: Integer read GetFatturaRicevutaImageIndex;
property FatturaInviataImageIndex: Integer read GetFatturaInviataImageIndex;
property FatturaPreviewImageIndex: Integer read GetFatturaPreviewImageIndex;
property BackImageIndex: Integer read GetBackImageIndex;
property FatturaID: string read FFatturaID write FFatturaID;
end;
function UIUtils: TUIUtils;
implementation
uses
FMXER.IconFontsData, System.Types
;
function UIUtils: TUIUtils;
begin
Result := TUIUtils.Instance;
end;
{ TUIUtils }
class destructor TUIUtils.ClassDestroy;
begin
if Assigned(_Instance) then
FreeAndNil(_Instance);
end;
constructor TUIUtils.Create;
begin
inherited Create;
FChangePasswordImageIndex := -1;
FFatturaInviataImageIndex := -1;
FFatturaRicevutaImageIndex := -1;
FFatturaPreviewImageIndex := -1;
FBackImageIndex := -1;
end;
destructor TUIUtils.Destroy;
begin
inherited;
end;
function TUIUtils.GetBackImageIndex: Integer;
begin
if FBackImageIndex = -1 then
FBackImageIndex := IconFonts.AddIcon(IconFonts.MD.arrow_left, TAlphaColorRec.Black);
Result := FBackImageIndex;
end;
function TUIUtils.GetChangePasswordImageIndex: Integer;
begin
if FChangePasswordImageIndex = -1 then
FChangePasswordImageIndex := IconFonts.AddIcon(IconFonts.MD.form_textbox_password, TAlphaColorRec.Black);
Result := FChangePasswordImageIndex;
end;
function TUIUtils.GetFatturaInviataImageIndex: Integer;
begin
if FFatturaInviataImageIndex = -1 then
FFatturaInviataImageIndex := IconFonts.AddIcon(IconFonts.MD.cloud_upload, TAlphaColorRec.Green);
Result := FFatturaInviataImageIndex;
end;
function TUIUtils.GetFatturaPreviewImageIndex: Integer;
begin
if FFatturaPreviewImageIndex = -1 then
FFatturaPreviewImageIndex := IconFonts.AddIcon(IconFonts.MD.loupe, TAlphaColorRec.Black);
Result := FFatturaPreviewImageIndex;
end;
function TUIUtils.GetFatturaRicevutaImageIndex: Integer;
begin
if FFatturaRicevutaImageIndex = -1 then
FFatturaRicevutaImageIndex := IconFonts.AddIcon(IconFonts.MD.cloud_download, TAlphaColorRec.Red);
Result := FFatturaRicevutaImageIndex;
end;
class function TUIUtils.GetInstance: TUIUtils;
begin
if not Assigned(_Instance) then
_Instance := TUIUtils.Create;
Result := _Instance;
end;
end.