| | |
| | | package com.application.zhangshi_app_android.ui.function; |
| | | |
| | | import android.graphics.drawable.ColorDrawable; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | | import android.widget.PopupWindow; |
| | | |
| | | import androidx.databinding.DataBindingUtil; |
| | | |
| | | 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.FamilyAssetsRvAdapter; |
| | | import com.application.zhangshi_app_android.adapter.GrowthExperiencePrimaryRvAdapter; |
| | | import com.application.zhangshi_app_android.bean.GrowthExperienceBean; |
| | | import com.application.zhangshi_app_android.databinding.ActivityGrowthExperienceBinding; |
| | | import com.application.zhangshi_app_android.ui.DLBaseActivity; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author Gss |
| | |
| | | * @desc 成长经历 GrowthExperienceActivity |
| | | */ |
| | | public class GrowthExperienceActivity extends DLBaseActivity<ActivityGrowthExperienceBinding,GrowthExperienceActivityViewModel> { |
| | | private GrowthExperiencePrimaryRvAdapter adapter; |
| | | |
| | | |
| | | @Override |
| | | public int getLayoutId() { |
| | |
| | | |
| | | @Override |
| | | public void initParam() { |
| | | |
| | | GrowthExperienceBean bean = new GrowthExperienceBean("name", "date", "content"); |
| | | List<GrowthExperienceBean> dataList=new ArrayList<>(); |
| | | dataList.add(new GrowthExperienceBean("2010-2016","**小学","张三")); |
| | | dataList.add(new GrowthExperienceBean("2017-2020","**中学","李四")); |
| | | adapter=new GrowthExperiencePrimaryRvAdapter(this,dataList); |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public void initView() { |
| | | adapter = new GrowthExperiencePrimaryRvAdapter(this); |
| | | LinearItemDecoration itemDecoration = new LinearItemDecoration(); |
| | | itemDecoration.setBottomSpace((int) getResources().getDimension(com.android.app_base.R.dimen.dp_12)); |
| | | itemDecoration.setHorizontalSpace((int) getResources().getDimension(com.android.app_base.R.dimen.dp_20)); |
| | | itemDecoration.setFirstTop((int) getResources().getDimension(com.android.app_base.R.dimen.dp_20)); |
| | | binding.rvPrimary.addItemDecoration(itemDecoration); |
| | | binding.rvPrimary.setAdapter(adapter); |
| | | binding.rvRelationship.addItemDecoration(itemDecoration); |
| | | binding.rvRelationship.setAdapter(adapter); |
| | | binding.rvCertificates.addItemDecoration(itemDecoration); |
| | | binding.rvCertificates.setAdapter(adapter); |
| | | binding.rvAbroad.addItemDecoration(itemDecoration); |
| | | binding.rvAbroad.setAdapter(adapter); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void initData() { |
| | | |
| | | viewModel.getGrowthExperience(); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void initLiveDataObserve() { |
| | | ActivityGrowthExperienceBinding binding1= DataBindingUtil.setContentView(this,R.layout.activity_growth_experience); |
| | | ActivityGrowthExperienceBinding binding2= DataBindingUtil.setContentView(this,R.layout.activity_growth_experience); |
| | | ActivityGrowthExperienceBinding binding3= DataBindingUtil.setContentView(this,R.layout.activity_growth_experience); |
| | | ActivityGrowthExperienceBinding binding4= DataBindingUtil.setContentView(this,R.layout.activity_growth_experience); |
| | | |
| | | viewModel.getDataListLiveData().observe(this, GrowthExperienceBeans -> { |
| | | adapter.setData(GrowthExperienceBeans); |
| | | }); |
| | | } |
| | | |
| | | |
| | | private PopupWindow initPopUpWindow(View view){ |
| | | PopupWindow popupWindow = new PopupWindow(this); |
| | | // 设置布局文件 |
| | | popupWindow.setContentView(view); |
| | | // 为了避免部分机型不显示,需要重新设置一下宽高 |
| | | 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_add); |
| | | // 设置pop获取焦点,如果为false点击返回按钮会退出当前Activity,如果pop中有Editor的话,focusable必须要为true |
| | | popupWindow.setFocusable(true); |
| | | // 设置pop可点击,为false点击事件无效,默认为true |
| | | popupWindow.setTouchable(true); |
| | | // 设置点击pop外侧消失,默认为false;在focusable为true时点击外侧始终消失 |
| | | popupWindow.setOutsideTouchable(false); |
| | | return popupWindow; |
| | | } |
| | | } |