Developer Flying Wang has released a set of utility functions called FlyFilesUtils for handling files, strings, screen DPI, and dialogs for Delphi XE8 Firemonkey. The functions are specifically built to help with development on the Android and IOS platforms (but also Windows and OSX). The source code for these utility functions is available over on Sourceforge. There are four areas that the utility functions cover which are working with files, working with strings, working with dialogs, and working with the Firemonkey screen DPI. Here are the file utility functions:
function GetCaseSensitiveFileName(const FileName: string; RootPath: string = ”): string;
function isPathCanUseNow(const PathOrDir: string; const Default: Boolean = True): Boolean;
function GetSDCardPath(Index: Integer = 0): string;
function FindSDCardSubPath(SubPath: string; Index: Integer = 0): string;
function GetAppPath: string;
function BuildFileListInAPath(const Path: string; const Attr: Integer; const List: TStrings;
JustFile: Boolean = False): Boolean; overload;
function BuildFileListInAPath(const Path: string; const Attr: Integer;
JustFile: Boolean = False): string; overload;
function GetFileNamesFromDirectory(const DirName: string; const SearchFilter: string = ‘*’;
const FileAttribs: Integer = faAnyFile; const isIncludeSubDirName: Boolean = False; const Recursion: Boolean = False;
const FullName: Boolean = False): string;
function DeleteDirectoryByEcho(const Source: string;
AbortOnFailure: Boolean = False; YesToAll: Boolean = True;
WaitMinSecond: Integer = DeleteDirectories_WaitMinSecond): Boolean;
function GetTotalSpaceSize(Path: string = PathDelim): UInt64;
function GetAvailableSpaceSize(Path: string = PathDelim): UInt64;
function GetFreeSpaceSize(Path: string = PathDelim): UInt64;
function GetTotalMemorySize: UInt64;
function GetFreeMemorySize: UInt64;
function IsPadOrPC(MiniScreenInches: Single = 6.2): Boolean;
function GetVolumePaths: string;
function GetExternalStoragePath: string;
function GetExterStoragePath: string;
function GetInnerStoragePath: string;
function GetIsExternalStorageRemovable: Boolean;
function FindJavaClass(NamePath: string): Boolean;
function FindJavaMethod(MethodName, Signature: string; CalssNamePath: string = ”): Boolean;
function FindJavaStaticMethod(MethodName, Signature: string; CalssNamePath: string = ”): Boolean;
Here are the string utility functions:
function DetectUTF8Encoding(const s: TBytes): TEncodeType;
function HasExtendCharacter(const s: TBytes): Boolean;
function HasUTF8BOM(S : TStream) : boolean; overload;
function HasUTF8BOM(const S: TBytes) : boolean; overload;
function HasUTF8BOM(const S: MarshaledAString) : boolean; overload;
function BytesAutoToString(const S: TBytes; const UnknowEncodeDefaultIsAnsi: Boolean = True): string; overload;
function BytesAutoToString(const S: MarshaledAString; const UnknowEncodeDefaultIsAnsi: Boolean = True): string; overload;
function StreamAutoToString(const aStream: TStream; const UnknowEncodeDefaultIsAnsi: Boolean = True): string;
function IsUTF8String(const s: MarshaledAString): Boolean; overload;
function IsUTF8String(const s: TBytes): Boolean; overload;
Here are the Firemonkey screen functions:
function GetScreenPixelsXY(const Context: TFmxObject = nil): TPoint;
function GetScreenClientPixelsXY(const Context: TFmxObject = nil): TPoint;
function GetScreenInchXY(const Context: TFmxObject = nil): TPointF;
function GetScreenDPIXY(const Context: TFmxObject = nil): TPointF;
function GetScreenDPI(const Context: TFmxObject = nil): Single;
function GetScreenInches(const Context: TFmxObject = nil): Single;
function GetFormXY(const AForm: TCustomForm): TPointF;
function GetFormClientXY(const AForm: TCustomForm): TPointF;
function GetFormClient(const AForm: TCustomForm): TRectF;
function GetFormPixelsXY(const AForm: TCustomForm): TPointF;
function GetFormClientPixelsXY(const AForm: TCustomForm): TPointF;
And here are the message dialog functions:
procedure ShowMessageWait(const AMessage: string);
procedure ShowMessageFmtWait(const AMessage: string; const AParams: array of const);
procedure ShowMessagePosWait(const AMessage: string; const AX, AY: Integer);
1 Comment