This repository has been archived by the owner on Sep 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #236 from malcolmgroves/delphi-xe5-android
Updated for Delphi XE5 iOS and Android
- Loading branch information
Showing
27 changed files
with
6,244 additions
and
5,725 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- BEGIN_INCLUDE(manifest) --> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="%package%" | ||
android:versionCode="%versionCode%" | ||
android:versionName="%versionName%"> | ||
|
||
<!-- This is the platform API where NativeActivity was introduced. --> | ||
<uses-sdk android:minSdkVersion="%minSdkVersion%" /> | ||
<%uses-permission%> | ||
<application android:persistent="%persistent%" | ||
android:restoreAnyVersion="%restoreAnyVersion%" | ||
android:label="%label%" | ||
android:installLocation="%installLocation%" | ||
android:debuggable="%debuggable%" | ||
android:largeHeap="%largeHeap%" | ||
android:icon="%icon%" | ||
android:theme="%theme%"> | ||
<!-- Our activity is a subclass of the built-in NativeActivity framework class. | ||
This will take care of integrating with our NDK code. --> | ||
<activity android:name="com.embarcadero.firemonkey.FMXNativeActivity" | ||
android:label="%activityLabel%" | ||
android:configChanges="orientation|keyboardHidden"> | ||
<!-- Tell NativeActivity the name of our .so --> | ||
<meta-data android:name="android.app.lib_name" | ||
android:value="%libNameValue%" /> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
<receiver android:name="com.embarcadero.firemonkey.notifications.FMXNotificationAlarm" /> | ||
</application> | ||
</manifest> | ||
<!-- END_INCLUDE(manifest) --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
unit BackButtonManager; | ||
|
||
interface | ||
|
||
uses FMX.TabControl, FMX.Types, System.Classes, FMX.Forms, System.Actions; | ||
|
||
type | ||
TActionHelper = class helper for TFMXObject | ||
function GetFMXAction: TBasicAction; | ||
end; | ||
|
||
TBackActionManager = class | ||
private | ||
public | ||
class procedure HideBackActionControls(Root : TFMXObject; UpdateActionState: Boolean); | ||
class function FindBackAction(TabControl : TTabControl; IncInvisibleLinks : Boolean): TChangeTabAction; overload; | ||
class function FindBackAction(CurrFMXObj : TFMXObject; IncInvisibleLinks : Boolean): TChangeTabAction; overload; | ||
end; | ||
|
||
implementation | ||
|
||
uses FMX.Controls, System.SysUtils, System.Generics.Collections; | ||
|
||
{ TActionFinder } | ||
|
||
class function TBackActionManager.FindBackAction(TabControl: TTabControl; | ||
IncInvisibleLinks: Boolean): TChangeTabAction; | ||
begin | ||
Result := nil; | ||
|
||
if (TabControl = nil) or (TabControl.ActiveTab = nil) then | ||
Exit; | ||
|
||
// Find the active Page... If it has a control with ChangeTabAction, and BackStyle :-) | ||
// If not, Has it got a PageControl... if so recursively call. | ||
Result := FindBackAction(TabControl.ActiveTab,IncInvisibleLinks); | ||
end; | ||
|
||
class procedure TBackActionManager.HideBackActionControls(Root: TFMXObject; UpdateActionState: Boolean); | ||
var | ||
I : Integer; | ||
Comp : TFMXObject; | ||
Control : TStyledControl; | ||
Action: TBasicAction; | ||
begin | ||
if Root = nil then | ||
Exit; | ||
|
||
for I := 0 to Pred(Root.ChildrenCount) do begin | ||
Comp := Root.Children.Items[I]; | ||
if Comp is TStyledControl then begin | ||
Control := TStyledControl(Comp); | ||
|
||
if Control.Visible then begin | ||
if LowerCase(Control.StyleLookup) = 'backtoolbutton' then begin | ||
Action := Control.GetFMXAction; | ||
if UpdateActionState and Assigned(Action) and (Action is TContainedAction) then | ||
TContainedAction(Action).Visible := False | ||
else | ||
Control.Visible := False; | ||
end; | ||
end; | ||
end; | ||
TBackActionManager.HideBackActionControls(Comp, UpdateActionState); | ||
end; | ||
end; | ||
|
||
|
||
class function TBackActionManager.FindBackAction(CurrFMXObj: TFMXObject; | ||
IncInvisibleLinks: Boolean): TChangeTabAction; | ||
var | ||
I : Integer; | ||
Comp : TFMXObject; | ||
Control : TStyledControl; | ||
Action: TBasicAction; | ||
begin | ||
Result := nil; | ||
|
||
if CurrFMXObj = nil then | ||
Exit(nil); | ||
|
||
for I := 0 to Pred(CurrFMXObj.ChildrenCount) do begin | ||
Comp := CurrFMXObj.Children.Items[I]; | ||
if Comp is TStyledControl then begin | ||
Control := TStyledControl(Comp); | ||
|
||
if Control.Visible or IncInvisibleLinks then begin | ||
if LowerCase(Control.StyleLookup) = 'backtoolbutton' then begin | ||
// Check for Action | ||
Action := Control.GetFMXAction; | ||
if Assigned(Action) then begin | ||
if Action is TChangeTabAction then | ||
Exit(TChangeTabAction(Action)); | ||
end; | ||
end; | ||
end; | ||
end; | ||
|
||
if Comp is TTabControl then | ||
Result := FindBackAction(TTabControl(Comp),IncInvisibleLinks) | ||
else | ||
Result := FindBackAction(Comp,IncInvisibleLinks); | ||
|
||
if Assigned(Result) then | ||
Exit; | ||
end; | ||
end; | ||
|
||
{ TActionHelper } | ||
|
||
function TActionHelper.GetFMXAction: TBasicAction; | ||
begin | ||
Result := Self.GetAction; | ||
end; | ||
|
||
end. |
Oops, something went wrong.