From e102578ebfc95c27aeb13dce13fb82af53a2bead Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期四, 25 二月 2021 17:07:23 +0800
Subject: [PATCH] 1. 新增夜间施工查询界面 2. 新增夜间施工管理统计界面

---
 app/src/main/java/cn/flightfeather/thirdapp/business/widgettype3/HomeFragment_scene.java |   88 ++++++++++++++++++++++++-------------------
 1 files changed, 49 insertions(+), 39 deletions(-)

diff --git a/app/src/main/java/cn/flightfeather/thirdapp/business/widgettype3/HomeFragment_scene.java b/app/src/main/java/cn/flightfeather/thirdapp/business/widgettype3/HomeFragment_scene.java
index 33cdab4..0df6103 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/business/widgettype3/HomeFragment_scene.java
+++ b/app/src/main/java/cn/flightfeather/thirdapp/business/widgettype3/HomeFragment_scene.java
@@ -1,6 +1,7 @@
 package cn.flightfeather.thirdapp.business.widgettype3;
 
 
+import android.arch.lifecycle.ViewModelProviders;
 import android.content.Intent;
 import android.os.Bundle;
 import android.support.annotation.Nullable;
@@ -11,7 +12,6 @@
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
-import android.view.Window;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.TextView;
@@ -32,9 +32,7 @@
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Date;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 import butterknife.BindView;
 import butterknife.ButterKnife;
@@ -42,24 +40,23 @@
 import butterknife.Unbinder;
 import cn.flightfeather.thirdapp.CommonApplication;
 import cn.flightfeather.thirdapp.R;
-import cn.flightfeather.thirdapp.bean.entity.Domainitem;
 import cn.flightfeather.thirdapp.bean.entity.Scense;
 import cn.flightfeather.thirdapp.bean.entity.Subtask;
 import cn.flightfeather.thirdapp.bean.vo.InspectionInfoVo;
-import cn.flightfeather.thirdapp.bean.vo.InspectionVo;
 import cn.flightfeather.thirdapp.bean.vo.RankVo;
 import cn.flightfeather.thirdapp.bean.vo.TaskVo;
+import cn.flightfeather.thirdapp.common.net.ResultCallBack;
 import cn.flightfeather.thirdapp.dataanalysis.AnalysisOverViewFragment;
 import cn.flightfeather.thirdapp.httpservice.InspectionService;
 import cn.flightfeather.thirdapp.httpservice.TaskService;
+import cn.flightfeather.thirdapp.model.bean.NightWorkFileVo;
+import cn.flightfeather.thirdapp.module.nightwork.NightWorkRecordActivity;
+import cn.flightfeather.thirdapp.module.nightwork.NightWorkViewModel;
 import cn.flightfeather.thirdapp.util.Constant;
 import cn.flightfeather.thirdapp.util.DateFormatter;
-import cn.flightfeather.thirdapp.util.ScreenUtils;
-import cn.flightfeather.thirdapp.view.MyScrollView;
 import retrofit2.Call;
 import retrofit2.Callback;
 import retrofit2.Response;
