Commit 98bf95256268f8d98acd20ed3e42b80b190d1031

Authored by 韩亚云
2 parents 4d1c5b77 8ac7ea6c

Merge branch 'master' of bj.gitlab.cnlive.com:cnlive-team/newModuleStrike

core/base/src/main/java/com/cnlive/core/libs/base/frame/activity/BaseActivity.java
... ... @@ -19,8 +19,10 @@ import android.os.Message;
19 19 import android.provider.Settings;
20 20 import android.text.TextUtils;
21 21 import android.util.DisplayMetrics;
  22 +import android.util.Log;
22 23 import android.view.MotionEvent;
23 24 import android.view.View;
  25 +import android.view.ViewGroup;
24 26 import android.view.Window;
25 27 import android.view.WindowManager;
26 28 import android.view.inputmethod.InputMethodManager;
... ... @@ -240,6 +242,39 @@ public abstract class BaseActivity<V extends BaseView, P extends BasePresenter<V
240 242 }
241 243  
242 244 /**
  245 + * 获取状态栏高度dp
  246 + *
  247 + * @return
  248 + */
  249 + public int getStatusBarHeight() {
  250 + return StatusBarUtil.getStatusBarHeight(this);
  251 + }
  252 +
  253 + /**将标题视图自适应沉浸式状态栏
  254 + * @param view
  255 + */
  256 + public void setTitleViewAdjustImmersiveStatusBar(View view) {
  257 + if (null==view){
  258 + Log.e(TAG,"setTitleViewAdjustImmersiveStatusBar->view is Null");
  259 + }
  260 + ViewGroup.LayoutParams params = view.getLayoutParams();
  261 + if (null==params){
  262 + Log.e(TAG,"setTitleViewAdjustImmersiveStatusBar->LayoutParams is Null 无法将标题视图自适应沉浸式状态栏!");
  263 + return;
  264 + }
  265 + int oldHeight = params.height;
  266 + if (oldHeight<=0){
  267 + Log.e(TAG,"setTitleViewAdjustImmersiveStatusBar->无法获取标题视图高度!");
  268 + return;
  269 + }
  270 + if (0==getStatusBarHeight()){
  271 + Log.e(TAG,"setTitleViewAdjustImmersiveStatusBar->无法获取状态栏高度!");
  272 + return;
  273 + }
  274 + params.height = oldHeight + getStatusBarHeight();
  275 + view.setLayoutParams(params);
  276 + }
  277 + /**
243 278 * 设置状态栏字体颜色
244 279 */
245 280 // 定义适用于参数的注解,限定取值范围为{STATUS_OPEN, STATUS_CLOSE}
... ...
core/base/src/main/java/com/cnlive/core/libs/base/frame/fragment/BaseFragment.java
... ... @@ -29,6 +29,7 @@ import com.cnlive.core.libs.base.util.ReflectUtil;
29 29 import com.cnlive.core.libs.base.frame.view.BaseView;
30 30 import com.cnlive.core.libs.base.util.StatusBarConfig;
31 31 import com.cnlive.cloud.base.R;
  32 +import com.cnlive.core.libs.base.util.StatusBarUtil;
