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 ifileoperation替换shfileoperation

Delphi不占cpu的延时函数

Delphi 设置本地系统时间

Delphi获取进程pid

Delphi实现解析百度搜索结果link?url=

Delphi 快速调用resource资源数据

Delphi加载驱动的代码演示

Delphi 分离网址链接最后一层文件目录

Delphi 去掉文件只读属性

Delphi写com+的心得体会

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



打赏

取消

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

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

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

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

评论

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