Delphi android下拉刷新


本文整理自网络,侵删。

 
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 idhttp上传图给asp完美解决

Delphi从外部拖拽文件

Delphi debug和release区别

Delphi rest请求控件增加请求头时不编码

Delphi取得网页源码内容

pascal 语言中的关键字及保留字

Delphi 不可移动的窗体

Delphi 实现透明窗体

Delphi 命令行 打开读写txt文件

Delphi 获取动态创建的image与scrollbox的相对位置

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...