| | |
| | | |
| | | import androidx.recyclerview.widget.GridLayoutManager; |
| | | |
| | | import com.android.app_base.utils.ScreenSizeUtils; |
| | | import com.android.app_base.utils.Utils; |
| | | 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.ImageRvAdapter; |
| | | import com.application.zhangshi_app_android.adapter.ElectronicFileAddAdapter; |
| | | import com.application.zhangshi_app_android.adapter.MemoRvAdapter; |
| | | import com.application.zhangshi_app_android.bean.FamilyAssetsBean; |
| | | import com.application.zhangshi_app_android.databinding.ActivityFamilyAssetsDetailBinding; |
| | | import com.application.zhangshi_app_android.ui.DLBaseActivity; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author Ljj |
| | | * @date 2023.04.03. 21:46 |
| | | * @desc |
| | | * @desc 家庭资产详情 |
| | | */ |
| | | public class FamilyAssetsDetailActivity extends DLBaseActivity<ActivityFamilyAssetsDetailBinding,FamilyAssetsDetailActivityViewModel> { |
| | | private ImageRvAdapter adapter; |
| | | |
| | | private ElectronicFileAddAdapter adapter; |
| | | private MemoRvAdapter memoRvAdapter; |
| | | |
| | | @Override |
| | | public int getLayoutId() { |
| | |
| | | |
| | | @Override |
| | | public void initView() { |
| | | adapter = new ImageRvAdapter(this); |
| | | adapter = new ElectronicFileAddAdapter(this); |
| | | GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 3); |
| | | binding.rvImage.setLayoutManager(gridLayoutManager); |
| | | binding.rvImage.setNestedScrollingEnabled(false); |
| | | binding.rvImage.setAdapter(adapter); |
| | | |
| | | memoRvAdapter = new MemoRvAdapter(this); |
| | | LinearItemDecoration itemDecoration = new LinearItemDecoration(); |
| | | itemDecoration.setBottomSpace(ScreenSizeUtils.dip2px(this, 15)); |
| | | binding.rvMemo.addItemDecoration(itemDecoration); |
| | | binding.rvMemo.setAdapter(memoRvAdapter); |
| | | |
| | | setIsEdited(false); |
| | | } |
| | | |
| | | @Override |
| | | public void initData() { |
| | | |
| | | viewModel.getMemos(); |
| | | } |
| | | |
| | | @Override |
| | | public void initLiveDataObserve() { |
| | | viewModel.getBeanLiveData().observe(this,bean -> { |
| | | if (bean!=null){ |
| | | if (getTitleBar() != null){ |
| | | getTitleBar().setTitle(bean.getHolder() + "的" + bean.getType()); |
| | | } |
| | | String url = bean.getUrl(); |
| | | if (url == null||url.isEmpty()){ |
| | | return; |
| | | } |
| | | List<String> list; |
| | | if (url.contains(",")){ |
| | | String[] split = url.split(","); |
| | | list = new ArrayList<>(Arrays.asList(split)); |
| | | }else { |
| | | list = new ArrayList<>(); |
| | | list.add(url); |
| | | } |
| | | adapter.setData(list); |
| | | adapter.setData(Utils.splitString2List(bean.getUrl(),",")); |
| | | } |
| | | }); |
| | | viewModel.getMemoListLiveData().observe(this, memoBeans -> { |
| | | if (memoBeans!=null){ |
| | | memoRvAdapter.setData(memoBeans); |
| | | } |
| | | }); |
| | | } |
| | |
| | | public void setIsEdited(boolean isEdited){ |
| | | disableAllEditText(getContentView(),isEdited); |
| | | adapter.setIsEdited(isEdited); |
| | | memoRvAdapter.setEdited(isEdited); |
| | | } |
| | | public void disableAllEditText(ViewGroup viewGroup, boolean isEdited) { |
| | | for (int i = 0; i < viewGroup.getChildCount(); i++) { |