本文整理自网络,侵删。
procedure TForm6.FormCreate(Sender: TObject);begin Image1.Position.Y := (0 - Image1.Height); lMovendoObjeto := False;end;
procedure TForm6.Image2Click(Sender: TObject);begin {$IF DEFINED(ANDROID)} AbreYoutube; {$ENDIF}end;
procedure TForm6.ListView1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single);begin if((ListView1.ScrollViewPos = 0)and(Image1.Position.Y = (0 - Image1.Height)))then begin ListView1.Root.Captured := ListView1; lMovendoObjeto := True; oPosicao.Y := Y; oPosicao.X := X; end;end;
procedure TForm6.ListView1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Single);begin if(lMovendoObjeto)then begin if Y < oPosicao.Y then Y := oPosicao.Y;
if((Y < 150)and(Y > 0))then begin Image1.Position.Y := (Y - oPosicao.Y - Image1.Height); Image1.RotationAngle := (Y - oPosicao.Y - 50); end; end;end;
procedure TForm6.ListView1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single);begin if(lMovendoObjeto)then begin if(Image1.Position.Y > 35)then begin Image1.AnimateFloat('Position.Y', 35, 0.2, TAnimationType.&In,TInterpolationType.Cubic); Image1.AnimateFloatDelay('RotationAngle', (Image1.RotationAngle + 800), 1,0.2, TAnimationType.&In,TInterpolationType.Cubic); Image1.AnimateFloatDelay('Position.Y', (0 - Image1.Height), 0.5,0.8, TAnimationType.&In,TInterpolationType.Cubic); end else begin Image1.AnimateFloat('Position.Y', (0 - Form6.Image1.Height), 0.5, TAnimationType.&In,TInterpolationType.Cubic); end; lMovendoObjeto := False; end;end;
{$IF DEFINED(ANDROID)}procedure TForm6.AbreYoutube;var JIntentYoutube : JIntent;begin try JIntentYoutube := TJIntent.JavaClass.init(TJIntent.JavaClass.ACTION_VIEW); JIntentYoutube.setPackage(StringToJString('com.google.android.youtube')); JIntentYoutube.setData(TJnet_Uri.JavaClass.parse(StringToJString('https://www.youtube.com/channel/UCd-vLa_qcKve3CsDFlYiygA'))); SharedActivity.startActivity(JIntentYoutube); except end;end;{$ENDIF}
相关阅读 >>
Delphi getrandompassword 生成随机密码
更多相关阅读请进入《Delphi》频道 >>