32 33 import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter;
33 34 import com.me.yokeyword.fragmentation.ExtraTransaction;
34 35 import com.me.yokeyword.fragmentation.ISupportFragment;
... ... @@ -411,9 +412,28 @@ public abstract class BaseFragment&lt;V extends BaseView, P extends BasePresenter&lt;V
411 412 /**
412 413 * 沉浸式状态栏
413 414 */
414   - public void showImmersiveStatusBar(){
  415 + public void showImmersiveStatusBar() {
415 416 me.showImmersiveStatusBar();
416 417 }
  418 +
  419 + /**
  420 + * 将标题视图自适应沉浸式状态栏
  421 + *
  422 + * @param view
  423 + */
  424 + public void setTitleViewAdjustImmersiveStatusBar(View view) {
  425 + me.setTitleViewAdjustImmersiveStatusBar(view);
  426 + }
  427 +
  428 + /**
  429 + * 获取状态栏高度
  430 + *
  431 + * @return
  432 + */
  433 + public int getStatusBarHeight() {
  434 + return me.getStatusBarHeight();
  435 + }
  436 +
417 437 @Override
418 438 public void onDestroy() {
419 439 super.onDestroy();
... ...
core/base/src/main/res/values/colors.xml
... ... @@ -67,4 +67,5 @@
67 67 <color name="color_9c9c9c">#9c9c9c</color>
68 68 <color name="color_ff3b30">#ff3b30</color>
69 69  
  70 + <color name="black_50_percentage">#80000000</color>
70 71 </resources>
71 72 \ No newline at end of file
... ...
core/dentity_verfication/src/main/java/com/cnlive/core/company_verfication/ui/adapter/CompanyItemDataAdapter.java
... ... @@ -4,6 +4,7 @@ import android.content.Context;
4 4 import android.view.LayoutInflater;
5 5 import android.view.View;
6 6 import android.view.ViewGroup;
  7 +import android.widget.TextView;
7 8  
8 9 import com.cnlive.core.company_verfication.ui.model.CompanyItemData;
9 10 import com.cnlive.core.people_verfication.R;
... ... @@ -26,12 +27,17 @@ import androidx.recyclerview.widget.RecyclerView;
26 27 */public class CompanyItemDataAdapter extends RecyclerView.Adapter {
27 28 private Context context;
28 29 private List<CompanyItemData> dataList;
  30 + private OnClickListener onClickListener;
29 31  
30 32 public CompanyItemDataAdapter(Context context, List<CompanyItemData> dataList) {
31 33 this.context = context;
32 34 this.dataList = dataList;
33 35 }
34 36  
  37 + public void setOnClickListener(OnClickListener onClickListener) {
  38 + this.onClickListener = onClickListener;
  39 + }
  40 +
35 41 @NonNull
36 42 @Override
37 43 public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
... ... @@ -112,17 +118,25 @@ import androidx.recyclerview.widget.RecyclerView;
112 118 super(binding.getRoot());
113 119 this.binding = binding;
114 120 binding.ivOrganizationDelete.setOnClickListener(this);
  121 + binding.tvOrganization.setOnClickListener(this);
115 122 }
116 123  
117 124 @Override
118 125 public void onClick(View v) {
  126 + //删除机构
119 127 if (v.getId() == R.id.iv_organization_delete) {
120 128 //获取当前所在逻辑位置
121 129 int logicPosition = dataList.get(getLayoutPosition()).getLogicPosition();
122 130 deleteLogicItem(logicPosition);
123   - dataList.add(new CompanyItemData(CompanyItemData.TYPE_ADD_ORGANIZATION, dataList.get(dataList.size()-1).getLogicPosition()));
  131 + dataList.add(new CompanyItemData(CompanyItemData.TYPE_ADD_ORGANIZATION, dataList.get(dataList.size() - 1).getLogicPosition()));
124 132 notifyDataSetChanged();
125 133 }
  134 + //选中机构
  135 + else if (v.getId() == R.id.tv_organization) {
  136 + if (null != onClickListener) {
  137 + onClickListener.onClick(binding.tvOrganization);
  138 + }
  139 + }
126 140 }
127 141 }
128 142  
... ... @@ -258,4 +272,8 @@ import androidx.recyclerview.widget.RecyclerView;
258 272 }
259 273 }
260 274 }
  275 +
  276 + public interface OnClickListener {
  277 + void onClick(TextView textView);
  278 + }
261 279 }
... ...
core/dentity_verfication/src/main/java/com/cnlive/core/company_verfication/ui/fragment/BottomSheetDialog.java 0 → 100644
  1 +package com.cnlive.core.company_verfication.ui.fragment;
  2 +
  3 +import android.os.Bundle;
  4 +import android.view.LayoutInflater;
  5 +import android.view.View;
  6 +import android.view.ViewGroup;
  7 +
  8 +import androidx.annotation.NonNull;
  9 +import androidx.annotation.Nullable;
  10 +
  11 +import com.cnlive.core.people_verfication.R;
  12 +import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
  13 +
  14 +public class BottomSheetDialog extends BottomSheetDialogFragment {
  15 + @Nullable
  16 + @Override
  17 + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
  18 +
  19 + return inflater.inflate(R.layout.fragment_bottom, container, false);
  20 + }
  21 +
  22 + @Override
  23 + public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
  24 + super.onViewCreated(view, savedInstanceState);
  25 +
  26 +
  27 + }
  28 +}
