Advertisement
dondonondon

ShowPesan

May 15th, 2019
301
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 4.15 KB | None | 0 0
  1. unit uFunction;
  2.  
  3. interface
  4.  
  5. uses
  6.   System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  7.   FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
  8.   Data.DB, MemDS, DBAccess, Uni, UniProvider,
  9.   MySQLUniProvider, FireDAC.Stan.Intf, FireDAC.Stan.Option,
  10.   FireDAC.Stan.Error, FireDAC.UI.Intf, FireDAC.Phys.Intf, FireDAC.Stan.Def,
  11.   FireDAC.Stan.Pool, FireDAC.Stan.Async, FireDAC.Phys, FireDAC.Phys.SQLite,
  12.   FireDAC.Phys.SQLiteDef, FireDAC.Stan.ExprFuncs, FireDAC.FMXUI.Wait,
  13.   FireDAC.Stan.Param, FireDAC.DatS, FireDAC.DApt.Intf, FireDAC.DApt,
  14.   FireDAC.Comp.DataSet, FireDAC.Comp.Client, FMX.Objects, FMX.StdCtrls,
  15.   FMX.DialogService, FMX.Layouts, FMX.WebBrowser;
  16.  
  17. type
  18.   FuncClass = Class
  19.     public
  20.      class procedure ReleaseInfo(Sender: TObject);
  21.   end;
  22.  
  23. procedure fnCreateInfo(Form : TForm; Status : String);
  24. procedure fnLoadLoading(Form : TForm; Status : String);
  25. procedure fnReleaseInfo;
  26.  
  27. var
  28.   loInfo : TLayout;
  29.   aniAds : TAniIndicator;
  30.   reInfo : TRectangle;
  31.   lblInfo : TLabel;
  32.   tiInfo : TTimer;
  33.  
  34.   statBrowser, statAds, statInfo : Boolean;
  35.   onError : String;
  36.   WB : TWebBrowser;
  37.  
  38. implementation
  39.  
  40. uses uDM, uMain, uMainCode;
  41.  
  42. procedure fnCreateInfo(Form : TForm; Status : String);
  43. var
  44.   totString : Integer;
  45. begin
  46.   if statInfo = True then
  47.     Exit;
  48.  
  49.   totString := Length(Status);
  50.  
  51.   TThread.CreateAnonymousThread(
  52.   procedure
  53.   begin
  54.     TThread.Synchronize(TThread.CurrentThread,
  55.     procedure
  56.     begin
  57.       try
  58.         statInfo := True;
  59.  
  60.         loInfo := TLayout.Create(Form);
  61.         loInfo.Parent := Form;
  62.         loInfo.Align := TAlignLayout.Client;
  63.         loInfo.HitTest := False;
  64.           reInfo := TRectangle.Create(loInfo);
  65.           reInfo.Parent := loInfo;
  66.           reInfo.Stroke.Thickness := 0;
  67.           reInfo.Stroke.Color := TAlphaColorRec.Null;
  68.           reInfo.XRadius := 8;
  69.           reInfo.YRadius := 8;
  70.           reInfo.Opacity := 0.8;
  71.           reInfo.Fill.Color := TAlphaColorRec.Black;
  72.           reInfo.Height := 30;
  73.           reInfo.Align := TAlignLayout.Center;
  74.           reInfo.Width := reInfo.Width + (totString * 5);
  75.           reInfo.Margins.Top := loInfo.Height - reInfo.Height - 200;
  76.           reInfo.HitTest := False;
  77.  
  78.           lblInfo := TLabel.Create(loInfo);
  79.           lblInfo.Parent := loInfo;
  80.           lblInfo.Height := reInfo.Height;
  81.           lblInfo.Align := TAlignLayout.Center;
  82.           lblInfo.Width := lblInfo.Width + (totString * 5);
  83.           lblInfo.Margins.Top := loInfo.Height - lblInfo.Height - 200;
  84.           lblInfo.HitTest := False;
  85.           lblInfo.Font.Family := 'Bebas Neue'; //nama Font yang digunakan
  86.           lblInfo.Font.Size := 12;
  87.           lblInfo.Text := Status;
  88.           lblInfo.TextSettings.HorzAlign := TTextAlign.Center;
  89.           lblInfo.Font.Style := [TFontStyle.fsBold];
  90.           lblInfo.FontColor := TAlphaColorRec.White;
  91.           lblInfo.StyledSettings := [];
  92.  
  93.           tiInfo := TTimer.Create(Form);
  94.           tiInfo.Interval := 50;
  95.           tiInfo.OnTimer := FuncClass.ReleaseInfo;
  96.           tiInfo.Enabled := False;
  97.           tiInfo.Enabled := True;
  98.  
  99.       except
  100.         statInfo := False;
  101.       end;
  102.     end
  103.     );
  104.   end
  105.   ) .Start;
  106. end;
  107.  
  108. procedure fnLoadLoading(Form : TForm; Status : String);
  109. var
  110.   totString : integer;
  111. begin
  112.   if statInfo = True then
  113.   begin
  114.     totString := Length(Status);
  115.     lblInfo.Width := lblInfo.Width + (totString * 5);
  116.     reInfo.Opacity := 0.8;
  117.     lblInfo.Text := Status;
  118.   end
  119.   else if statInfo = False then
  120.     fnCreateInfo(Form, Status);
  121. end;
  122.  
  123. procedure fnReleaseInfo;
  124. begin
  125.   if statInfo = True then
  126.   begin
  127.     {$IF DEFINED(IOS) or DEFINED(ANDROID)}
  128.       tiInfo.DisposeOf;
  129.       reInfo.DisposeOf;
  130.       lblInfo.DisposeOf;
  131.       loInfo.DisposeOf;
  132.     {$ELSE}
  133.       tiInfo.Free;
  134.       reInfo.Free;
  135.       lblInfo.Free;
  136.       loInfo.Free;
  137.     {$ENDIF}
  138.     statInfo := False;
  139.   end;
  140. end;
  141.  
  142.  
  143. { FuncClass }
  144.  
  145. class procedure FuncClass.ReleaseInfo(Sender: TObject);
  146. begin
  147.   if statInfo = True then
  148.     reInfo.Opacity := reInfo.Opacity - 0.02;
  149.  
  150.   if reInfo.Opacity <= 0.1 then
  151.   begin
  152.     fnReleaseInfo;
  153.   end;
  154. end;
  155.  
  156. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement