| | |
| | | package com.application.zhangshi_app_android.ui.home; |
| | | |
| | | import android.animation.Animator; |
| | | import android.animation.AnimatorListenerAdapter; |
| | | import android.animation.ObjectAnimator; |
| | | import android.annotation.SuppressLint; |
| | | import android.graphics.drawable.ColorDrawable; |
| | | import android.os.Bundle; |
| | | import android.view.GestureDetector; |
| | | import android.view.MotionEvent; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | | import android.view.animation.AlphaAnimation; |
| | | import android.view.animation.Animation; |
| | | import android.view.animation.AnimationSet; |
| | | import android.view.animation.ScaleAnimation; |
| | | import android.widget.PopupWindow; |
| | | import android.widget.TextView; |
| | | |
| | | import androidx.constraintlayout.utils.widget.ImageFilterView; |
| | | import androidx.constraintlayout.widget.ConstraintLayout; |
| | | import androidx.databinding.DataBindingUtil; |
| | | import androidx.lifecycle.Observer; |
| | | |
| | | import com.android.app_base.base.view.BaseFragment; |
| | | import com.android.app_base.manager.AppManager; |
| | | import com.android.app_base.utils.GlideUtil; |
| | | import com.android.app_base.utils.ScreenSizeUtils; |
| | | import com.android.app_base.widget.LinearItemDecoration; |
| | | import com.application.zhangshi_app_android.BR; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.adapter.HomeMemberAdapter; |
| | | import com.application.zhangshi_app_android.bean.HomeMemberBean; |
| | | import com.application.zhangshi_app_android.bean.HomeRootBean; |
| | | import com.application.zhangshi_app_android.databinding.FragmentHomeBinding; |
| | | import com.application.zhangshi_app_android.databinding.PopBasicInformationBinding; |
| | | import com.application.zhangshi_app_android.databinding.PopBasicInformationDoubleBinding; |
| | | import com.application.zhangshi_app_android.databinding.PopBasicInformationSingleBinding; |
| | | import com.application.zhangshi_app_android.ui.DLBaseFragment; |
| | | import com.hjq.bar.TitleBar; |
| | | import com.application.zhangshi_app_android.widget.HomeMindMapLayout; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | */ |
| | | public class HomeFragment extends DLBaseFragment<FragmentHomeBinding,HomeFragmentViewModel> { |
| | | private PopupWindow mOperatePopupWindow; |
| | | private ViewOperator firstViewOperator1;//第一代 |
| | | private ViewOperator firstViewOperator2;//第一代 |
| | | private List<ViewOperator> secondSelfList;//第二代四个分支 |
| | | private List<ViewOperator> secondSpouseList;//第二代四个分支的配偶 |
| | | |
| | | private List<List<ViewOperator>> thirdSelfListList;//第三代四个分支的列表 |
| | | |
| | | |
| | | private List<List<ViewOperator>> fourthSelfListList;//第四代四个分支的列表 |
| | | |
| | | |
| | | |
| | | public HomeFragment() { |
| | | } |
| | | |
| | |
| | | binding.ivOperate.setOnClickListener(v -> { |
| | | mOperatePopupWindow.showAsDropDown(binding.ivOperate,-ScreenSizeUtils.dip2px(getSelfActivity(),120) +binding.ivOperate.getWidth(),0); |
| | | }); |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_first).setOnClickListener(v -> { |
| | | binding.ivTreeViewDiff.setBackgroundResource(R.drawable.bg_home_root_net_detail_first); |
| | | viewModel.setIndexLiveData(0); |
| | | }); |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_second).setOnClickListener(v -> { |
| | | binding.ivTreeViewDiff.setBackgroundResource(R.drawable.bg_home_root_net_detail_second); |
| | | viewModel.setIndexLiveData(1); |
| | | }); |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_third).setOnClickListener(v -> { |
| | | binding.ivTreeViewDiff.setBackgroundResource(R.drawable.bg_home_root_net_detail_third); |
| | | viewModel.setIndexLiveData(2); |
| | | }); |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_all).setOnClickListener(v -> { |
| | | binding.ivTreeViewDiff.setBackgroundResource(R.drawable.bg_home_root_net_detail); |
| | | viewModel.setIndexLiveData(3); |
| | | }); |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_family).setOnClickListener(v -> { |
| | | AppManager.getAppManager().startActivity(GenealogyActivity.class); |
| | | mOperatePopupWindow.dismiss(); |
| | | }); |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_relation).setOnClickListener(v -> { |
| | | AppManager.getAppManager().startActivity(HomeMindMapActivity.class); |
| | | mOperatePopupWindow.dismiss(); |
| | | binding.scrollHomeMindMapLayout.setOnItemClickListener(new HomeMindMapLayout.OnItemClickListener() { |
| | | @Override |
| | | public void onItemClick(View view, HomeRootBean bean) { |
| | | View contentView; |
| | | if (bean.getSpouse()!=null) { |
| | | bean.getSpouse().setSpouse(bean); |
| | | PopBasicInformationDoubleBinding binding= DataBindingUtil.inflate(getLayoutInflater(),R.layout.pop_basic_information_double,null,false); |
| | | binding.setSelfBean(bean); |
| | | binding.setSpouseBean(bean.getSpouse()); |
| | | contentView = binding.getRoot(); |
| | | }else { |
| | | PopBasicInformationSingleBinding binding = DataBindingUtil.inflate(getLayoutInflater(),R.layout.pop_basic_information_single,null,false); |
| | | binding.setSelfBean(bean); |
| | | contentView = binding.getRoot(); |
| | | } |
| | | PopupWindow popupWindow = new PopupWindow(); |
| | | // 设置布局文件 |
| | | popupWindow.setContentView(contentView); |
| | | // 为了避免部分机型不显示,需要重新设置一下宽高 |
| | | popupWindow.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT); |
| | | popupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT); |
| | | // 设置pop透明效果 |
| | | popupWindow.setBackgroundDrawable(new ColorDrawable(0x0000)); |
| | | // 设置pop出入动画 |
| | | popupWindow.setAnimationStyle(com.android.app_base.R.style.pop_info); |
| | | // 设置pop获取焦点,如果为false点击返回按钮会退出当前Activity,如果pop中有Editor的话,focusable必须要为true |
| | | popupWindow.setFocusable(true); |
| | | // 设置pop可点击,为false点击事件无效,默认为true |
| | | popupWindow.setTouchable(true); |
| | | // 设置点击pop外侧消失,默认为false;在focusable为true时点击外侧始终消失 |
| | | popupWindow.setOutsideTouchable(false); |
| | | |
| | | |
| | | popupWindow.setHeight(binding.zoomLayout.getHeight()); |
| | | popupWindow.setWidth(binding.zoomLayout.getWidth()); |
| | | popupWindow.showAsDropDown(binding.titleBar,0,0); |
| | | } |
| | | }); |
| | | // final GestureDetector gestureDetector = new GestureDetector(getSelfActivity(), new GestureDetector.SimpleOnGestureListener() { |
| | | // @Override |
| | | // public boolean onDoubleTap(MotionEvent e) { |
| | | // AlphaAnimation alphaAnimation = new AlphaAnimation(0f, 1f); |
| | | // alphaAnimation.setDuration(1000); |
| | | // alphaAnimation.setAnimationListener(new Animation.AnimationListener() { |
| | | // @Override |
| | | // public void onAnimationStart(Animation animation) { |
| | | // binding.scrollView.setVisibility(View.VISIBLE); |
| | | // binding.scrollView.post(new Runnable() { |
| | | // @Override |
| | | // public void run() { |
| | | // binding.scrollView.scrollTo(binding.scrollView.getChildAt(0).getMeasuredWidth()/2 - ScreenSizeUtils.getScreenWidth(getSelfActivity())/2,0); |
| | | // } |
| | | // }); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void onAnimationEnd(Animation animation) { |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void onAnimationRepeat(Animation animation) { |
| | | // |
| | | // } |
| | | // }); |
| | | // |
| | | // AlphaAnimation alphaAnimation1 = new AlphaAnimation(1f, 0f); |
| | | // alphaAnimation1.setDuration(1000); |
| | | // alphaAnimation1.setAnimationListener(new Animation.AnimationListener() { |
| | | // @Override |
| | | // public void onAnimationStart(Animation animation) { |
| | | // binding.layoutHomeRootNet.setVisibility(View.VISIBLE); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void onAnimationEnd(Animation animation) { |
| | | // binding.layoutHomeRootNet.setVisibility(View.GONE); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void onAnimationRepeat(Animation animation) { |
| | | // |
| | | // } |
| | | // }); |
| | | // |
| | | // float scale = binding.layoutHomeRootNet.getWidth()/ (binding.ivTreeView.getWidth() * 2f / 3f); |
| | | // //缩放动画 |
| | | // ScaleAnimation scaleAnimation = new ScaleAnimation(1f, scale, 1f, scale, binding.layoutHomeRootNet.getWidth()/2f, binding.layoutHomeRootNet.getHeight()/2f); |
| | | // scaleAnimation.setDuration(1000); |
| | | // scaleAnimation.setAnimationListener(new Animation.AnimationListener() { |
| | | // @Override |
| | | // public void onAnimationStart(Animation animation) { |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void onAnimationEnd(Animation animation) { |
| | | // binding.scrollView.startAnimation(alphaAnimation); |
| | | // binding.layoutHomeRootNet.startAnimation(alphaAnimation1); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void onAnimationRepeat(Animation animation) { |
| | | // |
| | | // } |
| | | // }); |
| | | // binding.layoutHomeRootNet.startAnimation(scaleAnimation); |
| | | // |
| | | // return true; |
| | | // } |
| | | // }); |
| | | // binding.layoutHomeRootNet.setOnTouchListener(new View.OnTouchListener() { |
| | | // @Override |
| | | // public boolean onTouch(View v, MotionEvent event) { |
| | | // gestureDetector.onTouchEvent(event); |
| | | // return true; |
| | | // } |
| | | // }); |
| | | binding.layoutHomeRootNet.setVisibility(View.GONE); |
| | | binding.scrollView.setVisibility(View.VISIBLE); |
| | | |
| | | |
| | | firstViewOperator1 = new ViewOperator(binding.tvFirst1,binding.ivFirst1); |
| | | firstViewOperator2 = new ViewOperator(binding.tvFirst2,binding.ivFirst2); |
| | | |
| | | secondSelfList = new ArrayList<>(); |
| | | secondSpouseList = new ArrayList<>(); |
| | | secondSelfList.add(new ViewOperator(binding.tvSecond11,binding.ivSecond11)); |
| | | secondSpouseList.add(new ViewOperator(binding.tvSecond12,binding.ivSecond12)); |
| | | secondSelfList.add(new ViewOperator(binding.tvSecond21,binding.ivSecond21)); |
| | | secondSpouseList.add(new ViewOperator(binding.tvSecond22,binding.ivSecond22)); |
| | | secondSelfList.add(new ViewOperator(binding.tvSecond31,binding.ivSecond31)); |
| | | secondSpouseList.add(new ViewOperator(binding.tvSecond32,binding.ivSecond32)); |
| | | secondSelfList.add(new ViewOperator(binding.tvSecond41,binding.ivSecond41)); |
| | | secondSpouseList.add(new ViewOperator(binding.tvSecond42,binding.ivSecond42)); |
| | | |
| | | thirdSelfListList = new ArrayList<>(); |
| | | |
| | | List<ViewOperator> thirdSelfList1 = new ArrayList<>(); |
| | | thirdSelfList1.add(new ViewOperator(binding.tvThird11,binding.ivThird11)); |
| | | thirdSelfList1.add(new ViewOperator(binding.tvThird12,binding.ivThird12)); |
| | | thirdSelfList1.add(new ViewOperator(binding.tvThird13,binding.ivThird13)); |
| | | thirdSelfList1.add(new ViewOperator(binding.tvThird14,binding.ivThird14)); |
| | | thirdSelfListList.add(thirdSelfList1); |
| | | |
| | | List<ViewOperator> thirdSelfList2 = new ArrayList<>(); |
| | | thirdSelfList2.add(new ViewOperator(binding.tvThird21,binding.ivThird21)); |
| | | thirdSelfList2.add(new ViewOperator(binding.tvThird22,binding.ivThird22)); |
| | | thirdSelfList2.add(new ViewOperator(binding.tvThird23,binding.ivThird23)); |
| | | thirdSelfList2.add(new ViewOperator(binding.tvThird24,binding.ivThird24)); |
| | | thirdSelfListList.add(thirdSelfList2); |
| | | |
| | | List<ViewOperator> thirdSelfList3 = new ArrayList<>(); |
| | | thirdSelfList3.add(new ViewOperator(binding.tvThird31,binding.ivThird31)); |
| | | thirdSelfList3.add(new ViewOperator(binding.tvThird32,binding.ivThird32)); |
| | | thirdSelfList3.add(new ViewOperator(binding.tvThird33,binding.ivThird33)); |
| | | thirdSelfList3.add(new ViewOperator(binding.tvThird34,binding.ivThird34)); |
| | | thirdSelfListList.add(thirdSelfList3); |
| | | |
| | | List<ViewOperator> thirdSelfList4 = new ArrayList<>(); |
| | | thirdSelfList4.add(new ViewOperator(binding.tvThird41,binding.ivThird41)); |
| | | thirdSelfList4.add(new ViewOperator(binding.tvThird42,binding.ivThird42)); |
| | | thirdSelfListList.add(thirdSelfList4); |
| | | |
| | | fourthSelfListList = new ArrayList<>(); |
| | | |
| | | List<ViewOperator> fourthSelfList1 = new ArrayList<>(); |
| | | fourthSelfList1.add(new ViewOperator(binding.tvFourth11,binding.ivFourth11)); |
| | | fourthSelfList1.add(new ViewOperator(binding.tvFourth12,binding.ivFourth12)); |
| | | fourthSelfListList.add(fourthSelfList1); |
| | | |
| | | List<ViewOperator> fourthSelfList2 = new ArrayList<>(); |
| | | fourthSelfList2.add(new ViewOperator(binding.tvFourth21,binding.ivFourth21)); |
| | | fourthSelfList2.add(new ViewOperator(binding.tvFourth22,binding.ivFourth22)); |
| | | fourthSelfList2.add(new ViewOperator(binding.tvFourth23,binding.ivFourth23)); |
| | | fourthSelfList2.add(new ViewOperator(binding.tvFourth24,binding.ivFourth24)); |
| | | fourthSelfListList.add(fourthSelfList2); |
| | | |
| | | List<ViewOperator> fourthSelfList3 = new ArrayList<>(); |
| | | fourthSelfList3.add(new ViewOperator(binding.tvFourth31,binding.ivFourth31)); |
| | | fourthSelfList3.add(new ViewOperator(binding.tvFourth32,binding.ivFourth32)); |
| | | fourthSelfList3.add(new ViewOperator(binding.tvFourth33,binding.ivFourth33)); |
| | | fourthSelfList3.add(new ViewOperator(binding.tvFourth34,binding.ivFourth34)); |
| | | fourthSelfListList.add(fourthSelfList3); |
| | | |
| | | List<ViewOperator> fourthSelfList4 = new ArrayList<>(); |
| | | fourthSelfList4.add(new ViewOperator(binding.tvFourth41,binding.ivFourth41)); |
| | | fourthSelfList4.add(new ViewOperator(binding.tvFourth42,binding.ivFourth42)); |
| | | fourthSelfList4.add(new ViewOperator(binding.tvFourth43,binding.ivFourth43)); |
| | | fourthSelfListList.add(fourthSelfList4); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | @Override |
| | | protected void initLiveDataObserve() { |
| | | viewModel.getIndexLiveData().observe(this, new Observer<Integer>() { |
| | | @Override |
| | | public void onChanged(Integer integer) { |
| | | firstViewOperator1.setVisibility(View.VISIBLE); |
| | | firstViewOperator2.setVisibility(View.VISIBLE); |
| | | if (integer == 0){ |
| | | for (ViewOperator viewOperator : secondSelfList) { |
| | | viewOperator.setVisibility(View.GONE); |
| | | } |
| | | for (ViewOperator viewOperator : secondSpouseList) { |
| | | viewOperator.setVisibility(View.GONE); |
| | | } |
| | | for (List<ViewOperator> viewOperators : thirdSelfListList) { |
| | | for (ViewOperator viewOperator : viewOperators) { |
| | | viewOperator.setVisibility(View.GONE); |
| | | } |
| | | } |
| | | for (List<ViewOperator> viewOperators : fourthSelfListList) { |
| | | for (ViewOperator viewOperator : viewOperators) { |
| | | viewOperator.setVisibility(View.GONE); |
| | | } |
| | | } |
| | | }else if (integer == 1){ |
| | | for (int i = 0; i < secondSelfList.size(); i++) { |
| | | if (secondSelfList.get(i).selfBean != null) { |
| | | secondSelfList.get(i).setVisibility(View.VISIBLE); |
| | | }else { |
| | | secondSelfList.get(i).setVisibility(View.GONE); |
| | | } |
| | | if (secondSpouseList.get(i).selfBean != null) { |
| | | secondSpouseList.get(i).setVisibility(View.VISIBLE); |
| | | }else { |
| | | secondSpouseList.get(i).setVisibility(View.GONE); |
| | | } |
| | | } |
| | | for (List<ViewOperator> viewOperators : thirdSelfListList) { |
| | | for (ViewOperator viewOperator : viewOperators) { |
| | | viewOperator.setVisibility(View.GONE); |
| | | } |
| | | } |
| | | for (List<ViewOperator> viewOperators : fourthSelfListList) { |
| | | for (ViewOperator viewOperator : viewOperators) { |
| | | viewOperator.setVisibility(View.GONE); |
| | | } |
| | | } |
| | | }else if (integer == 2){ |
| | | for (int i = 0; i < secondSelfList.size(); i++) { |
| | | if (secondSelfList.get(i).selfBean != null) { |
| | | secondSelfList.get(i).setVisibility(View.VISIBLE); |
| | | }else { |
| | | secondSelfList.get(i).setVisibility(View.GONE); |
| | | } |
| | | if (secondSpouseList.get(i).selfBean != null) { |
| | | secondSpouseList.get(i).setVisibility(View.VISIBLE); |
| | | }else { |
| | | secondSpouseList.get(i).setVisibility(View.GONE); |
| | | } |
| | | } |
| | | for (List<ViewOperator> viewOperators : thirdSelfListList) { |
| | | for (ViewOperator viewOperator : viewOperators) { |
| | | if (viewOperator.selfBean != null) { |
| | | viewOperator.setVisibility(View.VISIBLE); |
| | | }else { |
| | | viewOperator.setVisibility(View.GONE); |
| | | } |
| | | } |
| | | } |
| | | for (List<ViewOperator> viewOperators : fourthSelfListList) { |
| | | for (ViewOperator viewOperator : viewOperators) { |
| | | viewOperator.setVisibility(View.GONE); |
| | | } |
| | | } |
| | | }else if (integer == 3){ |
| | | for (int i = 0; i < secondSelfList.size(); i++) { |
| | | if (secondSelfList.get(i).selfBean != null) { |
| | | secondSelfList.get(i).setVisibility(View.VISIBLE); |
| | | }else { |
| | | secondSelfList.get(i).setVisibility(View.GONE); |
| | | } |
| | | if (secondSpouseList.get(i).selfBean != null) { |
| | | secondSpouseList.get(i).setVisibility(View.VISIBLE); |
| | | }else { |
| | | secondSpouseList.get(i).setVisibility(View.GONE); |
| | | } |
| | | } |
| | | for (List<ViewOperator> viewOperators : thirdSelfListList) { |
| | | for (ViewOperator viewOperator : viewOperators) { |
| | | if (viewOperator.selfBean != null) { |
| | | viewOperator.setVisibility(View.VISIBLE); |
| | | }else { |
| | | viewOperator.setVisibility(View.GONE); |
| | | } |
| | | } |
| | | } |
| | | for (List<ViewOperator> viewOperators : fourthSelfListList) { |
| | | for (ViewOperator viewOperator : viewOperators) { |
| | | if (viewOperator.selfBean != null) { |
| | | viewOperator.setVisibility(View.VISIBLE); |
| | | }else { |
| | | viewOperator.setVisibility(View.GONE); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | |
| | | viewModel.getHomeRootBeanLiveData().observe(this, new Observer<List<HomeRootBean>>() { |
| | | @Override |
| | | public void onChanged(List<HomeRootBean> homeRootBeans) { |
| | | if (homeRootBeans.size() > 0){ |
| | | //填充第一代数据 |
| | | firstViewOperator1.setBean(homeRootBeans.get(0),homeRootBeans.get(0).getSpouse()); |
| | | firstViewOperator2.setBean(homeRootBeans.get(0).getSpouse(),homeRootBeans.get(0)); |
| | | |
| | | List<HomeRootBean> secondGeneration = homeRootBeans.get(0).getChildList();//第二代人员 |
| | | for (int i = 0; i < Math.min(homeRootBeans.get(0).getChildList().size(),4); i++) { |
| | | //填充第i分支的第二代数据 |
| | | secondSelfList.get(i).setBean(secondGeneration.get(i),secondGeneration.get(i).getSpouse()); |
| | | secondSpouseList.get(i).setBean(secondGeneration.get(i).getSpouse(),secondGeneration.get(i)); |
| | | |
| | | List<HomeRootBean> thirdGeneration = secondGeneration.get(i).getChildList();//第i分支的第三代人员 |
| | | List<ViewOperator> thirdList = thirdSelfListList.get(i);//第i分支的第三代对应view |
| | | |
| | | List<HomeRootBean> fourthGeneration = new ArrayList<>();//第i分支的第四代人员 |
| | | List<ViewOperator> fourthList = fourthSelfListList.get(i);//第i分支的第四代对应view |
| | | |
| | | for (int j = 0; j < Math.min(thirdGeneration.size(),thirdList.size()); j++) { |
| | | //填充第i分支下的第三代数据 |
| | | thirdList.get(j).setBean(thirdGeneration.get(j),thirdGeneration.get(j).getSpouse()); |
| | | |
| | | fourthGeneration.addAll(thirdGeneration.get(j).getChildList());//收集第i分支下的全部第四代人员 |
| | | } |
| | | |
| | | for (int j = 0; j < Math.min(fourthGeneration.size(),fourthList.size()); j++) { |
| | | //填充第i分支下的第四代数据 |
| | | fourthList.get(j).setBean(fourthGeneration.get(j),fourthGeneration.get(j).getSpouse()); |
| | | } |
| | | } |
| | | if (homeRootBeans == null || homeRootBeans.size() == 0) { |
| | | return; |
| | | } |
| | | binding.scrollHomeMindMapLayout.setRootMember(homeRootBeans.get(0)); |
| | | } |
| | | }); |
| | | } |
| | |
| | | return true; |
| | | } |
| | | |
| | | private class ViewOperator{ |
| | | private TextView tvIndex; |
| | | private ImageFilterView ivHead; |
| | | private HomeRootBean selfBean; |
| | | private HomeRootBean spouseBean; |
| | | |
| | | public ViewOperator(TextView tvIndex, ImageFilterView ivHead) { |
| | | this.tvIndex = tvIndex; |
| | | this.ivHead = ivHead; |
| | | } |
| | | |
| | | public void setVisibility(int visibility){ |
| | | tvIndex.setVisibility(visibility); |
| | | ivHead.setVisibility(visibility); |
| | | } |
| | | public void setBean(HomeRootBean selfBean, HomeRootBean spouseBean) { |
| | | this.selfBean = selfBean; |
| | | this.spouseBean = spouseBean; |
| | | if (selfBean == null){ |
| | | tvIndex.setVisibility(View.GONE); |
| | | ivHead.setVisibility(View.GONE); |
| | | return; |
| | | }else { |
| | | tvIndex.setVisibility(View.VISIBLE); |
| | | ivHead.setVisibility(View.VISIBLE); |
| | | } |
| | | GlideUtil.loadImage(selfBean.getImg(), ivHead); |
| | | View.OnClickListener clickListener = new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | PopBasicInformationBinding mBinding= DataBindingUtil.inflate(getLayoutInflater(),R.layout.pop_basic_information,null,false); |
| | | PopupWindow mPopupWindow = initPopUpWindow(mBinding.getRoot()); |
| | | mPopupWindow.setHeight(binding.layoutParent.getHeight()); |
| | | mPopupWindow.setWidth(binding.layoutParent.getWidth()); |
| | | mBinding.setSelfBean(selfBean); |
| | | mBinding.setSpouseBean(spouseBean); |
| | | mPopupWindow.showAsDropDown(binding.titleBar,0,0); |
| | | } |
| | | }; |
| | | ivHead.setOnClickListener(clickListener); |
| | | tvIndex.setOnClickListener(clickListener); |
| | | } |
| | | |
| | | public TextView getTvIndex() { |
| | | return tvIndex; |
| | | } |
| | | |
| | | public void setTvIndex(TextView tvIndex) { |
| | | this.tvIndex = tvIndex; |
| | | } |
| | | |
| | | public ImageFilterView getIvHead() { |
| | | return ivHead; |
| | | } |
| | | |
| | | public void setIvHead(ImageFilterView ivHead) { |
| | | this.ivHead = ivHead; |
| | | } |
| | | |
| | | public HomeRootBean getSelfBean() { |
| | | return selfBean; |
| | | } |
| | | |
| | | public void setSelfBean(HomeRootBean selfBean) { |
| | | this.selfBean = selfBean; |
| | | } |
| | | |
| | | public HomeRootBean getSpouseBean() { |
| | | return spouseBean; |
| | | } |
| | | |
| | | public void setSpouseBean(HomeRootBean spouseBean) { |
| | | this.spouseBean = spouseBean; |
| | | } |
| | | } |
| | | } |