0 29 \ No newline at end of file
... ...
core/dentity_verfication/src/main/java/com/cnlive/core/company_verfication/ui/fragment/SelectCompanyDataFragment.java
1 1 package com.cnlive.core.company_verfication.ui.fragment;
2 2  
  3 +import android.view.Gravity;
  4 +import android.view.View;
  5 +import android.view.ViewGroup;
  6 +import android.widget.LinearLayout;
  7 +import android.widget.RelativeLayout;
  8 +import android.widget.TextView;
  9 +
3 10 import com.cnlive.core.company_verfication.ui.adapter.CompanyDataAdapter;
4 11 import com.cnlive.core.company_verfication.ui.adapter.CompanyItemDataAdapter;
5 12 import com.cnlive.core.company_verfication.ui.model.CompanyItemData;
6 13 import com.cnlive.core.libs.base.frame.fragment.BaseFragment;
  14 +import com.cnlive.core.libs.base.util.StatusBarUtil;
7 15 import com.cnlive.core.people_verfication.R;
8 16 import com.cnlive.core.people_verfication.databinding.FragmentSelectInCompanyDataBinding;
  17 +import com.google.android.material.bottomsheet.BottomSheetBehavior;
9 18  
10 19 import java.util.ArrayList;
11 20 import java.util.List;
12 21  
  22 +import androidx.annotation.NonNull;
  23 +import androidx.coordinatorlayout.widget.CoordinatorLayout;
