| | |
| | | package cn.flightfeather.thirdapp.business.widgettype3; |
| | | |
| | | |
| | | import android.arch.lifecycle.ViewModelProviders; |
| | | import android.content.Intent; |
| | | import android.os.Bundle; |
| | | import android.support.annotation.Nullable; |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | import butterknife.Unbinder; |
| | | import cn.flightfeather.thirdapp.CommonApplication; |
| | | import cn.flightfeather.thirdapp.R; |
| | | import cn.flightfeather.thirdapp.bean.Domainitem; |
| | | import cn.flightfeather.thirdapp.bean.Scense; |
| | | import cn.flightfeather.thirdapp.bean.Subtask; |
| | | 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. |
| | |
| | | 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); |
| | |
| | | @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) { |
| | |
| | | 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(); |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | //</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); |