|
|
@@ -11,6 +11,7 @@ import android.widget.TextView;
|
|
|
|
|
|
import com.kfzs.duanduan.utils.NumberFormatUtils;
|
|
|
import com.sheep.gamegroup.event.BigEvent;
|
|
|
+import com.sheep.gamegroup.greendao.download.DownLoadInfo;
|
|
|
import com.sheep.gamegroup.model.entity.BaseMessage;
|
|
|
import com.sheep.gamegroup.model.entity.MessageUnReadEntity;
|
|
|
import com.sheep.gamegroup.model.entity.UserEntity;
|
|
|
@@ -19,6 +20,7 @@ import com.sheep.gamegroup.util.CommonUtil;
|
|
|
import com.sheep.gamegroup.util.DataUtil;
|
|
|
import com.sheep.gamegroup.util.GlideImageLoader;
|
|
|
import com.sheep.gamegroup.util.Jump2View;
|
|
|
+import com.sheep.gamegroup.util.LogUtil;
|
|
|
import com.sheep.gamegroup.util.ViewUtil;
|
|
|
import com.sheep.gamegroup.view.activity.ActMsg;
|
|
|
import com.sheep.gamegroup.view.dialog.DialogNotificationOfArrival;
|
|
|
@@ -29,10 +31,12 @@ import com.sheep.jiuyan.samllsheep.R;
|
|
|
import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
|
import com.sheep.jiuyan.samllsheep.base.BaseFragment;
|
|
|
import com.sheep.jiuyan.samllsheep.utils.SpUtils;
|
|
|
+import com.sheep.gamegroup.util.DownloadUtil;
|
|
|
|
|
|
import org.greenrobot.eventbus.EventBus;
|
|
|
import org.greenrobot.eventbus.Subscribe;
|
|
|
|
|
|
+import java.util.List;
|
|
|
import java.util.Locale;
|
|
|
|
|
|
import butterknife.BindView;
|
|
|
@@ -50,6 +54,8 @@ public class FgtMainHeader extends BaseFragment {
|
|
|
TextView tv_user_asset;
|
|
|
@BindView(R.id.tv_msg_count)
|
|
|
TextView tv_msg_count;
|
|
|
+ @BindView(R.id.tv_download_count)
|
|
|
+ TextView tv_download_count;
|
|
|
@BindView(R.id.iv_flag_vip)
|
|
|
ImageView iv_flag_vip;
|
|
|
@BindView(R.id.v_red_dot)
|
|
|
@@ -92,6 +98,7 @@ public class FgtMainHeader extends BaseFragment {
|
|
|
public void onViewCreated() {
|
|
|
getUnReadMessageCounts();
|
|
|
ViewUtil.setVisibility(v_red_dot, SpUtils.isVoucherFirst());
|
|
|
+ showDownloadInfo();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -176,6 +183,22 @@ public class FgtMainHeader extends BaseFragment {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ public void showDownloadInfo() {
|
|
|
+ List<DownLoadInfo> infos = new DownloadUtil().getAllDownloadTasks();
|
|
|
+ int runningCount = 0;
|
|
|
+ for (DownLoadInfo info : infos) {
|
|
|
+ if (info.getMStatus() == 2) {
|
|
|
+ runningCount++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (runningCount > 0) {
|
|
|
+ ViewUtil.setText(tv_download_count, runningCount + "");
|
|
|
+ ViewUtil.setVisibility(tv_download_count, true);
|
|
|
+ } else {
|
|
|
+ ViewUtil.setVisibility(tv_download_count, false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Subscribe
|
|
|
public void onEventMainThread(BigEvent event) {
|
|
|
switch (event.getEventTypes()) {
|
|
|
@@ -184,6 +207,15 @@ public class FgtMainHeader extends BaseFragment {
|
|
|
getActivity().runOnUiThread(() -> getUnReadMessageCounts());
|
|
|
}
|
|
|
break;
|
|
|
+ case DOWNLOAD_START:
|
|
|
+ case DOWNLOAD_RUNNING:
|
|
|
+ case DOWNLOAD_STOP:
|
|
|
+ case DOWNLOAD_COMPLETE:
|
|
|
+ case DOWNLOAD_FAIL:
|
|
|
+ case DOWNLOAD_CANCEL:
|
|
|
+ LogUtil.logI(event.getData().toString());
|
|
|
+ showDownloadInfo();
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
|