13 24 import androidx.databinding.ViewDataBinding;
14 25 import androidx.recyclerview.widget.LinearLayoutManager;
15 26  
... ... @@ -19,32 +30,96 @@ import androidx.recyclerview.widget.LinearLayoutManager;
19 30 */public class SelectCompanyDataFragment extends BaseFragment {
20 31 private List<String> data = new ArrayList<>();
21 32 private FragmentSelectInCompanyDataBinding binding;
22   - private CompanyDataAdapter adapter;
23 33 private CompanyItemDataAdapter itemDataAdapter;
  34 + private BottomSheetBehavior behavior;
24 35  
25 36 @Override
26 37 protected int getBindLayoutId() {
27 38 return R.layout.fragment_select_in_company_data;
28 39 }
29 40  
30   - @Override
  41 + @Override
31 42 protected void initBindingLayoutData(ViewDataBinding baseBinding) {
32 43 super.initBindingLayoutData(baseBinding);
33   - binding= (FragmentSelectInCompanyDataBinding) baseBinding;
  44 + binding = (FragmentSelectInCompanyDataBinding) baseBinding;
34 45 }
  46 +
35 47 @Override
36 48 protected void initView() {
37 49 // data.add("测试");
38 50 // adapter = new CompanyDataAdapter(me, data);
39   - List<CompanyItemData>list=new ArrayList<>();
40   - list.add(new CompanyItemData(CompanyItemData.TYPE_ORGANIZATION,0));
41   - list.add(new CompanyItemData(CompanyItemData.TYPE_CIRCLE,0));
42   - list.add(new CompanyItemData(CompanyItemData.TYPE_ADD_CIRCLE,0));
43   - list.add(new CompanyItemData(CompanyItemData.TYPE_CHILD_ACCOUNT,0));
44   - list.add(new CompanyItemData(CompanyItemData.TYPE_ADD_CHILD_ACCOUNT,0));
45   - list.add(new CompanyItemData(CompanyItemData.TYPE_ADD_ORGANIZATION,0));
46   - itemDataAdapter=new CompanyItemDataAdapter(me,list);
  51 + showImmersiveStatusBar();
  52 + initTopBar();
  53 + List<CompanyItemData> list = new ArrayList<>();
  54 + list.add(new CompanyItemData(CompanyItemData.TYPE_ORGANIZATION, 0));
  55 + list.add(new CompanyItemData(CompanyItemData.TYPE_CIRCLE, 0));
  56 + list.add(new CompanyItemData(CompanyItemData.TYPE_ADD_CIRCLE, 0));
  57 + list.add(new CompanyItemData(CompanyItemData.TYPE_CHILD_ACCOUNT, 0));
  58 + list.add(new CompanyItemData(CompanyItemData.TYPE_ADD_CHILD_ACCOUNT, 0));
  59 + list.add(new CompanyItemData(CompanyItemData.TYPE_ADD_ORGANIZATION, 0));
  60 + itemDataAdapter = new CompanyItemDataAdapter(me, list);
47 61 binding.recyclerView.setLayoutManager(new LinearLayoutManager(me));
48 62 binding.recyclerView.setAdapter(itemDataAdapter);
  63 + binding.viewMask.setVisibility(View.GONE);
  64 + behavior = BottomSheetBehavior.from(binding.llBottom);
  65 + behavior.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() {
  66 + @Override
  67 + public void onStateChanged(@NonNull View bottomSheet, @BottomSheetBehavior.State int newState) {
  68 + String state = "null";
  69 + switch (newState) {
  70 + case 1:
  71 + state = "STATE_DRAGGING";//过渡状态此时用户正在向上或者向下拖动bottom sheet
  72 + break;
  73 + case 2:
  74 + state = "STATE_SETTLING"; // 视图从脱离手指自由滑动到最终停下的这一小段时间
  75 + break;
  76 + case 3:
  77 + state = "STATE_EXPANDED"; //处于完全展开的状态
  78 +
  79 + break;
  80 + case 4:
  81 + state = "STATE_COLLAPSED"; //默认的折叠状态
  82 + binding.viewMask.setVisibility(View.GONE);
  83 + break;
  84 + case 5:
  85 + state = "STATE_HIDDEN"; //下滑动完全隐藏 bottom sheet
  86 + binding.viewMask.setVisibility(View.GONE);
  87 + break;
  88 + }
  89 +
  90 + }
  91 +
  92 + @Override
  93 + public void onSlide(@NonNull View view, float v) {
  94 +
  95 + }
  96 + });
  97 +
  98 +
  99 + itemDataAdapter.setOnClickListener(new CompanyItemDataAdapter.OnClickListener() {
  100 + @Override
  101 + public void onClick(TextView textView) {
  102 + if (!isNull(behavior)) {
  103 +
  104 + binding.viewMask.setVisibility(View.VISIBLE);
  105 + behavior.setState(BottomSheetBehavior.STATE_EXPANDED);
  106 + }
  107 +// BottomSheetDialog bottomSheetDialog=new BottomSheetDialog();
  108 +// bottomSheetDialog.show(getFragmentManager(),TAG);
  109 + }
  110 + });
  111 + }
  112 +
  113 + private void initTopBar() {
  114 + // 设置标题栏的内容在状态栏之下
  115 + binding.topbar.setTitle("填写公司信息");
  116 + // 设置标题栏 + 状态栏的高度
  117 + setTitleViewAdjustImmersiveStatusBar(binding.llTop);
  118 + binding.topbar.addLeftImageButton(R.drawable.icon_verficat_back, R.id.back_btn).setOnClickListener(new View.OnClickListener() {
  119 + @Override
  120 + public void onClick(View v) {
  121 + me.finish();
  122 + }
  123 + });
49 124 }
50 125 }
... ...
core/dentity_verfication/src/main/res/drawable/shape_verficat_bottom_sheet_white_bg.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<shape xmlns:android="http://schemas.android.com/apk/res/android">
  3 + <corners
  4 + android:topLeftRadius="10dp"
  5 + android:topRightRadius="10dp" />
  6 + <solid android:color="@color/white" />
  7 +</shape>
0 8 \ No newline at end of file
... ...
core/dentity_verfication/src/main/res/layout/fragment_bottom.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + android:layout_width="match_parent"
  4 + android:layout_height="match_parent"
  5 + android:orientation="vertical">
  6 +
  7 + <LinearLayout
  8 + android:id="@+id/recyclerview"
  9 + android:layout_width="match_parent"
  10 + android:layout_height="500dp"
  11 + android:background="@drawable/shape_verficat_bottom_sheet_white_bg"
  12 + android:clickable="true"
  13 + android:focusable="true"></LinearLayout>
  14 +</LinearLayout>
