IDownloadEventHandler.java 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Copyright (C) 2020 xuexiangjys(xuexiangjys@163.com)
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. *
  16. */
  17. package com.xuexiang.xupdate.widget;
  18. import java.io.File;
  19. /**
  20. * 下载事件处理者
  21. *
  22. * @author xuexiang
  23. * @since 2020/12/23 10:47 PM
  24. */
  25. public interface IDownloadEventHandler {
  26. /**
  27. * 处理开始下载
  28. */
  29. void handleStart();
  30. /**
  31. * 处理下载中的进度更新
  32. *
  33. * @param progress 下载进度
  34. */
  35. void handleProgress(float progress);
  36. /**
  37. * 处理下载完毕
  38. *
  39. * @param file 下载文件
  40. * @return 下载完毕后是否打开文件进行安装<br>{@code true} :安装<br>{@code false} :不安装
  41. */
  42. boolean handleCompleted(File file);
  43. /**
  44. * 处理下载失败
  45. *
  46. * @param throwable 失败原因
  47. */
  48. void handleError(Throwable throwable);
  49. }