feat(apk): copier renvoie a l'app d'avant, recherche prete a l'ouverture et au retour

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
r-zakarya
2026-09-18 14:28:52 +01:00
parent 9a09cc5d29
commit 946880ecf4
3 changed files with 70 additions and 0 deletions
+48
View File
@@ -42,6 +42,14 @@ procedure TintSystemBars(ATop, ABottom: TAlphaColor);
/// decide de la suite d'apres la reponse.
function HideSoftKeyboard: Boolean;
/// Deplie le clavier pour le champ qui a le focus (la recherche). Un focus()
/// JavaScript seul pose le curseur sans ouvrir le clavier.
procedure ShowSoftKeyboard;
/// Renvoie l'application en arriere-plan : on retombe sur l'app d'ou l'on
/// venait, prete a recevoir le collage.
procedure MoveAppToBack;
implementation
{$IF DEFINED(ANDROID)}
@@ -126,4 +134,44 @@ begin
end;
{$ENDIF}
{$IF DEFINED(ANDROID)}
procedure ShowSoftKeyboard;
var
LService: JObject;
LView: JView;
begin
try
LView := TAndroidHelper.Activity.getWindow.getDecorView.findFocus;
if LView = nil then Exit;
LService := TAndroidHelper.Context.getSystemService(
TJContext.JavaClass.INPUT_METHOD_SERVICE);
if LService = nil then Exit;
TJInputMethodManager.Wrap(LService).showSoftInput(LView, 0);
except
// Pas de clavier : la recherche reste a un appui.
end;
end;
procedure MoveAppToBack;
begin
CallInUIThread(
procedure
begin
try
TAndroidHelper.Activity.moveTaskToBack(True);
except
// Reste au premier plan : on colle apres un retour manuel.
end;
end);
end;
{$ELSE}
procedure ShowSoftKeyboard;
begin
end;
procedure MoveAppToBack;
begin
end;
{$ENDIF}
end.