0 15 \ No newline at end of file
... ...
core/dentity_verfication/src/main/res/layout/fragment_select_in_company_data.xml
1 1 <?xml version="1.0" encoding="utf-8"?>
2 2 <layout>
3 3  
4   - <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
  4 + <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
5 5 xmlns:app="http://schemas.android.com/apk/res-auto"
6 6 xmlns:tools="http://schemas.android.com/tools"
7 7 android:layout_width="match_parent"
8 8 android:layout_height="match_parent"
9 9 tools:context="com.cnlive.core.company_verfication.ui.activity.SelectCompanyDataActivity">
10 10  
11   - <TextView
  11 + <LinearLayout
12 12 android:layout_width="match_parent"
13   - android:layout_height="43dp"
14   - android:background="@color/color_48A7F9"
15   - android:gravity="center"
16   - android:text="请选择在网家家平台上与您相关的所有机构公司信息"
17   - android:textColor="@color/white"
18   - android:drawableRight="@drawable/icon_verficat_tip"
19   - app:layout_constraintStart_toStartOf="parent"
20   - android:paddingRight="10dp"
21   - app:layout_constraintTop_toTopOf="parent" />
22   -
23   - <androidx.recyclerview.widget.RecyclerView
24   - android:id="@+id/recyclerView"
  13 + android:layout_height="match_parent"
  14 + android:orientation="vertical">
  15 + <!--标题-->
  16 + <LinearLayout
  17 + android:id="@+id/ll_top"
  18 + android:layout_width="match_parent"
  19 + android:layout_height="?attr/qmui_topbar_height"
  20 + android:background="@color/white"
  21 + android:gravity="bottom">
  22 +
  23 + <com.qmuiteam.qmui.widget.QMUITopBar
  24 + android:id="@+id/topbar"
  25 + android:layout_width="match_parent"
  26 + android:layout_height="?attr/qmui_topbar_height" />
  27 + </LinearLayout>
  28 +
  29 +
  30 + <TextView
  31 + android:layout_width="match_parent"
  32 + android:layout_height="43dp"
  33 + android:background="@color/color_48A7F9"
  34 + android:drawableRight="@drawable/icon_verficat_tip"
  35 + android:gravity="center"
  36 + android:paddingRight="10dp"
  37 + android:text="请选择在网家家平台上与您相关的所有机构公司信息"
  38 + android:textColor="@color/white"
  39 + app:layout_constraintStart_toStartOf="parent"
  40 + app:layout_constraintTop_toTopOf="parent" />
  41 +
  42 + <androidx.recyclerview.widget.RecyclerView
  43 + android:id="@+id/recyclerView"
  44 + android:layout_width="match_parent"
  45 + android:layout_height="match_parent" />
  46 + </LinearLayout>
  47 +
  48 + <View
  49 + android:id="@+id/view_mask"
25 50 android:layout_width="match_parent"
26 51 android:layout_height="match_parent"
27   - android:layout_marginTop="43dp" />
28   - </androidx.constraintlayout.widget.ConstraintLayout>
  52 + android:background="#80000000"
  53 + android:clickable="true"
  54 + android:focusable="true" />
  55 +
  56 + <LinearLayout
  57 + android:id="@+id/ll_bottom"
  58 + android:layout_width="match_parent"
  59 + android:layout_height="500dp"
  60 + android:background="@drawable/shape_verficat_bottom_sheet_white_bg"
  61 + android:clickable="true"
  62 + android:focusable="true"
  63 + android:orientation="vertical"
  64 + app:behavior_hideable="true"
  65 + app:behavior_peekHeight="0dp"
  66 + app:layout_behavior="@string/bottom_sheet_behavior"></LinearLayout>
  67 + </androidx.coordinatorlayout.widget.CoordinatorLayout>
29 68 </layout>
... ...
core/dentity_verfication/src/main/res/layout/item_company_data_type_organization.xml
... ... @@ -71,6 +71,7 @@
71 71  
72 72  
73 73 <TextView
  74 + android:id="@+id/tv_organization"
74 75 android:layout_width="match_parent"
75 76 android:layout_height="wrap_content"
76 77 android:background="@drawable/shape_verficat_et_5_round_black_bg"
... ...