Commit 60c23e3a authored by sheteng's avatar sheteng

v2.0 开发 10 下载取消

parent acd80b21
...@@ -53,7 +53,6 @@ object GameDownLoadManger { ...@@ -53,7 +53,6 @@ object GameDownLoadManger {
if (file.exists()) { if (file.exists()) {
// activity.context?.let { DownloadUtils.install(file.absolutePath, it) } // activity.context?.let { DownloadUtils.install(file.absolutePath, it) }
file.delete() file.delete()
return
} }
downloadManager = downloadManager =
activity.context?.getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager activity.context?.getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager
...@@ -119,7 +118,6 @@ object GameDownLoadManger { ...@@ -119,7 +118,6 @@ object GameDownLoadManger {
downloadMap.remove(it) downloadMap.remove(it)
} }
} }
} catch (e: Exception) { } catch (e: Exception) {
e.printStackTrace() e.printStackTrace()
} }
......
...@@ -18,6 +18,7 @@ import com.bumptech.glide.Glide ...@@ -18,6 +18,7 @@ import com.bumptech.glide.Glide
import com.ccwangluo.accelerator.R import com.ccwangluo.accelerator.R
import com.ccwangluo.accelerator.adapter.KotlinDataAdapter import com.ccwangluo.accelerator.adapter.KotlinDataAdapter
import com.ccwangluo.accelerator.databinding.FragmentGameListBinding import com.ccwangluo.accelerator.databinding.FragmentGameListBinding
import com.ccwangluo.accelerator.manager.DownloadUtils
import com.ccwangluo.accelerator.manager.GameDownLoadManger import com.ccwangluo.accelerator.manager.GameDownLoadManger
import com.ccwangluo.accelerator.manager.GameDownLoadManger.download import com.ccwangluo.accelerator.manager.GameDownLoadManger.download
import com.ccwangluo.accelerator.manager.LoginUtils import com.ccwangluo.accelerator.manager.LoginUtils
...@@ -260,6 +261,16 @@ class GameListFragment : XPageFragment() { ...@@ -260,6 +261,16 @@ class GameListFragment : XPageFragment() {
tx_game_update_notice.setOnClickListener { tx_game_update_notice.setOnClickListener {
download(itemData) download(itemData)
} }
progress_download.setOnClickListener {
context?.let {
CommonDialog(it)
.setContent("确定要关闭下载任务吗? ")
.setBtnLeft("取消") {
}.setBtnRight("关闭") {
GameDownLoadManger.cancellDownload(itemData)
}.show<CommonDialog>()
}
}
} }
.create() .create()
gameListModel.freshData(this, page) gameListModel.freshData(this, page)
...@@ -326,17 +337,17 @@ class GameListFragment : XPageFragment() { ...@@ -326,17 +337,17 @@ class GameListFragment : XPageFragment() {
Handler(Looper.getMainLooper()).post { Handler(Looper.getMainLooper()).post {
gameInfo?.let { gameInfo?.let {
if (AcceleratorUtils.state == BaseService.State.Connected && AcceleratorUtils.game?.id == it.id) { if (AcceleratorUtils.state == BaseService.State.Connected && AcceleratorUtils.game?.id == it.id) {
context?.let { context?.let {
CommonDialog(it).setTitle("加速停止确认") CommonDialog(it).setTitle("加速停止确认")
.setContent("停止加速可能会导致游戏断线,是否确认停止?") .setContent("停止加速可能会导致游戏断线,是否确认停止?")
.setBtnLeft("取消") { .setBtnLeft("取消") {
DataRePortUtils.report("st_speed_stop_pop_cancel_clk") DataRePortUtils.report("st_speed_stop_pop_cancel_clk")
}.setBtnRight("停止加速") { }.setBtnRight("停止加速") {
DataRePortUtils.report("st_speed_stop_pop_ok_clk") DataRePortUtils.report("st_speed_stop_pop_ok_clk")
AcceleratorUtils.stopAccelerator({}) AcceleratorUtils.stopAccelerator({})
}.show<CommonDialog>() }.show<CommonDialog>()
DataRePortUtils.report("st_speed_stop_pop_show") DataRePortUtils.report("st_speed_stop_pop_show")
} }
} else { } else {
startAccBtn(it) startAccBtn(it)
} }
......
...@@ -173,12 +173,19 @@ ...@@ -173,12 +173,19 @@
android:textSize="12.5sp" /> android:textSize="12.5sp" />
</LinearLayout> </LinearLayout>
<LinearLayout <RelativeLayout
android:id="@+id/btn_download_status" android:id="@+id/btn_download_status"
android:layout_width="90dp" android:layout_width="90dp"
android:layout_height="30dp" android:layout_height="30dp"
android:gravity="center" android:gravity="center"
android:orientation="horizontal"> android:orientation="horizontal">
<com.xuexiang.xui.widget.imageview.RadiusImageView
android:id="@+id/progress_bg"
android:layout_width="21dp"
android:layout_height="21dp"
android:layout_centerInParent="true"
android:clickable="true"
app:srcCompat="@mipmap/download_concell" />
<com.xuexiang.xui.widget.progress.CircleProgressView <com.xuexiang.xui.widget.progress.CircleProgressView
android:id="@+id/progress_download" android:id="@+id/progress_download"
...@@ -201,7 +208,7 @@ ...@@ -201,7 +208,7 @@
app:cpv_track_color="@color/divide_gray" app:cpv_track_color="@color/divide_gray"
app:cpv_track_width="1.5dp" /> app:cpv_track_width="1.5dp" />
</LinearLayout> </RelativeLayout>
</FrameLayout> </FrameLayout>
</LinearLayout> </LinearLayout>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment