liufuhua007

重构代码

Showing 41 changed files with 282 additions and 479 deletions
...@@ -24,6 +24,9 @@ android { ...@@ -24,6 +24,9 @@ android {
24 abiFilters 'armeabi-v7a', "arm64-v8a" 24 abiFilters 'armeabi-v7a', "arm64-v8a"
25 } 25 }
26 } 26 }
27 + buildFeatures {
28 + viewBinding true
29 + }
27 30
28 signingConfigs { 31 signingConfigs {
29 debug { 32 debug {
...@@ -58,7 +61,7 @@ android { ...@@ -58,7 +61,7 @@ android {
58 } 61 }
59 } 62 }
60 compileOptions { 63 compileOptions {
61 - sourceCompatibility JavaVersion.VERSION_1_8 64 + sourceCompatibility JavaVersion.VERSION_1_7
62 targetCompatibility JavaVersion.VERSION_1_8 65 targetCompatibility JavaVersion.VERSION_1_8
63 } 66 }
64 67
...@@ -119,21 +122,22 @@ dependencies { ...@@ -119,21 +122,22 @@ dependencies {
119 implementation 'com.squareup.okio:okio:1.9.0' 122 implementation 'com.squareup.okio:okio:1.9.0'
120 123
121 124
122 - implementation('com.jakewharton:butterknife:10.0.0') { 125 +// implementation('com.jakewharton:butterknife:10.0.0') {
123 - exclude group: 'com.android.support' 126 +// exclude group: 'com.android.support'
124 - } 127 +// }
125 - annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0' 128 +// annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'
126 129
127 implementation 'com.github.bumptech.glide:glide:4.0.0' 130 implementation 'com.github.bumptech.glide:glide:4.0.0'
128 implementation 'androidx.appcompat:appcompat:1.3.0-alpha02' 131 implementation 'androidx.appcompat:appcompat:1.3.0-alpha02'
129 132
130 //implementation files('libs\\photoview.jar') 133 //implementation files('libs\\photoview.jar')
131 implementation 'com.itextpdf:itext7-core:7.1.13' 134 implementation 'com.itextpdf:itext7-core:7.1.13'
132 - implementation 'com.github.barteksc:android-pdf-viewer:2.5.1' 135 +// implementation 'com.github.barteksc:android-pdf-viewer:2.5.1'
133 //implementation 'com.github.barteksc:android-pdf-viewer:3.2.0-beta.1' 136 //implementation 'com.github.barteksc:android-pdf-viewer:3.2.0-beta.1'
134 137
135 - implementation files('libs\\signature-pad.jar') 138 +// implementation files('libs\\signature-pad.jar')
136 - implementation 'com.github.barteksc:android-pdf-viewer:3.2.0-beta.1' 139 +// implementation 'com.github.gcacace:signature-pad:1.3.1' // 或最新版本
140 + implementation 'com.github.mhiew:android-pdf-viewer:3.2.0-beta.1'
137 implementation files('libs\\dcm4che-core-5.27.0.jar') 141 implementation files('libs\\dcm4che-core-5.27.0.jar')
138 implementation files('libs\\dcm4che-net-5.27.0.jar') 142 implementation files('libs\\dcm4che-net-5.27.0.jar')
139 143
......
...@@ -10,13 +10,12 @@ import android.view.View; ...@@ -10,13 +10,12 @@ import android.view.View;
10 import android.view.ViewGroup; 10 import android.view.ViewGroup;
11 11
12 import androidx.annotation.Nullable; 12 import androidx.annotation.Nullable;
13 +import androidx.viewbinding.ViewBinding;
13 14
14 -import butterknife.ButterKnife;
15 15
16 -public abstract class BaseFragment extends Fragment 16 +public abstract class BaseFragment<VB extends ViewBinding> extends Fragment
17 - implements View.OnClickListener, HomeCallback { 17 + implements HomeCallback {
18 - 18 + protected VB binding; // ViewBinding 变量
19 - protected View rootView;
20 public HomeActivity homeActivity; 19 public HomeActivity homeActivity;
21 public BaseFragment homeFragment; 20 public BaseFragment homeFragment;
22 public String TAG = ""; 21 public String TAG = "";
...@@ -38,32 +37,31 @@ public abstract class BaseFragment extends Fragment ...@@ -38,32 +37,31 @@ public abstract class BaseFragment extends Fragment
38 @Nullable 37 @Nullable
39 @Override 38 @Override
40 public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) { 39 public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
41 - rootView = inflater.inflate(rootLayout(), container, false); 40 + binding = getViewBinding(inflater, container);
42 - ButterKnife.bind(this, rootView);
43 context = getActivity().getApplicationContext(); 41 context = getActivity().getApplicationContext();
44 init(); 42 init();
45 setListener(); 43 setListener();
46 - return rootView; 44 + return binding.getRoot();
47 } 45 }
48 46
49 @Override 47 @Override
50 public void onResume() { 48 public void onResume() {
51 super.onResume(); 49 super.onResume();
52 - if (rootView != null) { 50 + if (binding != null) {
53 - rootView.setOnTouchListener(homeActivity); 51 + binding.getRoot().setOnTouchListener(homeActivity);
54 } 52 }
55 } 53 }
56 54
57 @Override 55 @Override
58 public void onHiddenChanged(boolean hidden) { 56 public void onHiddenChanged(boolean hidden) {
59 super.onHiddenChanged(hidden); 57 super.onHiddenChanged(hidden);
60 - if (rootView != null) { 58 + if (binding != null) {
61 - rootView.setOnTouchListener(homeActivity); 59 + binding.getRoot().setOnTouchListener(homeActivity);
62 if (hidden) { 60 if (hidden) {
63 //隐藏的时候 61 //隐藏的时候
64 - rootView.setVisibility(View.GONE); 62 + binding.getRoot().setVisibility(View.GONE);
65 } else { 63 } else {
66 - rootView.setVisibility(View.VISIBLE); 64 + binding.getRoot().setVisibility(View.VISIBLE);
67 } 65 }
68 } 66 }
69 } 67 }
...@@ -76,10 +74,9 @@ public abstract class BaseFragment extends Fragment ...@@ -76,10 +74,9 @@ public abstract class BaseFragment extends Fragment
76 } 74 }
77 75
78 public View getRootView() { 76 public View getRootView() {
79 - return rootView; 77 + return binding != null ? binding.getRoot() : null;
80 } 78 }
81 - 79 + protected abstract VB getViewBinding(LayoutInflater inflater, ViewGroup container);
82 - protected abstract int rootLayout();
83 80
84 protected abstract void init(); 81 protected abstract void init();
85 82
......
...@@ -2,7 +2,9 @@ package com.sw.laryngoscope.activity.fragment; ...@@ -2,7 +2,9 @@ package com.sw.laryngoscope.activity.fragment;
2 2
3 import android.app.FragmentManager; 3 import android.app.FragmentManager;
4 import android.content.Context; 4 import android.content.Context;
5 +import android.view.LayoutInflater;
5 import android.view.View; 6 import android.view.View;
7 +import android.view.ViewGroup;
6 import android.widget.FrameLayout; 8 import android.widget.FrameLayout;
7 import android.widget.RadioButton; 9 import android.widget.RadioButton;
8 import android.widget.RadioGroup; 10 import android.widget.RadioGroup;
...@@ -18,41 +20,16 @@ import com.sw.laryngoscope.activity.fragment.setting.LanFragment; ...@@ -18,41 +20,16 @@ import com.sw.laryngoscope.activity.fragment.setting.LanFragment;
18 import com.sw.laryngoscope.activity.fragment.setting.LogExportFragment; 20 import com.sw.laryngoscope.activity.fragment.setting.LogExportFragment;
19 import com.sw.laryngoscope.activity.fragment.setting.NetWorkFragment; 21 import com.sw.laryngoscope.activity.fragment.setting.NetWorkFragment;
20 import com.sw.laryngoscope.activity.fragment.setting.TimeDateFragment; 22 import com.sw.laryngoscope.activity.fragment.setting.TimeDateFragment;
23 +import com.sw.laryngoscope.databinding.FgSettingBinding;
21 import com.sw.laryngoscope.manager.CameraInfoMg; 24 import com.sw.laryngoscope.manager.CameraInfoMg;
22 import com.sw.laryngoscope.utils.Logger; 25 import com.sw.laryngoscope.utils.Logger;
23 26
24 -import butterknife.BindView;
25 -import butterknife.OnClick;
26 27
27 -public class SettingFragment extends BaseFragment implements CustomTimer.TimerCallBack, 28 +public class SettingFragment extends BaseFragment<FgSettingBinding> implements CustomTimer.TimerCallBack,
28 - RadioGroup.OnCheckedChangeListener { 29 + RadioGroup.OnCheckedChangeListener,View.OnClickListener {
29 30
30 private static final String TAG = "SettingFragment"; 31 private static final String TAG = "SettingFragment";
31 private Context context; 32 private Context context;
32 -
33 - @BindView(R.id.layout_main_show_setting)
34 - View layout_main_show_setting;
35 - @BindView(R.id.setting_fragment)
36 - FrameLayout setting_fragment;
37 -
38 - @BindView(R.id.rg_setting_first)
39 - RadioGroup rg_setting_first;
40 -
41 - @BindView(R.id.rb_lan)
42 - public RadioButton rb_lan;
43 - @BindView(R.id.rb_timedate)
44 - public RadioButton rb_timedate;
45 - @BindView(R.id.rb_network)
46 - public RadioButton rb_network;
47 - @BindView(R.id.rb_dicom)
48 - public RadioButton rb_dicom;
49 - @BindView(R.id.rb_general_settings)
50 - public RadioButton rb_general_settings;
51 - @BindView(R.id.rb_device_info)
52 - public RadioButton rb_device_info;
53 - @BindView(R.id.rb_log_export)
54 - public RadioButton rb_log_export;
55 -
56 public FragmentManager fragmentManager; 33 public FragmentManager fragmentManager;
57 public BaseFragment currFragment; 34 public BaseFragment currFragment;
58 35
...@@ -81,18 +58,18 @@ public class SettingFragment extends BaseFragment implements CustomTimer.TimerCa ...@@ -81,18 +58,18 @@ public class SettingFragment extends BaseFragment implements CustomTimer.TimerCa
81 Logger.d(TAG, "======showFragment===1===hidden "); 58 Logger.d(TAG, "======showFragment===1===hidden ");
82 //rb_about.setChecked(true); 59 //rb_about.setChecked(true);
83 //rg_setting_first.clearCheck(); 60 //rg_setting_first.clearCheck();
84 - layout_main_show_setting.setVisibility(View.VISIBLE); 61 + binding.layoutMainShowSetting.getRoot().setVisibility(View.VISIBLE);
85 //backHomeFragment(); 62 //backHomeFragment();
86 if ( isBackToSetting ) { 63 if ( isBackToSetting ) {
87 isBackToSetting = false; 64 isBackToSetting = false;
88 - if ( rb_network != null ) { 65 + if ( binding.layoutMainShowSetting.rbNetwork != null ) {
89 - rb_network.setChecked(true); 66 + binding.layoutMainShowSetting.rbNetwork.setChecked(true);
90 } 67 }
91 } else { 68 } else {
92 if ( !isFirstEnter ) { 69 if ( !isFirstEnter ) {
93 isFirstEnter = true; 70 isFirstEnter = true;
94 - if ( rb_lan != null ) { 71 + if ( binding.layoutMainShowSetting.rbLan != null ) {
95 - rb_lan.setChecked(true); 72 + binding.layoutMainShowSetting.rbLan.setChecked(true);
96 } 73 }
97 } 74 }
98 } 75 }
...@@ -111,12 +88,12 @@ public class SettingFragment extends BaseFragment implements CustomTimer.TimerCa ...@@ -111,12 +88,12 @@ public class SettingFragment extends BaseFragment implements CustomTimer.TimerCa
111 //rb_about.setChecked(true); 88 //rb_about.setChecked(true);
112 //rg_setting_first.clearCheck(); 89 //rg_setting_first.clearCheck();
113 Logger.d(TAG, "======showFragment======hidden " + hidden); 90 Logger.d(TAG, "======showFragment======hidden " + hidden);
114 - layout_main_show_setting.setVisibility(View.VISIBLE); 91 + binding.layoutMainShowSetting.getRoot().setVisibility(View.VISIBLE);
115 } 92 }
116 93
117 @Override 94 @Override
118 - protected int rootLayout() { 95 + protected FgSettingBinding getViewBinding(LayoutInflater inflater, ViewGroup container) {
119 - return R.layout.fg_setting; 96 + return FgSettingBinding.inflate(inflater,container,false);
120 } 97 }
121 98
122 @Override 99 @Override
...@@ -127,11 +104,11 @@ public class SettingFragment extends BaseFragment implements CustomTimer.TimerCa ...@@ -127,11 +104,11 @@ public class SettingFragment extends BaseFragment implements CustomTimer.TimerCa
127 104
128 @Override 105 @Override
129 protected void setListener() { 106 protected void setListener() {
130 - rg_setting_first.setOnCheckedChangeListener(this); 107 + binding.layoutMainShowSetting.rgSettingFirst.setOnCheckedChangeListener(this);
108 + binding.layBack.setOnClickListener(this);
131 } 109 }
132 110
133 @Override 111 @Override
134 - @OnClick({ R.id.lay_back, })
135 public void onClick(View v) { 112 public void onClick(View v) {
136 switch (v.getId()) { 113 switch (v.getId()) {
137 case R.id.lay_back: 114 case R.id.lay_back:
...@@ -150,7 +127,7 @@ public class SettingFragment extends BaseFragment implements CustomTimer.TimerCa ...@@ -150,7 +127,7 @@ public class SettingFragment extends BaseFragment implements CustomTimer.TimerCa
150 127
151 @Override 128 @Override
152 public void onCheckedChanged(RadioGroup radioGroup, int i) { 129 public void onCheckedChanged(RadioGroup radioGroup, int i) {
153 - switch (rg_setting_first.getCheckedRadioButtonId()) { 130 + switch (binding.layoutMainShowSetting.rgSettingFirst.getCheckedRadioButtonId()) {
154 case R.id.rb_lan: 131 case R.id.rb_lan:
155 Logger.d(TAG, "======showFragment======rb_lan"); 132 Logger.d(TAG, "======showFragment======rb_lan");
156 if (lanFragment == null) { 133 if (lanFragment == null) {
...@@ -264,7 +241,7 @@ public class SettingFragment extends BaseFragment implements CustomTimer.TimerCa ...@@ -264,7 +241,7 @@ public class SettingFragment extends BaseFragment implements CustomTimer.TimerCa
264 } 241 }
265 } 242 }
266 currFragment = targetFragment; 243 currFragment = targetFragment;
267 - setting_fragment.setVisibility(View.VISIBLE); 244 + binding.settingFragment.getRootView().setVisibility(View.VISIBLE);
268 //layout_main_show_setting.setVisibility(View.GONE); 245 //layout_main_show_setting.setVisibility(View.GONE);
269 } 246 }
270 247
...@@ -277,7 +254,7 @@ public class SettingFragment extends BaseFragment implements CustomTimer.TimerCa ...@@ -277,7 +254,7 @@ public class SettingFragment extends BaseFragment implements CustomTimer.TimerCa
277 if ( currFragment != null ) { 254 if ( currFragment != null ) {
278 //rg_setting_first.clearCheck(); 255 //rg_setting_first.clearCheck();
279 fragmentManager.beginTransaction().hide(currFragment).commit(); 256 fragmentManager.beginTransaction().hide(currFragment).commit();
280 - layout_main_show_setting.setVisibility(View.VISIBLE); 257 + binding.layoutMainShowSetting.getRoot().setVisibility(View.VISIBLE);
281 } 258 }
282 } 259 }
283 260
......
...@@ -2,7 +2,9 @@ package com.sw.laryngoscope.activity.fragment.setting; ...@@ -2,7 +2,9 @@ package com.sw.laryngoscope.activity.fragment.setting;
2 2
3 3
4 import android.content.Context; 4 import android.content.Context;
5 +import android.view.LayoutInflater;
5 import android.view.View; 6 import android.view.View;
7 +import android.view.ViewGroup;
6 import android.widget.CompoundButton; 8 import android.widget.CompoundButton;
7 import android.widget.RadioButton; 9 import android.widget.RadioButton;
8 import android.widget.RadioGroup; 10 import android.widget.RadioGroup;
...@@ -15,6 +17,7 @@ import com.sw.laryngoscope.activity.CustomTimer; ...@@ -15,6 +17,7 @@ import com.sw.laryngoscope.activity.CustomTimer;
15 import com.sw.laryngoscope.activity.HomeActivity; 17 import com.sw.laryngoscope.activity.HomeActivity;
16 import com.sw.laryngoscope.common.Constant; 18 import com.sw.laryngoscope.common.Constant;
17 import com.sw.laryngoscope.common.InitParam; 19 import com.sw.laryngoscope.common.InitParam;
20 +import com.sw.laryngoscope.databinding.FgSettingGeneralBinding;
18 import com.sw.laryngoscope.manager.LogoutTimerManager; 21 import com.sw.laryngoscope.manager.LogoutTimerManager;
19 import com.sw.laryngoscope.manager.SpManager; 22 import com.sw.laryngoscope.manager.SpManager;
20 import com.sw.laryngoscope.utils.Logger; 23 import com.sw.laryngoscope.utils.Logger;
...@@ -23,72 +26,12 @@ import com.sw.laryngoscope.widget.PhotoBgView1; ...@@ -23,72 +26,12 @@ import com.sw.laryngoscope.widget.PhotoBgView1;
23 26
24 import java.util.Calendar; 27 import java.util.Calendar;
25 28
26 -import butterknife.BindView;
27 -import butterknife.OnCheckedChanged;
28 -import butterknife.OnClick;
29 29
30 -public class GeneralFragment extends BaseFragment implements 30 +public class GeneralFragment extends BaseFragment<FgSettingGeneralBinding> implements
31 - CustomTimer.TimerCallBack, Switch.OnCheckedChangeListener, RadioGroup.OnCheckedChangeListener { 31 + CustomTimer.TimerCallBack, Switch.OnCheckedChangeListener, RadioGroup.OnCheckedChangeListener,View.OnClickListener {
32 32
33 private static final String TAG = "GeneralFragment"; 33 private static final String TAG = "GeneralFragment";
34 private Context context; 34 private Context context;
35 -
36 - @BindView(R.id.switch_usb_input)
37 - Switch switch_usb_input;
38 - @BindView(R.id.switch_rt_rotation)
39 - Switch switch_rt_rotation;
40 - @BindView(R.id.switch_no_login_visit_doc)
41 - Switch switch_no_login_visit_doc;
42 - @BindView(R.id.switch_boot_psd)
43 - Switch switch_boot_psd;
44 -
45 -
46 - @BindView(R.id.rg_one_camera_set)
47 - RadioGroup rg_one_camera_set;
48 - @BindView(R.id.rb_one_awb)
49 - RadioButton rb_one_awb;
50 - @BindView(R.id.rb_one_magnify)
51 - RadioButton rb_one_magnify;
52 - @BindView(R.id.rb_one_record)
53 - RadioButton rb_one_record;
54 - @BindView(R.id.rb_one_photo)
55 - RadioButton rb_one_photo;
56 - @BindView(R.id.rb_one_ice)
57 - RadioButton rb_one_ice;
58 -
59 - @BindView(R.id.rg_two_camera_set)
60 - RadioGroup rg_two_camera_set;
61 - @BindView(R.id.rb_two_awb)
62 - RadioButton rb_two_awb;
63 - @BindView(R.id.rb_two_magnify)
64 - RadioButton rb_two_magnify;
65 - @BindView(R.id.rb_two_record)
66 - RadioButton rb_two_record;
67 - @BindView(R.id.rb_two_photo)
68 - RadioButton rb_two_photo;
69 - @BindView(R.id.rb_two_ice)
70 - RadioButton rb_two_ice;
71 -
72 - @BindView(R.id.rg_inactivity)
73 - RadioGroup rg_inactivity;
74 - @BindView(R.id.rb_10_min)
75 - RadioButton rb_10_min;
76 - @BindView(R.id.rb_30_min)
77 - RadioButton rb_30_min;
78 - @BindView(R.id.rb_60_min)
79 - RadioButton rb_60_min;
80 - @BindView(R.id.rb_never)
81 - RadioButton rb_never;
82 -
83 - @BindView(R.id.txt_border_a)
84 - TextView txt_border_a;
85 - @BindView(R.id.txt_border_b)
86 - PhotoBgView1 txt_border_b;
87 - @BindView(R.id.txt_border_c)
88 - TextView txt_border_c;
89 - /*@BindView(R.id.txt_border_d)
90 - PhotoBgView1 txt_border_d;*/
91 -
92 RadioButton[] oneKeyBt = new RadioButton[5]; 35 RadioButton[] oneKeyBt = new RadioButton[5];
93 RadioButton[] twoKeyBt = new RadioButton[5]; 36 RadioButton[] twoKeyBt = new RadioButton[5];
94 37
...@@ -120,8 +63,8 @@ public class GeneralFragment extends BaseFragment implements ...@@ -120,8 +63,8 @@ public class GeneralFragment extends BaseFragment implements
120 } 63 }
121 64
122 @Override 65 @Override
123 - protected int rootLayout() { 66 + protected FgSettingGeneralBinding getViewBinding(LayoutInflater inflater, ViewGroup container) {
124 - return R.layout.fg_setting_general; 67 + return FgSettingGeneralBinding.inflate(inflater,container,false);
125 } 68 }
126 69
127 @Override 70 @Override
...@@ -133,15 +76,15 @@ public class GeneralFragment extends BaseFragment implements ...@@ -133,15 +76,15 @@ public class GeneralFragment extends BaseFragment implements
133 } 76 }
134 77
135 public void initValue() { 78 public void initValue() {
136 - rb_10_min.setChecked(SpManager.get_inactivity_logout_time() == Constant.INACTIVITY_LOGOUT_TIME_10); 79 + binding.rb10Min.setChecked(SpManager.get_inactivity_logout_time() == Constant.INACTIVITY_LOGOUT_TIME_10);
137 - rb_30_min.setChecked(SpManager.get_inactivity_logout_time() == Constant.INACTIVITY_LOGOUT_TIME_30); 80 + binding.rb30Min.setChecked(SpManager.get_inactivity_logout_time() == Constant.INACTIVITY_LOGOUT_TIME_30);
138 - rb_60_min.setChecked(SpManager.get_inactivity_logout_time() == Constant.INACTIVITY_LOGOUT_TIME_60); 81 + binding.rb60Min.setChecked(SpManager.get_inactivity_logout_time() == Constant.INACTIVITY_LOGOUT_TIME_60);
139 - rb_never.setChecked(SpManager.get_inactivity_logout_time() == Constant.INACTIVITY_LOGOUT_TIME_NEVER); 82 + binding.rbNever.setChecked(SpManager.get_inactivity_logout_time() == Constant.INACTIVITY_LOGOUT_TIME_NEVER);
140 83
141 - switch_usb_input.setChecked(!SpManager.get_usb_input_enabled()); 84 + binding.switchUsbInput.setChecked(!SpManager.get_usb_input_enabled());
142 - switch_rt_rotation.setChecked(!SpManager.get_rt_rotation()); 85 + binding.switchRtRotation.setChecked(!SpManager.get_rt_rotation());
143 - switch_no_login_visit_doc.setChecked(!SpManager.get_no_login_visit_doc()); 86 + binding.switchNoLoginVisitDoc.setChecked(!SpManager.get_no_login_visit_doc());
144 - switch_boot_psd.setChecked(!SpManager.get_boot_psd()); 87 + binding.switchBootPsd.setChecked(!SpManager.get_boot_psd());
145 88
146 setBonder(); 89 setBonder();
147 90
...@@ -149,13 +92,15 @@ public class GeneralFragment extends BaseFragment implements ...@@ -149,13 +92,15 @@ public class GeneralFragment extends BaseFragment implements
149 92
150 @Override 93 @Override
151 protected void setListener() { 94 protected void setListener() {
152 - rg_inactivity.setOnCheckedChangeListener(this); 95 + binding.rgInactivity.setOnCheckedChangeListener(this);
153 - rg_one_camera_set.setOnCheckedChangeListener(this); 96 + binding.rgOneCameraSet.setOnCheckedChangeListener(this);
154 - rg_two_camera_set.setOnCheckedChangeListener(this); 97 + binding.rgTwoCameraSet.setOnCheckedChangeListener(this);
98 + binding.txtBorderA.setOnClickListener(this);
99 + binding.txtBorderB.setOnClickListener(this);
100 + binding.txtBorderC.setOnClickListener(this);
155 } 101 }
156 102
157 @Override 103 @Override
158 - @OnClick({ R.id.txt_border_a, R.id.txt_border_b, R.id.txt_border_c,/* R.id.txt_border_d,*/ })
159 public void onClick(View v) { 104 public void onClick(View v) {
160 switch (v.getId()) { 105 switch (v.getId()) {
161 case R.id.txt_border_a: 106 case R.id.txt_border_a:
...@@ -234,16 +179,16 @@ public class GeneralFragment extends BaseFragment implements ...@@ -234,16 +179,16 @@ public class GeneralFragment extends BaseFragment implements
234 } 179 }
235 180
236 public void initKeySel() { 181 public void initKeySel() {
237 - oneKeyBt[0] = rb_one_awb; 182 + oneKeyBt[0] = binding.rbOneAwb;
238 - oneKeyBt[1] = rb_one_magnify; 183 + oneKeyBt[1] = binding.rbOneMagnify;
239 - oneKeyBt[2] = rb_one_record; 184 + oneKeyBt[2] = binding.rbOneRecord;
240 - oneKeyBt[3] = rb_one_photo; 185 + oneKeyBt[3] = binding.rbOnePhoto;
241 - oneKeyBt[4] = rb_one_ice; 186 + oneKeyBt[4] = binding.rbOneIce;
242 - twoKeyBt[0] = rb_two_awb; 187 + twoKeyBt[0] = binding.rbTwoAwb;
243 - twoKeyBt[1] = rb_two_magnify; 188 + twoKeyBt[1] = binding.rbTwoMagnify;
244 - twoKeyBt[2] = rb_two_record; 189 + twoKeyBt[2] = binding.rbTwoRecord;
245 - twoKeyBt[3] = rb_two_photo; 190 + twoKeyBt[3] = binding.rbTwoPhoto;
246 - twoKeyBt[4] = rb_two_ice; 191 + twoKeyBt[4] = binding.rbTwoIce;
247 192
248 InitParam.handleOneKey[SpManager.get_handle_one_key()] = true; 193 InitParam.handleOneKey[SpManager.get_handle_one_key()] = true;
249 InitParam.handleTwoKey[SpManager.get_handle_two_key()] = true; 194 InitParam.handleTwoKey[SpManager.get_handle_two_key()] = true;
...@@ -277,8 +222,6 @@ public class GeneralFragment extends BaseFragment implements ...@@ -277,8 +222,6 @@ public class GeneralFragment extends BaseFragment implements
277 } 222 }
278 223
279 @Override 224 @Override
280 - @OnCheckedChanged({ R.id.switch_usb_input, R.id.switch_rt_rotation,
281 - R.id.switch_no_login_visit_doc, R.id.switch_boot_psd, })
282 public void onCheckedChanged(CompoundButton compoundButton, boolean b) { 225 public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
283 switch (compoundButton.getId()) { 226 switch (compoundButton.getId()) {
284 case R.id.switch_usb_input: 227 case R.id.switch_usb_input:
...@@ -306,19 +249,19 @@ public class GeneralFragment extends BaseFragment implements ...@@ -306,19 +249,19 @@ public class GeneralFragment extends BaseFragment implements
306 249
307 public void setBonder() { 250 public void setBonder() {
308 if ( SpManager.get_border_type() == Constant.BORDER_TYPE_A ) { 251 if ( SpManager.get_border_type() == Constant.BORDER_TYPE_A ) {
309 - txt_border_a.setSelected(true); 252 + binding.txtBorderA.setSelected(true);
310 } else { 253 } else {
311 - txt_border_a.setSelected(false); 254 + binding.txtBorderA.setSelected(false);
312 } 255 }
313 if ( SpManager.get_border_type() == Constant.BORDER_TYPE_B ) { 256 if ( SpManager.get_border_type() == Constant.BORDER_TYPE_B ) {
314 - txt_border_b.setSelect(true); 257 + binding.txtBorderB.setSelect(true);
315 } else { 258 } else {
316 - txt_border_b.setSelect(false); 259 + binding.txtBorderB.setSelect(false);
317 } 260 }
318 if ( SpManager.get_border_type() == Constant.BORDER_TYPE_C ) { 261 if ( SpManager.get_border_type() == Constant.BORDER_TYPE_C ) {
319 - txt_border_c.setSelected(true); 262 + binding.txtBorderC.setSelected(true);
320 } else { 263 } else {
321 - txt_border_c.setSelected(false); 264 + binding.txtBorderC.setSelected(false);
322 } 265 }
323 /*if ( SpManager.get_border_type() == Constant.BORDER_TYPE_D ) { 266 /*if ( SpManager.get_border_type() == Constant.BORDER_TYPE_D ) {
324 txt_border_d.setSelect(true); 267 txt_border_d.setSelect(true);
......
...@@ -2,7 +2,9 @@ package com.sw.laryngoscope.activity.fragment.setting; ...@@ -2,7 +2,9 @@ package com.sw.laryngoscope.activity.fragment.setting;
2 2
3 3
4 import android.content.Context; 4 import android.content.Context;
5 +import android.view.LayoutInflater;
5 import android.view.View; 6 import android.view.View;
7 +import android.view.ViewGroup;
6 import android.widget.ImageView; 8 import android.widget.ImageView;
7 import android.widget.LinearLayout; 9 import android.widget.LinearLayout;
8 import android.widget.TextView; 10 import android.widget.TextView;
...@@ -12,23 +14,15 @@ import com.sw.laryngoscope.activity.BaseFragment; ...@@ -12,23 +14,15 @@ import com.sw.laryngoscope.activity.BaseFragment;
12 import com.sw.laryngoscope.activity.CustomTimer; 14 import com.sw.laryngoscope.activity.CustomTimer;
13 import com.sw.laryngoscope.activity.HomeActivity; 15 import com.sw.laryngoscope.activity.HomeActivity;
14 import com.sw.laryngoscope.common.InitParam; 16 import com.sw.laryngoscope.common.InitParam;
17 +import com.sw.laryngoscope.databinding.FgSettingLanBinding;
15 import com.sw.laryngoscope.utils.Logger; 18 import com.sw.laryngoscope.utils.Logger;
16 19
17 -import butterknife.BindView;
18 -import butterknife.OnClick;
19 20
20 -public class LanFragment extends BaseFragment implements CustomTimer.TimerCallBack { 21 +public class LanFragment extends BaseFragment<FgSettingLanBinding> implements CustomTimer.TimerCallBack,View.OnClickListener {
21 22
22 private static final String TAG = "LanFragment"; 23 private static final String TAG = "LanFragment";
23 private Context context; 24 private Context context;
24 25
25 - @BindView(R.id.lin_lan)
26 - public LinearLayout lin_lan;
27 - @BindView(R.id.txt_lan)
28 - public TextView txt_lan;
29 - @BindView(R.id.img_lan_next)
30 - public ImageView img_lan_next;
31 -
32 private CustomTimer scrollTimer; 26 private CustomTimer scrollTimer;
33 private final String timerTAG_scroll = "scroll"; 27 private final String timerTAG_scroll = "scroll";
34 28
...@@ -57,8 +51,8 @@ public class LanFragment extends BaseFragment implements CustomTimer.TimerCallBa ...@@ -57,8 +51,8 @@ public class LanFragment extends BaseFragment implements CustomTimer.TimerCallBa
57 } 51 }
58 52
59 @Override 53 @Override
60 - protected int rootLayout() { 54 + protected FgSettingLanBinding getViewBinding(LayoutInflater inflater, ViewGroup container) {
61 - return R.layout.fg_setting_lan; 55 + return FgSettingLanBinding.inflate(inflater,container,false);
62 } 56 }
63 57
64 @Override 58 @Override
...@@ -72,22 +66,22 @@ public class LanFragment extends BaseFragment implements CustomTimer.TimerCallBa ...@@ -72,22 +66,22 @@ public class LanFragment extends BaseFragment implements CustomTimer.TimerCallBa
72 for (int i = 0; i < InitParam.LAN_TYPE_RES.length; i++ ) { 66 for (int i = 0; i < InitParam.LAN_TYPE_RES.length; i++ ) {
73 if ( getRootView().getResources().getConfiguration().locale.getLanguage() 67 if ( getRootView().getResources().getConfiguration().locale.getLanguage()
74 .equals(InitParam.mLocale[i].getLanguage()) ) { 68 .equals(InitParam.mLocale[i].getLanguage()) ) {
75 - txt_lan.setText(InitParam.LAN_TYPE_RES[i]); 69 + binding.txtLan.setText(InitParam.LAN_TYPE_RES[i]);
76 } 70 }
77 } 71 }
78 } 72 }
79 73
80 @Override 74 @Override
81 protected void setListener() { 75 protected void setListener() {
76 + binding.linLan.setOnClickListener(this);
82 } 77 }
83 78
84 @Override 79 @Override
85 - @OnClick({ R.id.lin_lan, })
86 public void onClick(View v) { 80 public void onClick(View v) {
87 switch (v.getId()) { 81 switch (v.getId()) {
88 case R.id.lin_lan: 82 case R.id.lin_lan:
89 //homeFragment.backHomeFragment(); 83 //homeFragment.backHomeFragment();
90 - (new LanPopWindow(getContext())).showLanPop(lin_lan, txt_lan, img_lan_next); 84 + (new LanPopWindow(getContext())).showLanPop(binding.linLan, binding.txtLan, binding.imgLanNext);
91 break; 85 break;
92 default: 86 default:
93 break; 87 break;
......
...@@ -32,7 +32,7 @@ public class LanPopWindow { ...@@ -32,7 +32,7 @@ public class LanPopWindow {
32 this.context = context; 32 this.context = context;
33 } 33 }
34 34
35 - public void showLanPop(View view, TextView txtView, View arrow) { 35 + public void showLanPop(View view, final TextView txtView, final View arrow) {
36 int curPos = -1; 36 int curPos = -1;
37 View bottomView = View.inflate(context, R.layout.layout_lan_choose, null); 37 View bottomView = View.inflate(context, R.layout.layout_lan_choose, null);
38 ListView lt_user = bottomView.findViewById(R.id.lt_user); 38 ListView lt_user = bottomView.findViewById(R.id.lt_user);
......
...@@ -5,7 +5,9 @@ import android.content.Context; ...@@ -5,7 +5,9 @@ import android.content.Context;
5 import android.os.Handler; 5 import android.os.Handler;
6 import android.os.Message; 6 import android.os.Message;
7 import android.util.Log; 7 import android.util.Log;
8 +import android.view.LayoutInflater;
8 import android.view.View; 9 import android.view.View;
10 +import android.view.ViewGroup;
9 import android.widget.ListView; 11 import android.widget.ListView;
10 import android.widget.RelativeLayout; 12 import android.widget.RelativeLayout;
11 import android.widget.SeekBar; 13 import android.widget.SeekBar;
...@@ -16,6 +18,7 @@ import com.sw.laryngoscope.activity.BaseFragment; ...@@ -16,6 +18,7 @@ import com.sw.laryngoscope.activity.BaseFragment;
16 import com.sw.laryngoscope.activity.CustomTimer; 18 import com.sw.laryngoscope.activity.CustomTimer;
17 import com.sw.laryngoscope.activity.HomeActivity; 19 import com.sw.laryngoscope.activity.HomeActivity;
18 import com.sw.laryngoscope.adapter.UsbItemAdapter; 20 import com.sw.laryngoscope.adapter.UsbItemAdapter;
21 +import com.sw.laryngoscope.databinding.FgSettingLogBinding;
19 import com.sw.laryngoscope.db.UsbInfoBean; 22 import com.sw.laryngoscope.db.UsbInfoBean;
20 import com.sw.laryngoscope.manager.Storage; 23 import com.sw.laryngoscope.manager.Storage;
21 import com.sw.laryngoscope.manager.StorageStateManager; 24 import com.sw.laryngoscope.manager.StorageStateManager;
...@@ -26,11 +29,9 @@ import com.sw.laryngoscope.utils.ShellUtils; ...@@ -26,11 +29,9 @@ import com.sw.laryngoscope.utils.ShellUtils;
26 import java.util.ArrayList; 29 import java.util.ArrayList;
27 import java.util.List; 30 import java.util.List;
28 31
29 -import butterknife.BindView;
30 -import butterknife.OnClick;
31 32
32 -public class LogExportFragment extends BaseFragment implements 33 +public class LogExportFragment extends BaseFragment<FgSettingLogBinding> implements
33 - CustomTimer.TimerCallBack, StorageStateManager.MountCallBack { 34 + CustomTimer.TimerCallBack, StorageStateManager.MountCallBack,View.OnClickListener {
34 35
35 private static final String TAG = "LogExportFragment"; 36 private static final String TAG = "LogExportFragment";
36 private Context context; 37 private Context context;
...@@ -38,18 +39,6 @@ public class LogExportFragment extends BaseFragment implements ...@@ -38,18 +39,6 @@ public class LogExportFragment extends BaseFragment implements
38 private CustomTimer scrollTimer; 39 private CustomTimer scrollTimer;
39 private final String timerTAG_scroll = "scroll"; 40 private final String timerTAG_scroll = "scroll";
40 41
41 - @BindView(R.id.listView_usb)
42 - ListView listView_usb;
43 - @BindView(R.id.lay_usb)
44 - RelativeLayout lay_usb;
45 - @BindView(R.id.sb_log)
46 - SeekBar sb_log;
47 - //@BindView(R.id.ptv_open_persentage)
48 - //ProgressTextView ptv_open_persentage;
49 -
50 - @BindView(R.id.txt_export)
51 - TextView txt_export;
52 -
53 public UsbItemAdapter mUsbItemAdapter; 42 public UsbItemAdapter mUsbItemAdapter;
54 public List<UsbInfoBean> usbInfolist = new ArrayList<>(); 43 public List<UsbInfoBean> usbInfolist = new ArrayList<>();
55 int mProgress = 0; 44 int mProgress = 0;
...@@ -67,9 +56,9 @@ public class LogExportFragment extends BaseFragment implements ...@@ -67,9 +56,9 @@ public class LogExportFragment extends BaseFragment implements
67 StorageStateManager.getInstance().setMountCallBackFun(this); 56 StorageStateManager.getInstance().setMountCallBackFun(this);
68 Logger.d(TAG, "======showFragment======2"); 57 Logger.d(TAG, "======showFragment======2");
69 //禁用状态 58 //禁用状态
70 - sb_log.setClickable(false); 59 + binding.sbLog.setClickable(false);
71 - sb_log.setEnabled(false); 60 + binding.sbLog.setEnabled(false);
72 - sb_log.setFocusable(false); 61 + binding.sbLog.setFocusable(false);
73 } 62 }
74 63
75 @Override 64 @Override
...@@ -83,14 +72,14 @@ public class LogExportFragment extends BaseFragment implements ...@@ -83,14 +72,14 @@ public class LogExportFragment extends BaseFragment implements
83 } else { 72 } else {
84 mHandler.removeMessages(MSG_COPY_LOG); 73 mHandler.removeMessages(MSG_COPY_LOG);
85 //StorageStateManager.getInstance().setMountCallBackFun(null); 74 //StorageStateManager.getInstance().setMountCallBackFun(null);
86 - lay_usb.setVisibility(View.GONE); 75 + binding.layUsb.setVisibility(View.GONE);
87 Logger.d(TAG, "======showFragment======2 " + hidden); 76 Logger.d(TAG, "======showFragment======2 " + hidden);
88 } 77 }
89 } 78 }
90 79
91 @Override 80 @Override
92 - protected int rootLayout() { 81 + protected FgSettingLogBinding getViewBinding(LayoutInflater inflater, ViewGroup container) {
93 - return R.layout.fg_setting_log; 82 + return FgSettingLogBinding.inflate(inflater,container,false);
94 } 83 }
95 84
96 @Override 85 @Override
...@@ -98,17 +87,17 @@ public class LogExportFragment extends BaseFragment implements ...@@ -98,17 +87,17 @@ public class LogExportFragment extends BaseFragment implements
98 //layout_home_home_guest = (ConstraintLayout) rootView.findViewById(R.id.layout_home_home_guest); 87 //layout_home_home_guest = (ConstraintLayout) rootView.findViewById(R.id.layout_home_home_guest);
99 usbInfolist = new ArrayList<>(); 88 usbInfolist = new ArrayList<>();
100 mUsbItemAdapter = new UsbItemAdapter(getContext(), usbInfolist); 89 mUsbItemAdapter = new UsbItemAdapter(getContext(), usbInfolist);
101 - listView_usb.setAdapter(mUsbItemAdapter); 90 + binding.listViewUsb.setAdapter(mUsbItemAdapter);
102 initValue(); 91 initValue();
103 } 92 }
104 93
105 public void initValue() { 94 public void initValue() {
106 if ( !Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath()) ) { 95 if ( !Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath()) ) {
107 clearList(); 96 clearList();
108 - lay_usb.setVisibility(View.GONE); 97 + binding.layUsb.setVisibility(View.GONE);
109 } else if ( Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath()) 98 } else if ( Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath())
110 /*&& SpManager.get_usb_input_enabled()*/ ) { 99 /*&& SpManager.get_usb_input_enabled()*/ ) {
111 - txt_export.setEnabled(true); 100 + binding.txtExport.setEnabled(true);
112 initList(Storage.getUName(getContext())); 101 initList(Storage.getUName(getContext()));
113 } 102 }
114 } 103 }
...@@ -119,10 +108,10 @@ public class LogExportFragment extends BaseFragment implements ...@@ -119,10 +108,10 @@ public class LogExportFragment extends BaseFragment implements
119 usbInfolist.add(usbInfoBean); 108 usbInfolist.add(usbInfoBean);
120 mUsbItemAdapter.setBeans(usbInfolist); 109 mUsbItemAdapter.setBeans(usbInfolist);
121 mUsbItemAdapter.notifyDataSetChanged(); 110 mUsbItemAdapter.notifyDataSetChanged();
122 - sb_log.setProgress(0); 111 + binding.sbLog.setProgress(0);
123 //ptv_open_persentage.setProgress(0, 0 + "%"); 112 //ptv_open_persentage.setProgress(0, 0 + "%");
124 - lay_usb.setVisibility(View.VISIBLE); 113 + binding.layUsb.setVisibility(View.VISIBLE);
125 - sb_log.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { 114 + binding.sbLog.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
126 @Override 115 @Override
127 public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { 116 public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
128 if (!fromUser) { 117 if (!fromUser) {
...@@ -152,15 +141,15 @@ public class LogExportFragment extends BaseFragment implements ...@@ -152,15 +141,15 @@ public class LogExportFragment extends BaseFragment implements
152 141
153 @Override 142 @Override
154 protected void setListener() { 143 protected void setListener() {
144 + binding.txtExport.setOnClickListener(this);
155 } 145 }
156 146
157 @Override 147 @Override
158 - @OnClick({ R.id.txt_export })
159 public void onClick(View v) { 148 public void onClick(View v) {
160 switch (v.getId()) { 149 switch (v.getId()) {
161 case R.id.txt_export: 150 case R.id.txt_export:
162 - sb_log.setProgress(0); 151 + binding.sbLog.setProgress(0);
163 - txt_export.setEnabled(false); 152 + binding.txtExport.setEnabled(false);
164 mHandler.sendEmptyMessageDelayed(MSG_COPY_LOG, 500); 153 mHandler.sendEmptyMessageDelayed(MSG_COPY_LOG, 500);
165 break; 154 break;
166 default: 155 default:
...@@ -193,10 +182,10 @@ public class LogExportFragment extends BaseFragment implements ...@@ -193,10 +182,10 @@ public class LogExportFragment extends BaseFragment implements
193 public void MountEventProc(boolean mount) { 182 public void MountEventProc(boolean mount) {
194 if ( mount /*&& SpManager.get_usb_input_enabled()*/ ) { 183 if ( mount /*&& SpManager.get_usb_input_enabled()*/ ) {
195 initList(Storage.getUName(getContext())); 184 initList(Storage.getUName(getContext()));
196 - txt_export.setEnabled(true); 185 + binding.txtExport.setEnabled(true);
197 } else { 186 } else {
198 clearList(); 187 clearList();
199 - lay_usb.setVisibility(View.GONE); 188 + binding.layUsb.setVisibility(View.GONE);
200 mHandler.removeMessages(MSG_COPY_LOG); 189 mHandler.removeMessages(MSG_COPY_LOG);
201 //LogcatHelper.getInstance(context).stop(); 190 //LogcatHelper.getInstance(context).stop();
202 } 191 }
...@@ -211,8 +200,8 @@ public class LogExportFragment extends BaseFragment implements ...@@ -211,8 +200,8 @@ public class LogExportFragment extends BaseFragment implements
211 switch (msg.what) { 200 switch (msg.what) {
212 case MSG_COPY_LOG: 201 case MSG_COPY_LOG:
213 Log.d(TAG, "==.copyToUsb()1============"); 202 Log.d(TAG, "==.copyToUsb()1============");
214 - int num = sb_log.getProgress(); 203 + int num = binding.sbLog.getProgress();
215 - int max = sb_log.getMax(); 204 + int max = binding.sbLog.getMax();
216 if ( num < max ) { 205 if ( num < max ) {
217 num += 1; 206 num += 1;
218 } else { 207 } else {
...@@ -227,12 +216,12 @@ public class LogExportFragment extends BaseFragment implements ...@@ -227,12 +216,12 @@ public class LogExportFragment extends BaseFragment implements
227 }).start(); 216 }).start();
228 mProgress = 0; 217 mProgress = 0;
229 //ptv_open_persentage.setProgress(0, 0 + "%"); 218 //ptv_open_persentage.setProgress(0, 0 + "%");
230 - sb_log.setProgress(0); 219 + binding.sbLog.setProgress(0);
231 mHandler.removeMessages(MSG_COPY_LOG); 220 mHandler.removeMessages(MSG_COPY_LOG);
232 - txt_export.setEnabled(true); 221 + binding.txtExport.setEnabled(true);
233 break; 222 break;
234 } 223 }
235 - sb_log.setProgress(num); 224 + binding.sbLog.setProgress(num);
236 mHandler.sendEmptyMessageDelayed(MSG_COPY_LOG, 500); 225 mHandler.sendEmptyMessageDelayed(MSG_COPY_LOG, 500);
237 break; 226 break;
238 default: 227 default:
......
...@@ -33,7 +33,7 @@ public class ZonePopWindow { ...@@ -33,7 +33,7 @@ public class ZonePopWindow {
33 this.context = context; 33 this.context = context;
34 } 34 }
35 35
36 - public void showZonePop(View view, final TextView txtView, View arrow) { 36 + public void showZonePop(View view, final TextView txtView, final View arrow) {
37 View bottomView = View.inflate(context, R.layout.layout_zone_choose, null); 37 View bottomView = View.inflate(context, R.layout.layout_zone_choose, null);
38 ListView lt_zone = bottomView.findViewById(R.id.lt_zone); 38 ListView lt_zone = bottomView.findViewById(R.id.lt_zone);
39 mZoneItemAdapter = new ZoneItemAdapter(context, InitParam.zoneList); 39 mZoneItemAdapter = new ZoneItemAdapter(context, InitParam.zoneList);
......
...@@ -24,6 +24,8 @@ import android.widget.Toast; ...@@ -24,6 +24,8 @@ import android.widget.Toast;
24 import com.sw.laryngoscope.R; 24 import com.sw.laryngoscope.R;
25 import com.sw.laryngoscope.base.BaseActivity; 25 import com.sw.laryngoscope.base.BaseActivity;
26 import com.sw.laryngoscope.base.factory.CreatePresenter; 26 import com.sw.laryngoscope.base.factory.CreatePresenter;
27 +import com.sw.laryngoscope.databinding.ActivityLoginBinding;
28 +import com.sw.laryngoscope.databinding.ActivityMainBinding;
27 import com.sw.laryngoscope.db.AccountInfoDB; 29 import com.sw.laryngoscope.db.AccountInfoDB;
28 import com.sw.laryngoscope.manager.AccountManager; 30 import com.sw.laryngoscope.manager.AccountManager;
29 import com.sw.laryngoscope.manager.LogoutTimerManager; 31 import com.sw.laryngoscope.manager.LogoutTimerManager;
...@@ -38,7 +40,6 @@ import com.sw.laryngoscope.widget.BatteryStateView; ...@@ -38,7 +40,6 @@ import com.sw.laryngoscope.widget.BatteryStateView;
38 import java.util.ArrayList; 40 import java.util.ArrayList;
39 import java.util.List; 41 import java.util.List;
40 42
41 -import butterknife.BindView;
42 43
43 /** 44 /**
44 * @Description 这里用一句话描述 45 * @Description 这里用一句话描述
...@@ -47,34 +48,11 @@ import butterknife.BindView; ...@@ -47,34 +48,11 @@ import butterknife.BindView;
47 */ 48 */
48 @CreatePresenter(LoginPresenter.class) 49 @CreatePresenter(LoginPresenter.class)
49 public class LoginActivity extends 50 public class LoginActivity extends
50 - BaseActivity<LoginView, LoginPresenter> 51 + BaseActivity<LoginView, LoginPresenter, ActivityLoginBinding>
51 implements LoginView, View.OnClickListener, View.OnTouchListener, 52 implements LoginView, View.OnClickListener, View.OnTouchListener,
52 LogoutTimerManager.LogoutCallBack, 53 LogoutTimerManager.LogoutCallBack,
53 BatteryStateViewUtil.OnBatteryChargeLitener { 54 BatteryStateViewUtil.OnBatteryChargeLitener {
54 55
55 - @BindView(R.id.batterView)
56 - public BatteryStateView batterView;
57 -
58 - @BindView(R.id.layout_ad)
59 - View layout_ad;
60 -
61 - @BindView(R.id.layout_login)
62 - View layout_login;
63 - @BindView(R.id.layout_name)
64 - LinearLayout layout_name;
65 - @BindView(R.id.edit_user_name)
66 - EditText edit_user_name;
67 - @BindView(R.id.img_user_spinner)
68 - ImageView img_user_spinner;
69 - @BindView(R.id.edit_user_psd)
70 - EditText edit_user_psd;
71 - @BindView(R.id.img_hide_secret)
72 - ImageView img_hide_secret;
73 - @BindView(R.id.txt_login)
74 - TextView txt_login;
75 - @BindView(R.id.txt_anonymous)
76 - TextView txt_anonymous;
77 -
78 protected Context context; 56 protected Context context;
79 57
80 /*@BindView(R.id.txt_test) 58 /*@BindView(R.id.txt_test)
...@@ -110,9 +88,9 @@ public class LoginActivity extends ...@@ -110,9 +88,9 @@ public class LoginActivity extends
110 getdata = SpManager.getSelectBean(); 88 getdata = SpManager.getSelectBean();
111 if (getdata != null && getdata.size() > 0) { 89 if (getdata != null && getdata.size() > 0) {
112 if (!TextUtils.isEmpty(getdata.get(0).getName())) { 90 if (!TextUtils.isEmpty(getdata.get(0).getName())) {
113 - edit_user_name.setText(getdata.get(0).getName()); 91 + binding.layoutLogin.editUserName.setText(getdata.get(0).getName());
114 //edit_user_psd.setText(getdata.get(0).getPassword()); 92 //edit_user_psd.setText(getdata.get(0).getPassword());
115 - edit_user_name.setSelection(edit_user_name.getText().length()); 93 + binding.layoutLogin.editUserName.setSelection(binding.layoutLogin.editUserName.getText().length());
116 //edit_user_psd.setSelection(edit_user_psd.getText().length()); 94 //edit_user_psd.setSelection(edit_user_psd.getText().length());
117 } 95 }
118 Logger.d(" getdata ---- " + getdata.size()); 96 Logger.d(" getdata ---- " + getdata.size());
...@@ -134,14 +112,19 @@ public class LoginActivity extends ...@@ -134,14 +112,19 @@ public class LoginActivity extends
134 /*txt_test.setOnMultiClickListener(() -> { 112 /*txt_test.setOnMultiClickListener(() -> {
135 HomeActivity.this.startActivity(new Intent("android.intent.action.WEIKENTEST")); 113 HomeActivity.this.startActivity(new Intent("android.intent.action.WEIKENTEST"));
136 });*/ 114 });*/
137 - layout_ad.postDelayed(runnable, 5 * 1000); 115 + binding.layoutAd.getRoot().postDelayed(runnable, 5 * 1000);
116 + }
117 +
118 + @Override
119 + protected ActivityLoginBinding getViewBinding() {
120 + return ActivityLoginBinding.inflate(getLayoutInflater());
138 } 121 }
139 122
140 Runnable runnable = new Runnable() { 123 Runnable runnable = new Runnable() {
141 @Override 124 @Override
142 public void run() { 125 public void run() {
143 - layout_ad.setVisibility(View.GONE); 126 + binding.layoutAd.getRoot().setVisibility(View.GONE);
144 - layout_login.setVisibility(View.VISIBLE); 127 + binding.layoutLogin.getRoot().setVisibility(View.VISIBLE);
145 } 128 }
146 }; 129 };
147 130
...@@ -164,11 +147,6 @@ public class LoginActivity extends ...@@ -164,11 +147,6 @@ public class LoginActivity extends
164 } 147 }
165 148
166 @Override 149 @Override
167 - protected int getLayoutId() {
168 - return R.layout.activity_login;
169 - }
170 -
171 - @Override
172 public void onClick(View view) { 150 public void onClick(View view) {
173 switch (view.getId()) { 151 switch (view.getId()) {
174 case R.id.txt_login: 152 case R.id.txt_login:
...@@ -180,8 +158,8 @@ public class LoginActivity extends ...@@ -180,8 +158,8 @@ public class LoginActivity extends
180 } 158 }
181 }).start();*/ 159 }).start();*/
182 160
183 - account = edit_user_name.getText().toString(); 161 + account = binding.layoutLogin.editUserName.getText().toString();
184 - password = edit_user_psd.getText().toString(); 162 + password = binding.layoutLogin.editUserPsd.getText().toString();
185 if( TextUtils.isEmpty(account) || TextUtils.isEmpty(password) ){ 163 if( TextUtils.isEmpty(account) || TextUtils.isEmpty(password) ){
186 Toast.makeText(context, getString(R.string.string_account_non), Toast.LENGTH_LONG).show(); 164 Toast.makeText(context, getString(R.string.string_account_non), Toast.LENGTH_LONG).show();
187 break; 165 break;
...@@ -230,20 +208,20 @@ public class LoginActivity extends ...@@ -230,20 +208,20 @@ public class LoginActivity extends
230 } else { 208 } else {
231 isShowDialog = true; 209 isShowDialog = true;
232 if (mSpinerPopWindow != null) { 210 if (mSpinerPopWindow != null) {
233 - mSpinerPopWindow.showAsDropDown(layout_name, 0, -2); 211 + mSpinerPopWindow.showAsDropDown(binding.layoutLogin.layoutName, 0, -2);
234 } 212 }
235 } 213 }
236 break; 214 break;
237 case R.id.img_hide_secret: 215 case R.id.img_hide_secret:
238 //Jpg2Dcm.main(); 216 //Jpg2Dcm.main();
239 - if ( edit_user_psd.getInputType() == 128 ) { 217 + if ( binding.layoutLogin.editUserPsd.getInputType() == 128 ) {
240 - edit_user_psd.setInputType(129);//设置为隐藏密码 218 + binding.layoutLogin.editUserPsd.setInputType(129);//设置为隐藏密码
241 - img_hide_secret.setSelected(false); 219 + binding.layoutLogin.imgHideSecret.setSelected(false);
242 } else { 220 } else {
243 - edit_user_psd.setInputType(128);//设置为显示密码 221 + binding.layoutLogin.editUserPsd.setInputType(128);//设置为显示密码
244 - img_hide_secret.setSelected(true); 222 + binding.layoutLogin.imgHideSecret.setSelected(true);
245 } 223 }
246 - edit_user_psd.setSelection(edit_user_psd.getText().length()); 224 + binding.layoutLogin.editUserPsd.setSelection(binding.layoutLogin.editUserPsd.getText().length());
247 break; 225 break;
248 case R.id.txt_anonymous: 226 case R.id.txt_anonymous:
249 finish(); 227 finish();
...@@ -270,10 +248,10 @@ public class LoginActivity extends ...@@ -270,10 +248,10 @@ public class LoginActivity extends
270 @SuppressLint("ClickableViewAccessibility") 248 @SuppressLint("ClickableViewAccessibility")
271 private void setListener() { 249 private void setListener() {
272 //((RadioButton) rg_home_bottom.getChildAt(0)).setChecked(true); 250 //((RadioButton) rg_home_bottom.getChildAt(0)).setChecked(true);
273 - img_user_spinner.setOnClickListener(this); 251 + binding.layoutLogin.imgUserSpinner.setOnClickListener(this);
274 - img_hide_secret.setOnClickListener(this); 252 + binding.layoutLogin.imgHideSecret.setOnClickListener(this);
275 - txt_login.setOnClickListener(this); 253 + binding.layoutLogin.txtLogin.setOnClickListener(this);
276 - txt_anonymous.setOnClickListener(this); 254 + binding.layoutLogin.txtAnonymous.setOnClickListener(this);
277 } 255 }
278 256
279 @Override 257 @Override
...@@ -288,7 +266,7 @@ public class LoginActivity extends ...@@ -288,7 +266,7 @@ public class LoginActivity extends
288 266
289 private void showInput() { 267 private void showInput() {
290 if (!imm.isActive()) { 268 if (!imm.isActive()) {
291 - imm.showSoftInput(edit_user_name, 269 + imm.showSoftInput(binding.layoutLogin.editUserName,
292 InputMethodManager.SHOW_IMPLICIT); 270 InputMethodManager.SHOW_IMPLICIT);
293 } 271 }
294 } 272 }
...@@ -296,7 +274,7 @@ public class LoginActivity extends ...@@ -296,7 +274,7 @@ public class LoginActivity extends
296 private void hideInput() { 274 private void hideInput() {
297 if (imm.isActive()) { 275 if (imm.isActive()) {
298 imm.hideSoftInputFromWindow( 276 imm.hideSoftInputFromWindow(
299 - edit_user_name.getWindowToken(), 0); 277 + binding.layoutLogin.editUserName.getWindowToken(), 0);
300 } 278 }
301 } 279 }
302 280
...@@ -310,10 +288,10 @@ public class LoginActivity extends ...@@ -310,10 +288,10 @@ public class LoginActivity extends
310 isShowDialog = false; 288 isShowDialog = false;
311 List<AccountInfoDB> datalist = SpManager.getSelectBean(); 289 List<AccountInfoDB> datalist = SpManager.getSelectBean();
312 if (datalist != null && datalist.size() > 0) { 290 if (datalist != null && datalist.size() > 0) {
313 - edit_user_name.setText(datalist.get(0).getName()); 291 + binding.layoutLogin.editUserName.setText(datalist.get(0).getName());
314 - edit_user_psd.setText(datalist.get(0).getPassword()); 292 + binding.layoutLogin.editUserPsd.setText(datalist.get(0).getPassword());
315 - edit_user_name.setSelection(edit_user_name.getText().length()); 293 + binding.layoutLogin.editUserName.setSelection(binding.layoutLogin.editUserName.getText().length());
316 - edit_user_psd.setSelection(edit_user_psd.getText().length()); 294 + binding.layoutLogin.editUserPsd.setSelection(binding.layoutLogin.editUserPsd.getText().length());
317 } 295 }
318 getdata = SpManager.getSelectBean(); 296 getdata = SpManager.getSelectBean();
319 mSpinerPopWindow.setList(getdata); 297 mSpinerPopWindow.setList(getdata);
...@@ -337,10 +315,10 @@ public class LoginActivity extends ...@@ -337,10 +315,10 @@ public class LoginActivity extends
337 isShowDialog = false; 315 isShowDialog = false;
338 mSpinerPopWindow.dismiss(); 316 mSpinerPopWindow.dismiss();
339 if ( getdata.size() > 0 ) { 317 if ( getdata.size() > 0 ) {
340 - edit_user_name.setText(getdata.get(position).getName()); 318 + binding.layoutLogin.editUserName.setText(getdata.get(position).getName());
341 - edit_user_psd.setText(getdata.get(position).getPassword()); 319 + binding.layoutLogin.editUserPsd.setText(getdata.get(position).getPassword());
342 - edit_user_name.setSelection(edit_user_name.getText().length()); 320 + binding.layoutLogin.editUserName.setSelection(binding.layoutLogin.editUserName.getText().length());
343 - edit_user_psd.setSelection(edit_user_psd.getText().length()); 321 + binding.layoutLogin.editUserPsd.setSelection(binding.layoutLogin.editUserPsd.getText().length());
344 } 322 }
345 } 323 }
346 }; 324 };
...@@ -350,7 +328,7 @@ public class LoginActivity extends ...@@ -350,7 +328,7 @@ public class LoginActivity extends
350 public void batteryRegister() { 328 public void batteryRegister() {
351 if ( batteryChangedReceiver == null ) { 329 if ( batteryChangedReceiver == null ) {
352 BatteryStateViewUtil.setOnBatteryLitener(this); 330 BatteryStateViewUtil.setOnBatteryLitener(this);
353 - batteryChangedReceiver = BatteryStateViewUtil.createBroadcastReceiver(batterView); 331 + batteryChangedReceiver = BatteryStateViewUtil.createBroadcastReceiver(binding.batterView);
354 } 332 }
355 //binding.batteryStateView是电量的组件 333 //binding.batteryStateView是电量的组件
356 registerReceiver(batteryChangedReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED)); 334 registerReceiver(batteryChangedReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
......
...@@ -163,7 +163,7 @@ public class DetailGdItemAdapter extends RecyclerView.Adapter<DetailGdItemAdapte ...@@ -163,7 +163,7 @@ public class DetailGdItemAdapter extends RecyclerView.Adapter<DetailGdItemAdapte
163 } 163 }
164 164
165 @Override 165 @Override
166 - public void onBindViewHolder(ViewHolder holder, @SuppressLint("RecyclerView") int position) { 166 + public void onBindViewHolder(final ViewHolder holder, @SuppressLint("RecyclerView") final int position) {
167 RecordInfoDB temp = list.get( list.size() - position -1 ); 167 RecordInfoDB temp = list.get( list.size() - position -1 );
168 String file; 168 String file;
169 if ( temp.getType() == InitParam.FILE_PHOTO ) { 169 if ( temp.getType() == InitParam.FILE_PHOTO ) {
......
...@@ -89,7 +89,7 @@ public class FileItemAdapter extends BaseAdapter { ...@@ -89,7 +89,7 @@ public class FileItemAdapter extends BaseAdapter {
89 holder = (ViewHolder)convertView.getTag(); 89 holder = (ViewHolder)convertView.getTag();
90 } 90 }
91 91
92 - FileDayBean bean = this.beans.get(position); 92 + final FileDayBean bean = this.beans.get(position);
93 if ( selPos == position ) { 93 if ( selPos == position ) {
94 //holder.lay_value.setBackgroundResource(R.drawable.bg_user_sideview_gray); 94 //holder.lay_value.setBackgroundResource(R.drawable.bg_user_sideview_gray);
95 /*holder.lay_userlist.setBackgroundColor( 95 /*holder.lay_userlist.setBackgroundColor(
......
...@@ -63,8 +63,8 @@ public class FolderItemAdapter extends RecyclerView.Adapter<FolderItemAdapter.Vi ...@@ -63,8 +63,8 @@ public class FolderItemAdapter extends RecyclerView.Adapter<FolderItemAdapter.Vi
63 } 63 }
64 64
65 @Override 65 @Override
66 - public void onBindViewHolder(ViewHolder holder, @SuppressLint("RecyclerView") int position) { 66 + public void onBindViewHolder(ViewHolder holder, @SuppressLint("RecyclerView") final int position) {
67 - FolderItemBean temp = list.get( list.size() - position -1 ); 67 + final FolderItemBean temp = list.get( list.size() - position -1 );
68 //Logger.d(" onBindViewHolder ------------- " + list.size()); 68 //Logger.d(" onBindViewHolder ------------- " + list.size());
69 if ( mFileListMg.curFoldLevel == InitParam.FOLDER_LEVEL.L_ONE.ordinal() ) { 69 if ( mFileListMg.curFoldLevel == InitParam.FOLDER_LEVEL.L_ONE.ordinal() ) {
70 holder.txt_name.setText(temp.getFdName()); 70 holder.txt_name.setText(temp.getFdName());
......
...@@ -70,7 +70,7 @@ public class ListAdapter extends RecyclerView.Adapter<ListAdapter.ViewHolder> { ...@@ -70,7 +70,7 @@ public class ListAdapter extends RecyclerView.Adapter<ListAdapter.ViewHolder> {
70 } 70 }
71 71
72 @Override 72 @Override
73 - public void onBindViewHolder(ViewHolder holder, @SuppressLint("RecyclerView") int position) { 73 + public void onBindViewHolder(ViewHolder holder, @SuppressLint("RecyclerView") final int position) {
74 if ( curSelPos == position ) { 74 if ( curSelPos == position ) {
75 holder.item_detail_img.setSelected(true); 75 holder.item_detail_img.setSelected(true);
76 } else { 76 } else {
......
...@@ -61,7 +61,7 @@ public class ShowGdItemAdapter extends BaseAdapter { ...@@ -61,7 +61,7 @@ public class ShowGdItemAdapter extends BaseAdapter {
61 } 61 }
62 62
63 @Override 63 @Override
64 - public View getView(int position, View convertView, ViewGroup parent) { 64 + public View getView(final int position, View convertView, ViewGroup parent) {
65 ViewHolder viewHolder; 65 ViewHolder viewHolder;
66 if (convertView != null) { 66 if (convertView != null) {
67 viewHolder = (ViewHolder) convertView.getTag(); 67 viewHolder = (ViewHolder) convertView.getTag();
......
...@@ -9,6 +9,7 @@ import android.view.Window; ...@@ -9,6 +9,7 @@ import android.view.Window;
9 import android.view.WindowManager; 9 import android.view.WindowManager;
10 10
11 import androidx.annotation.Nullable; 11 import androidx.annotation.Nullable;
12 +import androidx.viewbinding.ViewBinding;
12 13
13 import com.sw.laryngoscope.base.factory.PresenterFactory; 14 import com.sw.laryngoscope.base.factory.PresenterFactory;
14 import com.sw.laryngoscope.base.factory.PresenterFactoryImpl; 15 import com.sw.laryngoscope.base.factory.PresenterFactoryImpl;
...@@ -16,7 +17,6 @@ import com.sw.laryngoscope.base.factory.PresenterProxy; ...@@ -16,7 +17,6 @@ import com.sw.laryngoscope.base.factory.PresenterProxy;
16 import com.sw.laryngoscope.base.factory.PresenterProxyImpl; 17 import com.sw.laryngoscope.base.factory.PresenterProxyImpl;
17 import com.sw.laryngoscope.utils.Logger; 18 import com.sw.laryngoscope.utils.Logger;
18 19
19 -import butterknife.ButterKnife;
20 20
21 /** 21 /**
22 * @Description 继承自Activity的基类MvpActivity 22 * @Description 继承自Activity的基类MvpActivity
...@@ -26,14 +26,14 @@ import butterknife.ButterKnife; ...@@ -26,14 +26,14 @@ import butterknife.ButterKnife;
26 * @Author 26 * @Author
27 * @Time 2019/05/29 27 * @Time 2019/05/29
28 */ 28 */
29 -public abstract class BaseActivity<V extends BaseView, P extends BasePresenter<V>> 29 +public abstract class BaseActivity<V extends BaseView, P extends BasePresenter<V>,VB extends ViewBinding>
30 extends Activity implements BaseView, PresenterProxy<V, P> { 30 extends Activity implements BaseView, PresenterProxy<V, P> {
31 31
32 public String TAG; 32 public String TAG;
33 private static final String PRESENTER_SAVE_KEY = "presenter_save_key"; 33 private static final String PRESENTER_SAVE_KEY = "presenter_save_key";
34 34
35 private PresenterProxyImpl<V, P> mProxyImpl; 35 private PresenterProxyImpl<V, P> mProxyImpl;
36 - 36 + protected VB binding; // ViewBinding 变量
37 public View.OnLongClickListener longClickListener = new View.OnLongClickListener() { 37 public View.OnLongClickListener longClickListener = new View.OnLongClickListener() {
38 @Override 38 @Override
39 public boolean onLongClick(View v) { 39 public boolean onLongClick(View v) {
...@@ -56,8 +56,9 @@ public abstract class BaseActivity<V extends BaseView, P extends BasePresenter<V ...@@ -56,8 +56,9 @@ public abstract class BaseActivity<V extends BaseView, P extends BasePresenter<V
56 super.onCreate(savedInstanceState); 56 super.onCreate(savedInstanceState);
57 TAG = getClass().getSimpleName(); 57 TAG = getClass().getSimpleName();
58 hideBottomUIMenu(); 58 hideBottomUIMenu();
59 - setContentView(getLayoutId()); 59 + // 绑定 ViewBinding
60 - ButterKnife.bind(this); 60 + binding = getViewBinding();
61 + setContentView(binding.getRoot());
61 //创建被代理对象,传入默认Presenter的工厂 62 //创建被代理对象,传入默认Presenter的工厂
62 mProxyImpl = new PresenterProxyImpl<>(PresenterFactoryImpl.<V, P>createFactory(getClass())); 63 mProxyImpl = new PresenterProxyImpl<>(PresenterFactoryImpl.<V, P>createFactory(getClass()));
63 64
...@@ -73,7 +74,8 @@ public abstract class BaseActivity<V extends BaseView, P extends BasePresenter<V ...@@ -73,7 +74,8 @@ public abstract class BaseActivity<V extends BaseView, P extends BasePresenter<V
73 mProxyImpl.onResume((V) this); 74 mProxyImpl.onResume((V) this);
74 } 75 }
75 76
76 - protected abstract int getLayoutId(); 77 + // 让子类提供 ViewBinding 实例
78 + protected abstract VB getViewBinding();
77 79
78 @Override 80 @Override
79 protected void onDestroy() { 81 protected void onDestroy() {
......
...@@ -325,9 +325,6 @@ public class VideoCFModule extends BaseModule implements MediaRecorder.OnErrorLi ...@@ -325,9 +325,6 @@ public class VideoCFModule extends BaseModule implements MediaRecorder.OnErrorLi
325 zoomParam = 0; 325 zoomParam = 0;
326 previewSizeWidth = 0; 326 previewSizeWidth = 0;
327 previewSizeHeight = 0; 327 previewSizeHeight = 0;
328 - fragment.getActivity().runOnUiThread(() -> {
329 - //(fragment.getRootView().findViewById(R.id.img_cam_fg_2)).setBackgroundResource(0);
330 - });
331 try { 328 try {
332 if ( frontCamera == null ) { 329 if ( frontCamera == null ) {
333 //TMP_CAM_ID = FACING_FRONT; 330 //TMP_CAM_ID = FACING_FRONT;
......
...@@ -7,35 +7,36 @@ import android.widget.PopupWindow; ...@@ -7,35 +7,36 @@ import android.widget.PopupWindow;
7 7
8 import androidx.annotation.IdRes; 8 import androidx.annotation.IdRes;
9 import androidx.constraintlayout.widget.ConstraintLayout; 9 import androidx.constraintlayout.widget.ConstraintLayout;
10 +import androidx.viewbinding.ViewBinding;
10 11
11 import com.sw.laryngoscope.R; 12 import com.sw.laryngoscope.R;
12 13
13 -import butterknife.ButterKnife;
14 14
15 -public abstract class BasePopWindow 15 +public abstract class BasePopWindow<T extends ViewBinding>
16 extends PopupWindow 16 extends PopupWindow
17 implements View.OnClickListener, View.OnTouchListener { 17 implements View.OnClickListener, View.OnTouchListener {
18 18
19 public String TAG = ""; 19 public String TAG = "";
20 protected Context mContext; 20 protected Context mContext;
21 protected ConstraintLayout rootView; 21 protected ConstraintLayout rootView;
22 - 22 + protected T binding; // 绑定 ViewBinding
23 protected View view_pop_empty; 23 protected View view_pop_empty;
24 24
25 - public View.OnLongClickListener 25 + public View.OnLongClickListener longClickListener = new View.OnLongClickListener() {
26 - longClickListener = v -> true; 26 + @Override
27 + public boolean onLongClick(View v) {
28 + return true;
29 + }
30 + };
27 31
28 public BasePopWindow(Context context) { 32 public BasePopWindow(Context context) {
29 this.mContext = context; 33 this.mContext = context;
30 TAG = getClass().getSimpleName(); 34 TAG = getClass().getSimpleName();
31 35
32 - LayoutInflater inflater = (LayoutInflater) context 36 + // 使用 ViewBinding 代替 LayoutInflater.inflate()
33 - .getSystemService(Context.LAYOUT_INFLATER_SERVICE); 37 + binding = getViewBinding(LayoutInflater.from(context));
34 - rootView = (ConstraintLayout) inflater.inflate(
35 - getPopLayoutId(), null);
36 38
37 - setContentView(rootView); 39 + setContentView(binding.getRoot());
38 - ButterKnife.bind(this, rootView);
39 40
40 setWidth(mContext.getResources() 41 setWidth(mContext.getResources()
41 .getDimensionPixelSize(R.dimen.dp_x_823)); 42 .getDimensionPixelSize(R.dimen.dp_x_823));
...@@ -70,7 +71,9 @@ public abstract class BasePopWindow ...@@ -70,7 +71,9 @@ public abstract class BasePopWindow
70 71
71 } 72 }
72 73
73 - public abstract int getPopLayoutId(); 74 + // 抽象方法,让子类提供 ViewBinding 实例
75 + protected abstract T getViewBinding(LayoutInflater inflater);
76 +
74 77
75 public abstract void init(); 78 public abstract void init();
76 79
......
...@@ -2,6 +2,7 @@ package com.sw.laryngoscope.popWindow; ...@@ -2,6 +2,7 @@ package com.sw.laryngoscope.popWindow;
2 2
3 import android.annotation.SuppressLint; 3 import android.annotation.SuppressLint;
4 import android.content.Context; 4 import android.content.Context;
5 +import android.view.LayoutInflater;
5 import android.view.MotionEvent; 6 import android.view.MotionEvent;
6 import android.view.View; 7 import android.view.View;
7 import android.view.inputmethod.InputMethodManager; 8 import android.view.inputmethod.InputMethodManager;
...@@ -11,18 +12,11 @@ import android.widget.TextView; ...@@ -11,18 +12,11 @@ import android.widget.TextView;
11 12
12 import com.sw.laryngoscope.R; 13 import com.sw.laryngoscope.R;
13 import com.sw.laryngoscope.activity.HomeActivity; 14 import com.sw.laryngoscope.activity.HomeActivity;
15 +import com.sw.laryngoscope.databinding.LayoutDlgUserDelBinding;
14 16
15 -import butterknife.BindView;
16 17
17 @SuppressLint("NonConstantResourceId") 18 @SuppressLint("NonConstantResourceId")
18 -public class DelUserPopWindow extends BasePopWindow { 19 +public class DelUserPopWindow extends BasePopWindow<LayoutDlgUserDelBinding> {
19 -
20 - @BindView(R.id.txt_title)
21 - TextView txt_title;
22 - @BindView(R.id.img_export_close)
23 - ImageView img_export_close;
24 - @BindView(R.id.img_del)
25 - ImageView img_del;
26 20
27 /** 21 /**
28 * 是否为公制 22 * 是否为公制
...@@ -38,8 +32,8 @@ public class DelUserPopWindow extends BasePopWindow { ...@@ -38,8 +32,8 @@ public class DelUserPopWindow extends BasePopWindow {
38 } 32 }
39 33
40 @Override 34 @Override
41 - public int getPopLayoutId() { 35 + protected LayoutDlgUserDelBinding getViewBinding(LayoutInflater inflater) {
42 - return R.layout.layout_dlg_user_del; 36 + return LayoutDlgUserDelBinding.inflate(inflater);
43 } 37 }
44 38
45 @Override 39 @Override
...@@ -59,12 +53,12 @@ public class DelUserPopWindow extends BasePopWindow { ...@@ -59,12 +53,12 @@ public class DelUserPopWindow extends BasePopWindow {
59 53
60 @Override 54 @Override
61 public void setListener() { 55 public void setListener() {
62 - img_export_close.setOnClickListener(this); 56 + binding.imgExportClose.setOnClickListener(this);
63 - img_del.setOnClickListener(this); 57 + binding.imgDel.setOnClickListener(this);
64 } 58 }
65 59
66 public void setTitle(String name) { 60 public void setTitle(String name) {
67 - txt_title.setText(homeActivity.getString(R.string.string_is_del_user, name)); 61 + binding.txtTitle.setText(homeActivity.getString(R.string.string_is_del_user, name));
68 } 62 }
69 63
70 @Override 64 @Override
......
...@@ -2,6 +2,7 @@ package com.sw.laryngoscope.popWindow; ...@@ -2,6 +2,7 @@ package com.sw.laryngoscope.popWindow;
2 2
3 import android.annotation.SuppressLint; 3 import android.annotation.SuppressLint;
4 import android.content.Context; 4 import android.content.Context;
5 +import android.view.LayoutInflater;
5 import android.view.MotionEvent; 6 import android.view.MotionEvent;
6 import android.view.View; 7 import android.view.View;
7 import android.view.inputmethod.InputMethodManager; 8 import android.view.inputmethod.InputMethodManager;
...@@ -14,66 +15,16 @@ import android.widget.TextView; ...@@ -14,66 +15,16 @@ import android.widget.TextView;
14 15
15 import com.sw.laryngoscope.R; 16 import com.sw.laryngoscope.R;
16 import com.sw.laryngoscope.activity.HomeActivity; 17 import com.sw.laryngoscope.activity.HomeActivity;
18 +import com.sw.laryngoscope.databinding.LayoutDetailCopyInfoDialogBinding;
17 import com.sw.laryngoscope.manager.SpManager; 19 import com.sw.laryngoscope.manager.SpManager;
18 import com.sw.laryngoscope.utils.Logger; 20 import com.sw.laryngoscope.utils.Logger;
19 21
20 -import butterknife.BindView;
21 22
22 @SuppressLint("NonConstantResourceId") 23 @SuppressLint("NonConstantResourceId")
23 -public class DetailCopyInfoPopWindow extends BasePopWindow implements RadioGroup.OnCheckedChangeListener { 24 +public class DetailCopyInfoPopWindow extends BasePopWindow<LayoutDetailCopyInfoDialogBinding>
24 - 25 + implements RadioGroup.OnCheckedChangeListener {
25 - @BindView(R.id.lay_copy_info)
26 - RelativeLayout lay_copy_info;
27 -
28 - @BindView(R.id.rg_format)
29 - RadioGroup rg_format;
30 - @BindView(R.id.rb_dicom)
31 - RadioButton rb_dicom;
32 - @BindView(R.id.rb_basic)
33 - RadioButton rb_basic;
34 - @BindView(R.id.ed_patient_id)
35 - EditText ed_patient_id;
36 - @BindView(R.id.ed_name)
37 - EditText ed_name;
38 - @BindView(R.id.ed_age)
39 - EditText ed_age;
40 -
41 - @BindView(R.id.rg_sex)
42 - RadioGroup rg_sex;
43 - @BindView(R.id.rb_male)
44 - RadioButton rb_male;
45 - @BindView(R.id.rb_female)
46 - RadioButton rb_female;
47 -
48 - @BindView(R.id.img_export_close)
49 - ImageView img_export_close;
50 - @BindView(R.id.img_export)
51 - ImageView img_export;
52 -
53 - @BindView(R.id.lay_copying)
54 - RelativeLayout lay_copying;
55 - @BindView(R.id.txt_tip_3)
56 - TextView txt_tip_3;
57 - @BindView(R.id.txt_ok)
58 - TextView txt_ok;
59 -
60 - @BindView(R.id.lay_2)
61 - RelativeLayout lay_2;
62 - @BindView(R.id.lay_3)
63 - RelativeLayout lay_3;
64 - @BindView(R.id.lay_4)
65 - RelativeLayout lay_4;
66 - @BindView(R.id.lay_5)
67 - RelativeLayout lay_5;
68 - @BindView(R.id.lay_6)
69 - RelativeLayout lay_6;
70 -
71 - /**
72 - * 是否为公制
73 - */
74 private boolean isMetric = false; 26 private boolean isMetric = false;
75 private InputMethodManager imm; 27 private InputMethodManager imm;
76 -
77 private final HomeActivity homeActivity; 28 private final HomeActivity homeActivity;
78 29
79 public DetailCopyInfoPopWindow(HomeActivity activity, Context context) { 30 public DetailCopyInfoPopWindow(HomeActivity activity, Context context) {
...@@ -82,8 +33,8 @@ public class DetailCopyInfoPopWindow extends BasePopWindow implements RadioGroup ...@@ -82,8 +33,8 @@ public class DetailCopyInfoPopWindow extends BasePopWindow implements RadioGroup
82 } 33 }
83 34
84 @Override 35 @Override
85 - public int getPopLayoutId() { 36 + protected LayoutDetailCopyInfoDialogBinding getViewBinding(LayoutInflater inflater) {
86 - return R.layout.layout_detail_copy_info_dialog; 37 + return LayoutDetailCopyInfoDialogBinding.inflate(inflater);
87 } 38 }
88 39
89 @Override 40 @Override
...@@ -91,7 +42,7 @@ public class DetailCopyInfoPopWindow extends BasePopWindow implements RadioGroup ...@@ -91,7 +42,7 @@ public class DetailCopyInfoPopWindow extends BasePopWindow implements RadioGroup
91 setFocusable(true); 42 setFocusable(true);
92 imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE); 43 imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
93 44
94 - ActionModeCallbackInterceptor interceptor = new ActionModeCallbackInterceptor(); 45 +// ActionModeCallbackInterceptor interceptor = new ActionModeCallbackInterceptor();
95 //edit_login_new_account_name.setCustomSelectionActionModeCallback(interceptor); 46 //edit_login_new_account_name.setCustomSelectionActionModeCallback(interceptor);
96 //edit_login_new_account_name.setCustomInsertionActionModeCallback(interceptor); 47 //edit_login_new_account_name.setCustomInsertionActionModeCallback(interceptor);
97 setOutsideTouchable(false); 48 setOutsideTouchable(false);
...@@ -104,13 +55,13 @@ public class DetailCopyInfoPopWindow extends BasePopWindow implements RadioGroup ...@@ -104,13 +55,13 @@ public class DetailCopyInfoPopWindow extends BasePopWindow implements RadioGroup
104 .getDimensionPixelSize(R.dimen.dp_y_755)); 55 .getDimensionPixelSize(R.dimen.dp_y_755));
105 56
106 if ( SpManager.get_copy_file_type() == 0 ) { 57 if ( SpManager.get_copy_file_type() == 0 ) {
107 - rb_dicom.setChecked(true); 58 + binding.rbDicom.setChecked(true);
108 setLayDicomShow(View.VISIBLE); 59 setLayDicomShow(View.VISIBLE);
109 } else if ( SpManager.get_copy_file_type() == 1 ) { 60 } else if ( SpManager.get_copy_file_type() == 1 ) {
110 - rb_basic.setChecked(true); 61 + binding.rbBasic.setChecked(true);
111 setLayDicomShow(View.GONE); 62 setLayDicomShow(View.GONE);
112 } 63 }
113 - rb_male.setChecked(true); 64 + binding.rbMale.setChecked(true);
114 65
115 /*setTouchInterceptor(new View.OnTouchListener() { 66 /*setTouchInterceptor(new View.OnTouchListener() {
116 @Override 67 @Override
...@@ -127,25 +78,25 @@ public class DetailCopyInfoPopWindow extends BasePopWindow implements RadioGroup ...@@ -127,25 +78,25 @@ public class DetailCopyInfoPopWindow extends BasePopWindow implements RadioGroup
127 } 78 }
128 79
129 void setLayDicomShow(int visibility) { 80 void setLayDicomShow(int visibility) {
130 - lay_2.setVisibility(visibility); 81 + binding.lay2.setVisibility(visibility);
131 - lay_3.setVisibility(visibility); 82 + binding.lay3.setVisibility(visibility);
132 - lay_4.setVisibility(visibility); 83 + binding.lay4.setVisibility(visibility);
133 - lay_5.setVisibility(visibility); 84 + binding.lay5.setVisibility(visibility);
134 - lay_6.setVisibility(visibility == View.VISIBLE ? View.GONE : View.VISIBLE); 85 + binding.lay6.setVisibility(visibility == View.VISIBLE ? View.GONE : View.VISIBLE);
135 } 86 }
136 87
137 @Override 88 @Override
138 public void setListener() { 89 public void setListener() {
139 - img_export_close.setOnClickListener(this); 90 + binding.imgExportClose.setOnClickListener(this);
140 - img_export.setOnClickListener(this); 91 + binding.imgExport.setOnClickListener(this);
141 - txt_ok.setOnClickListener(this); 92 + binding.txtOk.setOnClickListener(this);
142 93
143 - rg_format.setOnCheckedChangeListener(this); 94 + binding.rgFormat.setOnCheckedChangeListener(this);
144 - rg_sex.setOnCheckedChangeListener(this); 95 + binding.rgSex.setOnCheckedChangeListener(this);
145 96
146 - ed_patient_id.setOnClickListener(this); 97 + binding.edPatientId.setOnClickListener(this);
147 - ed_name.setOnClickListener(this); 98 + binding.edName.setOnClickListener(this);
148 - ed_age.setOnClickListener(this); 99 + binding.edAge.setOnClickListener(this);
149 } 100 }
150 101
151 @Override 102 @Override
...@@ -165,12 +116,12 @@ public class DetailCopyInfoPopWindow extends BasePopWindow implements RadioGroup ...@@ -165,12 +116,12 @@ public class DetailCopyInfoPopWindow extends BasePopWindow implements RadioGroup
165 break; 116 break;
166 case R.id.img_export: 117 case R.id.img_export:
167 if ( mCopyCallback != null ) { 118 if ( mCopyCallback != null ) {
168 - lay_copy_info.setVisibility(View.GONE); 119 + binding.layCopyInfo.setVisibility(View.GONE);
169 - lay_copying.setVisibility(View.VISIBLE); 120 + binding.layCopying.setVisibility(View.VISIBLE);
170 - mCopyCallback.startCopy(SpManager.get_copy_file_type(), ed_name.getText().toString().trim(), 121 + mCopyCallback.startCopy(SpManager.get_copy_file_type(), binding.edName.getText().toString().trim(),
171 - rb_male.isChecked() ? "M" : "F", 122 + binding.rbMale.isChecked() ? "M" : "F",
172 - ed_patient_id.getText().toString().trim(), 123 + binding.edPatientId.getText().toString().trim(),
173 - ed_age.getText().toString().trim()); 124 + binding.edAge.getText().toString().trim());
174 } 125 }
175 break; 126 break;
176 case R.id.txt_ok: 127 case R.id.txt_ok:
...@@ -192,8 +143,8 @@ public class DetailCopyInfoPopWindow extends BasePopWindow implements RadioGroup ...@@ -192,8 +143,8 @@ public class DetailCopyInfoPopWindow extends BasePopWindow implements RadioGroup
192 @Override 143 @Override
193 public void showAtLocation(View parent, int gravity, int x, int y) { 144 public void showAtLocation(View parent, int gravity, int x, int y) {
194 super.showAtLocation(parent, gravity, x, y); 145 super.showAtLocation(parent, gravity, x, y);
195 - lay_copy_info.setVisibility(View.VISIBLE); 146 + binding.layCopyInfo.setVisibility(View.VISIBLE);
196 - lay_copying.setVisibility(View.GONE); 147 + binding.layCopying.setVisibility(View.GONE);
197 setOnDismissListener(dismissListener); 148 setOnDismissListener(dismissListener);
198 } 149 }
199 150
...@@ -214,7 +165,7 @@ public class DetailCopyInfoPopWindow extends BasePopWindow implements RadioGroup ...@@ -214,7 +165,7 @@ public class DetailCopyInfoPopWindow extends BasePopWindow implements RadioGroup
214 165
215 private void showInput() { 166 private void showInput() {
216 //if (!imm.isActive()) { 167 //if (!imm.isActive()) {
217 - imm.showSoftInput(ed_patient_id, 168 + imm.showSoftInput(binding.edPatientId,
218 InputMethodManager.SHOW_IMPLICIT); 169 InputMethodManager.SHOW_IMPLICIT);
219 Logger.d("======showInput========"); 170 Logger.d("======showInput========");
220 //} 171 //}
...@@ -223,16 +174,16 @@ public class DetailCopyInfoPopWindow extends BasePopWindow implements RadioGroup ...@@ -223,16 +174,16 @@ public class DetailCopyInfoPopWindow extends BasePopWindow implements RadioGroup
223 private void hideInput() { 174 private void hideInput() {
224 if (imm.isActive()) { 175 if (imm.isActive()) {
225 imm.hideSoftInputFromWindow( 176 imm.hideSoftInputFromWindow(
226 - ed_patient_id.getWindowToken(), 0); 177 + binding.edPatientId.getWindowToken(), 0);
227 } 178 }
228 } 179 }
229 180
230 private final Runnable immMission = new Runnable() { 181 private final Runnable immMission = new Runnable() {
231 @Override 182 @Override
232 public void run() { 183 public void run() {
233 - ed_patient_id.requestFocus(); 184 + binding.edPatientId.requestFocus();
234 - ed_patient_id.performClick(); 185 + binding.edPatientId.performClick();
235 - imm.showSoftInput(ed_patient_id, 186 + imm.showSoftInput(binding.edPatientId,
236 InputMethodManager.SHOW_IMPLICIT); 187 InputMethodManager.SHOW_IMPLICIT);
237 } 188 }
238 }; 189 };
...@@ -255,7 +206,7 @@ public class DetailCopyInfoPopWindow extends BasePopWindow implements RadioGroup ...@@ -255,7 +206,7 @@ public class DetailCopyInfoPopWindow extends BasePopWindow implements RadioGroup
255 206
256 @Override 207 @Override
257 public void onCheckedChanged(RadioGroup group, int checkedId) { 208 public void onCheckedChanged(RadioGroup group, int checkedId) {
258 - switch (rg_format.getCheckedRadioButtonId()) { 209 + switch (binding.rgFormat.getCheckedRadioButtonId()) {
259 case R.id.rb_dicom: 210 case R.id.rb_dicom:
260 SpManager.set_copy_file_type(0); 211 SpManager.set_copy_file_type(0);
261 Logger.d(TAG, "============rb_dicom"); 212 Logger.d(TAG, "============rb_dicom");
...@@ -269,7 +220,7 @@ public class DetailCopyInfoPopWindow extends BasePopWindow implements RadioGroup ...@@ -269,7 +220,7 @@ public class DetailCopyInfoPopWindow extends BasePopWindow implements RadioGroup
269 default: 220 default:
270 break; 221 break;
271 } 222 }
272 - switch (rg_sex.getCheckedRadioButtonId()) { 223 + switch (binding.rgSex.getCheckedRadioButtonId()) {
273 case R.id.rb_male: 224 case R.id.rb_male:
274 Logger.d(TAG, "============rb_male"); 225 Logger.d(TAG, "============rb_male");
275 break; 226 break;
...@@ -288,7 +239,7 @@ public class DetailCopyInfoPopWindow extends BasePopWindow implements RadioGroup ...@@ -288,7 +239,7 @@ public class DetailCopyInfoPopWindow extends BasePopWindow implements RadioGroup
288 } 239 }
289 240
290 public void setCopyInfo(String cpNum, String checkNum) { 241 public void setCopyInfo(String cpNum, String checkNum) {
291 - txt_tip_3.setText( homeActivity.getString(R.string.string_copy_tip, cpNum, 242 + binding.txtTip3.setText( homeActivity.getString(R.string.string_copy_tip, cpNum,
292 checkNum) ); 243 checkNum) );
293 } 244 }
294 245
......
...@@ -2,43 +2,21 @@ package com.sw.laryngoscope.popWindow; ...@@ -2,43 +2,21 @@ package com.sw.laryngoscope.popWindow;
2 2
3 import android.annotation.SuppressLint; 3 import android.annotation.SuppressLint;
4 import android.content.Context; 4 import android.content.Context;
5 +import android.view.LayoutInflater;
5 import android.view.MotionEvent; 6 import android.view.MotionEvent;
6 import android.view.View; 7 import android.view.View;
7 import android.view.inputmethod.InputMethodManager; 8 import android.view.inputmethod.InputMethodManager;
8 -import android.widget.EditText;
9 import android.widget.PopupWindow; 9 import android.widget.PopupWindow;
10 -import android.widget.RadioButton;
11 import android.widget.RadioGroup; 10 import android.widget.RadioGroup;
12 11
13 import com.sw.laryngoscope.R; 12 import com.sw.laryngoscope.R;
14 import com.sw.laryngoscope.activity.HomeActivity; 13 import com.sw.laryngoscope.activity.HomeActivity;
15 import com.sw.laryngoscope.common.InitParam; 14 import com.sw.laryngoscope.common.InitParam;
15 +import com.sw.laryngoscope.databinding.LayoutMainShowUserinfoDialogBinding;
16 16
17 -import butterknife.BindView;
18 17
19 @SuppressLint("NonConstantResourceId") 18 @SuppressLint("NonConstantResourceId")
20 -public class NewPatientIDPopWindow extends BasePopWindow implements RadioGroup.OnCheckedChangeListener { 19 +public class NewPatientIDPopWindow extends BasePopWindow<LayoutMainShowUserinfoDialogBinding> implements RadioGroup.OnCheckedChangeListener {
21 -
22 - @BindView(R.id.ed_patient_id)
23 - EditText ed_patient_id;
24 - @BindView(R.id.ed_patient_age)
25 - EditText ed_patient_age;
26 - /*@BindView(R.id.ed_patient_gender)
27 - EditText ed_patient_gender;*/
28 -
29 - @BindView(R.id.rg_sex)
30 - RadioGroup rg_sex;
31 - @BindView(R.id.rb_male)
32 - RadioButton rb_male;
33 - @BindView(R.id.rb_female)
34 - RadioButton rb_female;
35 - @BindView(R.id.rb_blank)
36 - RadioButton rb_blank;
37 -
38 -
39 - /**
40 - * 是否为公制
41 - */
42 private boolean isMetric = false; 20 private boolean isMetric = false;
43 private InputMethodManager imm; 21 private InputMethodManager imm;
44 22
...@@ -48,10 +26,9 @@ public class NewPatientIDPopWindow extends BasePopWindow implements RadioGroup.O ...@@ -48,10 +26,9 @@ public class NewPatientIDPopWindow extends BasePopWindow implements RadioGroup.O
48 super(context); 26 super(context);
49 homeActivity = activity; 27 homeActivity = activity;
50 } 28 }
51 -
52 @Override 29 @Override
53 - public int getPopLayoutId() { 30 + protected LayoutMainShowUserinfoDialogBinding getViewBinding(LayoutInflater inflater) {
54 - return R.layout.layout_main_show_userinfo_dialog; 31 + return LayoutMainShowUserinfoDialogBinding.inflate(inflater);
55 } 32 }
56 33
57 @Override 34 @Override
...@@ -112,7 +89,7 @@ public class NewPatientIDPopWindow extends BasePopWindow implements RadioGroup.O ...@@ -112,7 +89,7 @@ public class NewPatientIDPopWindow extends BasePopWindow implements RadioGroup.O
112 public void afterTextChanged(Editable s) { 89 public void afterTextChanged(Editable s) {
113 } 90 }
114 });*/ 91 });*/
115 - rg_sex.setOnCheckedChangeListener(this); 92 + binding.rgSex.setOnCheckedChangeListener(this);
116 } 93 }
117 94
118 @SuppressLint("ClickableViewAccessibility") 95 @SuppressLint("ClickableViewAccessibility")
...@@ -145,9 +122,9 @@ public class NewPatientIDPopWindow extends BasePopWindow implements RadioGroup.O ...@@ -145,9 +122,9 @@ public class NewPatientIDPopWindow extends BasePopWindow implements RadioGroup.O
145 public void showAsDropDown(View parent, int x, int y) { 122 public void showAsDropDown(View parent, int x, int y) {
146 super.showAsDropDown(parent, x, y); 123 super.showAsDropDown(parent, x, y);
147 setOnDismissListener(dismissListener); 124 setOnDismissListener(dismissListener);
148 - rb_male.setChecked(InitParam.patientSex == 0); 125 + binding.rbMale.setChecked(InitParam.patientSex == 0);
149 - rb_female.setChecked(InitParam.patientSex == 1); 126 + binding.rbFemale.setChecked(InitParam.patientSex == 1);
150 - rb_blank.setChecked(InitParam.patientSex == 2); 127 + binding.rbBlank.setChecked(InitParam.patientSex == 2);
151 } 128 }
152 129
153 @Override 130 @Override
...@@ -158,7 +135,7 @@ public class NewPatientIDPopWindow extends BasePopWindow implements RadioGroup.O ...@@ -158,7 +135,7 @@ public class NewPatientIDPopWindow extends BasePopWindow implements RadioGroup.O
158 135
159 private void showInput() { 136 private void showInput() {
160 if (!imm.isActive()) { 137 if (!imm.isActive()) {
161 - imm.showSoftInput(ed_patient_id, 138 + imm.showSoftInput(binding.edPatientId,
162 InputMethodManager.SHOW_IMPLICIT); 139 InputMethodManager.SHOW_IMPLICIT);
163 } 140 }
164 } 141 }
...@@ -166,16 +143,16 @@ public class NewPatientIDPopWindow extends BasePopWindow implements RadioGroup.O ...@@ -166,16 +143,16 @@ public class NewPatientIDPopWindow extends BasePopWindow implements RadioGroup.O
166 private void hideInput() { 143 private void hideInput() {
167 if (imm.isActive()) { 144 if (imm.isActive()) {
168 imm.hideSoftInputFromWindow( 145 imm.hideSoftInputFromWindow(
169 - ed_patient_id.getWindowToken(), 0); 146 + binding.edPatientId.getWindowToken(), 0);
170 } 147 }
171 } 148 }
172 149
173 private final Runnable immMission = new Runnable() { 150 private final Runnable immMission = new Runnable() {
174 @Override 151 @Override
175 public void run() { 152 public void run() {
176 - ed_patient_id.requestFocus(); 153 + binding.edPatientId.requestFocus();
177 - ed_patient_id.performClick(); 154 + binding.edPatientId.performClick();
178 - imm.showSoftInput(ed_patient_id, 155 + imm.showSoftInput(binding.edPatientId,
179 InputMethodManager.SHOW_IMPLICIT); 156 InputMethodManager.SHOW_IMPLICIT);
180 } 157 }
181 }; 158 };
...@@ -184,8 +161,8 @@ public class NewPatientIDPopWindow extends BasePopWindow implements RadioGroup.O ...@@ -184,8 +161,8 @@ public class NewPatientIDPopWindow extends BasePopWindow implements RadioGroup.O
184 @Override 161 @Override
185 public void onDismiss() { 162 public void onDismiss() {
186 if ( minfoCallback != null ) { 163 if ( minfoCallback != null ) {
187 - minfoCallback.getinfo(ed_patient_id.getText().toString(), 164 + minfoCallback.getinfo(binding.edPatientId.getText().toString(),
188 - ed_patient_age.getText().toString(), 165 + binding.edPatientAge.getText().toString(),
189 homeActivity.getString(InitParam.SEX_VAL_RES[InitParam.patientSex])); 166 homeActivity.getString(InitParam.SEX_VAL_RES[InitParam.patientSex]));
190 } 167 }
191 } 168 }
......
...@@ -2,29 +2,18 @@ package com.sw.laryngoscope.popWindow; ...@@ -2,29 +2,18 @@ package com.sw.laryngoscope.popWindow;
2 2
3 import android.annotation.SuppressLint; 3 import android.annotation.SuppressLint;
4 import android.content.Context; 4 import android.content.Context;
5 +import android.view.LayoutInflater;
5 import android.view.MotionEvent; 6 import android.view.MotionEvent;
6 import android.view.View; 7 import android.view.View;
7 import android.view.inputmethod.InputMethodManager; 8 import android.view.inputmethod.InputMethodManager;
8 -import android.widget.EditText;
9 -import android.widget.RadioButton;
10 -import android.widget.RadioGroup;
11 9
12 -import com.sw.laryngoscope.R;
13 import com.sw.laryngoscope.activity.HomeActivity; 10 import com.sw.laryngoscope.activity.HomeActivity;
14 -import com.sw.laryngoscope.common.InitParam; 11 +import com.sw.laryngoscope.databinding.LayoutMainShowVideomakeBinding;
15 -import com.sw.laryngoscope.widget.TextThumbSeekBar2;
16 12
17 -import butterknife.BindView;
18 13
19 @SuppressLint("NonConstantResourceId") 14 @SuppressLint("NonConstantResourceId")
20 -public class VideoMakePopWindow extends BasePopWindow { 15 +public class VideoMakePopWindow extends BasePopWindow<LayoutMainShowVideomakeBinding> {
21 16
22 - @BindView(R.id.sb_con)
23 - TextThumbSeekBar2 sb_con;
24 -
25 - /**
26 - * 是否为公制
27 - */
28 private boolean isMetric = false; 17 private boolean isMetric = false;
29 private InputMethodManager imm; 18 private InputMethodManager imm;
30 19
...@@ -36,8 +25,8 @@ public class VideoMakePopWindow extends BasePopWindow { ...@@ -36,8 +25,8 @@ public class VideoMakePopWindow extends BasePopWindow {
36 } 25 }
37 26
38 @Override 27 @Override
39 - public int getPopLayoutId() { 28 + protected LayoutMainShowVideomakeBinding getViewBinding(LayoutInflater inflater) {
40 - return R.layout.layout_main_show_videomake; 29 + return LayoutMainShowVideomakeBinding.inflate(inflater);
41 } 30 }
42 31
43 @Override 32 @Override
...@@ -48,9 +37,9 @@ public class VideoMakePopWindow extends BasePopWindow { ...@@ -48,9 +37,9 @@ public class VideoMakePopWindow extends BasePopWindow {
48 //setOutsideTouchable(false); 37 //setOutsideTouchable(false);
49 //setFocusable(false); 38 //setFocusable(false);
50 //setTouchable(true); 39 //setTouchable(true);
51 - sb_con.setClickable(false); 40 + binding.sbCon.setClickable(false);
52 - sb_con.setEnabled(false); 41 + binding.sbCon.setEnabled(false);
53 - sb_con.setFocusable(false); 42 + binding.sbCon.setFocusable(false);
54 } 43 }
55 44
56 @Override 45 @Override
...@@ -66,7 +55,7 @@ public class VideoMakePopWindow extends BasePopWindow { ...@@ -66,7 +55,7 @@ public class VideoMakePopWindow extends BasePopWindow {
66 @Override 55 @Override
67 public void showAtLocation(View parent, int gravity, int x, int y) { 56 public void showAtLocation(View parent, int gravity, int x, int y) {
68 super.showAtLocation(parent, gravity, x, y); 57 super.showAtLocation(parent, gravity, x, y);
69 - sb_con.setProgress(0); 58 + binding.sbCon.setProgress(0);
70 } 59 }
71 60
72 @Override 61 @Override
...@@ -82,7 +71,7 @@ public class VideoMakePopWindow extends BasePopWindow { ...@@ -82,7 +71,7 @@ public class VideoMakePopWindow extends BasePopWindow {
82 } 71 }
83 72
84 public void setSb_con(int pro) { 73 public void setSb_con(int pro) {
85 - this.sb_con.setProgress(pro); 74 + binding.sbCon.setProgress(pro);
86 } 75 }
87 76
88 private void showInput() { 77 private void showInput() {
......
...@@ -125,7 +125,7 @@ public class AnimationUtil { ...@@ -125,7 +125,7 @@ public class AnimationUtil {
125 } 125 }
126 } 126 }
127 127
128 - public void incFileAnim(View view) { 128 + public void incFileAnim(final View view) {
129 view.startAnimation(incAnimation);//开始动画 129 view.startAnimation(incAnimation);//开始动画
130 incAnimation.setAnimationListener(new Animation.AnimationListener(){ 130 incAnimation.setAnimationListener(new Animation.AnimationListener(){
131 @Override 131 @Override
......
...@@ -14,7 +14,7 @@ public class BatteryStateViewUtil { ...@@ -14,7 +14,7 @@ public class BatteryStateViewUtil {
14 * @param view 14 * @param view
15 * @return 15 * @return
16 */ 16 */
17 - public static BroadcastReceiver createBroadcastReceiver(BatteryStateView view) { 17 + public static BroadcastReceiver createBroadcastReceiver(final BatteryStateView view) {
18 return new BroadcastReceiver() { 18 return new BroadcastReceiver() {
19 @Override 19 @Override
20 public void onReceive(Context context, Intent intent) { 20 public void onReceive(Context context, Intent intent) {
......
...@@ -25,7 +25,7 @@ public class SystemTimeUtil { ...@@ -25,7 +25,7 @@ public class SystemTimeUtil {
25 /** 25 /**
26 * 设置系统的时间 26 * 设置系统的时间
27 */ 27 */
28 - public static void setSysTime(Context context, int hourOfDay, int minute) { 28 + public static void setSysTime(Context context, final int hourOfDay, final int minute) {
29 new Thread(new Runnable() { 29 new Thread(new Runnable() {
30 @Override 30 @Override
31 public void run() { 31 public void run() {
......
...@@ -68,7 +68,7 @@ public class Thumbnail { ...@@ -68,7 +68,7 @@ public class Thumbnail {
68 return bitmap; 68 return bitmap;
69 } 69 }
70 70
71 - public static void createVideoThumbnailBitmap1(String filePath, String toFile) { 71 + public static void createVideoThumbnailBitmap1(final String filePath, final String toFile) {
72 new Thread(new Runnable() { 72 new Thread(new Runnable() {
73 @Override 73 @Override
74 public void run() { 74 public void run() {
...@@ -114,7 +114,7 @@ public class Thumbnail { ...@@ -114,7 +114,7 @@ public class Thumbnail {
114 }).start(); 114 }).start();
115 } 115 }
116 116
117 - public static void createVideoThumbnailBitmap(String filePath, String toFile, Bitmap mBitmap) { 117 + public static void createVideoThumbnailBitmap(final String filePath, final String toFile, final Bitmap mBitmap) {
118 //final String filePath = "/sdcard/DCIM/OCamera/VID_20221103_002616.mp4"; 118 //final String filePath = "/sdcard/DCIM/OCamera/VID_20221103_002616.mp4";
119 119
120 new Thread(new Runnable() { 120 new Thread(new Runnable() {
......
...@@ -4,6 +4,7 @@ import android.annotation.SuppressLint; ...@@ -4,6 +4,7 @@ import android.annotation.SuppressLint;
4 import android.content.Context; 4 import android.content.Context;
5 import android.os.SystemClock; 5 import android.os.SystemClock;
6 import android.util.AttributeSet; 6 import android.util.AttributeSet;
7 +import android.view.View;
7 import android.widget.TextView; 8 import android.widget.TextView;
8 9
9 import androidx.annotation.Nullable; 10 import androidx.annotation.Nullable;
...@@ -43,14 +44,16 @@ public class MultiClickTextView extends TextView { ...@@ -43,14 +44,16 @@ public class MultiClickTextView extends TextView {
43 44
44 private void init(){ 45 private void init(){
45 mHints = new long[mCount]; 46 mHints = new long[mCount];
46 - setOnClickListener(v -> { 47 + setOnClickListener(new View.OnClickListener() {
47 - //将原数组的第二位到最后一个复制到第1位到倒数第2位 48 + @Override
48 - System.arraycopy(mHints,1,mHints,0,mHints.length - 1); 49 + public void onClick(View v) {
49 - mHints[mHints.length - 1] = SystemClock.uptimeMillis(); 50 + System.arraycopy(mHints, 1, mHints, 0, mHints.length - 1);
50 - if(mHints[0] >= (SystemClock.uptimeMillis() - limiit)){ 51 + mHints[mHints.length - 1] = SystemClock.uptimeMillis();
51 - if(multiClickListener != null){ 52 + if (mHints[0] >= (SystemClock.uptimeMillis() - limiit)) {
52 - mHints = new long[mCount]; 53 + if (multiClickListener != null) {
53 - multiClickListener.onMultiClick(); 54 + mHints = new long[mCount];
55 + multiClickListener.onMultiClick();
56 + }
54 } 57 }
55 } 58 }
56 }); 59 });
......
...@@ -130,7 +130,12 @@ public class NiceSpinner extends AppCompatTextView { ...@@ -130,7 +130,12 @@ public class NiceSpinner extends AppCompatTextView {
130 if (bundle.getBoolean(IS_POPUP_SHOWING)) { 130 if (bundle.getBoolean(IS_POPUP_SHOWING)) {
131 if (popupWindow != null) { 131 if (popupWindow != null) {
132 // Post the show request into the looper to avoid bad token exception 132 // Post the show request into the looper to avoid bad token exception
133 - post(this::showDropDown); 133 + post(new Runnable() {
134 + @Override
135 + public void run() {
136 + showDropDown();
137 + }
138 + });
134 } 139 }
135 } 140 }
136 isArrowHidden = bundle.getBoolean(IS_ARROW_HIDDEN, false); 141 isArrowHidden = bundle.getBoolean(IS_ARROW_HIDDEN, false);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
2 buildscript { 2 buildscript {
3 repositories { 3 repositories {
4 google() 4 google()
5 - jcenter() 5 + mavenCentral()
6 } 6 }
7 dependencies { 7 dependencies {
8 classpath "com.android.tools.build:gradle:7.0.0" 8 classpath "com.android.tools.build:gradle:7.0.0"
...@@ -15,7 +15,7 @@ buildscript { ...@@ -15,7 +15,7 @@ buildscript {
15 allprojects { 15 allprojects {
16 repositories { 16 repositories {
17 google() 17 google()
18 - jcenter() 18 + mavenCentral()
19 } 19 }
20 gradle.projectsEvaluated { 20 gradle.projectsEvaluated {
21 tasks.withType(JavaCompile) { 21 tasks.withType(JavaCompile) {
......