diff --git a/app/src/main/java/com/gh/gamecenter/NewsDetailActivity.java b/app/src/main/java/com/gh/gamecenter/NewsDetailActivity.java index dc420195d4..c33c30f0d7 100644 --- a/app/src/main/java/com/gh/gamecenter/NewsDetailActivity.java +++ b/app/src/main/java/com/gh/gamecenter/NewsDetailActivity.java @@ -62,6 +62,7 @@ import com.gh.gamecenter.newsdetail.NewsDetailAdapter; import com.gh.gamecenter.retrofit.RetrofitManager; import com.lightgame.download.DataWatcher; import com.lightgame.download.DownloadEntity; +import com.lightgame.download.DownloadStatus; import com.lightgame.utils.Utils; import org.greenrobot.eventbus.Subscribe; @@ -139,6 +140,21 @@ public class NewsDetailActivity extends DownloadToolbarActivity implements OnCli DetailDownloadUtils.detailInvalidate(getDetailViewHolder()); } } + } else if (gameEntity != null && gameEntity.getApk().size() > 1) { + if (DownloadStatus.downloading.equals(downloadEntity.getStatus())) { + if (getDetailViewHolder().mDownloadTips.getVisibility() == View.GONE || !getDetailViewHolder().mDownloadTips.isAnimating()) { + getDetailViewHolder().mDownloadTips.setVisibility(View.VISIBLE); + ExtensionsKt.setDownloadTipsAnimation(getDetailViewHolder().mDownloadTips, true); + } + } else if (DownloadStatus.waiting.equals(downloadEntity.getStatus()) || DownloadStatus.done.equals(downloadEntity.getStatus()) || + DownloadStatus.pause.equals(downloadEntity.getStatus()) || DownloadStatus.timeout.equals(downloadEntity.getStatus()) || + DownloadStatus.subscribe.equals(downloadEntity.getStatus()) || DownloadStatus.overflow.equals(downloadEntity.getStatus()) || + DownloadStatus.neterror.equals(downloadEntity.getStatus())) { + getDetailViewHolder().mDownloadTips.setVisibility(View.VISIBLE); + ExtensionsKt.setDownloadTipsAnimation(getDetailViewHolder().mDownloadTips, false); + } else { + getDetailViewHolder().mDownloadTips.setVisibility(View.GONE); + } } } @@ -405,6 +421,7 @@ public class NewsDetailActivity extends DownloadToolbarActivity implements OnCli protected void onDestroy() { super.onDestroy(); handler.removeCallbacksAndMessages(null); + DownloadManager.getInstance().removeObserver(dataWatcher); } @Override @@ -421,7 +438,6 @@ public class NewsDetailActivity extends DownloadToolbarActivity implements OnCli isSentReport = true; } - DownloadManager.getInstance().removeObserver(dataWatcher); } @Override diff --git a/app/src/main/res/layout/activity_news_detail.xml b/app/src/main/res/layout/activity_news_detail.xml index 1641cdde80..bf368e4bae 100644 --- a/app/src/main/res/layout/activity_news_detail.xml +++ b/app/src/main/res/layout/activity_news_detail.xml @@ -3,6 +3,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" android:orientation="vertical"> @@ -75,7 +76,7 @@ - + app:download_button_text_size="@dimen/primary_text_size" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - + + + + +