//package cn.flightfeather.thirdapp.module.inspectioninfo;
|
//
|
//import android.content.Context;
|
//import android.content.Intent;
|
//import android.os.Build;
|
//import android.os.Bundle;
|
//import android.support.annotation.RequiresApi;
|
//import android.support.design.widget.TabLayout;
|
//import android.support.v4.app.Fragment;
|
//import android.support.v4.app.FragmentManager;
|
//import android.support.v4.app.FragmentPagerAdapter;
|
//import android.support.v4.content.ContextCompat;
|
//import android.support.v4.view.ViewCompat;
|
//import android.support.v4.view.ViewPager;
|
//import android.support.v7.app.AppCompatActivity;
|
//import android.support.v7.widget.GridLayoutManager;
|
//import android.support.v7.widget.LinearLayoutManager;
|
//import android.support.v7.widget.RecyclerView;
|
//import android.view.Gravity;
|
//import android.view.LayoutInflater;
|
//import android.view.View;
|
//import android.view.ViewGroup;
|
//import android.view.Window;
|
//import android.view.WindowManager;
|
//import android.widget.ImageView;
|
//import android.widget.PopupWindow;
|
//import android.widget.TextView;
|
//
|
//import java.util.ArrayList;
|
//import java.util.List;
|
//import java.util.Objects;
|
//
|
//import butterknife.BindView;
|
//import butterknife.ButterKnife;
|
//import butterknife.OnClick;
|
//import butterknife.Unbinder;
|
//import cn.flightfeather.thirdapp.R;
|
//import cn.flightfeather.thirdapp.adapter.AllRecyclerViewAdapter;
|
//import cn.flightfeather.thirdapp.bean.vo.ProblemCategoryVo;
|
//import cn.flightfeather.thirdapp.bean.vo.ProblemlistVo;
|
//import cn.flightfeather.thirdapp.util.Constant;
|
//import cn.flightfeather.thirdapp.util.Domain;
|
//
|
///**
|
// * 2019.1.25
|
// * @author riku
|
// * 客户界面
|
// * 整改情况界面,展示客户未整改和已整改的问题列表
|
// */
|
//public class ProblemChangeActivity_B extends AppCompatActivity {
|
//
|
//
|
// //<editor-fold desc="全局变量">
|
// public final static String ARG_PROBLEM = "problem";
|
// public final static String ARG_TOTAL_PROBLEM = "totalProblem";
|
//
|
// private ArrayList<ProblemlistVo> problemlistVos;
|
// private ArrayList<ProblemCategoryVo> problemCategories;
|
// private List<Integer> newSelectedTypes;
|
// private List<Integer> curSelectedTypes;
|
//
|
// private final String TITLE = "整改";
|
// private final String POPUP_TITLE = "问题类型";
|
// private Unbinder unbinder;
|
// //</editor-fold>
|
//
|
// //<editor-fold desc="lifecycle">
|
// @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
// @Override
|
// protected void onCreate(Bundle savedInstanceState) {
|
// super.onCreate(savedInstanceState);
|
// //设置允许使用转场动画
|
// getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
|
// setContentView(R.layout.activity_problem_change_pollution_scene);
|
// unbinder = ButterKnife.bind(this);
|
// Intent intent = getIntent();
|
// problemlistVos = (ArrayList<ProblemlistVo>) intent.getSerializableExtra(ARG_PROBLEM);
|
// problemCategories = (ArrayList<ProblemCategoryVo>) intent.getSerializableExtra(ARG_TOTAL_PROBLEM);
|
// newSelectedTypes = new ArrayList<>();
|
// curSelectedTypes = new ArrayList<>();
|
// initToolBar();
|
// initTab();
|
// initViewPager();
|
// initPopup();
|
// }
|
//
|
// @Override
|
// protected void onDestroy() {
|
// super.onDestroy();
|
// if (unbinder != null) {
|
// unbinder.unbind();
|
// }
|
// }
|
// //</editor-fold>
|
//
|
// //<editor-fold desc="标题栏">
|
// @BindView(R.id.action_bar) View action_bar;
|
// @BindView(R.id.img_right) ImageView img_right;
|
// @BindView(R.id.img_left) ImageView img_left;
|
// @BindView(R.id.text_left) TextView text_left;
|
// @BindView(R.id.text_right) TextView text_right;
|
// @BindView(R.id.actionbar_title) TextView title;
|
//
|
// @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
// private void initToolBar() {
|
//// action_bar.setElevation(0);
|
//// action_bar.setBackgroundColor(Color.alpha(0));
|
// action_bar.findViewById(R.id.spinner_topclass_task).setVisibility(View.GONE);
|
//// action_bar.findViewById(R.id.img_left).setVisibility(View.GONE);
|
// img_right.setImageResource(R.drawable.ic_filter_list_white_36dp);
|
// action_bar.findViewById(R.id.ll_menu_text).setVisibility(View.GONE);
|
// title.setText(TITLE);
|
// }
|
//
|
// @OnClick(R.id.img_left)
|
// void onClickBack() {
|
// this.finish();
|
// }
|
//
|
// @OnClick(R.id.img_right)
|
// void onClickFilter() {
|
// popShow();
|
// newSelectedTypes.clear();
|
// newSelectedTypes.addAll(curSelectedTypes);
|
//// img_left.setVisibility(View.INVISIBLE);
|
//// img_right.setVisibility(View.INVISIBLE);
|
//// text_left.setVisibility(View.VISIBLE);
|
//// text_right.setVisibility(View.VISIBLE);
|
//// title.setTitle(POPUP_TITLE);
|
// }
|
// //</editor-fold>
|
//
|
// //<editor-fold desc="ViewPager初始化">
|
// @BindView(R.id.tabLayout)
|
// TabLayout tabLayout;
|
// @BindView(R.id.viewPager)
|
// ViewPager viewPager;
|
// private List<String> tabIndicators;//tab标题
|
// private List<Fragment> tabFragments;//内容
|
// private ContentPagerAdapter contentAdapter;//viewPager内容页面适配器
|
//
|
// private void initTab(){
|
//// tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE);
|
// tabLayout.setTabGravity(Gravity.CENTER_HORIZONTAL);
|
// tabLayout.setTabTextColors(ContextCompat.getColor(this, R.color.unselected), ContextCompat.getColor(this, R.color.main_text_color));
|
// tabLayout.setSelectedTabIndicatorColor(ContextCompat.getColor(this, R.color.main_text_color));
|
// ViewCompat.setElevation(tabLayout, 2);
|
// tabLayout.setupWithViewPager(viewPager);//将tab和viewPager绑定
|
// }
|
//
|
// private ArrayList<ProblemlistVo> unChangedProblems = new ArrayList<>();
|
// private ArrayList<ProblemlistVo> changedProblems = new ArrayList<>();
|
//
|
// private void initViewPager(){
|
// this.changedProblems.clear();
|
// this.unChangedProblems.clear();
|
//
|
// for (int i = 0; i < problemlistVos.size(); i++) {
|
// ProblemlistVo problemlistVoTemp = problemlistVos.get(i);
|
// if (!problemlistVoTemp.getIschanged()) {
|
// this.unChangedProblems.add(problemlistVoTemp);
|
// } else if (!Objects.equals(problemlistVoTemp.getExtension3(), Domain.CHANGE_CHECK_PASS)) {
|
// this.unChangedProblems.add(problemlistVoTemp);
|
// } else {
|
// this.changedProblems.add(problemlistVoTemp);
|
// }
|
// }
|
// tabIndicators = new ArrayList<>();
|
// tabIndicators.add("待整改问题");
|
// tabIndicators.add("已整改问题");
|
//
|
// tabFragments = new ArrayList<>();
|
// tabFragments.add(ProblemChangeFragment.newInstance(this.unChangedProblems, Constant.UNCHANGED));
|
// tabFragments.add(ProblemChangeFragment.newInstance(this.changedProblems, Constant.CHANGED));
|
//
|
// contentAdapter = new ContentPagerAdapter(getSupportFragmentManager());
|
// viewPager.setAdapter(contentAdapter);
|
// }
|
//
|
// //刷新ViewPager
|
// public void refreshViewPager() {
|
// this.changedProblems.clear();
|
// this.unChangedProblems.clear();
|
//
|
// for (int i = 0; i < problemlistVos.size(); i++) {
|
// ProblemlistVo problemlistVoTemp = problemlistVos.get(i);
|
// if (!problemlistVoTemp.getIschanged()) {
|
// this.unChangedProblems.add(problemlistVoTemp);
|
// } else if (!Objects.equals(problemlistVoTemp.getExtension3(), Domain.CHANGE_CHECK_PASS)) {
|
// this.unChangedProblems.add(problemlistVoTemp);
|
// } else {
|
// this.changedProblems.add(problemlistVoTemp);
|
// }
|
// }
|
// ProblemChangeFragment pf1 = (ProblemChangeFragment) tabFragments.get(0);
|
// ProblemChangeFragment pf2 = (ProblemChangeFragment) tabFragments.get(1);
|
// pf1.notifyDataSetChanged();
|
// pf2.notifyDataSetChanged();
|
// }
|
//
|
// //整改完成后,刷新问题列表
|
// public void refreshProblemList(ProblemlistVo problemlistVo) {
|
// if (problemlistVo==null) return;
|
// for (ProblemlistVo p : this.problemlistVos) {
|
// if (p.getGuid().equals(problemlistVo.getGuid())) {
|
// this.problemlistVos.remove(p);
|
// break;
|
// }
|
// }
|
// this.problemlistVos.add(problemlistVo);
|
// }
|
//
|
// /**
|
// * viewPager适配器
|
// */
|
// class ContentPagerAdapter extends FragmentPagerAdapter {
|
//
|
// public ContentPagerAdapter(FragmentManager fm) {
|
// super(fm);
|
// }
|
//
|
// @Override
|
// public Fragment getItem(int position) {
|
// return tabFragments.get(position);
|
// }
|
//
|
// @Override
|
// public int getCount() {
|
// return tabIndicators.size();
|
// }
|
//
|
// @Override
|
// public CharSequence getPageTitle(int position) {
|
// return tabIndicators.get(position);
|
// }
|
// }
|
// //</editor-fold>
|
//
|
// //<editor-fold desc="根据用户选择显示对应类型的问题">
|
// private void showSelectedProblemType(List<Integer> type) {
|
// problemlistVos.clear();
|
// for (int t : type) {
|
// problemlistVos.addAll(problemCategories.get(t).getProblemlistVos());
|
// }
|
// if (type.isEmpty()) {
|
// for (ProblemCategoryVo p : problemCategories) {
|
// problemlistVos.addAll(p.getProblemlistVos());
|
// }
|
// }
|
// refreshViewPager();
|
// }
|
// //</editor-fold>
|
//
|
// //<editor-fold desc="popupWindow">
|
// private FilterPopupWindow popupWindow;
|
// private boolean popupIsShowing;
|
//
|
// @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
// private void initPopup() {
|
// popupWindow = new FilterPopupWindow(this, problemCategories);
|
// }
|
//
|
// private void popShow() {
|
// popupWindow.showAtLocation(action_bar, Gravity.BOTTOM, 0, 0);
|
// popupIsShowing = true;
|
//
|
// setWindowAloha(0.6f);
|
// }
|
//
|
// private void popDismiss() {
|
// popupWindow.dismiss();
|
// popupIsShowing = false;
|
// }
|
//
|
// private void setWindowAloha(float f) {
|
// Window window=getWindow();
|
// WindowManager.LayoutParams wl = window.getAttributes();
|
// wl.alpha = f;
|
// window.setAttributes(wl);
|
// }
|
//
|
// private void popupRefresh() {
|
// popupWindow.notifyDataSetChanged();
|
// }
|
//
|
// class FilterPopupWindow extends PopupWindow {
|
//
|
// private List<ProblemCategoryVo> datas;
|
// RecyclerView rv_problem_type;
|
// AllRecyclerViewAdapter<ProblemCategoryVo> adapter;
|
//
|
// @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
// public FilterPopupWindow(Context context, List<ProblemCategoryVo> datas) {
|
// super(context);
|
// this.datas = datas;
|
// setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
|
// setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
|
// setElevation(2f);
|
// setBackgroundDrawable(null);
|
// setOutsideTouchable(true);
|
// setFocusable(true);
|
// setAnimationStyle(R.style.popwin_anim_style);
|
// setOnDismissListener(new OnDismissListener() {
|
// @Override
|
// public void onDismiss() {
|
// setWindowAloha(1f);
|
// }
|
// });
|
// View contentView = LayoutInflater.from(ProblemChangeActivity_B.this).inflate(R.layout.popup_problem_selector, null, false);
|
// initView(contentView);
|
// setClickListener(contentView);
|
// setContentView(contentView);
|
// }
|
//
|
// private void initView(View view) {
|
// rv_problem_type = view.findViewById(R.id.rv_problem_type_2);
|
// adapter = new AllRecyclerViewAdapter<ProblemCategoryVo>(datas,
|
// R.layout.item_problem_type,
|
// ProblemChangeActivity_B.this) {
|
// @Override
|
// public void bindView(final MyViewHolder holder, final ProblemCategoryVo obj, final boolean isSelected, final int position) {
|
// final Integer pos = position;
|
// //填充问题类型名称
|
// holder.setText(R.id.text_problem_type, obj.getProblemTypeName());
|
//
|
// //根据问题数量设置点击事件
|
// if (obj.getTotalCount() == 0) {
|
// holder.setAlpha(R.id.text_problem_type, 0.2f);
|
// holder.setOnClickListener(R.id.text_problem_type, null);
|
// } else {
|
// holder.setOnClickListener(R.id.text_problem_type, new View.OnClickListener() {
|
// @Override
|
// public void onClick(View v) {
|
// v.setSelected(!v.isSelected());
|
// if (v.isSelected()) {
|
// newSelectedTypes.add(pos);
|
// } else {
|
// newSelectedTypes.remove(pos);
|
// }
|
// }
|
// });
|
// holder.setAlpha(R.id.text_problem_type, 1f);
|
// }
|
//
|
// //根据用户的选择设置是否选择状态
|
// if (curSelectedTypes.contains(pos)) {
|
// holder.setSelected(R.id.text_problem_type, true);
|
// } else {
|
// holder.setSelected(R.id.text_problem_type, false);
|
// }
|
// }
|
// };
|
//
|
// GridLayoutManager layoutManager = new GridLayoutManager(ProblemChangeActivity_B.this, 3);
|
// layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
|
// rv_problem_type.setLayoutManager(layoutManager);
|
// rv_problem_type.setAdapter(adapter);
|
// }
|
//
|
// private void setClickListener(View v) {
|
// TextView text_complete = v.findViewById(R.id.text_complete);
|
// TextView text_cancel = v.findViewById(R.id.text_cancel);
|
// text_complete.setOnClickListener(new View.OnClickListener() {
|
// @Override
|
// public void onClick(View v) {
|
// popDismiss();
|
// curSelectedTypes.clear();
|
// curSelectedTypes.addAll(newSelectedTypes);
|
// showSelectedProblemType(curSelectedTypes);
|
// popupRefresh();
|
// }
|
// });
|
// text_cancel.setOnClickListener(new View.OnClickListener() {
|
// @Override
|
// public void onClick(View v) {
|
// popDismiss();
|
// }
|
// });
|
// }
|
//
|
// public void notifyDataSetChanged() {
|
// adapter.notifyDataSetChanged();
|
// }
|
// }
|
// //</editor-fold>
|
//}
|