-import retrofit2.Retrofit;
 
 /**
  * A simple {@link Fragment} subclass.
@@ -86,33 +83,19 @@
     private ViewHolder2 viewHolder2;
     private ViewHolder3 viewHolder3;
     private ViewHolder4 viewHolder4;
+    private ViewHolder5 viewHolder5;
     //ViewHolder1(浠婃棩浠诲姟)
-    private Map<String, List<TaskVo>> taskAllMapList = new HashMap<>();//Map<鏃堕棿, 鎵�鏈変换鍔★紙椤跺眰浠诲姟銆佹棩浠诲姟銆佸瓙浠诲姟锛�>
-    private ArrayList<Subtask> mSubtaskList = new ArrayList<>();
     private ArrayList<Subtask> subtaskListOfUser = new ArrayList<>();
-    private ArrayList<TaskVo> mDayTaskList = new ArrayList<>();
-    private Calendar calendarCurrent;
-    private String mCurYearMonth;
-    private String mToday;
-    private boolean requestAgain;
-    private Retrofit mRetrofit;
-    private boolean firstLoad = true;
-    private final int VISIBLENUM = 2;//浠婃棩浠诲姟鏄剧ず鏈�灏戠殑浠诲姟鏁�
-    private Boolean visibility = false;
-    private Subtask subtask;
-    private InspectionVo inspectionVo;
-    //褰撳墠鍦烘櫙绫诲瀷
-    private String curSceneType = "1";
-    private List<Domainitem> sceneTypeData = new ArrayList<>();//鍦烘櫙绫诲瀷
-    //鐘舵�佹爮涓庢爣棰樻爮鐨勯珮搴﹀拰涓烘粦鍔ㄧ粍浠舵偓鍋滅殑鏈�澶ч珮搴�
-    private int topHeight;
     //鏄惁鍦ㄥ垏鎹㈠洖鏉ユ椂鍒锋柊
     private boolean isUnHiddenRefresh;
     private Unbinder unbinder;
 
+    private NightWorkViewModel viewModel;
+
     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container,
                              Bundle savedInstanceState) {
+        viewModel = ViewModelProviders.of(this).get(NightWorkViewModel.class);
         // Inflate the layout for this fragment
         View view = inflater.inflate(R.layout.fragment_home_pollution_scene, container, false);
         unbinder = ButterKnife.bind(this, view);
@@ -161,26 +144,14 @@
     @Override
     public void onStart() {
         super.onStart();
-        int statusBarHeight = ScreenUtils.getStatusHeight(getActivity());//鐘舵�佹爮楂樺害
-
-        int titleBarHeight = getActivity().getWindow().findViewById(Window.ID_ANDROID_CONTENT).getTop();//鏍囬鏍忛珮搴�
-        topHeight = titleBarHeight + statusBarHeight;
     }
 
     public HomeFragment_scene() {
         // Required empty public constructor
     }
 
-    MyScrollView sv_home_base;
-
-    LinearLayout ll_weather_detail;
-
     private void initData(){
         application = (CommonApplication) getActivity().getApplication();
-        mRetrofit = application.getRetrofit();
-        Date now = Calendar.getInstance().getTime();
-        mCurYearMonth = DateFormatter.YearMonthFormat.format(now);
-        mToday = DateFormatter.dateFormat2.format(now);
     }
 
     private void initUI(View view) {
@@ -210,10 +181,13 @@
         viewHolder2 = new ViewHolder2(savedInstanceState, sv_home_page);
         viewHolder3 = new ViewHolder3(savedInstanceState, sv_home_page);
         viewHolder4 = new ViewHolder4(savedInstanceState, sv_home_page);
+        viewHolder5 = new ViewHolder5();
+
         viewHolder1.initViewHolder1();
         viewHolder1.refreshView();
         viewHolder2.refreshView();
 //        viewHolder3.initViewHolder3();
+        viewHolder5.init();
     }
 
 
@@ -712,9 +686,45 @@
     }
     //</editor-fold>
 
+    @BindView(R.id.cl_night_work) ConstraintLayout cl_night_work;
+    @BindView(R.id.txt_news) TextView txt_news;
+    public class ViewHolder5 {
+
+        void init() {
+            cl_night_work.setOnClickListener(v -> startActivity(new Intent(getContext(), NightWorkRecordActivity.class)));
+            viewModel.getNightWorkFile(false, 1, new ResultCallBack<List<NightWorkFileVo>>(){
+                @Override
+                public void onCacheSuccess(@org.jetbrains.annotations.Nullable List<NightWorkFileVo> result) {
+
+                }
+
+                @Override
+                public void onPage(int current, int total) {
+
+                }
+
+                @Override
+                public void onSuccess(@org.jetbrains.annotations.Nullable List<NightWorkFileVo> result) {
+                    if (result == null || result.isEmpty()) {
+                        txt_news.setText("鏆傛棤鏂拌鍙瘉");
+                    } else {
+                        txt_news.setText("鏈夋柊璁稿彲璇佷笅鍙戯紝璇锋煡鐪�");
+                    }
+                }
+
+                @Override
+                public void onFailure() {
+                    txt_news.setText("缃戠粶杩炴帴澶辫触锛岃閫�鍑洪噸璇�");
+                }
+            });
+        }
+    }
+
+
+
 
     //<editor-fold desc="鐐瑰嚮浜嬩欢">
-    @OnClick({R.id.text_goto_change, R.id.image_goto_change})
+    @OnClick({R.id.card_change_problem, R.id.card_changed_problem})
     void OnClick() {
         Intent intent = new Intent("cn.flightfeather.thirdapp.broadcasereceiver.MainReceiver");
         intent.setAction(Constant.GOTO_INSPECTION_FRAGMENT);

--
Gitblit v1.9.3