Commit 7612afffafb4d3e0966b87cc7fbf2c18b2125679
1 parent
a661afd4
1 搭建机构认证绑定页面
Showing
6 changed files
with
106 additions
and
44 deletions
core/dentity_verfication/src/main/java/com/cnlive/core/company_verfication/ui/adapter/CompanyItemDataAdapter.java
| ... | ... | @@ -14,7 +14,6 @@ import com.cnlive.core.people_verfication.databinding.ItemCompanyDataTypeChildAc |
| 14 | 14 | import com.cnlive.core.people_verfication.databinding.ItemCompanyDataTypeCircleChildBinding; |
| 15 | 15 | import com.cnlive.core.people_verfication.databinding.ItemCompanyDataTypeOrganizationBinding; |
| 16 | 16 | |
| 17 | -import java.util.ArrayList; | |
| 18 | 17 | import java.util.List; |
| 19 | 18 | |
| 20 | 19 | import androidx.annotation.NonNull; |
| ... | ... | @@ -58,8 +57,8 @@ import androidx.recyclerview.widget.RecyclerView; |
| 58 | 57 | AddChildAccountHolder addChildAccountHolder = new AddChildAccountHolder(addChildAccountBinding); |
| 59 | 58 | return addChildAccountHolder; |
| 60 | 59 | case CompanyItemData.TYPE_ADD_ORGANIZATION: |
| 61 | - ItemCompanyDataTypeAddOrganizationBinding addOrganizationBinding=DataBindingUtil.inflate(LayoutInflater.from(context), R.layout.item_company_data_type_add_organization, parent, false); | |
| 62 | - AddOrganizactionHolder addOrganizactionHolder=new AddOrganizactionHolder(addOrganizationBinding); | |
| 60 | + ItemCompanyDataTypeAddOrganizationBinding addOrganizationBinding = DataBindingUtil.inflate(LayoutInflater.from(context), R.layout.item_company_data_type_add_organization, parent, false); | |
| 61 | + AddOrganizactionHolder addOrganizactionHolder = new AddOrganizactionHolder(addOrganizationBinding); | |
| 63 | 62 | return addOrganizactionHolder; |
| 64 | 63 | } |
| 65 | 64 | return null; |
| ... | ... | @@ -70,7 +69,9 @@ import androidx.recyclerview.widget.RecyclerView; |
| 70 | 69 | switch (getItemViewType(position)) { |
| 71 | 70 | case CompanyItemData.TYPE_ORGANIZATION: |
| 72 | 71 | OrganizactionHolder organizactionHolder = (OrganizactionHolder) holder; |
| 73 | - organizactionHolder.binding.llTopLine.setVisibility(dataList.get(position).isShowTopLine()?View.VISIBLE:View.GONE); | |
| 72 | + organizactionHolder.binding.llTopLine.setVisibility(dataList.get(position).isShowTopLine() ? View.VISIBLE : View.GONE); | |
| 73 | + organizactionHolder.binding.ivOrganizationDelete.setVisibility(dataList.get(position).isShowOrganizactionDelete() ? View.VISIBLE : View.GONE); | |
| 74 | + | |
| 74 | 75 | break; |
| 75 | 76 | case CompanyItemData.TYPE_CIRCLE: |
| 76 | 77 | CircleHolder circleHolder = (CircleHolder) holder; |
| ... | ... | @@ -104,12 +105,35 @@ import androidx.recyclerview.widget.RecyclerView; |
| 104 | 105 | /** |
| 105 | 106 | * 所属机构 |
| 106 | 107 | */ |
| 107 | - public class OrganizactionHolder extends RecyclerView.ViewHolder { | |
| 108 | + public class OrganizactionHolder extends RecyclerView.ViewHolder implements View.OnClickListener { | |
| 108 | 109 | private ItemCompanyDataTypeOrganizationBinding binding; |
| 109 | 110 | |
| 110 | 111 | public OrganizactionHolder(@NonNull ItemCompanyDataTypeOrganizationBinding binding) { |
| 111 | 112 | super(binding.getRoot()); |
| 112 | 113 | this.binding = binding; |
| 114 | + binding.ivOrganizationDelete.setOnClickListener(this); | |
| 115 | + } | |
| 116 | + | |
| 117 | + @Override | |
| 118 | + public void onClick(View v) { | |
| 119 | + if (v.getId() == R.id.iv_organization_delete) { | |
| 120 | + //获取当前所在逻辑位置 | |
| 121 | + int logicPosition = dataList.get(getLayoutPosition()).getLogicPosition(); | |
| 122 | + deleteLogicItem(logicPosition); | |
| 123 | + dataList.add(new CompanyItemData(CompanyItemData.TYPE_ADD_ORGANIZATION, dataList.get(dataList.size()-1).getLogicPosition())); | |
| 124 | + notifyDataSetChanged(); | |
| 125 | + } | |
| 126 | + } | |
| 127 | + } | |
| 128 | + | |
| 129 | + private void deleteLogicItem(int logicPosition) { | |
| 130 | + if (dataList.size() == 0) { | |
| 131 | + return; | |
| 132 | + } | |
| 133 | + for (int i = dataList.size() - 1; i >= 0; i--) { | |
| 134 | + if (dataList.get(i).getLogicPosition() == logicPosition) { | |
| 135 | + dataList.remove(i); | |
| 136 | + } | |
| 113 | 137 | } |
| 114 | 138 | } |
| 115 | 139 | |
| ... | ... | @@ -127,8 +151,8 @@ import androidx.recyclerview.widget.RecyclerView; |
| 127 | 151 | |
| 128 | 152 | @Override |
| 129 | 153 | public void onClick(View v) { |
| 130 | - if (v.getId()==R.id.ll_circle_delete){ | |
| 131 | - int removeIndex=getLayoutPosition(); | |
| 154 | + if (v.getId() == R.id.ll_circle_delete) { | |
| 155 | + int removeIndex = getLayoutPosition(); | |
| 132 | 156 | dataList.remove(removeIndex); |
| 133 | 157 | notifyItemRemoved(removeIndex); |
| 134 | 158 | } |
| ... | ... | @@ -151,8 +175,8 @@ import androidx.recyclerview.widget.RecyclerView; |
| 151 | 175 | public void onClick(View v) { |
| 152 | 176 | if (v.getId() == R.id.btn_addChildCircle) { |
| 153 | 177 | //获取当前逻辑上的数量 |
| 154 | - int logicSize = dataList.get(getLayoutPosition()).getLogicSize(); | |
| 155 | - dataList.add(getLayoutPosition(), new CompanyItemData(CompanyItemData.TYPE_CIRCLE, logicSize,true)); | |
| 178 | + int logicSize = dataList.get(getLayoutPosition()).getLogicPosition(); | |
| 179 | + dataList.add(getLayoutPosition(), new CompanyItemData(CompanyItemData.TYPE_CIRCLE, logicSize, true)); | |
| 156 | 180 | notifyItemInserted(getLayoutPosition() + 1); |
| 157 | 181 | } |
| 158 | 182 | } |
| ... | ... | @@ -172,8 +196,8 @@ import androidx.recyclerview.widget.RecyclerView; |
| 172 | 196 | |
| 173 | 197 | @Override |
| 174 | 198 | public void onClick(View v) { |
| 175 | - if (v.getId()==R.id.ll_child_account_delete){ | |
| 176 | - int removeIndex=getLayoutPosition(); | |
| 199 | + if (v.getId() == R.id.ll_child_account_delete) { | |
| 200 | + int removeIndex = getLayoutPosition(); | |
| 177 | 201 | dataList.remove(removeIndex); |
| 178 | 202 | notifyItemRemoved(removeIndex); |
| 179 | 203 | |
| ... | ... | @@ -197,8 +221,8 @@ import androidx.recyclerview.widget.RecyclerView; |
| 197 | 221 | public void onClick(View v) { |
| 198 | 222 | if (v.getId() == R.id.btn_addChildAccount) { |
| 199 | 223 | //获取当前逻辑上的数量 |
| 200 | - int logicSize = dataList.get(getLayoutPosition()).getLogicSize(); | |
| 201 | - dataList.add(getAdapterPosition(), new CompanyItemData(CompanyItemData.TYPE_CHILD_ACCOUNT, logicSize,true)); | |
| 224 | + int logicSize = dataList.get(getLayoutPosition()).getLogicPosition(); | |
| 225 | + dataList.add(getAdapterPosition(), new CompanyItemData(CompanyItemData.TYPE_CHILD_ACCOUNT, logicSize, true)); | |
| 202 | 226 | notifyItemInserted(getLayoutPosition() + 1); |
| 203 | 227 | |
| 204 | 228 | } |
| ... | ... | @@ -219,17 +243,17 @@ import androidx.recyclerview.widget.RecyclerView; |
| 219 | 243 | |
| 220 | 244 | @Override |
| 221 | 245 | public void onClick(View v) { |
| 222 | - if (v.getId()==R.id.btn_addOrganization){ | |
| 246 | + if (v.getId() == R.id.btn_addOrganization) { | |
| 223 | 247 | //获取当前逻辑上的数量 |
| 224 | - int logicSize = dataList.get(getLayoutPosition()).getLogicSize(); | |
| 225 | - int selectIndex=getLayoutPosition(); | |
| 226 | - dataList.remove(dataList.size()-1); | |
| 227 | - dataList.add(new CompanyItemData(CompanyItemData.TYPE_ORGANIZATION,logicSize+1,true,false)); | |
| 228 | - dataList.add(new CompanyItemData(CompanyItemData.TYPE_CIRCLE,logicSize+1)); | |
| 229 | - dataList.add(new CompanyItemData(CompanyItemData.TYPE_ADD_CIRCLE,logicSize+1)); | |
| 230 | - dataList.add(new CompanyItemData(CompanyItemData.TYPE_CHILD_ACCOUNT,logicSize+1)); | |
| 231 | - dataList.add(new CompanyItemData(CompanyItemData.TYPE_ADD_CHILD_ACCOUNT,logicSize+1)); | |
| 232 | - dataList.add(new CompanyItemData(CompanyItemData.TYPE_ADD_ORGANIZATION,0)); | |
| 248 | + int logicSize = dataList.get(getLayoutPosition()).getLogicPosition(); | |
| 249 | + int selectIndex = getLayoutPosition(); | |
| 250 | + dataList.remove(dataList.size() - 1); | |
| 251 | + dataList.add(new CompanyItemData(CompanyItemData.TYPE_ORGANIZATION, logicSize + 1, true, true)); | |
| 252 | + dataList.add(new CompanyItemData(CompanyItemData.TYPE_CIRCLE, logicSize + 1)); | |
| 253 | + dataList.add(new CompanyItemData(CompanyItemData.TYPE_ADD_CIRCLE, logicSize + 1)); | |
| 254 | + dataList.add(new CompanyItemData(CompanyItemData.TYPE_CHILD_ACCOUNT, logicSize + 1)); | |
| 255 | + dataList.add(new CompanyItemData(CompanyItemData.TYPE_ADD_CHILD_ACCOUNT, logicSize + 1)); | |
| 256 | + dataList.add(new CompanyItemData(CompanyItemData.TYPE_ADD_ORGANIZATION, logicSize + 1)); | |
| 233 | 257 | notifyItemInserted(selectIndex); |
| 234 | 258 | } |
| 235 | 259 | } | ... | ... |
core/dentity_verfication/src/main/java/com/cnlive/core/company_verfication/ui/model/CompanyItemData.java
| ... | ... | @@ -13,8 +13,9 @@ package com.cnlive.core.company_verfication.ui.model; |
| 13 | 13 | |
| 14 | 14 | private int type; |
| 15 | 15 | private boolean showDelete; |
| 16 | - private int logicSize;//逻辑上数量 | |
| 16 | + private int logicPosition;//逻辑上数量 | |
| 17 | 17 | private boolean showTopLine; |
| 18 | + private boolean showOrganizactionDelete; | |
| 18 | 19 | |
| 19 | 20 | public int getType() { |
| 20 | 21 | return type; |
| ... | ... | @@ -31,20 +32,21 @@ package com.cnlive.core.company_verfication.ui.model; |
| 31 | 32 | public void setShowDelete(boolean showDelete) { |
| 32 | 33 | this.showDelete = showDelete; |
| 33 | 34 | } |
| 34 | - | |
| 35 | - public CompanyItemData(int type, int logicSize) { | |
| 35 | + public CompanyItemData(int type, int logicPosition) { | |
| 36 | 36 | this.type = type; |
| 37 | - this.logicSize = logicSize; | |
| 37 | + this.logicPosition = logicPosition; | |
| 38 | 38 | } |
| 39 | - public CompanyItemData(int type, int logicSize,boolean showTopLine,boolean showDelete) { | |
| 39 | + | |
| 40 | + public CompanyItemData(int type, int logicPosition, boolean showTopLine, boolean showOrganizactionDelete) { | |
| 40 | 41 | this.type = type; |
| 41 | - this.logicSize = logicSize; | |
| 42 | - this.showTopLine=showTopLine; | |
| 43 | - this.showDelete=showDelete; | |
| 42 | + this.logicPosition = logicPosition; | |
| 43 | + this.showTopLine = showTopLine; | |
| 44 | + this.showOrganizactionDelete = showOrganizactionDelete; | |
| 44 | 45 | } |
| 45 | - public CompanyItemData(int type, int logicSize, boolean showDelete) { | |
| 46 | + | |
| 47 | + public CompanyItemData(int type, int logicPosition, boolean showDelete) { | |
| 46 | 48 | this.type = type; |
| 47 | - this.logicSize = logicSize; | |
| 49 | + this.logicPosition = logicPosition; | |
| 48 | 50 | this.showDelete = showDelete; |
| 49 | 51 | } |
| 50 | 52 | |
| ... | ... | @@ -56,11 +58,19 @@ package com.cnlive.core.company_verfication.ui.model; |
| 56 | 58 | this.showTopLine = showTopLine; |
| 57 | 59 | } |
| 58 | 60 | |
| 59 | - public int getLogicSize() { | |
| 60 | - return logicSize; | |
| 61 | + public int getLogicPosition() { | |
| 62 | + return logicPosition; | |
| 63 | + } | |
| 64 | + | |
| 65 | + public void setLogicPosition(int logicPosition) { | |
| 66 | + this.logicPosition = logicPosition; | |
| 67 | + } | |
| 68 | + | |
| 69 | + public boolean isShowOrganizactionDelete() { | |
| 70 | + return showOrganizactionDelete; | |
| 61 | 71 | } |
| 62 | 72 | |
| 63 | - public void setLogicSize(int logicSize) { | |
| 64 | - this.logicSize = logicSize; | |
| 73 | + public void setShowOrganizactionDelete(boolean showOrganizactionDelete) { | |
| 74 | + this.showOrganizactionDelete = showOrganizactionDelete; | |
| 65 | 75 | } |
| 66 | 76 | } | ... | ... |
core/dentity_verfication/src/main/res/drawable-hdpi/icon_verficat_select_company_delete.png
0 → 100644
714 Bytes
core/dentity_verfication/src/main/res/drawable-xhdpi/icon_verficat_select_company_delete.png
0 → 100644
819 Bytes
core/dentity_verfication/src/main/res/drawable-xxhdpi/icon_verficat_select_company_delete.png
0 → 100644
1.28 KB
core/dentity_verfication/src/main/res/layout/item_company_data_type_organization.xml
| ... | ... | @@ -14,14 +14,42 @@ |
| 14 | 14 | android:layout_height="10dp" |
| 15 | 15 | android:background="@color/coloe_F7F7F7" /> |
| 16 | 16 | |
| 17 | - <TextView | |
| 18 | - android:layout_width="wrap_content" | |
| 17 | + <LinearLayout | |
| 18 | + android:layout_width="match_parent" | |
| 19 | 19 | android:layout_height="wrap_content" |
| 20 | - android:layout_marginTop="10dp" | |
| 21 | - android:text="选择您在网家家平台上的所属机构" | |
| 22 | - android:textColor="@color/color_333333" | |
| 23 | - android:textSize="14sp" | |
| 24 | - android:textStyle="bold" /> | |
| 20 | + android:gravity="center_vertical" | |
| 21 | + android:paddingLeft="10dp" | |
| 22 | + android:paddingTop="10dp"> | |
| 23 | + | |
| 24 | + <LinearLayout | |
| 25 | + android:layout_width="0dp" | |
| 26 | + android:layout_height="wrap_content" | |
| 27 | + android:layout_weight="1"> | |
| 28 | + | |
| 29 | + <ImageView | |
| 30 | + android:layout_width="16dp" | |
| 31 | + android:layout_height="18dp" | |
| 32 | + android:background="@drawable/xzjg" /> | |
| 33 | + | |
| 34 | + <TextView | |
| 35 | + android:layout_width="wrap_content" | |
| 36 | + android:layout_height="wrap_content" | |
| 37 | + android:layout_marginLeft="10dp" | |
| 38 | + android:text="选择您在网家家平台上的所属机构" | |
| 39 | + android:textColor="@color/color_333333" | |
| 40 | + android:textSize="14sp" | |
| 41 | + android:textStyle="bold" /> | |
| 42 | + </LinearLayout> | |
| 43 | + | |
| 44 | + <ImageView | |
| 45 | + android:id="@+id/iv_organization_delete" | |
| 46 | + android:layout_width="26dp" | |
| 47 | + android:layout_height="28dp" | |
| 48 | + android:layout_marginLeft="10dp" | |
| 49 | + android:layout_marginRight="10dp" | |
| 50 | + android:padding="5dp" | |
| 51 | + android:src="@drawable/icon_verficat_select_company_delete" /> | |
| 52 | + </LinearLayout> | |
| 25 | 53 | |
| 26 | 54 | <LinearLayout |
| 27 | 55 | android:layout_width="match_parent" | ... | ... |