Showing
41 changed files
with
1443 additions
and
2123 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 | ... | ... |
| ... | @@ -42,6 +42,7 @@ import com.sw.laryngoscope.base.factory.CreatePresenter; | ... | @@ -42,6 +42,7 @@ import com.sw.laryngoscope.base.factory.CreatePresenter; |
| 42 | import com.sw.laryngoscope.camera.VideoModule; | 42 | import com.sw.laryngoscope.camera.VideoModule; |
| 43 | import com.sw.laryngoscope.common.Constant; | 43 | import com.sw.laryngoscope.common.Constant; |
| 44 | import com.sw.laryngoscope.common.InitParam; | 44 | import com.sw.laryngoscope.common.InitParam; |
| 45 | +import com.sw.laryngoscope.databinding.ActivityMainBinding; | ||
| 45 | import com.sw.laryngoscope.db.AccountInfoDB; | 46 | import com.sw.laryngoscope.db.AccountInfoDB; |
| 46 | import com.sw.laryngoscope.db.RecordInfoDB; | 47 | import com.sw.laryngoscope.db.RecordInfoDB; |
| 47 | import com.sw.laryngoscope.floatwindow.FloatWindowManager; | 48 | import com.sw.laryngoscope.floatwindow.FloatWindowManager; |
| ... | @@ -64,9 +65,6 @@ import org.jetbrains.annotations.NotNull; | ... | @@ -64,9 +65,6 @@ import org.jetbrains.annotations.NotNull; |
| 64 | import java.util.List; | 65 | import java.util.List; |
| 65 | import java.util.UUID; | 66 | import java.util.UUID; |
| 66 | 67 | ||
| 67 | -import butterknife.BindView; | ||
| 68 | -import butterknife.OnClick; | ||
| 69 | - | ||
| 70 | /** | 68 | /** |
| 71 | * @Description 这里用一句话描述 | 69 | * @Description 这里用一句话描述 |
| 72 | * @Author | 70 | * @Author |
| ... | @@ -74,54 +72,13 @@ import butterknife.OnClick; | ... | @@ -74,54 +72,13 @@ import butterknife.OnClick; |
| 74 | */ | 72 | */ |
| 75 | @CreatePresenter(HomePresenter.class) | 73 | @CreatePresenter(HomePresenter.class) |
| 76 | public class HomeActivity extends | 74 | public class HomeActivity extends |
| 77 | - BaseActivity<HomeView, HomePresenter> | 75 | + BaseActivity<HomeView, HomePresenter, ActivityMainBinding> |
| 78 | implements | 76 | implements |
| 79 | - HomeView, View.OnClickListener, | 77 | + HomeView, CustomTimer.TimerCallBack, View.OnTouchListener, |
| 80 | - CustomTimer.TimerCallBack, View.OnTouchListener, | 78 | + LogoutTimerManager.LogoutCallBack, StorageStateManager.CallBack, |
| 81 | - LogoutTimerManager.LogoutCallBack, | ||
| 82 | - StorageStateManager.CallBack, | ||
| 83 | RadioGroup.OnCheckedChangeListener, PermissionManager.OnPermissionsCallback, | 79 | RadioGroup.OnCheckedChangeListener, PermissionManager.OnPermissionsCallback, |
| 84 | BatteryStateViewUtil.OnBatteryChargeLitener { | 80 | BatteryStateViewUtil.OnBatteryChargeLitener { |
| 85 | 81 | ||
| 86 | - | ||
| 87 | - @BindView(R.id.batterView) | ||
| 88 | - public BatteryStateView batterView; | ||
| 89 | - @BindView(R.id.img_usb) | ||
| 90 | - public ImageView img_usb; | ||
| 91 | - | ||
| 92 | - @BindView(R.id.layout_home_left) | ||
| 93 | - View layout_home_left; | ||
| 94 | - @BindView(R.id.rg_home_bottom) | ||
| 95 | - public RadioGroup rg_home_bottom; | ||
| 96 | - @BindView(R.id.btn_real_time_display) | ||
| 97 | - public RadioButton btn_real_time_display; | ||
| 98 | - @BindView(R.id.btn_file) | ||
| 99 | - public RadioButton btn_file; | ||
| 100 | - @BindView(R.id.btn_user) | ||
| 101 | - public RadioButton btn_user; | ||
| 102 | - @BindView(R.id.btn_set) | ||
| 103 | - public RadioButton btn_set; | ||
| 104 | - | ||
| 105 | - @BindView(R.id.layout_home_left_o) | ||
| 106 | - View layout_home_left_o; | ||
| 107 | - @BindView(R.id.rg_home_bottom_o) | ||
| 108 | - RadioGroup rg_home_bottom_o; | ||
| 109 | - @BindView(R.id.btn_real_time_display_o) | ||
| 110 | - RadioButton btn_real_time_display_o; | ||
| 111 | - @BindView(R.id.btn_file_o) | ||
| 112 | - RadioButton btn_file_o; | ||
| 113 | - @BindView(R.id.btn_user_o) | ||
| 114 | - RadioButton btn_user_o; | ||
| 115 | - @BindView(R.id.btn_set_o) | ||
| 116 | - RadioButton btn_set_o; | ||
| 117 | - | ||
| 118 | - @BindView(R.id.txt_device_id) | ||
| 119 | - TextView txt_device_id; | ||
| 120 | - @BindView(R.id.img_user_icon) | ||
| 121 | - ImageView img_user_icon; | ||
| 122 | - @BindView(R.id.txt_user_name) | ||
| 123 | - TextView txt_user_name; | ||
| 124 | - | ||
| 125 | protected Context context; | 82 | protected Context context; |
| 126 | 83 | ||
| 127 | public FragmentManager fragmentManager; | 84 | public FragmentManager fragmentManager; |
| ... | @@ -143,6 +100,11 @@ public class HomeActivity extends | ... | @@ -143,6 +100,11 @@ public class HomeActivity extends |
| 143 | public static boolean isInMainWin = false; | 100 | public static boolean isInMainWin = false; |
| 144 | 101 | ||
| 145 | @Override | 102 | @Override |
| 103 | + protected ActivityMainBinding getViewBinding() { | ||
| 104 | + return ActivityMainBinding.inflate(getLayoutInflater()); | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + @Override | ||
| 146 | protected void onCreate(Bundle savedInstanceState) { | 108 | protected void onCreate(Bundle savedInstanceState) { |
| 147 | super.onCreate(savedInstanceState); | 109 | super.onCreate(savedInstanceState); |
| 148 | context = getApplicationContext(); | 110 | context = getApplicationContext(); |
| ... | @@ -159,36 +121,36 @@ public class HomeActivity extends | ... | @@ -159,36 +121,36 @@ public class HomeActivity extends |
| 159 | LogoutTimerManager.getInstance().setCallback(this); | 121 | LogoutTimerManager.getInstance().setCallback(this); |
| 160 | TimerChangeManager.getInstance().startThread(this); | 122 | TimerChangeManager.getInstance().startThread(this); |
| 161 | 123 | ||
| 162 | - txt_device_id.setText(getString(R.string.string_dev_id, getRandomUUID())); | 124 | + binding.txtDeviceId.setText(getString(R.string.string_dev_id, getRandomUUID())); |
| 163 | 125 | ||
| 164 | } | 126 | } |
| 165 | 127 | ||
| 166 | public void setUseName() { | 128 | public void setUseName() { |
| 167 | if ( !AccountManager.getInstance().isLogin() && !SpManager.get_no_login_visit_doc() ) { | 129 | if ( !AccountManager.getInstance().isLogin() && !SpManager.get_no_login_visit_doc() ) { |
| 168 | - btn_file.setBackgroundResource(R.drawable.bg_real_time_display_disable); | 130 | + binding.layoutHomeLeft.btnFile.setBackgroundResource(R.drawable.bg_real_time_display_disable); |
| 169 | - btn_file_o.setBackgroundResource(R.drawable.bg_real_time_display_disable); | 131 | + binding.layoutHomeLeftO.btnFileO.setBackgroundResource(R.drawable.bg_real_time_display_disable); |
| 170 | - btn_file.setChecked(false); | 132 | + binding.layoutHomeLeft.btnFile.setChecked(false); |
| 171 | - btn_file_o.setChecked(false); | 133 | + binding.layoutHomeLeftO.btnFileO.setChecked(false); |
| 172 | //setDrawTop(btn_file, R.drawable.btn_menu_file_disable); | 134 | //setDrawTop(btn_file, R.drawable.btn_menu_file_disable); |
| 173 | //setDrawTop(btn_file_o, R.drawable.btn_menu_file_disable); | 135 | //setDrawTop(btn_file_o, R.drawable.btn_menu_file_disable); |
| 174 | } else { | 136 | } else { |
| 175 | - btn_file.setBackgroundResource(R.drawable.bg_real_time_display_select); | 137 | + binding.layoutHomeLeft.btnFile.setBackgroundResource(R.drawable.bg_real_time_display_select); |
| 176 | - btn_file_o.setBackgroundResource(R.drawable.bg_real_time_display_select); | 138 | + binding.layoutHomeLeftO.btnFileO.setBackgroundResource(R.drawable.bg_real_time_display_select); |
| 177 | //setDrawTop(btn_file, R.drawable.btn_menu_file); | 139 | //setDrawTop(btn_file, R.drawable.btn_menu_file); |
| 178 | //setDrawTop(btn_file_o, R.drawable.btn_menu_file); | 140 | //setDrawTop(btn_file_o, R.drawable.btn_menu_file); |
| 179 | } | 141 | } |
| 180 | AccountInfoDB mTmp = AccountManager.getInstance().getLoginAcc(); | 142 | AccountInfoDB mTmp = AccountManager.getInstance().getLoginAcc(); |
| 181 | if ( mTmp.getUserType() != InitParam.USER_TYPE_GUEST ) { | 143 | if ( mTmp.getUserType() != InitParam.USER_TYPE_GUEST ) { |
| 182 | - txt_user_name.setText(mTmp.getName()); | 144 | + binding.txtUserName.setText(mTmp.getName()); |
| 183 | } else { | 145 | } else { |
| 184 | //txt_user_name.setText(R.string.string_guest); | 146 | //txt_user_name.setText(R.string.string_guest); |
| 185 | - txt_user_name.setText(""); | 147 | + binding.txtUserName.setText(""); |
| 186 | } | 148 | } |
| 187 | if ( mTmp.getUserType() != InitParam.USER_TYPE_GUEST ) { | 149 | if ( mTmp.getUserType() != InitParam.USER_TYPE_GUEST ) { |
| 188 | - img_user_icon.setImageResource(mTmp.getUserType() == 1 ? | 150 | + binding.imgUserIcon.setImageResource(mTmp.getUserType() == 1 ? |
| 189 | R.mipmap.img_admin_user : R.mipmap.img_normal_user); | 151 | R.mipmap.img_admin_user : R.mipmap.img_normal_user); |
| 190 | } else { | 152 | } else { |
| 191 | - img_user_icon.setImageResource(R.mipmap.img_normal_user); | 153 | + binding.imgUserIcon.setImageResource(R.mipmap.img_normal_user); |
| 192 | } | 154 | } |
| 193 | } | 155 | } |
| 194 | 156 | ||
| ... | @@ -232,7 +194,7 @@ public class HomeActivity extends | ... | @@ -232,7 +194,7 @@ public class HomeActivity extends |
| 232 | String path = StorageStateManager.getInstance().getUdiskPath(); | 194 | String path = StorageStateManager.getInstance().getUdiskPath(); |
| 233 | Logger.d(TAG, " + path " + path); | 195 | Logger.d(TAG, " + path " + path); |
| 234 | if ( Storage.isCheckExist(path) && SpManager.get_usb_input_enabled() ) { | 196 | if ( Storage.isCheckExist(path) && SpManager.get_usb_input_enabled() ) { |
| 235 | - img_usb.setVisibility(View.VISIBLE); | 197 | + binding.layoutHomeLeft.imgUsb.setVisibility(View.VISIBLE); |
| 236 | } | 198 | } |
| 237 | 199 | ||
| 238 | /*txt_test.setOnMultiClickListener(() -> { | 200 | /*txt_test.setOnMultiClickListener(() -> { |
| ... | @@ -258,11 +220,11 @@ public class HomeActivity extends | ... | @@ -258,11 +220,11 @@ public class HomeActivity extends |
| 258 | 220 | ||
| 259 | public void showSettingIcon() { | 221 | public void showSettingIcon() { |
| 260 | if ( AccountManager.getInstance().isLogin() ) { | 222 | if ( AccountManager.getInstance().isLogin() ) { |
| 261 | - btn_set_o.setVisibility(View.VISIBLE); | 223 | + binding.layoutHomeLeftO.btnSetO.setVisibility(View.VISIBLE); |
| 262 | - btn_set.setVisibility(View.VISIBLE); | 224 | + binding.layoutHomeLeft.btnSet.setVisibility(View.VISIBLE); |
| 263 | } else { | 225 | } else { |
| 264 | - btn_set_o.setVisibility(View.GONE); | 226 | + binding.layoutHomeLeftO.btnSetO.setVisibility(View.GONE); |
| 265 | - btn_set.setVisibility(View.GONE); | 227 | + binding.layoutHomeLeft.btnSet.setVisibility(View.GONE); |
| 266 | } | 228 | } |
| 267 | } | 229 | } |
| 268 | 230 | ||
| ... | @@ -319,110 +281,90 @@ public class HomeActivity extends | ... | @@ -319,110 +281,90 @@ public class HomeActivity extends |
| 319 | } | 281 | } |
| 320 | 282 | ||
| 321 | @Override | 283 | @Override |
| 322 | - protected int getLayoutId() { | ||
| 323 | - return R.layout.activity_main; | ||
| 324 | - } | ||
| 325 | - | ||
| 326 | - @Override | ||
| 327 | - @OnClick({ R.id.txt_device_id, }) | ||
| 328 | - public void onClick(View view) { | ||
| 329 | - switch (view.getId()) { | ||
| 330 | - case R.id.txt_device_id: | ||
| 331 | - //logout(); | ||
| 332 | - break; | ||
| 333 | - /*case R.id.btn_head_back: | ||
| 334 | - currFragment.pageBack(); | ||
| 335 | - break;*/ | ||
| 336 | - default: | ||
| 337 | - break; | ||
| 338 | - } | ||
| 339 | - } | ||
| 340 | - | ||
| 341 | - @Override | ||
| 342 | public boolean onTouch(View view, MotionEvent motionEvent) { | 284 | public boolean onTouch(View view, MotionEvent motionEvent) { |
| 343 | return false; | 285 | return false; |
| 344 | } | 286 | } |
| 345 | 287 | ||
| 346 | @Override | 288 | @Override |
| 347 | public void onCheckedChanged(RadioGroup radioGroup, int i) { | 289 | public void onCheckedChanged(RadioGroup radioGroup, int i) { |
| 348 | - if ( layout_home_left.getVisibility() == View.VISIBLE ) { | 290 | + if (binding.layoutHomeLeft.getRoot().getVisibility() == View.VISIBLE ) { |
| 349 | - switch (rg_home_bottom.getCheckedRadioButtonId()) { | 291 | + switch (binding.layoutHomeLeft.rgHomeBottom.getCheckedRadioButtonId()) { |
| 350 | case R.id.btn_real_time_display://首页 | 292 | case R.id.btn_real_time_display://首页 |
| 351 | - Logger.d(TAG, "======showFragment======btn_real_time_display"+btn_real_time_display.isPressed()); | 293 | + Logger.d(TAG, "======showFragment======btn_real_time_display"+ binding.layoutHomeLeft.btnRealTimeDisplay.isPressed()); |
| 352 | - if( btn_real_time_display.isPressed() ) { | 294 | + if( binding.layoutHomeLeft.btnRealTimeDisplay.isPressed() ) { |
| 353 | showHomeFragment(); | 295 | showHomeFragment(); |
| 354 | } | 296 | } |
| 355 | break; | 297 | break; |
| 356 | case R.id.btn_file: | 298 | case R.id.btn_file: |
| 357 | - Logger.d(TAG, "======showFragment======btn_file"+btn_file.isPressed()); | 299 | + Logger.d(TAG, "======showFragment======btn_file"+ binding.layoutHomeLeft.btnFile.isPressed()); |
| 358 | if ( !AccountManager.getInstance().isLogin() ) { | 300 | if ( !AccountManager.getInstance().isLogin() ) { |
| 359 | if ( !SpManager.get_no_login_visit_doc() ) { | 301 | if ( !SpManager.get_no_login_visit_doc() ) { |
| 360 | MyApplication.showToastLong1(getString(R.string.string_no_visit_doc_tip)); | 302 | MyApplication.showToastLong1(getString(R.string.string_no_visit_doc_tip)); |
| 361 | return ; | 303 | return ; |
| 362 | } | 304 | } |
| 363 | } | 305 | } |
| 364 | - if( btn_file.isPressed() ) { | 306 | + if( binding.layoutHomeLeft.btnFile.isPressed() ) { |
| 365 | showFileFragment(); | 307 | showFileFragment(); |
| 366 | //layout_home_left.setVisibility(View.GONE); | 308 | //layout_home_left.setVisibility(View.GONE); |
| 367 | //layout_home_left_o.setVisibility(View.VISIBLE); | 309 | //layout_home_left_o.setVisibility(View.VISIBLE); |
| 368 | - btn_file_o.setChecked(true); | 310 | + binding.layoutHomeLeftO.btnFileO.setChecked(true); |
| 369 | } | 311 | } |
| 370 | break; | 312 | break; |
| 371 | case R.id.btn_user: | 313 | case R.id.btn_user: |
| 372 | - Logger.d(TAG, "======showFragment======btn_user"+btn_user.isPressed()); | 314 | + Logger.d(TAG, "======showFragment======btn_user"+binding.layoutHomeLeft.btnUser.isPressed()); |
| 373 | - if( btn_user.isPressed() ) { | 315 | + if( binding.layoutHomeLeft.btnUser.isPressed() ) { |
| 374 | showUserFragment(); | 316 | showUserFragment(); |
| 375 | //layout_home_left.setVisibility(View.GONE); | 317 | //layout_home_left.setVisibility(View.GONE); |
| 376 | //layout_home_left_o.setVisibility(View.VISIBLE); | 318 | //layout_home_left_o.setVisibility(View.VISIBLE); |
| 377 | - btn_user_o.setChecked(true); | 319 | + binding.layoutHomeLeftO.btnUserO.setChecked(true); |
| 378 | } | 320 | } |
| 379 | break; | 321 | break; |
| 380 | case R.id.btn_set: | 322 | case R.id.btn_set: |
| 381 | - Logger.d(TAG, "======showFragment======btn_set"+btn_set.isPressed()); | 323 | + Logger.d(TAG, "======showFragment======btn_set"+binding.layoutHomeLeft.btnSet.isPressed()); |
| 382 | - if( btn_set.isPressed() ) { | 324 | + if( binding.layoutHomeLeft.btnSet.isPressed() ) { |
| 383 | showSettingFragment(); | 325 | showSettingFragment(); |
| 384 | } | 326 | } |
| 385 | break; | 327 | break; |
| 386 | } | 328 | } |
| 387 | } | 329 | } |
| 388 | - if ( layout_home_left_o.getVisibility() == View.VISIBLE ) { | 330 | + if ( binding.layoutHomeLeftO.getRoot().getVisibility() == View.VISIBLE ) { |
| 389 | - switch (rg_home_bottom_o.getCheckedRadioButtonId()) { | 331 | + switch (binding.layoutHomeLeftO.rgHomeBottomO.getCheckedRadioButtonId()) { |
| 390 | case R.id.btn_real_time_display_o: | 332 | case R.id.btn_real_time_display_o: |
| 391 | - Logger.d(TAG, "======showFragment======btn_real_time_display_o"+btn_real_time_display_o.isPressed()); | 333 | + Logger.d(TAG, "======showFragment======btn_real_time_display_o"+ binding.layoutHomeLeftO.btnRealTimeDisplayO.isPressed()); |
| 392 | - if( btn_real_time_display_o.isPressed() ) { | 334 | + if( binding.layoutHomeLeftO.btnRealTimeDisplayO.isPressed() ) { |
| 393 | showHomeFragment(); | 335 | showHomeFragment(); |
| 394 | //layout_home_left.setVisibility(View.VISIBLE); | 336 | //layout_home_left.setVisibility(View.VISIBLE); |
| 395 | //layout_home_left_o.setVisibility(View.GONE); | 337 | //layout_home_left_o.setVisibility(View.GONE); |
| 396 | - btn_real_time_display.setChecked(true); | 338 | + binding.layoutHomeLeft.btnRealTimeDisplay.setChecked(true); |
| 397 | } | 339 | } |
| 398 | break; | 340 | break; |
| 399 | case R.id.btn_file_o: | 341 | case R.id.btn_file_o: |
| 400 | - Logger.d(TAG, "======showFragment======btn_file_o"+btn_file_o.isPressed()); | 342 | + Logger.d(TAG, "======showFragment======btn_file_o"+ binding.layoutHomeLeftO.btnFileO.isPressed()); |
| 401 | if ( !AccountManager.getInstance().isLogin() ) { | 343 | if ( !AccountManager.getInstance().isLogin() ) { |
| 402 | if ( !SpManager.get_no_login_visit_doc() ) { | 344 | if ( !SpManager.get_no_login_visit_doc() ) { |
| 403 | MyApplication.showToastLong1(getString(R.string.string_no_visit_doc_tip)); | 345 | MyApplication.showToastLong1(getString(R.string.string_no_visit_doc_tip)); |
| 404 | return ; | 346 | return ; |
| 405 | } | 347 | } |
| 406 | } | 348 | } |
| 407 | - if( btn_file_o.isPressed() ) { | 349 | + if( binding.layoutHomeLeftO.btnFileO.isPressed() ) { |
| 408 | showFileFragment(); | 350 | showFileFragment(); |
| 409 | - btn_file.setChecked(true); | 351 | + binding.layoutHomeLeft.btnFile.setChecked(true); |
| 410 | } | 352 | } |
| 411 | break; | 353 | break; |
| 412 | case R.id.btn_user_o: | 354 | case R.id.btn_user_o: |
| 413 | - Logger.d(TAG, "======showFragment======btn_user_o"+btn_user_o.isPressed()); | 355 | + Logger.d(TAG, "======showFragment======btn_user_o"+binding.layoutHomeLeftO.btnUserO.isPressed()); |
| 414 | - if( btn_user_o.isPressed() ) { | 356 | + if( binding.layoutHomeLeftO.btnUserO.isPressed() ) { |
| 415 | showUserFragment(); | 357 | showUserFragment(); |
| 416 | - btn_user.setChecked(true); | 358 | + binding.layoutHomeLeft.btnUser.setChecked(true); |
| 417 | } | 359 | } |
| 418 | break; | 360 | break; |
| 419 | case R.id.btn_set_o: | 361 | case R.id.btn_set_o: |
| 420 | - Logger.d(TAG, "======showFragment======btn_set_o"+btn_set_o.isPressed()); | 362 | + Logger.d(TAG, "======showFragment======btn_set_o"+binding.layoutHomeLeftO.btnSetO.isPressed()); |
| 421 | - if( btn_set_o.isPressed() ) { | 363 | + if( binding.layoutHomeLeftO.btnSetO.isPressed() ) { |
| 422 | showSettingFragment(); | 364 | showSettingFragment(); |
| 423 | //layout_home_left.setVisibility(View.VISIBLE); | 365 | //layout_home_left.setVisibility(View.VISIBLE); |
| 424 | //layout_home_left_o.setVisibility(View.GONE); | 366 | //layout_home_left_o.setVisibility(View.GONE); |
| 425 | - btn_set.setChecked(true); | 367 | + binding.layoutHomeLeft.btnSet.setChecked(true); |
| 426 | } | 368 | } |
| 427 | break; | 369 | break; |
| 428 | } | 370 | } |
| ... | @@ -462,7 +404,7 @@ public class HomeActivity extends | ... | @@ -462,7 +404,7 @@ public class HomeActivity extends |
| 462 | 404 | ||
| 463 | public synchronized void showHomeFragment() { | 405 | public synchronized void showHomeFragment() { |
| 464 | //rg_home_bottom.clearCheck(); | 406 | //rg_home_bottom.clearCheck(); |
| 465 | - btn_real_time_display.setChecked(true); | 407 | + binding.layoutHomeLeft.btnRealTimeDisplay.setChecked(true); |
| 466 | //layout_home_left.setVisibility(View.VISIBLE); | 408 | //layout_home_left.setVisibility(View.VISIBLE); |
| 467 | //layout_home_left_o.setVisibility(View.GONE); | 409 | //layout_home_left_o.setVisibility(View.GONE); |
| 468 | //txt_device_id.setVisibility(View.VISIBLE); | 410 | //txt_device_id.setVisibility(View.VISIBLE); |
| ... | @@ -470,7 +412,7 @@ public class HomeActivity extends | ... | @@ -470,7 +412,7 @@ public class HomeActivity extends |
| 470 | } | 412 | } |
| 471 | 413 | ||
| 472 | private void showFileFragment() { | 414 | private void showFileFragment() { |
| 473 | - txt_device_id.setVisibility(View.GONE); | 415 | + binding.txtDeviceId.setVisibility(View.GONE); |
| 474 | if (archiveFragment == null) { | 416 | if (archiveFragment == null) { |
| 475 | archiveFragment = new ArchiveFragment(); | 417 | archiveFragment = new ArchiveFragment(); |
| 476 | archiveFragment.setHomeActivity(this); | 418 | archiveFragment.setHomeActivity(this); |
| ... | @@ -483,7 +425,7 @@ public class HomeActivity extends | ... | @@ -483,7 +425,7 @@ public class HomeActivity extends |
| 483 | } | 425 | } |
| 484 | 426 | ||
| 485 | private void showUserFragment() { | 427 | private void showUserFragment() { |
| 486 | - txt_device_id.setVisibility(View.GONE); | 428 | + binding.txtDeviceId.setVisibility(View.GONE); |
| 487 | if (loginFragment == null) { | 429 | if (loginFragment == null) { |
| 488 | loginFragment = new LoginFragment(); | 430 | loginFragment = new LoginFragment(); |
| 489 | loginFragment.setHomeActivity(this); | 431 | loginFragment.setHomeActivity(this); |
| ... | @@ -495,7 +437,7 @@ public class HomeActivity extends | ... | @@ -495,7 +437,7 @@ public class HomeActivity extends |
| 495 | } | 437 | } |
| 496 | 438 | ||
| 497 | private void showSettingFragment() { | 439 | private void showSettingFragment() { |
| 498 | - txt_device_id.setVisibility(View.GONE); | 440 | + binding.txtDeviceId.setVisibility(View.GONE); |
| 499 | if (settingFragment == null) { | 441 | if (settingFragment == null) { |
| 500 | settingFragment = new SettingFragment(); | 442 | settingFragment = new SettingFragment(); |
| 501 | settingFragment.setHomeActivity(this); | 443 | settingFragment.setHomeActivity(this); |
| ... | @@ -525,15 +467,15 @@ public class HomeActivity extends | ... | @@ -525,15 +467,15 @@ public class HomeActivity extends |
| 525 | } | 467 | } |
| 526 | 468 | ||
| 527 | public void enterCurPos(RecordInfoDB recordInfoDB) { | 469 | public void enterCurPos(RecordInfoDB recordInfoDB) { |
| 528 | - btn_file.setChecked(true); | 470 | + binding.layoutHomeLeft.btnFile.setChecked(true); |
| 529 | archiveFragment.showCurPos(recordInfoDB); | 471 | archiveFragment.showCurPos(recordInfoDB); |
| 530 | } | 472 | } |
| 531 | 473 | ||
| 532 | @SuppressLint("ClickableViewAccessibility") | 474 | @SuppressLint("ClickableViewAccessibility") |
| 533 | private void setListener() { | 475 | private void setListener() { |
| 534 | //((RadioButton) rg_home_bottom.getChildAt(0)).setChecked(true); | 476 | //((RadioButton) rg_home_bottom.getChildAt(0)).setChecked(true); |
| 535 | - rg_home_bottom.setOnCheckedChangeListener(this); | 477 | + binding.layoutHomeLeft.rgHomeBottom.setOnCheckedChangeListener(this); |
| 536 | - rg_home_bottom_o.setOnCheckedChangeListener(this); | 478 | + binding.layoutHomeLeftO.rgHomeBottomO.setOnCheckedChangeListener(this); |
| 537 | } | 479 | } |
| 538 | 480 | ||
| 539 | @Override | 481 | @Override |
| ... | @@ -564,7 +506,7 @@ public class HomeActivity extends | ... | @@ -564,7 +506,7 @@ public class HomeActivity extends |
| 564 | public void batteryRegister() { | 506 | public void batteryRegister() { |
| 565 | if ( batteryChangedReceiver == null ) { | 507 | if ( batteryChangedReceiver == null ) { |
| 566 | BatteryStateViewUtil.setOnBatteryLitener(this); | 508 | BatteryStateViewUtil.setOnBatteryLitener(this); |
| 567 | - batteryChangedReceiver = BatteryStateViewUtil.createBroadcastReceiver(batterView); | 509 | + batteryChangedReceiver = BatteryStateViewUtil.createBroadcastReceiver(binding.batterView); |
| 568 | } | 510 | } |
| 569 | //binding.batteryStateView是电量的组件 | 511 | //binding.batteryStateView是电量的组件 |
| 570 | registerReceiver(batteryChangedReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED)); | 512 | registerReceiver(batteryChangedReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED)); |
| ... | @@ -620,10 +562,10 @@ public class HomeActivity extends | ... | @@ -620,10 +562,10 @@ public class HomeActivity extends |
| 620 | @Override | 562 | @Override |
| 621 | public void MountEventProc(boolean mount) { | 563 | public void MountEventProc(boolean mount) { |
| 622 | if ( !SpManager.get_usb_input_enabled() ) { | 564 | if ( !SpManager.get_usb_input_enabled() ) { |
| 623 | - img_usb.setVisibility(View.GONE); | 565 | + binding.layoutHomeLeft.imgUsb.setVisibility(View.GONE); |
| 624 | return ; | 566 | return ; |
| 625 | } | 567 | } |
| 626 | - img_usb.setVisibility(mount ? View.VISIBLE : View.GONE); | 568 | + binding.layoutHomeLeft.imgUsb.setVisibility(mount ? View.VISIBLE : View.GONE); |
| 627 | } | 569 | } |
| 628 | 570 | ||
| 629 | public void setUSBVisibility() { | 571 | public void setUSBVisibility() { | ... | ... |
| ... | @@ -10,6 +10,7 @@ import android.os.Message; | ... | @@ -10,6 +10,7 @@ import android.os.Message; |
| 10 | import android.provider.Settings; | 10 | import android.provider.Settings; |
| 11 | import android.util.Log; | 11 | import android.util.Log; |
| 12 | import android.view.KeyEvent; | 12 | import android.view.KeyEvent; |
| 13 | +import android.view.LayoutInflater; | ||
| 13 | import android.view.MotionEvent; | 14 | import android.view.MotionEvent; |
| 14 | import android.view.TextureView; | 15 | import android.view.TextureView; |
| 15 | import android.view.View; | 16 | import android.view.View; |
| ... | @@ -36,6 +37,7 @@ import com.sw.laryngoscope.camera.VideoCFModule; | ... | @@ -36,6 +37,7 @@ import com.sw.laryngoscope.camera.VideoCFModule; |
| 36 | import com.sw.laryngoscope.camera.VideoModule; | 37 | import com.sw.laryngoscope.camera.VideoModule; |
| 37 | import com.sw.laryngoscope.common.Constant; | 38 | import com.sw.laryngoscope.common.Constant; |
| 38 | import com.sw.laryngoscope.common.InitParam; | 39 | import com.sw.laryngoscope.common.InitParam; |
| 40 | +import com.sw.laryngoscope.databinding.FgHomeBinding; | ||
| 39 | import com.sw.laryngoscope.manager.CameraCheck; | 41 | import com.sw.laryngoscope.manager.CameraCheck; |
| 40 | import com.sw.laryngoscope.manager.CameraInfoMg; | 42 | import com.sw.laryngoscope.manager.CameraInfoMg; |
| 41 | import com.sw.laryngoscope.manager.LcdParamManager; | 43 | import com.sw.laryngoscope.manager.LcdParamManager; |
| ... | @@ -55,10 +57,8 @@ import java.io.FileWriter; | ... | @@ -55,10 +57,8 @@ import java.io.FileWriter; |
| 55 | import java.io.IOException; | 57 | import java.io.IOException; |
| 56 | import java.lang.ref.WeakReference; | 58 | import java.lang.ref.WeakReference; |
| 57 | 59 | ||
| 58 | -import butterknife.BindView; | ||
| 59 | -import butterknife.OnClick; | ||
| 60 | 60 | ||
| 61 | -public class HomeFragment extends BaseFragment implements | 61 | +public class HomeFragment extends BaseFragment<FgHomeBinding> implements |
| 62 | CustomTimer.TimerCallBack, SeekBar.OnSeekBarChangeListener, | 62 | CustomTimer.TimerCallBack, SeekBar.OnSeekBarChangeListener, |
| 63 | VideoCBModule.OnMediaListener, VideoCFModule.OnMediaListener, | 63 | VideoCBModule.OnMediaListener, VideoCFModule.OnMediaListener, |
| 64 | NewPatientIDPopWindow.infoCallback, CameraCheck.CameraCallback, | 64 | NewPatientIDPopWindow.infoCallback, CameraCheck.CameraCallback, |
| ... | @@ -66,126 +66,6 @@ public class HomeFragment extends BaseFragment implements | ... | @@ -66,126 +66,6 @@ public class HomeFragment extends BaseFragment implements |
| 66 | 66 | ||
| 67 | private static final String TAG = "HomeFragment"; | 67 | private static final String TAG = "HomeFragment"; |
| 68 | private Context context; | 68 | private Context context; |
| 69 | - | ||
| 70 | - @BindView(R.id.layout_main_camera) | ||
| 71 | - RelativeLayout layout_main_camera; | ||
| 72 | - @BindView(R.id.img_icer_1) | ||
| 73 | - PhotoBgView_50 img_icer_1; | ||
| 74 | - @BindView(R.id.view_camera_1) | ||
| 75 | - TextureView view_camera_1; | ||
| 76 | - @BindView(R.id.img_cam_fg_1) | ||
| 77 | - PhotoBgView img_cam_fg_1; | ||
| 78 | - @BindView(R.id.img_animation_cam1) | ||
| 79 | - CaptureAnimationOverlay img_animation_cam1; | ||
| 80 | - | ||
| 81 | - @BindView(R.id.view_camera_2) | ||
| 82 | - TextureView view_camera_2; | ||
| 83 | - @BindView(R.id.img_animation_cam2) | ||
| 84 | - CaptureAnimationOverlay img_animation_cam2; | ||
| 85 | - | ||
| 86 | - @BindView(R.id.lay_icon) | ||
| 87 | - LinearLayout lay_icon; | ||
| 88 | - @BindView(R.id.img_record_shortcut) | ||
| 89 | - ImageView img_record_shortcut; | ||
| 90 | - @BindView(R.id.img_photo_shortcut) | ||
| 91 | - ImageView img_photo_shortcut; | ||
| 92 | - @BindView(R.id.lay_key_2) | ||
| 93 | - RelativeLayout lay_key_2; | ||
| 94 | - @BindView(R.id.lay_three) | ||
| 95 | - RelativeLayout lay_three; | ||
| 96 | - @BindView(R.id.btn_switch_camera) | ||
| 97 | - ImageView btn_switch_camera; | ||
| 98 | - | ||
| 99 | - @BindView(R.id.txt_video_total_time) | ||
| 100 | - TextView txt_video_total_time; | ||
| 101 | - | ||
| 102 | - | ||
| 103 | - @BindView(R.id.layout_camera_type) | ||
| 104 | - View layout_camera_type; | ||
| 105 | - @BindView(R.id.btn_camera_set) | ||
| 106 | - ImageView btn_camera_set; | ||
| 107 | - @BindView(R.id.layout_camera_set) | ||
| 108 | - View layout_camera_set; | ||
| 109 | - @BindView(R.id.sb_color) | ||
| 110 | - SeekBar sb_color; | ||
| 111 | - @BindView(R.id.sb_saturation) | ||
| 112 | - SeekBar sb_saturation; | ||
| 113 | - @BindView(R.id.sb_sharpness) | ||
| 114 | - SeekBar sb_sharpness; | ||
| 115 | - @BindView(R.id.sb_brightness) | ||
| 116 | - SeekBar sb_brightness; | ||
| 117 | - | ||
| 118 | - @BindView(R.id.img_patientinfo) | ||
| 119 | - ImageView img_patientinfo; | ||
| 120 | - | ||
| 121 | - @BindView(R.id.ed_patient_id) | ||
| 122 | - EditText ed_patient_id; | ||
| 123 | - @BindView(R.id.ed_patient_age) | ||
| 124 | - EditText ed_patient_age; | ||
| 125 | - @BindView(R.id.ed_patient_gender) | ||
| 126 | - EditText ed_patient_gender; | ||
| 127 | - | ||
| 128 | - /*@BindView(R.id.seek_bar) | ||
| 129 | - CircleSeekBar seek_bar;*/ | ||
| 130 | - | ||
| 131 | - @BindView(R.id.layout_camera2) | ||
| 132 | - RelativeLayout layout_camera2; | ||
| 133 | - @BindView(R.id.img_icer_2) | ||
| 134 | - PhotoBgView_50 img_icer_2; | ||
| 135 | - | ||
| 136 | - @BindView(R.id.layout_camera_1_over) | ||
| 137 | - RelativeLayout layout_camera_1_over; | ||
| 138 | - @BindView(R.id.img_camera_1_status) | ||
| 139 | - ImageView img_camera_1_status; | ||
| 140 | - @BindView(R.id.img_uncon_camera) | ||
| 141 | - TextView img_uncon_camera; | ||
| 142 | - | ||
| 143 | - @BindView(R.id.layout_camera_2_over) | ||
| 144 | - View layout_camera_2_over; | ||
| 145 | - @BindView(R.id.img_tf_card) | ||
| 146 | - ImageView img_tf_card; | ||
| 147 | - @BindView(R.id.img_camera_2_status) | ||
| 148 | - ImageView img_camera_2_status; | ||
| 149 | - | ||
| 150 | - | ||
| 151 | - @BindView(R.id.rg_4) | ||
| 152 | - public RadioGroup rg_4; | ||
| 153 | - @BindView(R.id.rb_264) | ||
| 154 | - public RadioButton rb_264; | ||
| 155 | - @BindView(R.id.rb_265) | ||
| 156 | - public RadioButton rb_265; | ||
| 157 | - @BindView(R.id.rg_3) | ||
| 158 | - public RadioGroup rg_3; | ||
| 159 | - @BindView(R.id.rb_shot) | ||
| 160 | - public RadioButton rb_shot; | ||
| 161 | - @BindView(R.id.rb_cvbs_in) | ||
| 162 | - public RadioButton rb_cvbs_in; | ||
| 163 | - | ||
| 164 | - @BindView(R.id.rg_5) | ||
| 165 | - public RadioGroup rg_5; | ||
| 166 | - @BindView(R.id.rb_awb_led) | ||
| 167 | - public RadioButton rb_awb_led; | ||
| 168 | - @BindView(R.id.rb_awb_rect) | ||
| 169 | - public RadioButton rb_awb_rect; | ||
| 170 | - @BindView(R.id.rb_awb_temp) | ||
| 171 | - public RadioButton rb_awb_temp; | ||
| 172 | - @BindView(R.id.rb_awb_sun) | ||
| 173 | - public RadioButton rb_awb_sun; | ||
| 174 | - @BindView(R.id.rb_awb_cloud) | ||
| 175 | - public RadioButton rb_awb_cloud; | ||
| 176 | - @BindView(R.id.txt_camera_ori) | ||
| 177 | - public ImageView txt_camera_ori; | ||
| 178 | - | ||
| 179 | - @BindView(R.id.sb_zoom) | ||
| 180 | - SeekBar sb_zoom; | ||
| 181 | - | ||
| 182 | - @BindView(R.id.txt_camera_inter) | ||
| 183 | - public TextView txt_camera_inter; | ||
| 184 | - @BindView(R.id.txt_camera_exter) | ||
| 185 | - public TextView txt_camera_exter; | ||
| 186 | - @BindView(R.id.txt_camera_name) | ||
| 187 | - public TextView txt_camera_name; | ||
| 188 | - | ||
| 189 | private CustomTimer scrollTimer; | 69 | private CustomTimer scrollTimer; |
| 190 | private final String timerTAG_scroll = "scroll"; | 70 | private final String timerTAG_scroll = "scroll"; |
| 191 | 71 | ||
| ... | @@ -237,19 +117,19 @@ public class HomeFragment extends BaseFragment implements | ... | @@ -237,19 +117,19 @@ public class HomeFragment extends BaseFragment implements |
| 237 | Logger.d(TAG, "==onResume======HomeFragment===1========="); | 117 | Logger.d(TAG, "==onResume======HomeFragment===1========="); |
| 238 | mNewPatientIDPopWindow = new NewPatientIDPopWindow(homeActivity, context); | 118 | mNewPatientIDPopWindow = new NewPatientIDPopWindow(homeActivity, context); |
| 239 | mNewPatientIDPopWindow.setInfoCallback(this); | 119 | mNewPatientIDPopWindow.setInfoCallback(this); |
| 240 | - view_camera_1.setVisibility(View.VISIBLE); | 120 | + binding.viewCamera1.setVisibility(View.VISIBLE); |
| 241 | 121 | ||
| 242 | initVideoModule(); | 122 | initVideoModule(); |
| 243 | if ( mAnimationUtils == null ) { | 123 | if ( mAnimationUtils == null ) { |
| 244 | mAnimationUtils = new AnimationUtil(getContext()); | 124 | mAnimationUtils = new AnimationUtil(getContext()); |
| 245 | - mAnimationUtils.setTmpSet(layout_camera_set); | 125 | + mAnimationUtils.setTmpSet(binding.layoutCameraSet.getRoot()); |
| 246 | mAnimationUtils.setAnimation(); | 126 | mAnimationUtils.setAnimation(); |
| 247 | } | 127 | } |
| 248 | 128 | ||
| 249 | //seek_bar.setOnSeekBarChangeListener(this); | 129 | //seek_bar.setOnSeekBarChangeListener(this); |
| 250 | 130 | ||
| 251 | mLcdParamManager = new LcdParamManager(); | 131 | mLcdParamManager = new LcdParamManager(); |
| 252 | - mLcdParamManager.onCreate(sb_brightness, sb_saturation, sb_color); | 132 | + mLcdParamManager.onCreate(binding.layoutCameraSet.sbBrightness, binding.layoutCameraSet.sbSaturation, binding.layoutCameraSet.sbColor); |
| 253 | 133 | ||
| 254 | /*sb_color.setProgress(SpManager.get_value_color()); | 134 | /*sb_color.setProgress(SpManager.get_value_color()); |
| 255 | sb_color.setOnSeekBarChangeListener(this); | 135 | sb_color.setOnSeekBarChangeListener(this); |
| ... | @@ -261,20 +141,20 @@ public class HomeFragment extends BaseFragment implements | ... | @@ -261,20 +141,20 @@ public class HomeFragment extends BaseFragment implements |
| 261 | int bright = getBrightness(getActivity()); | 141 | int bright = getBrightness(getActivity()); |
| 262 | sb_brightness.setProgress((int)( bright / 255.0f * 100 )); | 142 | sb_brightness.setProgress((int)( bright / 255.0f * 100 )); |
| 263 | sb_brightness.setOnSeekBarChangeListener(this);*/ | 143 | sb_brightness.setOnSeekBarChangeListener(this);*/ |
| 264 | - sb_zoom.setProgress(0); | 144 | + binding.layoutCameraSet.sbZoom.setProgress(0); |
| 265 | - sb_zoom.setOnSeekBarChangeListener(this); | 145 | + binding.layoutCameraSet.sbZoom.setOnSeekBarChangeListener(this); |
| 266 | 146 | ||
| 267 | refreshCameraItem(); | 147 | refreshCameraItem(); |
| 268 | setBonderType(); | 148 | setBonderType(); |
| 269 | if ( SpManager.get_camera_encode() == MediaRecorder.VideoEncoder.H264 ) { | 149 | if ( SpManager.get_camera_encode() == MediaRecorder.VideoEncoder.H264 ) { |
| 270 | - rb_264.setChecked(true); | 150 | + binding.layoutCameraSet.rb264.setChecked(true); |
| 271 | } else { | 151 | } else { |
| 272 | - rb_265.setChecked(true); | 152 | + binding.layoutCameraSet.rb265.setChecked(true); |
| 273 | } | 153 | } |
| 274 | if ( SpManager.get_camera_record_source() == 0 ) { | 154 | if ( SpManager.get_camera_record_source() == 0 ) { |
| 275 | - rb_shot.setChecked(true); | 155 | + binding.layoutCameraSet.rbShot.setChecked(true); |
| 276 | } else { | 156 | } else { |
| 277 | - rb_cvbs_in.setChecked(true); | 157 | + binding.layoutCameraSet.rbCvbsIn.setChecked(true); |
| 278 | } | 158 | } |
| 279 | CameraInfoMg.getInstance(null).setCameraInfoCb(this); | 159 | CameraInfoMg.getInstance(null).setCameraInfoCb(this); |
| 280 | } | 160 | } |
| ... | @@ -323,8 +203,8 @@ public class HomeFragment extends BaseFragment implements | ... | @@ -323,8 +203,8 @@ public class HomeFragment extends BaseFragment implements |
| 323 | 203 | ||
| 324 | private void setBonderType() { | 204 | private void setBonderType() { |
| 325 | if ( SpManager.get_border_type() == Constant.BORDER_TYPE_A ) { | 205 | if ( SpManager.get_border_type() == Constant.BORDER_TYPE_A ) { |
| 326 | - layout_main_camera.setBackgroundResource(R.drawable.bg_black_33); | 206 | + binding.layoutMainCamera.setBackgroundResource(R.drawable.bg_black_33); |
| 327 | - layout_camera2.setBackgroundResource(R.drawable.bg_black_33); | 207 | + binding.layoutCamera2.setBackgroundResource(R.drawable.bg_black_33); |
| 328 | } | 208 | } |
| 329 | if ( SpManager.get_border_type() == Constant.BORDER_TYPE_B ) { | 209 | if ( SpManager.get_border_type() == Constant.BORDER_TYPE_B ) { |
| 330 | /*layout_main_camera.setBackgroundResource(R.color.color_black_33); | 210 | /*layout_main_camera.setBackgroundResource(R.color.color_black_33); |
| ... | @@ -333,105 +213,103 @@ public class HomeFragment extends BaseFragment implements | ... | @@ -333,105 +213,103 @@ public class HomeFragment extends BaseFragment implements |
| 333 | //layout_camera2.setBackgroundResource(R.drawable.bg_black_33_polygon); | 213 | //layout_camera2.setBackgroundResource(R.drawable.bg_black_33_polygon); |
| 334 | } | 214 | } |
| 335 | if ( SpManager.get_border_type() == Constant.BORDER_TYPE_C ) { | 215 | if ( SpManager.get_border_type() == Constant.BORDER_TYPE_C ) { |
| 336 | - layout_main_camera.setBackgroundResource(R.drawable.bg_black_33_round); | 216 | + binding.layoutMainCamera.setBackgroundResource(R.drawable.bg_black_33_round); |
| 337 | - layout_camera2.setBackgroundResource(R.drawable.bg_black_33_round); | 217 | + binding.layoutCamera2.setBackgroundResource(R.drawable.bg_black_33_round); |
| 338 | } | 218 | } |
| 339 | /*if ( SpManager.get_border_type() == Constant.BORDER_TYPE_D ) { | 219 | /*if ( SpManager.get_border_type() == Constant.BORDER_TYPE_D ) { |
| 340 | layout_main_camera.setBackgroundResource(R.drawable.bg_black_33_polygon); | 220 | layout_main_camera.setBackgroundResource(R.drawable.bg_black_33_polygon); |
| 341 | layout_camera2.setBackgroundResource(R.drawable.bg_black_33_polygon); | 221 | layout_camera2.setBackgroundResource(R.drawable.bg_black_33_polygon); |
| 342 | }*/ | 222 | }*/ |
| 343 | - txt_camera_inter.setText(CameraInfoMg.getInstance(null).data_internal_diameter); | 223 | + binding.layoutCameraType.txtCameraInter.setText(CameraInfoMg.getInstance(null).data_internal_diameter); |
| 344 | - txt_camera_exter.setText(CameraInfoMg.getInstance(null).data_external_diameter); | 224 | + binding.layoutCameraType.txtCameraExter.setText(CameraInfoMg.getInstance(null).data_external_diameter); |
| 345 | - txt_camera_name.setText(CameraInfoMg.getInstance(null).data_mirror_model); | 225 | + binding.layoutCameraType.txtCameraName.setText(CameraInfoMg.getInstance(null).data_mirror_model); |
| 346 | } | 226 | } |
| 347 | 227 | ||
| 348 | - @Override | ||
| 349 | - protected int rootLayout() { | ||
| 350 | - return R.layout.fg_home; | ||
| 351 | - } | ||
| 352 | 228 | ||
| 353 | @Override | 229 | @Override |
| 354 | protected void init() { | 230 | protected void init() { |
| 355 | //writeFile(InitParam.pwmPath, light[indexLight-1]+""); | 231 | //writeFile(InitParam.pwmPath, light[indexLight-1]+""); |
| 356 | - txt_camera_ori.setVisibility(SpManager.get_rt_rotation() ? View.VISIBLE : View.GONE); | 232 | + binding.layoutCameraSet.txtCameraOri.setVisibility(SpManager.get_rt_rotation() ? View.VISIBLE : View.GONE); |
| 357 | } | 233 | } |
| 358 | 234 | ||
| 359 | @Override | 235 | @Override |
| 360 | protected void setListener() { | 236 | protected void setListener() { |
| 361 | //img_back.setOnClickListener(this); | 237 | //img_back.setOnClickListener(this); |
| 362 | - rg_3.setOnCheckedChangeListener(this); | 238 | + binding.layoutCameraSet.rg3.setOnCheckedChangeListener(this); |
| 363 | - rg_4.setOnCheckedChangeListener(this); | 239 | + binding.layoutCameraSet.rg4.setOnCheckedChangeListener(this); |
| 364 | - rg_5.setOnCheckedChangeListener(this); | 240 | + binding.layoutCameraSet.rg5.setOnCheckedChangeListener(this); |
| 365 | - } | 241 | + binding.layoutCameraSet.getRoot().setOnClickListener(new View.OnClickListener() { |
| 366 | - | 242 | + @Override |
| 367 | - @Override | 243 | + public void onClick(View v) { |
| 368 | - @OnClick({ R.id.img_record_shortcut, R.id.img_photo_shortcut, | 244 | + if ( binding.layoutCameraSet.getRoot().getVisibility() == View.GONE ) { |
| 369 | - R.id.btn_camera_set, | ||
| 370 | - R.id.img_patientinfo, | ||
| 371 | - R.id.layout_camera_2_over, R.id.btn_switch_camera, | ||
| 372 | - R.id.txt_camera_ori, }) | ||
| 373 | - public void onClick(View v) { | ||
| 374 | - switch (v.getId()) { | ||
| 375 | - /*case R.id.btn_left_close: | ||
| 376 | - mAnimationUtils.closePreview(); | ||
| 377 | - break;*/ | ||
| 378 | - case R.id.btn_camera_set: | ||
| 379 | - if ( layout_camera_set.getVisibility() == View.GONE ) { | ||
| 380 | mAnimationUtils.showSetView(); | 245 | mAnimationUtils.showSetView(); |
| 381 | - btn_camera_set.setSelected(true); | 246 | + binding.btnCameraSet.setSelected(true); |
| 382 | } else { | 247 | } else { |
| 383 | mAnimationUtils.closeSetView(); | 248 | mAnimationUtils.closeSetView(); |
| 384 | - btn_camera_set.setSelected(false); | 249 | + binding.btnCameraSet.setSelected(false); |
| 385 | } | 250 | } |
| 386 | - break; | 251 | + } |
| 387 | - case R.id.img_record_shortcut: | 252 | + }); |
| 253 | + binding.imgRecordShortcut.setOnClickListener(new View.OnClickListener() { | ||
| 254 | + @Override | ||
| 255 | + public void onClick(View v) { | ||
| 388 | Logger.d(TAG, "=====img_record_shortcut======"); | 256 | Logger.d(TAG, "=====img_record_shortcut======"); |
| 389 | //没有摄像头 | 257 | //没有摄像头 |
| 390 | if ( mCameraCheck.getCam_1() == -1 && mCameraCheck.getCam_2() == -1 ) { | 258 | if ( mCameraCheck.getCam_1() == -1 && mCameraCheck.getCam_2() == -1 ) { |
| 391 | - break; | ||
| 392 | } | 259 | } |
| 393 | sendEvent(key_event[SpManager.get_handle_one_key()]); | 260 | sendEvent(key_event[SpManager.get_handle_one_key()]); |
| 394 | - break; | 261 | + } |
| 395 | - case R.id.img_photo_shortcut: | 262 | + }); |
| 396 | - //没有摄像头 | 263 | + binding.imgPhotoShortcut.setOnClickListener(new View.OnClickListener() { |
| 264 | + @Override | ||
| 265 | + public void onClick(View v) { | ||
| 397 | if ( mCameraCheck.getCam_1() == -1 && mCameraCheck.getCam_2() == -1 ) { | 266 | if ( mCameraCheck.getCam_1() == -1 && mCameraCheck.getCam_2() == -1 ) { |
| 398 | - break; | ||
| 399 | } | 267 | } |
| 400 | sendEvent(key_event[SpManager.get_handle_two_key()]); | 268 | sendEvent(key_event[SpManager.get_handle_two_key()]); |
| 401 | - break; | 269 | + } |
| 402 | - case R.id.img_patientinfo: | 270 | + }); |
| 271 | + binding.layoutMainShowUserinfo.imgPatientinfo.setOnClickListener(new View.OnClickListener() { | ||
| 272 | + @Override | ||
| 273 | + public void onClick(View v) { | ||
| 403 | Logger.d("==========img_patientinfo======"); | 274 | Logger.d("==========img_patientinfo======"); |
| 404 | - mNewPatientIDPopWindow.showAsDropDown(img_patientinfo, 0, | 275 | + mNewPatientIDPopWindow.showAsDropDown(binding.layoutMainShowUserinfo.imgPatientinfo, 0, |
| 405 | - (int)getResources().getDimension(R.dimen.dp_y_170)); | 276 | - (int)getResources().getDimension(R.dimen.dp_y_170)); |
| 406 | - break; | 277 | + } |
| 407 | - case R.id.layout_camera_2_over: | 278 | + }); |
| 279 | + binding.layoutCamera2Over.getRoot().setOnClickListener(new View.OnClickListener() { | ||
| 280 | + @Override | ||
| 281 | + public void onClick(View v) { | ||
| 408 | //onKeyDown(KeyEvent.KEYCODE_F2, null); | 282 | //onKeyDown(KeyEvent.KEYCODE_F2, null); |
| 409 | Logger.d("==========layout_camera2======"); | 283 | Logger.d("==========layout_camera2======"); |
| 410 | /*mVideoModule.setMainCamera(mVideoModule.getMainCamera() == BaseModule.FACING_BACK ? | 284 | /*mVideoModule.setMainCamera(mVideoModule.getMainCamera() == BaseModule.FACING_BACK ? |
| 411 | BaseModule.FACING_FRONT : BaseModule.FACING_BACK); | 285 | BaseModule.FACING_FRONT : BaseModule.FACING_BACK); |
| 412 | switchCameraView();*/ | 286 | switchCameraView();*/ |
| 413 | - break; | 287 | + } |
| 414 | - case R.id.btn_switch_camera: | 288 | + }); |
| 289 | + binding.btnSwitchCamera.setOnClickListener(new View.OnClickListener() { | ||
| 290 | + @Override | ||
| 291 | + public void onClick(View v) { | ||
| 415 | Logger.d("==========btn_switch_camera======"); | 292 | Logger.d("==========btn_switch_camera======"); |
| 416 | mVideoModule.setMainCameraType(mVideoModule.getMainCameraType() == InitParam.CAM_BACK ? | 293 | mVideoModule.setMainCameraType(mVideoModule.getMainCameraType() == InitParam.CAM_BACK ? |
| 417 | InitParam.CAM_FRONT : InitParam.CAM_BACK); | 294 | InitParam.CAM_FRONT : InitParam.CAM_BACK); |
| 418 | switchCameraView(); | 295 | switchCameraView(); |
| 419 | - break; | 296 | + } |
| 420 | - case R.id.txt_camera_ori: | 297 | + }); |
| 298 | + binding.layoutCameraSet.txtCameraOri.setOnClickListener(new View.OnClickListener() { | ||
| 299 | + @Override | ||
| 300 | + public void onClick(View v) { | ||
| 421 | if ( SpManager.get_rt_rotation() ) { | 301 | if ( SpManager.get_rt_rotation() ) { |
| 422 | mVideoModule.setDisplayOrientation(); | 302 | mVideoModule.setDisplayOrientation(); |
| 423 | } | 303 | } |
| 424 | - break; | 304 | + } |
| 425 | - default: | 305 | + }); |
| 426 | - break; | ||
| 427 | - } | ||
| 428 | } | 306 | } |
| 429 | 307 | ||
| 430 | @Override | 308 | @Override |
| 431 | public void onPause() { | 309 | public void onPause() { |
| 432 | super.onPause(); | 310 | super.onPause(); |
| 433 | Logger.d(TAG, "========HomeFragment===12========="); | 311 | Logger.d(TAG, "========HomeFragment===12========="); |
| 434 | - view_camera_1.setVisibility(View.GONE); | 312 | + binding.viewCamera1.setVisibility(View.GONE); |
| 435 | closeCamera(); | 313 | closeCamera(); |
| 436 | } | 314 | } |
| 437 | 315 | ||
| ... | @@ -547,11 +425,15 @@ public class HomeFragment extends BaseFragment implements | ... | @@ -547,11 +425,15 @@ public class HomeFragment extends BaseFragment implements |
| 547 | } | 425 | } |
| 548 | 426 | ||
| 549 | @Override | 427 | @Override |
| 550 | - public void getinfo(String id, String age, String sex) { | 428 | + public void getinfo(final String id, final String age, final String sex) { |
| 551 | - homeActivity.runOnUiThread(()-> { | 429 | + homeActivity.runOnUiThread(new Runnable() { |
| 552 | - ed_patient_id.setText(id); | 430 | + @Override |
| 553 | - ed_patient_age.setText(age); | 431 | + public void run() { |
| 554 | - ed_patient_gender.setText(sex);}); | 432 | + binding.layoutMainShowUserinfo.edPatientId.setText(id); |
| 433 | + binding.layoutMainShowUserinfo.edPatientAge.setText(age); | ||
| 434 | + binding.layoutMainShowUserinfo.edPatientGender.setText(sex); | ||
| 435 | + } | ||
| 436 | + }); | ||
| 555 | } | 437 | } |
| 556 | 438 | ||
| 557 | private class MainHandler extends Handler { | 439 | private class MainHandler extends Handler { |
| ... | @@ -567,42 +449,42 @@ public class HomeFragment extends BaseFragment implements | ... | @@ -567,42 +449,42 @@ public class HomeFragment extends BaseFragment implements |
| 567 | case MSG_ICE_PROC: | 449 | case MSG_ICE_PROC: |
| 568 | if ( msg.arg1 == MSG_CAMERA_TYPE_USB ) { | 450 | if ( msg.arg1 == MSG_CAMERA_TYPE_USB ) { |
| 569 | if ( mCameraCheck.getTypeCPos() == InitParam.CAM_BACK ) { | 451 | if ( mCameraCheck.getTypeCPos() == InitParam.CAM_BACK ) { |
| 570 | - img_icer_1.setImageBitmap(view_camera_1.getBitmap()); | 452 | + binding.imgIcer1.setImageBitmap(binding.viewCamera1.getBitmap()); |
| 571 | - img_icer_1.setVisibility(img_icer_1.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE); | 453 | + binding.imgIcer1.setVisibility(binding.imgIcer1.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE); |
| 572 | - setCameraStatus(img_camera_1_status, InitParam.CAMERA_STATUS_RES[0]); | 454 | + setCameraStatus(binding.imgCamera1Status, InitParam.CAMERA_STATUS_RES[0]); |
| 573 | } else { | 455 | } else { |
| 574 | - img_icer_2.setImageBitmap(view_camera_2.getBitmap()); | 456 | + binding.imgIcer2.setImageBitmap(binding.viewCamera2.getBitmap()); |
| 575 | - img_icer_2.setVisibility(img_icer_2.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE); | 457 | + binding.imgIcer2.setVisibility(binding.imgIcer2.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE); |
| 576 | - setCameraStatus(img_camera_2_status, InitParam.CAMERA_STATUS_RES[0]); | 458 | + setCameraStatus(binding.layoutCamera2Over.imgCamera2Status, InitParam.CAMERA_STATUS_RES[0]); |
| 577 | } | 459 | } |
| 578 | } else { | 460 | } else { |
| 579 | if ( mCameraCheck.getOVPos() == InitParam.CAM_BACK ) { | 461 | if ( mCameraCheck.getOVPos() == InitParam.CAM_BACK ) { |
| 580 | - img_icer_1.setImageBitmap(view_camera_1.getBitmap()); | 462 | + binding.imgIcer1.setImageBitmap(binding.viewCamera1.getBitmap()); |
| 581 | - img_icer_1.setVisibility(img_icer_1.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE); | 463 | + binding.imgIcer1.setVisibility(binding.imgIcer1.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE); |
| 582 | - setCameraStatus(img_camera_1_status, InitParam.CAMERA_STATUS_RES[0]); | 464 | + setCameraStatus(binding.imgCamera1Status, InitParam.CAMERA_STATUS_RES[0]); |
| 583 | } else { | 465 | } else { |
| 584 | - img_icer_2.setImageBitmap(view_camera_2.getBitmap()); | 466 | + binding.imgIcer2.setImageBitmap(binding.viewCamera2.getBitmap()); |
| 585 | - img_icer_2.setVisibility(img_icer_2.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE); | 467 | + binding.imgIcer2.setVisibility(binding.imgIcer2.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE); |
| 586 | - setCameraStatus(img_camera_2_status, InitParam.CAMERA_STATUS_RES[0]); | 468 | + setCameraStatus(binding.layoutCamera2Over.imgCamera2Status, InitParam.CAMERA_STATUS_RES[0]); |
| 587 | } | 469 | } |
| 588 | } | 470 | } |
| 589 | break; | 471 | break; |
| 590 | case MSG_TAKE_PHOTO_BACK: | 472 | case MSG_TAKE_PHOTO_BACK: |
| 591 | if ( mVideoModule.isOpenBackCamera() ) { | 473 | if ( mVideoModule.isOpenBackCamera() ) { |
| 592 | mVideoModule.takeBackPhoto(); | 474 | mVideoModule.takeBackPhoto(); |
| 593 | - img_animation_cam1.onPreviewAreaChanged( | 475 | + binding.imgAnimationCam1.onPreviewAreaChanged( |
| 594 | - new RectF(0, 0, view_camera_1.getWidth(), view_camera_1.getHeight())); | 476 | + new RectF(0, 0, binding.viewCamera1.getWidth(), binding.viewCamera1.getHeight())); |
| 595 | - img_animation_cam1.startFlashAnimation(true); | 477 | + binding.imgAnimationCam1.startFlashAnimation(true); |
| 596 | - setCameraStatus(img_camera_1_status, InitParam.CAMERA_STATUS_RES[4]); | 478 | + setCameraStatus(binding.imgCamera1Status, InitParam.CAMERA_STATUS_RES[4]); |
| 597 | } | 479 | } |
| 598 | break; | 480 | break; |
| 599 | case MSG_TAKE_PHOTO_FRONT: | 481 | case MSG_TAKE_PHOTO_FRONT: |
| 600 | if ( mVideoModule.isOpenFrontCamera() ) { | 482 | if ( mVideoModule.isOpenFrontCamera() ) { |
| 601 | mVideoModule.takeFrontPhoto(); | 483 | mVideoModule.takeFrontPhoto(); |
| 602 | - img_animation_cam2.onPreviewAreaChanged( | 484 | + binding.layoutCamera2Over.imgAnimationCam2.onPreviewAreaChanged( |
| 603 | - new RectF(0, 0, view_camera_2.getWidth(), view_camera_2.getHeight())); | 485 | + new RectF(0, 0, binding.viewCamera2.getWidth(), binding.viewCamera2.getHeight())); |
| 604 | - img_animation_cam2.startFlashAnimation(true); | 486 | + binding.layoutCamera2Over.imgAnimationCam2.startFlashAnimation(true); |
| 605 | - setCameraStatus(img_camera_2_status, InitParam.CAMERA_STATUS_RES[4]); | 487 | + setCameraStatus(binding.layoutCamera2Over.imgCamera2Status, InitParam.CAMERA_STATUS_RES[4]); |
| 606 | } | 488 | } |
| 607 | break; | 489 | break; |
| 608 | case MSG_TAKE_VIDEO_BACK: | 490 | case MSG_TAKE_VIDEO_BACK: |
| ... | @@ -613,7 +495,7 @@ public class HomeFragment extends BaseFragment implements | ... | @@ -613,7 +495,7 @@ public class HomeFragment extends BaseFragment implements |
| 613 | } | 495 | } |
| 614 | if (!mVideoModule.isBackRec()) { | 496 | if (!mVideoModule.isBackRec()) { |
| 615 | mVideoModule.startBackVideoRec(); | 497 | mVideoModule.startBackVideoRec(); |
| 616 | - setCameraStatus(img_camera_1_status, InitParam.CAMERA_STATUS_RES[3]); | 498 | + setCameraStatus(binding.imgCamera1Status, InitParam.CAMERA_STATUS_RES[3]); |
| 617 | } else { | 499 | } else { |
| 618 | if ( mVideoModule.stopBackVideoRecDelay() ) { | 500 | if ( mVideoModule.stopBackVideoRecDelay() ) { |
| 619 | //img_record_shortcut.setSelected(false); | 501 | //img_record_shortcut.setSelected(false); |
| ... | @@ -629,7 +511,7 @@ public class HomeFragment extends BaseFragment implements | ... | @@ -629,7 +511,7 @@ public class HomeFragment extends BaseFragment implements |
| 629 | } | 511 | } |
| 630 | if (!mVideoModule.isFrontRec()) { | 512 | if (!mVideoModule.isFrontRec()) { |
| 631 | mVideoModule.startFrontVideoRec(); | 513 | mVideoModule.startFrontVideoRec(); |
| 632 | - setCameraStatus(img_camera_2_status, InitParam.CAMERA_STATUS_RES[3]); | 514 | + setCameraStatus(binding.layoutCamera2Over.imgCamera2Status, InitParam.CAMERA_STATUS_RES[3]); |
| 633 | } else { | 515 | } else { |
| 634 | if ( mVideoModule.stopFrontVideoRecDelay() ) { | 516 | if ( mVideoModule.stopFrontVideoRecDelay() ) { |
| 635 | } | 517 | } |
| ... | @@ -699,7 +581,7 @@ public class HomeFragment extends BaseFragment implements | ... | @@ -699,7 +581,7 @@ public class HomeFragment extends BaseFragment implements |
| 699 | } | 581 | } |
| 700 | } | 582 | } |
| 701 | setCameraStatus(cam_pos_show == InitParam.CAM_BACK ? | 583 | setCameraStatus(cam_pos_show == InitParam.CAM_BACK ? |
| 702 | - img_camera_1_status : img_camera_2_status, InitParam.CAMERA_STATUS_RES[1]); | 584 | + binding.imgCamera1Status : binding.layoutCamera2Over.imgCamera2Status, InitParam.CAMERA_STATUS_RES[1]); |
| 703 | break; | 585 | break; |
| 704 | case MSG_ENLARGE: | 586 | case MSG_ENLARGE: |
| 705 | int cam_status_pos= -1; | 587 | int cam_status_pos= -1; |
| ... | @@ -727,7 +609,7 @@ public class HomeFragment extends BaseFragment implements | ... | @@ -727,7 +609,7 @@ public class HomeFragment extends BaseFragment implements |
| 727 | } | 609 | } |
| 728 | } | 610 | } |
| 729 | setCameraStatus(cam_status_pos == InitParam.CAM_BACK ? | 611 | setCameraStatus(cam_status_pos == InitParam.CAM_BACK ? |
| 730 | - img_camera_1_status : img_camera_2_status, InitParam.CAMERA_STATUS_RES[2]); | 612 | + binding.imgCamera1Status : binding.layoutCamera2Over.imgCamera2Status, InitParam.CAMERA_STATUS_RES[2]); |
| 731 | break; | 613 | break; |
| 732 | case MSG_RECORD: | 614 | case MSG_RECORD: |
| 733 | if ( msg.arg1 == MSG_CAMERA_TYPE_USB ) { | 615 | if ( msg.arg1 == MSG_CAMERA_TYPE_USB ) { |
| ... | @@ -757,21 +639,21 @@ public class HomeFragment extends BaseFragment implements | ... | @@ -757,21 +639,21 @@ public class HomeFragment extends BaseFragment implements |
| 757 | /*ConstraintLayout.LayoutParams layoutParams_sv = (ConstraintLayout.LayoutParams) layout_main_camera.getLayoutParams(); | 639 | /*ConstraintLayout.LayoutParams layoutParams_sv = (ConstraintLayout.LayoutParams) layout_main_camera.getLayoutParams(); |
| 758 | layoutParams_sv.horizontalBias = 0.5f; | 640 | layoutParams_sv.horizontalBias = 0.5f; |
| 759 | layout_main_camera.setLayoutParams(layoutParams_sv);*/ | 641 | layout_main_camera.setLayoutParams(layoutParams_sv);*/ |
| 760 | - if ( layout_camera2.getVisibility() == View.VISIBLE ) { | 642 | + if (binding.layoutCamera2.getVisibility() == View.VISIBLE ) { |
| 761 | - ConstraintLayout.LayoutParams layoutParams_sv = (ConstraintLayout.LayoutParams) layout_camera2.getLayoutParams(); | 643 | + ConstraintLayout.LayoutParams layoutParams_sv = (ConstraintLayout.LayoutParams) binding.layoutCamera2.getLayoutParams(); |
| 762 | if ( layoutParams_sv.horizontalBias == oneHor ) {//第二个摄像头在主位置 | 644 | if ( layoutParams_sv.horizontalBias == oneHor ) {//第二个摄像头在主位置 |
| 763 | - setViewParam(InitParam.VIDEO_PREVIEW[curPreviewParam][0], InitParam.VIDEO_PREVIEW[curPreviewParam][1], layout_camera2); | 645 | + setViewParam(InitParam.VIDEO_PREVIEW[curPreviewParam][0], InitParam.VIDEO_PREVIEW[curPreviewParam][1], binding.layoutCamera2); |
| 764 | - setViewParam(InitParam.VIDEO_PREVIEW[curPreviewParam][0], InitParam.VIDEO_PREVIEW[curPreviewParam][1], layout_camera_2_over); | 646 | + setViewParam(InitParam.VIDEO_PREVIEW[curPreviewParam][0], InitParam.VIDEO_PREVIEW[curPreviewParam][1], binding.layoutCamera2Over.getRoot()); |
| 765 | - setCameraStatus(img_camera_2_status, InitParam.CAMERA_STATUS_RES[2]); | 647 | + setCameraStatus(binding.layoutCamera2Over.imgCamera2Status, InitParam.CAMERA_STATUS_RES[2]); |
| 766 | } else {//第二个摄像头在次位置 | 648 | } else {//第二个摄像头在次位置 |
| 767 | - setViewParam(InitParam.VIDEO_PREVIEW[curPreviewParam][0], InitParam.VIDEO_PREVIEW[curPreviewParam][1], layout_main_camera); | 649 | + setViewParam(InitParam.VIDEO_PREVIEW[curPreviewParam][0], InitParam.VIDEO_PREVIEW[curPreviewParam][1], binding.layoutMainCamera); |
| 768 | - setViewParam(InitParam.VIDEO_PREVIEW[curPreviewParam][0], InitParam.VIDEO_PREVIEW[curPreviewParam][1], layout_camera_1_over); | 650 | + setViewParam(InitParam.VIDEO_PREVIEW[curPreviewParam][0], InitParam.VIDEO_PREVIEW[curPreviewParam][1], binding.layoutCamera1Over); |
| 769 | - setCameraStatus(img_camera_1_status, InitParam.CAMERA_STATUS_RES[2]); | 651 | + setCameraStatus(binding.imgCamera1Status, InitParam.CAMERA_STATUS_RES[2]); |
| 770 | } | 652 | } |
| 771 | } else {//只有一个摄像头 | 653 | } else {//只有一个摄像头 |
| 772 | - setViewParam(InitParam.VIDEO_ONE_PREVIEW[curPreviewParam][0], InitParam.VIDEO_ONE_PREVIEW[curPreviewParam][1], layout_main_camera); | 654 | + setViewParam(InitParam.VIDEO_ONE_PREVIEW[curPreviewParam][0], InitParam.VIDEO_ONE_PREVIEW[curPreviewParam][1], binding.layoutMainCamera); |
| 773 | - setViewParam(InitParam.VIDEO_ONE_PREVIEW[curPreviewParam][0], InitParam.VIDEO_ONE_PREVIEW[curPreviewParam][1], layout_camera_1_over); | 655 | + setViewParam(InitParam.VIDEO_ONE_PREVIEW[curPreviewParam][0], InitParam.VIDEO_ONE_PREVIEW[curPreviewParam][1], binding.layoutCamera1Over); |
| 774 | - setCameraStatus(img_camera_1_status, InitParam.CAMERA_STATUS_RES[2]); | 656 | + setCameraStatus(binding.imgCamera1Status, InitParam.CAMERA_STATUS_RES[2]); |
| 775 | } | 657 | } |
| 776 | } | 658 | } |
| 777 | 659 | ||
| ... | @@ -786,8 +668,8 @@ public class HomeFragment extends BaseFragment implements | ... | @@ -786,8 +668,8 @@ public class HomeFragment extends BaseFragment implements |
| 786 | } | 668 | } |
| 787 | } | 669 | } |
| 788 | img_photo_shortcut.setVisibility(SpManager.get_snapshot_enabled() ? View.VISIBLE : View.GONE);*/ | 670 | img_photo_shortcut.setVisibility(SpManager.get_snapshot_enabled() ? View.VISIBLE : View.GONE);*/ |
| 789 | - img_record_shortcut.setImageResource(InitParam.CAMERA_KEY_RES[SpManager.get_handle_one_key()]); | 671 | + binding.imgRecordShortcut.setImageResource(InitParam.CAMERA_KEY_RES[SpManager.get_handle_one_key()]); |
| 790 | - img_photo_shortcut.setImageResource(InitParam.CAMERA_KEY_RES[SpManager.get_handle_two_key()]); | 672 | + binding.imgPhotoShortcut.setImageResource(InitParam.CAMERA_KEY_RES[SpManager.get_handle_two_key()]); |
| 791 | 673 | ||
| 792 | } | 674 | } |
| 793 | 675 | ||
| ... | @@ -796,85 +678,100 @@ public class HomeFragment extends BaseFragment implements | ... | @@ -796,85 +678,100 @@ public class HomeFragment extends BaseFragment implements |
| 796 | } | 678 | } |
| 797 | 679 | ||
| 798 | @Override | 680 | @Override |
| 799 | - public void setMainCamChange(int cam) { | 681 | + public void setMainCamChange(final int cam) { |
| 800 | - homeActivity.runOnUiThread( () -> { | 682 | + homeActivity.runOnUiThread(new Runnable() { |
| 801 | - Log.d(TAG,"setMainCamChange : " + cam + " mVideoModule " + mVideoModule); | 683 | + @Override |
| 802 | - mVideoModule.destoryBackMediaRec(); | 684 | + public void run() { |
| 803 | - mVideoModule.closeBackCamera(); | 685 | + Log.d(TAG,"setMainCamChange : " + cam + " mVideoModule " + mVideoModule); |
| 804 | - | 686 | + mVideoModule.destoryBackMediaRec(); |
| 805 | - sleep(1000); | 687 | + mVideoModule.closeBackCamera(); |
| 688 | + | ||
| 689 | + sleep(1000); | ||
| 690 | + | ||
| 691 | + if ( mCameraCheck.getCam_1() != -1 ) { | ||
| 692 | + Logger.d("============mVideoModule==MSG_OPEN_CAM_BACK======" + mVideoModule); | ||
| 693 | + mVideoModule.setBackId(mCameraCheck.getCam_1()); | ||
| 694 | + mVideoModule.startBackPreview(); | ||
| 695 | + } | ||
| 806 | 696 | ||
| 807 | - if ( mCameraCheck.getCam_1() != -1 ) { | 697 | + mHandler.removeMessages(MSG_OPEN_CAM_BACK); |
| 808 | - Logger.d("============mVideoModule==MSG_OPEN_CAM_BACK======" + mVideoModule); | 698 | + mHandler.sendEmptyMessage(MSG_OPEN_CAM_BACK); |
| 809 | - mVideoModule.setBackId(mCameraCheck.getCam_1()); | 699 | + //mHandler.sendEmptyMessageDelayed(MSG_OPEN_CAM_BACK, 2000); |
| 810 | - mVideoModule.startBackPreview(); | ||
| 811 | } | 700 | } |
| 812 | - | 701 | + }); |
| 813 | - mHandler.removeMessages(MSG_OPEN_CAM_BACK); | ||
| 814 | - mHandler.sendEmptyMessage(MSG_OPEN_CAM_BACK); | ||
| 815 | - //mHandler.sendEmptyMessageDelayed(MSG_OPEN_CAM_BACK, 2000); | ||
| 816 | - } ); | ||
| 817 | } | 702 | } |
| 818 | 703 | ||
| 819 | @Override | 704 | @Override |
| 820 | - public void setSecCamChange(int cam) { | 705 | + public void setSecCamChange(final int cam) { |
| 821 | - homeActivity.runOnUiThread( () -> { | 706 | + homeActivity.runOnUiThread(new Runnable() { |
| 822 | - Log.d(TAG,"setSecCamChange : " + cam); | 707 | + @Override |
| 823 | - mVideoModule.destoryFrontMediaRec(); | 708 | + public void run() { |
| 824 | - mVideoModule.closeFrontCamera(); | 709 | + Log.d(TAG,"setSecCamChange : " + cam); |
| 825 | - | 710 | + mVideoModule.destoryFrontMediaRec(); |
| 826 | - sleep(1000); | 711 | + mVideoModule.closeFrontCamera(); |
| 827 | - if ( mCameraCheck.getCam_2() != -1 ) { | 712 | + |
| 828 | - Logger.d("============mVideoModule===MSG_OPEN_CAM_FRONT=====" + mVideoModule); | 713 | + sleep(1000); |
| 829 | - mVideoModule.setFrontId(mCameraCheck.getCam_2()); | 714 | + if ( mCameraCheck.getCam_2() != -1 ) { |
| 830 | - mVideoModule.startFrontPreview(); | 715 | + Logger.d("============mVideoModule===MSG_OPEN_CAM_FRONT=====" + mVideoModule); |
| 716 | + mVideoModule.setFrontId(mCameraCheck.getCam_2()); | ||
| 717 | + mVideoModule.startFrontPreview(); | ||
| 718 | + } | ||
| 719 | + mHandler.removeMessages(MSG_OPEN_CAM_FRONT); | ||
| 720 | + mHandler.sendEmptyMessage(MSG_OPEN_CAM_FRONT); | ||
| 721 | + //mHandler.sendEmptyMessageDelayed(MSG_OPEN_CAM_FRONT, 2000); | ||
| 831 | } | 722 | } |
| 832 | - mHandler.removeMessages(MSG_OPEN_CAM_FRONT); | 723 | + }); |
| 833 | - mHandler.sendEmptyMessage(MSG_OPEN_CAM_FRONT); | ||
| 834 | - //mHandler.sendEmptyMessageDelayed(MSG_OPEN_CAM_FRONT, 2000); | ||
| 835 | - } ); | ||
| 836 | } | 724 | } |
| 837 | 725 | ||
| 838 | @Override | 726 | @Override |
| 839 | - public void setCamInfo(String data_internal_diameter, String data_external_diameter, | 727 | + public void setCamInfo(final String data_internal_diameter, final String data_external_diameter, |
| 840 | String data_number_insertions, String data_usage_time, | 728 | String data_number_insertions, String data_usage_time, |
| 841 | - String data_serial_number, String data_mirror_model) { | 729 | + String data_serial_number, final String data_mirror_model) { |
| 842 | - homeActivity.runOnUiThread( () -> { | 730 | + homeActivity.runOnUiThread(new Runnable() { |
| 843 | - Log.d(TAG,"setCamInfo : "); | 731 | + @Override |
| 844 | - txt_camera_inter.setText(data_internal_diameter); | 732 | + public void run() { |
| 845 | - txt_camera_exter.setText(data_external_diameter); | 733 | + Log.d(TAG,"setCamInfo : "); |
| 846 | - txt_camera_name.setText(data_mirror_model); | 734 | + binding.layoutCameraType.txtCameraInter.setText(data_internal_diameter); |
| 847 | - | 735 | + binding.layoutCameraType.txtCameraExter.setText(data_external_diameter); |
| 848 | - if ( layout_camera2.getVisibility() == View.GONE ) { | 736 | + binding.layoutCameraType.txtCameraName.setText(data_mirror_model); |
| 849 | - //layout_camera_type.setVisibility(View.VISIBLE); | 737 | + |
| 738 | + if ( binding.layoutCamera2.getRootView().getVisibility() == View.GONE ) { | ||
| 739 | + //layout_camera_type.setVisibility(View.VISIBLE); | ||
| 740 | + } | ||
| 850 | } | 741 | } |
| 851 | - } ); | 742 | + }); |
| 852 | } | 743 | } |
| 853 | 744 | ||
| 854 | @Override | 745 | @Override |
| 855 | public void resetCamInfo() { | 746 | public void resetCamInfo() { |
| 856 | - homeActivity.runOnUiThread( () -> { | 747 | + homeActivity.runOnUiThread(new Runnable() { |
| 857 | - Log.d(TAG,"resetCamInfo : "); | 748 | + @Override |
| 858 | - txt_camera_inter.setText(""); | 749 | + public void run() { |
| 859 | - txt_camera_exter.setText(""); | 750 | + Log.d(TAG,"resetCamInfo : "); |
| 860 | - txt_camera_name.setText(""); | 751 | + binding.layoutCameraType.txtCameraInter.setText(""); |
| 861 | - txt_video_total_time.setText("00:00"); | 752 | + binding.layoutCameraType.txtCameraExter.setText(""); |
| 862 | - layout_camera_type.setVisibility(View.GONE); | 753 | + binding.layoutCameraType.txtCameraName.setText(""); |
| 863 | - } ); | 754 | + binding.txtVideoTotalTime.setText("00:00"); |
| 755 | + binding.layoutCameraType.getRoot().setVisibility(View.GONE); | ||
| 756 | + } | ||
| 757 | + }); | ||
| 864 | } | 758 | } |
| 865 | 759 | ||
| 866 | @Override | 760 | @Override |
| 867 | - public void setCamTime(String data_usage_time) { | 761 | + public void setCamTime(final String data_usage_time) { |
| 868 | - homeActivity.runOnUiThread( () -> { | 762 | + homeActivity.runOnUiThread(new Runnable() { |
| 869 | - if ( mCameraCheck.getCam_1() != -1 && mCameraCheck.getCam_2() != -1 ) { | 763 | + @Override |
| 870 | - txt_video_total_time.setVisibility(View.GONE); | 764 | + public void run() { |
| 871 | - } else if ( mCameraCheck.getCam_1() != -1 || mCameraCheck.getCam_2() != -1 ) { | 765 | + if ( mCameraCheck.getCam_1() != -1 && mCameraCheck.getCam_2() != -1 ) { |
| 872 | - txt_video_total_time.setVisibility(View.VISIBLE); | 766 | + binding.txtVideoTotalTime.setVisibility(View.GONE); |
| 873 | - txt_video_total_time.setText(data_usage_time); | 767 | + } else if ( mCameraCheck.getCam_1() != -1 || mCameraCheck.getCam_2() != -1 ) { |
| 874 | - } else { | 768 | + binding.txtVideoTotalTime.setVisibility(View.VISIBLE); |
| 875 | - txt_video_total_time.setVisibility(View.GONE); | 769 | + binding.txtVideoTotalTime.setText(data_usage_time); |
| 770 | + } else { | ||
| 771 | + binding.txtVideoTotalTime.setVisibility(View.GONE); | ||
| 772 | + } | ||
| 876 | } | 773 | } |
| 877 | - } ); | 774 | + }); |
| 878 | } | 775 | } |
| 879 | 776 | ||
| 880 | private boolean shortPress[] = {false, false, false, false, false,}; | 777 | private boolean shortPress[] = {false, false, false, false, false,}; |
| ... | @@ -950,6 +847,11 @@ public class HomeFragment extends BaseFragment implements | ... | @@ -950,6 +847,11 @@ public class HomeFragment extends BaseFragment implements |
| 950 | } | 847 | } |
| 951 | return super.onKeyUp(keyCode, event); | 848 | return super.onKeyUp(keyCode, event); |
| 952 | } | 849 | } |
| 850 | + | ||
| 851 | + @Override | ||
| 852 | + protected FgHomeBinding getViewBinding(LayoutInflater inflater, ViewGroup container) { | ||
| 853 | + return FgHomeBinding.inflate(inflater, container, false); | ||
| 854 | + } | ||
| 953 | /*6946 131_F1 132_F2 | 855 | /*6946 131_F1 132_F2 |
| 954 | 9734 132_F2 133_F3 | 856 | 9734 132_F2 133_F3 |
| 955 | C 135_F5*/ | 857 | C 135_F5*/ |
| ... | @@ -1002,25 +904,25 @@ public class HomeFragment extends BaseFragment implements | ... | @@ -1002,25 +904,25 @@ public class HomeFragment extends BaseFragment implements |
| 1002 | 904 | ||
| 1003 | public void switchCameraView() {//双摄交换 | 905 | public void switchCameraView() {//双摄交换 |
| 1004 | if ( mVideoModule.getMainCameraType() == InitParam.CAM_BACK ) { | 906 | if ( mVideoModule.getMainCameraType() == InitParam.CAM_BACK ) { |
| 1005 | - setConstraintLay(layout_main_camera, oneHor, oneVer, oneSize, oneSize); | 907 | + setConstraintLay(binding.layoutMainCamera, oneHor, oneVer, oneSize, oneSize); |
| 1006 | - setConstraintLay(layout_camera_1_over, oneHor, oneVer, oneSize, oneSize); | 908 | + setConstraintLay(binding.layoutCamera1Over, oneHor, oneVer, oneSize, oneSize); |
| 1007 | - setConstraintLay(layout_camera2, twoHor, twoVer, twoSize, twoSize); | 909 | + setConstraintLay(binding.layoutCamera2, twoHor, twoVer, twoSize, twoSize); |
| 1008 | - setConstraintLay(layout_camera_2_over, twoHor, twoVer, twoSize, twoSize); | 910 | + setConstraintLay(binding.layoutCamera2Over.getRoot(), twoHor, twoVer, twoSize, twoSize); |
| 1009 | } else { | 911 | } else { |
| 1010 | - setConstraintLay(layout_camera2, oneHor, oneVer, oneSize, oneSize); | 912 | + setConstraintLay(binding.layoutCamera2, oneHor, oneVer, oneSize, oneSize); |
| 1011 | - setConstraintLay(layout_camera_2_over, oneHor, oneVer, oneSize, oneSize); | 913 | + setConstraintLay(binding.layoutCamera2Over.getRoot(), oneHor, oneVer, oneSize, oneSize); |
| 1012 | - setConstraintLay(layout_main_camera, twoHor, twoVer, twoSize, twoSize); | 914 | + setConstraintLay(binding.layoutMainCamera, twoHor, twoVer, twoSize, twoSize); |
| 1013 | - setConstraintLay(layout_camera_1_over, twoHor, twoVer, twoSize, twoSize); | 915 | + setConstraintLay(binding.layoutCamera1Over, twoHor, twoVer, twoSize, twoSize); |
| 1014 | } | 916 | } |
| 1015 | } | 917 | } |
| 1016 | 918 | ||
| 1017 | public void resetCameraView() {//双摄交换复原 | 919 | public void resetCameraView() {//双摄交换复原 |
| 1018 | mVideoModule.setMainCameraType(InitParam.CAM_BACK); | 920 | mVideoModule.setMainCameraType(InitParam.CAM_BACK); |
| 1019 | if ( mVideoModule.getMainCameraType() == InitParam.CAM_BACK ) { | 921 | if ( mVideoModule.getMainCameraType() == InitParam.CAM_BACK ) { |
| 1020 | - setConstraintLay(layout_main_camera, oneHor, oneVer, oneSize, oneSize); | 922 | + setConstraintLay(binding.layoutMainCamera, oneHor, oneVer, oneSize, oneSize); |
| 1021 | - setConstraintLay(layout_camera_1_over, oneHor, oneVer, oneSize, oneSize); | 923 | + setConstraintLay(binding.layoutCamera1Over, oneHor, oneVer, oneSize, oneSize); |
| 1022 | - setConstraintLay(layout_camera2, twoHor, twoVer, twoSize, twoSize); | 924 | + setConstraintLay(binding.layoutCamera2, twoHor, twoVer, twoSize, twoSize); |
| 1023 | - setConstraintLay(layout_camera_2_over, twoHor, twoVer, twoSize, twoSize); | 925 | + setConstraintLay(binding.layoutCamera2Over.getRoot(), twoHor, twoVer, twoSize, twoSize); |
| 1024 | } | 926 | } |
| 1025 | } | 927 | } |
| 1026 | 928 | ||
| ... | @@ -1030,47 +932,47 @@ public class HomeFragment extends BaseFragment implements | ... | @@ -1030,47 +932,47 @@ public class HomeFragment extends BaseFragment implements |
| 1030 | mainonlywidth = oneCamSize[sizeId][1]; | 932 | mainonlywidth = oneCamSize[sizeId][1]; |
| 1031 | mainonlyhor = oneCamHor[sizeId]; | 933 | mainonlyhor = oneCamHor[sizeId]; |
| 1032 | 934 | ||
| 1033 | - setConstraintLay(layout_main_camera, mainonlyhor, oneVer, mainonlyheight, mainonlywidth); | 935 | + setConstraintLay(binding.layoutMainCamera, mainonlyhor, oneVer, mainonlyheight, mainonlywidth); |
| 1034 | - setViewLay(layout_camera_1_over, mainonlyhor, oneVer, mainonlyheight, mainonlywidth); | 936 | + setViewLay(binding.layoutCamera1Over, mainonlyhor, oneVer, mainonlyheight, mainonlywidth); |
| 1035 | /*setViewParam(1422, 1048, img_animation_cam1);*/ | 937 | /*setViewParam(1422, 1048, img_animation_cam1);*/ |
| 1036 | - layout_camera2.setVisibility(View.GONE); | 938 | + binding.layoutCamera2.setVisibility(View.GONE); |
| 1037 | Logger.d(" show showOneCam "); | 939 | Logger.d(" show showOneCam "); |
| 1038 | - btn_camera_set.setVisibility(View.VISIBLE); | 940 | + binding.btnCameraSet.setVisibility(View.VISIBLE); |
| 1039 | //layout_camera_type.setVisibility(View.VISIBLE); | 941 | //layout_camera_type.setVisibility(View.VISIBLE); |
| 1040 | 942 | ||
| 1041 | - layout_camera_2_over.setVisibility(View.GONE); | 943 | + binding.layoutCamera2Over.getRoot().setVisibility(View.GONE); |
| 1042 | 944 | ||
| 1043 | - lay_three.setVisibility(View.GONE); | 945 | + binding.layThree.setVisibility(View.GONE); |
| 1044 | ConstraintLayout.LayoutParams mParams = (ConstraintLayout.LayoutParams) | 946 | ConstraintLayout.LayoutParams mParams = (ConstraintLayout.LayoutParams) |
| 1045 | - lay_icon.getLayoutParams(); | 947 | + binding.layIcon.getLayoutParams(); |
| 1046 | mParams.setMargins(1602, 75, 0, 0);//left top right button | 948 | mParams.setMargins(1602, 75, 0, 0);//left top right button |
| 1047 | mParams.width = 283; | 949 | mParams.width = 283; |
| 1048 | - lay_icon.setLayoutParams(mParams); | 950 | + binding.layIcon.setLayoutParams(mParams); |
| 1049 | 951 | ||
| 1050 | //typec 在主摄像头位置 | 952 | //typec 在主摄像头位置 |
| 1051 | - lay_key_2.setVisibility(mCameraCheck.getTypeCPos() == InitParam.CAM_BACK ? View.GONE : View.VISIBLE); | 953 | + binding.layKey2.setVisibility(mCameraCheck.getTypeCPos() == InitParam.CAM_BACK ? View.GONE : View.VISIBLE); |
| 1052 | } | 954 | } |
| 1053 | 955 | ||
| 1054 | public void showAllCam() {//展示双摄像头 | 956 | public void showAllCam() {//展示双摄像头 |
| 1055 | Logger.d(" show showAllCam "); | 957 | Logger.d(" show showAllCam "); |
| 1056 | resetCameraView(); | 958 | resetCameraView(); |
| 1057 | - setConstraintLay(layout_main_camera, oneHor, oneVer, oneSize, oneSize); | 959 | + setConstraintLay(binding.layoutMainCamera, oneHor, oneVer, oneSize, oneSize); |
| 1058 | - setViewLay(layout_camera_1_over, oneHor, oneVer, oneSize, oneSize); | 960 | + setViewLay(binding.layoutCamera1Over, oneHor, oneVer, oneSize, oneSize); |
| 1059 | /*setViewParam(oneSize, oneSize, img_animation_cam1);*/ | 961 | /*setViewParam(oneSize, oneSize, img_animation_cam1);*/ |
| 1060 | - layout_camera2.setVisibility(View.VISIBLE); | 962 | + binding.layoutCamera2.setVisibility(View.VISIBLE); |
| 1061 | - btn_camera_set.setVisibility(View.GONE); | 963 | + binding.btnCameraSet.setVisibility(View.GONE); |
| 1062 | - layout_camera_type.setVisibility(View.GONE); | 964 | + binding.layoutCameraType.getRoot().setVisibility(View.GONE); |
| 1063 | 965 | ||
| 1064 | - layout_camera_2_over.setVisibility(View.VISIBLE); | 966 | + binding.layoutCamera2Over.getRoot().setVisibility(View.VISIBLE); |
| 1065 | 967 | ||
| 1066 | - lay_three.setVisibility(View.VISIBLE); | 968 | + binding.layThree.setVisibility(View.VISIBLE); |
| 1067 | ConstraintLayout.LayoutParams mParams = (ConstraintLayout.LayoutParams) | 969 | ConstraintLayout.LayoutParams mParams = (ConstraintLayout.LayoutParams) |
| 1068 | - lay_icon.getLayoutParams(); | 970 | + binding.layIcon.getLayoutParams(); |
| 1069 | mParams.setMargins(1318, 75, 0, 0);//left top right button | 971 | mParams.setMargins(1318, 75, 0, 0);//left top right button |
| 1070 | mParams.width = 550; | 972 | mParams.width = 550; |
| 1071 | - lay_icon.setLayoutParams(mParams); | 973 | + binding.layIcon.setLayoutParams(mParams); |
| 1072 | 974 | ||
| 1073 | - lay_key_2.setVisibility(View.VISIBLE); | 975 | + binding.layKey2.setVisibility(View.VISIBLE); |
| 1074 | } | 976 | } |
| 1075 | 977 | ||
| 1076 | public void showCam() {//摄像头展示逻辑 | 978 | public void showCam() {//摄像头展示逻辑 |
| ... | @@ -1080,17 +982,22 @@ public class HomeFragment extends BaseFragment implements | ... | @@ -1080,17 +982,22 @@ public class HomeFragment extends BaseFragment implements |
| 1080 | showOneCam(); | 982 | showOneCam(); |
| 1081 | } | 983 | } |
| 1082 | if ( mCameraCheck.getCam_1() == -1 && mCameraCheck.getCam_2() == -1 ) { | 984 | if ( mCameraCheck.getCam_1() == -1 && mCameraCheck.getCam_2() == -1 ) { |
| 1083 | - img_uncon_camera.setVisibility(View.VISIBLE); | 985 | + binding.imgUnconCamera.setVisibility(View.VISIBLE); |
| 1084 | } else { | 986 | } else { |
| 1085 | - img_uncon_camera.setVisibility(View.GONE); | 987 | + binding.imgUnconCamera.setVisibility(View.GONE); |
| 1086 | } | 988 | } |
| 1087 | } | 989 | } |
| 1088 | 990 | ||
| 1089 | - public void setCameraStatus(ImageView view, int res) { | 991 | + public void setCameraStatus(final ImageView view, int res) { |
| 1090 | view.removeCallbacks(null); | 992 | view.removeCallbacks(null); |
| 1091 | view.setImageResource(res); | 993 | view.setImageResource(res); |
| 1092 | view.setVisibility(View.VISIBLE); | 994 | view.setVisibility(View.VISIBLE); |
| 1093 | - view.postDelayed( () -> {view.setVisibility(View.GONE);}, 3000 ); | 995 | + view.postDelayed(new Runnable() { |
| 996 | + @Override | ||
| 997 | + public void run() { | ||
| 998 | + view.setVisibility(View.GONE); | ||
| 999 | + } | ||
| 1000 | + }, 3000 ); | ||
| 1094 | } | 1001 | } |
| 1095 | 1002 | ||
| 1096 | public void setConstraintLay(View view, float hor, float ver, int height, int width) { | 1003 | public void setConstraintLay(View view, float hor, float ver, int height, int width) { |
| ... | @@ -1125,11 +1032,11 @@ public class HomeFragment extends BaseFragment implements | ... | @@ -1125,11 +1032,11 @@ public class HomeFragment extends BaseFragment implements |
| 1125 | if ( ev.getAction() == MotionEvent.ACTION_UP ) { | 1032 | if ( ev.getAction() == MotionEvent.ACTION_UP ) { |
| 1126 | //View v = getActivity().getCurrentFocus(); | 1033 | //View v = getActivity().getCurrentFocus(); |
| 1127 | Logger.d("=======dispatchTouchEvent==1=="); | 1034 | Logger.d("=======dispatchTouchEvent==1=="); |
| 1128 | - if ( isShouldHideView(layout_camera_set, ev) && isShouldHideView(btn_camera_set, ev) | 1035 | + if ( isShouldHideView(binding.layoutCameraSet.getRoot(), ev) && isShouldHideView(binding.btnCameraSet, ev) |
| 1129 | - && layout_camera_set.getVisibility() == View.VISIBLE ) { | 1036 | + && binding.layoutCameraSet.getRoot().getVisibility() == View.VISIBLE ) { |
| 1130 | Logger.d("=======dispatchTouchEv1ent==2=="); | 1037 | Logger.d("=======dispatchTouchEv1ent==2=="); |
| 1131 | - layout_camera_set.setVisibility(View.GONE); | 1038 | + binding.layoutCameraSet.getRoot().setVisibility(View.GONE); |
| 1132 | - btn_camera_set.setSelected(false); | 1039 | + binding.btnCameraSet.setSelected(false); |
| 1133 | } | 1040 | } |
| 1134 | } | 1041 | } |
| 1135 | } | 1042 | } |
| ... | @@ -1153,7 +1060,7 @@ public class HomeFragment extends BaseFragment implements | ... | @@ -1153,7 +1060,7 @@ public class HomeFragment extends BaseFragment implements |
| 1153 | } | 1060 | } |
| 1154 | 1061 | ||
| 1155 | public void setCamRotVisibility() { | 1062 | public void setCamRotVisibility() { |
| 1156 | - txt_camera_ori.setVisibility(SpManager.get_rt_rotation() ? View.VISIBLE : View.GONE); | 1063 | + binding.layoutCameraSet.txtCameraOri.setVisibility(SpManager.get_rt_rotation() ? View.VISIBLE : View.GONE); |
| 1157 | } | 1064 | } |
| 1158 | 1065 | ||
| 1159 | void sendEvent(int event) { | 1066 | void sendEvent(int event) { | ... | ... |
| ... | @@ -7,7 +7,9 @@ import android.text.Editable; | ... | @@ -7,7 +7,9 @@ import android.text.Editable; |
| 7 | import android.text.TextUtils; | 7 | import android.text.TextUtils; |
| 8 | import android.text.TextWatcher; | 8 | import android.text.TextWatcher; |
| 9 | import android.view.Gravity; | 9 | import android.view.Gravity; |
| 10 | +import android.view.LayoutInflater; | ||
| 10 | import android.view.View; | 11 | import android.view.View; |
| 12 | +import android.view.ViewGroup; | ||
| 11 | import android.view.inputmethod.InputMethodManager; | 13 | import android.view.inputmethod.InputMethodManager; |
| 12 | import android.widget.AdapterView; | 14 | import android.widget.AdapterView; |
| 13 | import android.widget.EditText; | 15 | import android.widget.EditText; |
| ... | @@ -25,6 +27,7 @@ import com.sw.laryngoscope.activity.CustomTimer; | ... | @@ -25,6 +27,7 @@ import com.sw.laryngoscope.activity.CustomTimer; |
| 25 | import com.sw.laryngoscope.activity.HomeActivity; | 27 | import com.sw.laryngoscope.activity.HomeActivity; |
| 26 | import com.sw.laryngoscope.adapter.UserLoginItemAdapter; | 28 | import com.sw.laryngoscope.adapter.UserLoginItemAdapter; |
| 27 | import com.sw.laryngoscope.common.InitParam; | 29 | import com.sw.laryngoscope.common.InitParam; |
| 30 | +import com.sw.laryngoscope.databinding.FgLoginBinding; | ||
| 28 | import com.sw.laryngoscope.db.AccountInfoDB; | 31 | import com.sw.laryngoscope.db.AccountInfoDB; |
| 29 | import com.sw.laryngoscope.manager.AccountManager; | 32 | import com.sw.laryngoscope.manager.AccountManager; |
| 30 | import com.sw.laryngoscope.manager.InfoManager; | 33 | import com.sw.laryngoscope.manager.InfoManager; |
| ... | @@ -35,52 +38,11 @@ import com.sw.laryngoscope.utils.Logger; | ... | @@ -35,52 +38,11 @@ import com.sw.laryngoscope.utils.Logger; |
| 35 | import java.util.ArrayList; | 38 | import java.util.ArrayList; |
| 36 | import java.util.List; | 39 | import java.util.List; |
| 37 | 40 | ||
| 38 | -import butterknife.BindView; | 41 | +public class LoginFragment extends BaseFragment<FgLoginBinding> implements CustomTimer.TimerCallBack, |
| 39 | -import butterknife.OnClick; | 42 | + UserLoginItemAdapter.OnClickListener, DelUserPopWindow.delCallback ,View.OnClickListener{ |
| 40 | - | ||
| 41 | -public class LoginFragment extends BaseFragment implements CustomTimer.TimerCallBack, | ||
| 42 | - UserLoginItemAdapter.OnClickListener, DelUserPopWindow.delCallback { | ||
| 43 | 43 | ||
| 44 | private static final String TAG = "LoginFragment"; | 44 | private static final String TAG = "LoginFragment"; |
| 45 | 45 | ||
| 46 | - @BindView(R.id.lay_back) | ||
| 47 | - LinearLayout lay_back; | ||
| 48 | - | ||
| 49 | - @BindView(R.id.txt_add_user) | ||
| 50 | - ImageView txt_add_user; | ||
| 51 | - | ||
| 52 | - @BindView(R.id.layout_user_list) | ||
| 53 | - View layout_user_list; | ||
| 54 | - @BindView(R.id.listView_user) | ||
| 55 | - ListView listView_user; | ||
| 56 | - | ||
| 57 | - | ||
| 58 | - @BindView(R.id.layout_user_new) | ||
| 59 | - View layout_user_new; | ||
| 60 | - @BindView(R.id.ed_add_name) | ||
| 61 | - EditText ed_add_name; | ||
| 62 | - @BindView(R.id.ed_add_psd) | ||
| 63 | - EditText ed_add_psd; | ||
| 64 | - @BindView(R.id.ed_add_repsd) | ||
| 65 | - EditText ed_add_repsd; | ||
| 66 | - | ||
| 67 | - | ||
| 68 | - @BindView(R.id.layout_user_swtich) | ||
| 69 | - View layout_user_swtich; | ||
| 70 | - @BindView(R.id.ed_switch_name) | ||
| 71 | - EditText ed_switch_name; | ||
| 72 | - @BindView(R.id.ed_switch_psd) | ||
| 73 | - EditText ed_switch_psd; | ||
| 74 | - | ||
| 75 | - @BindView(R.id.layout_user_edit) | ||
| 76 | - View layout_user_edit; | ||
| 77 | - @BindView(R.id.ed_name) | ||
| 78 | - EditText ed_name; | ||
| 79 | - @BindView(R.id.ed_psd) | ||
| 80 | - EditText ed_psd; | ||
| 81 | - @BindView(R.id.ed_repsd) | ||
| 82 | - EditText ed_repsd; | ||
| 83 | - | ||
| 84 | private CustomTimer scrollTimer; | 46 | private CustomTimer scrollTimer; |
| 85 | private final String timerTAG_scroll = "scroll"; | 47 | private final String timerTAG_scroll = "scroll"; |
| 86 | 48 | ||
| ... | @@ -109,9 +71,9 @@ public class LoginFragment extends BaseFragment implements CustomTimer.TimerCall | ... | @@ -109,9 +71,9 @@ public class LoginFragment extends BaseFragment implements CustomTimer.TimerCall |
| 109 | super.onResume(); | 71 | super.onResume(); |
| 110 | mDelUserPopWindow = new DelUserPopWindow(homeActivity, getActivity()); | 72 | mDelUserPopWindow = new DelUserPopWindow(homeActivity, getActivity()); |
| 111 | mDelUserPopWindow.setDelCallback(this); | 73 | mDelUserPopWindow.setDelCallback(this); |
| 112 | - ed_repsd.setBackgroundResource(R.drawable.bg_edt_normal); | 74 | + binding.layoutUserEdit.edRepsd.setBackgroundResource(R.drawable.bg_edt_normal); |
| 113 | - ed_repsd.setCompoundDrawables(null, null, null, null); | 75 | + binding.layoutUserEdit.edRepsd.setCompoundDrawables(null, null, null, null); |
| 114 | - ed_repsd.addTextChangedListener(new TextWatcher() { | 76 | + binding.layoutUserEdit.edRepsd.addTextChangedListener(new TextWatcher() { |
| 115 | @Override | 77 | @Override |
| 116 | public void beforeTextChanged(CharSequence s, int start, int count, | 78 | public void beforeTextChanged(CharSequence s, int start, int count, |
| 117 | int after) { | 79 | int after) { |
| ... | @@ -120,17 +82,17 @@ public class LoginFragment extends BaseFragment implements CustomTimer.TimerCall | ... | @@ -120,17 +82,17 @@ public class LoginFragment extends BaseFragment implements CustomTimer.TimerCall |
| 120 | public void onTextChanged(CharSequence s, int start, int before, | 82 | public void onTextChanged(CharSequence s, int start, int before, |
| 121 | int count) { | 83 | int count) { |
| 122 | // TODO Auto-generated method stub | 84 | // TODO Auto-generated method stub |
| 123 | - if ( ed_repsd.getText().length() >= 0 | 85 | + if ( binding.layoutUserEdit.edRepsd.getText().length() >= 0 |
| 124 | - && ed_psd.getText().length() >= 0 | 86 | + && binding.layoutUserEdit.edPsd.getText().length() >= 0 |
| 125 | - && !ed_repsd.getText().toString().equals(ed_psd.getText().toString()) | 87 | + && !binding.layoutUserEdit.edRepsd.getText().toString().equals(binding.layoutUserEdit.edPsd.getText().toString()) |
| 126 | - && ed_repsd.getText().toString().length() == ed_psd.getText().toString().length() ) { | 88 | + && binding.layoutUserEdit.edRepsd.getText().toString().length() == binding.layoutUserEdit.edPsd.getText().toString().length() ) { |
| 127 | - ed_repsd.setBackgroundResource(R.drawable.bg_edt_err); | 89 | + binding.layoutUserEdit.edRepsd.setBackgroundResource(R.drawable.bg_edt_err); |
| 128 | Drawable rightDrawable = getResources().getDrawable(R.mipmap.img_coolicon); | 90 | Drawable rightDrawable = getResources().getDrawable(R.mipmap.img_coolicon); |
| 129 | rightDrawable.setBounds(0, 0, rightDrawable.getMinimumWidth(), rightDrawable.getMinimumHeight()); | 91 | rightDrawable.setBounds(0, 0, rightDrawable.getMinimumWidth(), rightDrawable.getMinimumHeight()); |
| 130 | - ed_repsd.setCompoundDrawables(null, null, rightDrawable, null); | 92 | + binding.layoutUserEdit.edRepsd.setCompoundDrawables(null, null, rightDrawable, null); |
| 131 | } else { | 93 | } else { |
| 132 | - ed_repsd.setBackgroundResource(R.drawable.bg_edt_normal); | 94 | + binding.layoutUserEdit.edRepsd.setBackgroundResource(R.drawable.bg_edt_normal); |
| 133 | - ed_repsd.setCompoundDrawables(null, null, null, null); | 95 | + binding.layoutUserEdit.edRepsd.setCompoundDrawables(null, null, null, null); |
| 134 | } | 96 | } |
| 135 | } | 97 | } |
| 136 | @Override | 98 | @Override |
| ... | @@ -151,8 +113,8 @@ public class LoginFragment extends BaseFragment implements CustomTimer.TimerCall | ... | @@ -151,8 +113,8 @@ public class LoginFragment extends BaseFragment implements CustomTimer.TimerCall |
| 151 | } | 113 | } |
| 152 | 114 | ||
| 153 | @Override | 115 | @Override |
| 154 | - protected int rootLayout() { | 116 | + protected FgLoginBinding getViewBinding(LayoutInflater inflater, ViewGroup container) { |
| 155 | - return R.layout.fg_login; | 117 | + return FgLoginBinding.inflate(inflater,container,false); |
| 156 | } | 118 | } |
| 157 | 119 | ||
| 158 | @Override | 120 | @Override |
| ... | @@ -160,7 +122,7 @@ public class LoginFragment extends BaseFragment implements CustomTimer.TimerCall | ... | @@ -160,7 +122,7 @@ public class LoginFragment extends BaseFragment implements CustomTimer.TimerCall |
| 160 | mAccountManager = AccountManager.getInstance(); | 122 | mAccountManager = AccountManager.getInstance(); |
| 161 | 123 | ||
| 162 | accountInfolist = mAccountManager.findAll(); | 124 | accountInfolist = mAccountManager.findAll(); |
| 163 | - layout_user_list.setVisibility(View.VISIBLE); | 125 | + binding.layoutUserList.getRoot().setVisibility(View.VISIBLE); |
| 164 | 126 | ||
| 165 | accountInfoShowList = new ArrayList<>(); | 127 | accountInfoShowList = new ArrayList<>(); |
| 166 | for ( int i = 0; i < accountInfolist.size(); i++ ) { | 128 | for ( int i = 0; i < accountInfolist.size(); i++ ) { |
| ... | @@ -179,9 +141,9 @@ public class LoginFragment extends BaseFragment implements CustomTimer.TimerCall | ... | @@ -179,9 +141,9 @@ public class LoginFragment extends BaseFragment implements CustomTimer.TimerCall |
| 179 | + " position " + accountInfoShowList.size()); | 141 | + " position " + accountInfoShowList.size()); |
| 180 | mUserLoginItemAdapter = new UserLoginItemAdapter(getContext(), accountInfoShowList); | 142 | mUserLoginItemAdapter = new UserLoginItemAdapter(getContext(), accountInfoShowList); |
| 181 | //mUserLoginItemAdapter.setUpdateListener(this); | 143 | //mUserLoginItemAdapter.setUpdateListener(this); |
| 182 | - listView_user.setAdapter(mUserLoginItemAdapter); | 144 | + binding.layoutUserList.listViewUser.setAdapter(mUserLoginItemAdapter); |
| 183 | 145 | ||
| 184 | - listView_user.setOnItemClickListener(new AdapterView.OnItemClickListener() { | 146 | + binding.layoutUserList.listViewUser.setOnItemClickListener(new AdapterView.OnItemClickListener() { |
| 185 | public void onItemClick (AdapterView<?> parent, View view, int position, long id ) { | 147 | public void onItemClick (AdapterView<?> parent, View view, int position, long id ) { |
| 186 | for ( int i = 0; i < accountInfoShowList.size(); i++ ) { | 148 | for ( int i = 0; i < accountInfoShowList.size(); i++ ) { |
| 187 | AccountInfoDB bean = accountInfoShowList.get(i); | 149 | AccountInfoDB bean = accountInfoShowList.get(i); |
| ... | @@ -198,19 +160,22 @@ public class LoginFragment extends BaseFragment implements CustomTimer.TimerCall | ... | @@ -198,19 +160,22 @@ public class LoginFragment extends BaseFragment implements CustomTimer.TimerCall |
| 198 | 160 | ||
| 199 | @Override | 161 | @Override |
| 200 | protected void setListener() { | 162 | protected void setListener() { |
| 201 | - lay_back.setOnClickListener(this); | 163 | + |
| 164 | + binding.layBack.setOnClickListener(this); | ||
| 165 | + binding.txtAddUser.setOnClickListener(this); | ||
| 166 | + binding.layoutUserNew.imgAddUser.setOnClickListener(this); | ||
| 167 | + binding.layoutUserList.imgEdit.setOnClickListener(this); | ||
| 168 | + binding.layoutUserEdit.imgEditUser.setOnClickListener(this); | ||
| 169 | + binding.layoutUserList.imgUserSwitch1.setOnClickListener(this); | ||
| 170 | + binding.layoutUserSwtich.imgSwitchUser.setOnClickListener(this); | ||
| 171 | + binding.layoutUserList.imgUserDel.setOnClickListener(this); | ||
| 202 | } | 172 | } |
| 203 | 173 | ||
| 204 | @Override | 174 | @Override |
| 205 | - @OnClick({ R.id.lay_back, | ||
| 206 | - R.id.txt_add_user, R.id.img_add_user, | ||
| 207 | - R.id.img_edit, R.id.img_edit_user, | ||
| 208 | - R.id.img_user_switch1, R.id.img_switch_user, | ||
| 209 | - R.id.img_user_del, }) | ||
| 210 | public void onClick(View v) { | 175 | public void onClick(View v) { |
| 211 | switch (v.getId()) { | 176 | switch (v.getId()) { |
| 212 | case R.id.lay_back: | 177 | case R.id.lay_back: |
| 213 | - if ( layout_user_list.getVisibility() == View.GONE ) { | 178 | + if ( binding.layoutUserList.getRoot().getVisibility() == View.GONE ) { |
| 214 | refreshList(); | 179 | refreshList(); |
| 215 | initWin(); | 180 | initWin(); |
| 216 | hideIm(); | 181 | hideIm(); |
| ... | @@ -219,13 +184,13 @@ public class LoginFragment extends BaseFragment implements CustomTimer.TimerCall | ... | @@ -219,13 +184,13 @@ public class LoginFragment extends BaseFragment implements CustomTimer.TimerCall |
| 219 | } | 184 | } |
| 220 | break; | 185 | break; |
| 221 | case R.id.txt_add_user: | 186 | case R.id.txt_add_user: |
| 222 | - if ( layout_user_edit.getVisibility() == View.VISIBLE ) { | 187 | + if ( binding.layoutUserEdit.getRoot().getVisibility() == View.VISIBLE ) { |
| 223 | break; | 188 | break; |
| 224 | } | 189 | } |
| 225 | - if ( layout_user_new.getVisibility() == View.VISIBLE ) { | 190 | + if ( binding.layoutUserNew.getRoot().getVisibility() == View.VISIBLE ) { |
| 226 | break; | 191 | break; |
| 227 | } | 192 | } |
| 228 | - if ( layout_user_swtich.getVisibility() == View.VISIBLE ) { | 193 | + if ( binding.layoutUserList.getRoot().getVisibility() == View.VISIBLE ) { |
| 229 | break; | 194 | break; |
| 230 | } | 195 | } |
| 231 | if ( curLoginAcc == null || (curLoginAcc != null | 196 | if ( curLoginAcc == null || (curLoginAcc != null |
| ... | @@ -233,38 +198,38 @@ public class LoginFragment extends BaseFragment implements CustomTimer.TimerCall | ... | @@ -233,38 +198,38 @@ public class LoginFragment extends BaseFragment implements CustomTimer.TimerCall |
| 233 | //Toast.makeText(context, getString(R.string.string_no_admin), Toast.LENGTH_LONG).show(); | 198 | //Toast.makeText(context, getString(R.string.string_no_admin), Toast.LENGTH_LONG).show(); |
| 234 | break; | 199 | break; |
| 235 | } | 200 | } |
| 236 | - layout_user_list.setVisibility(View.GONE); | 201 | + binding.layoutUserList.getRoot().setVisibility(View.GONE); |
| 237 | - layout_user_new.setVisibility(View.VISIBLE); | 202 | + binding.layoutUserNew.getRoot().setVisibility(View.VISIBLE); |
| 238 | - ed_add_name.setText(""); | 203 | + binding.layoutUserNew.edAddName.setText(""); |
| 239 | - ed_add_psd.setText(""); | 204 | + binding.layoutUserNew.edAddPsd.setText(""); |
| 240 | - ed_add_repsd.setText(""); | 205 | + binding.layoutUserNew.edAddRepsd.setText(""); |
| 241 | break; | 206 | break; |
| 242 | case R.id.img_add_user: | 207 | case R.id.img_add_user: |
| 243 | - if ( TextUtils.isEmpty(ed_add_name.getText().toString()) | 208 | + if ( TextUtils.isEmpty(binding.layoutUserNew.edAddName.getText().toString()) |
| 244 | - || TextUtils.isEmpty(ed_add_psd.getText().toString()) | 209 | + || TextUtils.isEmpty(binding.layoutUserNew.edAddPsd.getText().toString()) |
| 245 | - || TextUtils.isEmpty(ed_add_repsd.getText().toString()) ) { | 210 | + || TextUtils.isEmpty(binding.layoutUserNew.edAddRepsd.getText().toString()) ) { |
| 246 | Toast.makeText(context, getString(R.string.string_account_non), Toast.LENGTH_SHORT).show(); | 211 | Toast.makeText(context, getString(R.string.string_account_non), Toast.LENGTH_SHORT).show(); |
| 247 | break; | 212 | break; |
| 248 | } | 213 | } |
| 249 | - if ( !ed_add_psd.getText().toString().equals(ed_add_repsd.getText().toString()) ) { | 214 | + if ( !binding.layoutUserNew.edAddPsd.getText().toString().equals(binding.layoutUserNew.edAddRepsd.getText().toString()) ) { |
| 250 | Toast.makeText(context, getString(R.string.string_psd_inconformity), Toast.LENGTH_SHORT).show(); | 215 | Toast.makeText(context, getString(R.string.string_psd_inconformity), Toast.LENGTH_SHORT).show(); |
| 251 | break; | 216 | break; |
| 252 | } | 217 | } |
| 253 | - if (ed_add_psd.getText().length() < 8) { | 218 | + if (binding.layoutUserNew.edAddPsd.getText().length() < 8) { |
| 254 | MyApplication.showToastShort(getString(R.string.string_password_length)); | 219 | MyApplication.showToastShort(getString(R.string.string_password_length)); |
| 255 | break; | 220 | break; |
| 256 | } | 221 | } |
| 257 | - if ( mAccountManager.findUserData(ed_add_name.getText().toString()) != null ) { | 222 | + if ( mAccountManager.findUserData(binding.layoutUserNew.edAddName.getText().toString()) != null ) { |
| 258 | Toast.makeText(context, getString(R.string.string_name_repeat), Toast.LENGTH_SHORT).show(); | 223 | Toast.makeText(context, getString(R.string.string_name_repeat), Toast.LENGTH_SHORT).show(); |
| 259 | break; | 224 | break; |
| 260 | } | 225 | } |
| 261 | 226 | ||
| 262 | - AccountInfoDB tmp = new AccountInfoDB(ed_add_name.getText().toString(), | 227 | + AccountInfoDB tmp = new AccountInfoDB(binding.layoutUserNew.edAddName.getText().toString(), |
| 263 | - ed_add_psd.getText().toString(), InitParam.USER_TYPE_USER); | 228 | + binding.layoutUserNew.edAddPsd.getText().toString(), InitParam.USER_TYPE_USER); |
| 264 | Logger.d(TAG, "========tmpAddInfoDB=31============"); | 229 | Logger.d(TAG, "========tmpAddInfoDB=31============"); |
| 265 | tmp.saveOrUpdate("id = ?", tmp.getId() + ""); | 230 | tmp.saveOrUpdate("id = ?", tmp.getId() + ""); |
| 266 | MyApplication.showToastShort(getString(R.string.string_save_success)); | 231 | MyApplication.showToastShort(getString(R.string.string_save_success)); |
| 267 | - lay_back.performClick(); | 232 | + binding.layBack.performClick(); |
| 268 | break; | 233 | break; |
| 269 | case R.id.img_edit: | 234 | case R.id.img_edit: |
| 270 | if ( curLoginAcc != null | 235 | if ( curLoginAcc != null |
| ... | @@ -281,36 +246,36 @@ public class LoginFragment extends BaseFragment implements CustomTimer.TimerCall | ... | @@ -281,36 +246,36 @@ public class LoginFragment extends BaseFragment implements CustomTimer.TimerCall |
| 281 | break; | 246 | break; |
| 282 | } | 247 | } |
| 283 | } | 248 | } |
| 284 | - ed_repsd.setBackgroundResource(R.drawable.bg_edt_normal); | 249 | + binding.layoutUserEdit.edRepsd.setBackgroundResource(R.drawable.bg_edt_normal); |
| 285 | - ed_repsd.setCompoundDrawables(null, null, null, null); | 250 | + binding.layoutUserEdit.edRepsd.setCompoundDrawables(null, null, null, null); |
| 286 | - layout_user_list.setVisibility(View.GONE); | 251 | + binding.layoutUserList.getRoot().setVisibility(View.GONE); |
| 287 | - layout_user_edit.setVisibility(View.VISIBLE); | 252 | + binding.layoutUserEdit.getRoot().setVisibility(View.VISIBLE); |
| 288 | - ed_name.setText(""); | 253 | + binding.layoutUserEdit.edName.setText(""); |
| 289 | - ed_psd.setText(""); | 254 | + binding.layoutUserEdit.edPsd.setText(""); |
| 290 | - ed_repsd.setText(""); | 255 | + binding.layoutUserEdit.edRepsd.setText(""); |
| 291 | break; | 256 | break; |
| 292 | case R.id.img_edit_user: | 257 | case R.id.img_edit_user: |
| 293 | - if ( TextUtils.isEmpty(ed_name.getText().toString()) | 258 | + if ( TextUtils.isEmpty(binding.layoutUserEdit.edName.getText().toString()) |
| 294 | - || TextUtils.isEmpty(ed_psd.getText().toString()) | 259 | + || TextUtils.isEmpty(binding.layoutUserEdit.edPsd.getText().toString()) |
| 295 | - || TextUtils.isEmpty(ed_repsd.getText().toString()) ) { | 260 | + || TextUtils.isEmpty(binding.layoutUserEdit.edRepsd.getText().toString()) ) { |
| 296 | Toast.makeText(context, getString(R.string.string_account_non), Toast.LENGTH_SHORT).show(); | 261 | Toast.makeText(context, getString(R.string.string_account_non), Toast.LENGTH_SHORT).show(); |
| 297 | break; | 262 | break; |
| 298 | } | 263 | } |
| 299 | - if ( !ed_psd.getText().toString().equals(ed_repsd.getText().toString()) ) { | 264 | + if ( !binding.layoutUserEdit.edPsd.getText().toString().equals(binding.layoutUserEdit.edRepsd.getText().toString()) ) { |
| 300 | Toast.makeText(context, getString(R.string.string_psd_inconformity), Toast.LENGTH_SHORT).show(); | 265 | Toast.makeText(context, getString(R.string.string_psd_inconformity), Toast.LENGTH_SHORT).show(); |
| 301 | break; | 266 | break; |
| 302 | } | 267 | } |
| 303 | - if (ed_psd.getText().length() < 8) { | 268 | + if (binding.layoutUserEdit.edPsd.getText().length() < 8) { |
| 304 | MyApplication.showToastShort(getString(R.string.string_password_length)); | 269 | MyApplication.showToastShort(getString(R.string.string_password_length)); |
| 305 | break; | 270 | break; |
| 306 | } | 271 | } |
| 307 | - if ( mAccountManager.findUserData(ed_name.getText().toString()) != null ) { | 272 | + if ( mAccountManager.findUserData(binding.layoutUserEdit.edName.getText().toString()) != null ) { |
| 308 | Toast.makeText(context, getString(R.string.string_name_repeat), Toast.LENGTH_SHORT).show(); | 273 | Toast.makeText(context, getString(R.string.string_name_repeat), Toast.LENGTH_SHORT).show(); |
| 309 | break; | 274 | break; |
| 310 | } | 275 | } |
| 311 | 276 | ||
| 312 | - AccountInfoDB tmp1 = new AccountInfoDB(curSelAcc.getId(), ed_name.getText().toString(), | 277 | + AccountInfoDB tmp1 = new AccountInfoDB(curSelAcc.getId(), binding.layoutUserEdit.edName.getText().toString(), |
| 313 | - ed_psd.getText().toString(), | 278 | + binding.layoutUserEdit.edPsd.getText().toString(), |
| 314 | curSelAcc.getUserType(), curSelAcc.getIsSelect(), curSelAcc.isLogin()); | 279 | curSelAcc.getUserType(), curSelAcc.getIsSelect(), curSelAcc.isLogin()); |
| 315 | Logger.d(TAG, "========tmpAddInfoDB=32============" + curSelAcc.isLogin() | 280 | Logger.d(TAG, "========tmpAddInfoDB=32============" + curSelAcc.isLogin() |
| 316 | + " getIsSelect " + curSelAcc.getIsSelect()); | 281 | + " getIsSelect " + curSelAcc.getIsSelect()); |
| ... | @@ -321,8 +286,8 @@ public class LoginFragment extends BaseFragment implements CustomTimer.TimerCall | ... | @@ -321,8 +286,8 @@ public class LoginFragment extends BaseFragment implements CustomTimer.TimerCall |
| 321 | 286 | ||
| 322 | refreshList(); | 287 | refreshList(); |
| 323 | 288 | ||
| 324 | - layout_user_list.setVisibility(View.VISIBLE); | 289 | + binding.layoutUserList.getRoot().setVisibility(View.VISIBLE); |
| 325 | - layout_user_edit.setVisibility(View.GONE); | 290 | + binding.layoutUserEdit.getRoot().setVisibility(View.GONE); |
| 326 | hideIm(); | 291 | hideIm(); |
| 327 | break; | 292 | break; |
| 328 | case R.id.img_user_switch1: | 293 | case R.id.img_user_switch1: |
| ... | @@ -334,27 +299,27 @@ public class LoginFragment extends BaseFragment implements CustomTimer.TimerCall | ... | @@ -334,27 +299,27 @@ public class LoginFragment extends BaseFragment implements CustomTimer.TimerCall |
| 334 | MyApplication.showToastShort(getString(R.string.string_relogin)); | 299 | MyApplication.showToastShort(getString(R.string.string_relogin)); |
| 335 | break; | 300 | break; |
| 336 | } | 301 | } |
| 337 | - layout_user_list.setVisibility(View.GONE); | 302 | + binding.layoutUserList.getRoot().setVisibility(View.GONE); |
| 338 | - layout_user_swtich.setVisibility(View.VISIBLE); | 303 | + binding.layoutUserList.getRoot().setVisibility(View.VISIBLE); |
| 339 | - ed_switch_name.setText(curSelAcc.getName()); | 304 | + binding.layoutUserSwtich.edSwitchName.setText(curSelAcc.getName()); |
| 340 | - ed_switch_name.setEnabled(false); | 305 | + binding.layoutUserSwtich.edSwitchName.setEnabled(false); |
| 341 | - ed_switch_psd.setText(""); | 306 | + binding.layoutUserSwtich.edSwitchPsd.setText(""); |
| 342 | break; | 307 | break; |
| 343 | case R.id.img_switch_user: | 308 | case R.id.img_switch_user: |
| 344 | - if ( TextUtils.isEmpty(ed_switch_name.getText().toString()) | 309 | + if ( TextUtils.isEmpty(binding.layoutUserSwtich.edSwitchName.getText().toString()) |
| 345 | - || TextUtils.isEmpty(ed_switch_psd.getText().toString()) ) { | 310 | + || TextUtils.isEmpty(binding.layoutUserSwtich.edSwitchPsd.getText().toString()) ) { |
| 346 | Toast.makeText(context, getString(R.string.string_account_non), Toast.LENGTH_SHORT).show(); | 311 | Toast.makeText(context, getString(R.string.string_account_non), Toast.LENGTH_SHORT).show(); |
| 347 | break; | 312 | break; |
| 348 | } | 313 | } |
| 349 | - if (ed_switch_psd.getText().length() < 8) { | 314 | + if (binding.layoutUserSwtich.edSwitchPsd.getText().length() < 8) { |
| 350 | MyApplication.showToastShort(getString(R.string.string_password_length)); | 315 | MyApplication.showToastShort(getString(R.string.string_password_length)); |
| 351 | break; | 316 | break; |
| 352 | } | 317 | } |
| 353 | - if ( mAccountManager.findUserData(ed_switch_name.getText().toString()) == null ) { | 318 | + if ( mAccountManager.findUserData(binding.layoutUserSwtich.edSwitchName.getText().toString()) == null ) { |
| 354 | Toast.makeText(context, getString(R.string.string_user_bo_exist), Toast.LENGTH_SHORT).show(); | 319 | Toast.makeText(context, getString(R.string.string_user_bo_exist), Toast.LENGTH_SHORT).show(); |
| 355 | break; | 320 | break; |
| 356 | } | 321 | } |
| 357 | - if ( checkDuplicate(ed_switch_name.getText().toString(), ed_switch_psd.getText().toString())) { | 322 | + if ( checkDuplicate(binding.layoutUserSwtich.edSwitchName.getText().toString(), binding.layoutUserSwtich.edSwitchPsd.getText().toString())) { |
| 358 | AccountManager.getInstance().clearAllLogin(); | 323 | AccountManager.getInstance().clearAllLogin(); |
| 359 | AccountManager.getInstance().clearAllSel(); | 324 | AccountManager.getInstance().clearAllSel(); |
| 360 | curSelAcc.setLogin(true); | 325 | curSelAcc.setLogin(true); |
| ... | @@ -364,7 +329,7 @@ public class LoginFragment extends BaseFragment implements CustomTimer.TimerCall | ... | @@ -364,7 +329,7 @@ public class LoginFragment extends BaseFragment implements CustomTimer.TimerCall |
| 364 | MyApplication.showToastShort(getString(R.string.string_login_success)); | 329 | MyApplication.showToastShort(getString(R.string.string_login_success)); |
| 365 | homeActivity.setUseName(); | 330 | homeActivity.setUseName(); |
| 366 | homeActivity.showSettingIcon(); | 331 | homeActivity.showSettingIcon(); |
| 367 | - lay_back.performClick(); | 332 | + binding.layBack.performClick(); |
| 368 | } else { | 333 | } else { |
| 369 | Toast.makeText(context, getString(R.string.string_psd_error), Toast.LENGTH_SHORT).show(); | 334 | Toast.makeText(context, getString(R.string.string_psd_error), Toast.LENGTH_SHORT).show(); |
| 370 | } | 335 | } |
| ... | @@ -374,7 +339,7 @@ public class LoginFragment extends BaseFragment implements CustomTimer.TimerCall | ... | @@ -374,7 +339,7 @@ public class LoginFragment extends BaseFragment implements CustomTimer.TimerCall |
| 374 | && curSelAcc.getUserType() != InitParam.USER_TYPE_ADMIN | 339 | && curSelAcc.getUserType() != InitParam.USER_TYPE_ADMIN |
| 375 | && curLoginAcc.getUserType() == InitParam.USER_TYPE_ADMIN ) { | 340 | && curLoginAcc.getUserType() == InitParam.USER_TYPE_ADMIN ) { |
| 376 | mDelUserPopWindow.setTitle(curSelAcc.getName()); | 341 | mDelUserPopWindow.setTitle(curSelAcc.getName()); |
| 377 | - mDelUserPopWindow.showAtLocation(rootView, Gravity.CENTER, 0, 0); | 342 | + mDelUserPopWindow.showAtLocation(getRootView(), Gravity.CENTER, 0, 0); |
| 378 | } else { | 343 | } else { |
| 379 | MyApplication.showToastLong1(getActivity().getString(R.string.string_login_or_no_user)); | 344 | MyApplication.showToastLong1(getActivity().getString(R.string.string_login_or_no_user)); |
| 380 | } | 345 | } |
| ... | @@ -416,10 +381,10 @@ public class LoginFragment extends BaseFragment implements CustomTimer.TimerCall | ... | @@ -416,10 +381,10 @@ public class LoginFragment extends BaseFragment implements CustomTimer.TimerCall |
| 416 | } | 381 | } |
| 417 | 382 | ||
| 418 | void initWin() { | 383 | void initWin() { |
| 419 | - layout_user_list.setVisibility(View.VISIBLE); | 384 | + binding.layoutUserList.getRoot().setVisibility(View.VISIBLE); |
| 420 | - layout_user_new.setVisibility(View.GONE); | 385 | + binding.layoutUserNew.getRoot().setVisibility(View.GONE); |
| 421 | - layout_user_edit.setVisibility(View.GONE); | 386 | + binding.layoutUserEdit.getRoot().setVisibility(View.GONE); |
| 422 | - layout_user_swtich.setVisibility(View.GONE); | 387 | + binding.layoutUserList.getRoot().setVisibility(View.GONE); |
| 423 | } | 388 | } |
| 424 | 389 | ||
| 425 | private void hideInput(View view) { | 390 | private void hideInput(View view) { | ... | ... |
| ... | @@ -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 | ... | ... |
| ... | @@ -10,6 +10,7 @@ import android.util.Log; | ... | @@ -10,6 +10,7 @@ import android.util.Log; |
| 10 | import android.view.Gravity; | 10 | import android.view.Gravity; |
| 11 | import android.view.LayoutInflater; | 11 | import android.view.LayoutInflater; |
| 12 | import android.view.View; | 12 | import android.view.View; |
| 13 | +import android.view.ViewGroup; | ||
| 13 | import android.view.WindowManager; | 14 | import android.view.WindowManager; |
| 14 | import android.view.inputmethod.InputMethodManager; | 15 | import android.view.inputmethod.InputMethodManager; |
| 15 | import android.widget.CheckBox; | 16 | import android.widget.CheckBox; |
| ... | @@ -32,6 +33,7 @@ import com.sw.laryngoscope.activity.HomeActivity; | ... | @@ -32,6 +33,7 @@ import com.sw.laryngoscope.activity.HomeActivity; |
| 32 | import com.sw.laryngoscope.adapter.DetailGdItemAdapter; | 33 | import com.sw.laryngoscope.adapter.DetailGdItemAdapter; |
| 33 | import com.sw.laryngoscope.adapter.SpaceItemDecoration; | 34 | import com.sw.laryngoscope.adapter.SpaceItemDecoration; |
| 34 | import com.sw.laryngoscope.common.InitParam; | 35 | import com.sw.laryngoscope.common.InitParam; |
| 36 | +import com.sw.laryngoscope.databinding.FgArchiveDetailBinding; | ||
| 35 | import com.sw.laryngoscope.db.AccountInfoDB; | 37 | import com.sw.laryngoscope.db.AccountInfoDB; |
| 36 | import com.sw.laryngoscope.db.RecordInfoDB; | 38 | import com.sw.laryngoscope.db.RecordInfoDB; |
| 37 | import com.sw.laryngoscope.dicom.Dcm2cheStoreSCU; | 39 | import com.sw.laryngoscope.dicom.Dcm2cheStoreSCU; |
| ... | @@ -55,64 +57,14 @@ import java.util.ArrayList; | ... | @@ -55,64 +57,14 @@ import java.util.ArrayList; |
| 55 | import java.util.Iterator; | 57 | import java.util.Iterator; |
| 56 | import java.util.List; | 58 | import java.util.List; |
| 57 | 59 | ||
| 58 | -import butterknife.BindView; | ||
| 59 | -import butterknife.OnClick; | ||
| 60 | 60 | ||
| 61 | -public class ArcDetailFragment extends BaseFragment implements CustomTimer.TimerCallBack, DetailGdItemAdapter.OnClickLitener, | 61 | +public class ArcDetailFragment extends BaseFragment<FgArchiveDetailBinding> implements CustomTimer.TimerCallBack, DetailGdItemAdapter.OnClickLitener, |
| 62 | RadioGroup.OnCheckedChangeListener, StorageStateManager.MountCallBack, | 62 | RadioGroup.OnCheckedChangeListener, StorageStateManager.MountCallBack, |
| 63 | - DetailCopyInfoPopWindow.copyCallback, SlidingCheckLayout.OnSlidingPositionListener { | 63 | + DetailCopyInfoPopWindow.copyCallback, SlidingCheckLayout.OnSlidingPositionListener, View.OnClickListener { |
| 64 | 64 | ||
| 65 | private static final String TAG = "ArcDetailFragment"; | 65 | private static final String TAG = "ArcDetailFragment"; |
| 66 | private Context context; | 66 | private Context context; |
| 67 | 67 | ||
| 68 | - @BindView(R.id.lay_back) | ||
| 69 | - LinearLayout lay_back; | ||
| 70 | - @BindView(R.id.txt_all_sel) | ||
| 71 | - CheckBox txt_all_sel; | ||
| 72 | - @BindView(R.id.lay_sliding) | ||
| 73 | - SlidingCheckLayout lay_sliding; | ||
| 74 | - @BindView(R.id.gd_detail) | ||
| 75 | - RecyclerView gd_detail; | ||
| 76 | - | ||
| 77 | - @BindView(R.id.img_exp) | ||
| 78 | - ImageView img_exp; | ||
| 79 | - @BindView(R.id.img_del) | ||
| 80 | - ImageView img_del; | ||
| 81 | - | ||
| 82 | - @BindView(R.id.fg_archive_info) | ||
| 83 | - View fg_archive_info; | ||
| 84 | - | ||
| 85 | - @BindView(R.id.rl_sel_num) | ||
| 86 | - RelativeLayout rl_sel_num; | ||
| 87 | - @BindView(R.id.txt_report_num) | ||
| 88 | - TextView txt_report_num; | ||
| 89 | - @BindView(R.id.txt_report_num_value) | ||
| 90 | - TextView txt_report_num_value; | ||
| 91 | - @BindView(R.id.txt_image_num) | ||
| 92 | - TextView txt_image_num; | ||
| 93 | - @BindView(R.id.txt_image_num_value) | ||
| 94 | - TextView txt_image_num_value; | ||
| 95 | - @BindView(R.id.txt_video_num) | ||
| 96 | - TextView txt_video_num; | ||
| 97 | - @BindView(R.id.txt_video_num_value) | ||
| 98 | - TextView txt_video_num_value; | ||
| 99 | - | ||
| 100 | - @BindView(R.id.i_view_1) | ||
| 101 | - TextView i_view_1; | ||
| 102 | - @BindView(R.id.layout_file_info) | ||
| 103 | - RelativeLayout layout_file_info; | ||
| 104 | - @BindView(R.id.txt_date_value) | ||
| 105 | - TextView txt_date_value; | ||
| 106 | - @BindView(R.id.txt_time_value) | ||
| 107 | - TextView txt_time_value; | ||
| 108 | - @BindView(R.id.txt_file_size) | ||
| 109 | - TextView txt_file_size; | ||
| 110 | - | ||
| 111 | - @BindView(R.id.txt_make_report) | ||
| 112 | - TextView txt_make_report; | ||
| 113 | - @BindView(R.id.txt_make_video) | ||
| 114 | - TextView txt_make_video; | ||
| 115 | - | ||
| 116 | private CustomTimer scrollTimer; | 68 | private CustomTimer scrollTimer; |
| 117 | private final String timerTAG_scroll = "scroll"; | 69 | private final String timerTAG_scroll = "scroll"; |
| 118 | 70 | ||
| ... | @@ -145,26 +97,26 @@ public class ArcDetailFragment extends BaseFragment implements CustomTimer.Timer | ... | @@ -145,26 +97,26 @@ public class ArcDetailFragment extends BaseFragment implements CustomTimer.Timer |
| 145 | 97 | ||
| 146 | void isShowReport() { | 98 | void isShowReport() { |
| 147 | if ( mFileListMg.detailList.size() > 0 && mFileListMg.detailList.get(0).isReport() ) { | 99 | if ( mFileListMg.detailList.size() > 0 && mFileListMg.detailList.get(0).isReport() ) { |
| 148 | - txt_make_report.setVisibility(View.GONE); | 100 | + binding.fgArchiveInfo.txtMakeReport.setVisibility(View.GONE); |
| 149 | - txt_make_video.setVisibility(View.GONE); | 101 | + binding.fgArchiveInfo.txtMakeVideo.setVisibility(View.GONE); |
| 150 | } else { | 102 | } else { |
| 151 | - txt_make_report.setVisibility(View.VISIBLE); | 103 | + binding.fgArchiveInfo.txtMakeReport.setVisibility(View.VISIBLE); |
| 152 | - txt_make_video.setVisibility(View.VISIBLE); | 104 | + binding.fgArchiveInfo.txtMakeVideo.setVisibility(View.VISIBLE); |
| 153 | } | 105 | } |
| 154 | if ( mFileListMg.detailList.size() > 0 && mFileListMg.detailList.get(0).isReport() ) { | 106 | if ( mFileListMg.detailList.size() > 0 && mFileListMg.detailList.get(0).isReport() ) { |
| 155 | - txt_report_num.setVisibility(View.VISIBLE); | 107 | + binding.txtReportNum.setVisibility(View.VISIBLE); |
| 156 | - txt_report_num_value.setVisibility(View.VISIBLE); | 108 | + binding.txtReportNumValue.setVisibility(View.VISIBLE); |
| 157 | - txt_image_num.setVisibility(View.GONE); | 109 | + binding.txtImageNum.setVisibility(View.GONE); |
| 158 | - txt_image_num_value.setVisibility(View.GONE); | 110 | + binding.txtImageNumValue.setVisibility(View.GONE); |
| 159 | - txt_video_num.setVisibility(View.GONE); | 111 | + binding.txtVideoNum.setVisibility(View.GONE); |
| 160 | - txt_video_num_value.setVisibility(View.GONE); | 112 | + binding.txtVideoNumValue.setVisibility(View.GONE); |
| 161 | } else { | 113 | } else { |
| 162 | - txt_report_num.setVisibility(View.GONE); | 114 | + binding.txtReportNum.setVisibility(View.GONE); |
| 163 | - txt_report_num_value.setVisibility(View.GONE); | 115 | + binding.txtReportNumValue.setVisibility(View.GONE); |
| 164 | - txt_image_num.setVisibility(View.VISIBLE); | 116 | + binding.txtImageNum.setVisibility(View.VISIBLE); |
| 165 | - txt_image_num_value.setVisibility(View.VISIBLE); | 117 | + binding.txtImageNumValue.setVisibility(View.VISIBLE); |
| 166 | - txt_video_num.setVisibility(View.VISIBLE); | 118 | + binding.txtVideoNum.setVisibility(View.VISIBLE); |
| 167 | - txt_video_num_value.setVisibility(View.VISIBLE); | 119 | + binding.txtVideoNumValue.setVisibility(View.VISIBLE); |
| 168 | } | 120 | } |
| 169 | } | 121 | } |
| 170 | 122 | ||
| ... | @@ -174,9 +126,9 @@ public class ArcDetailFragment extends BaseFragment implements CustomTimer.Timer | ... | @@ -174,9 +126,9 @@ public class ArcDetailFragment extends BaseFragment implements CustomTimer.Timer |
| 174 | 126 | ||
| 175 | public void initFileInfoShow() { | 127 | public void initFileInfoShow() { |
| 176 | List<RecordInfoDB> tmplist = mFileListMg.detailList; | 128 | List<RecordInfoDB> tmplist = mFileListMg.detailList; |
| 177 | - if ( tmplist.size() > 0 ) { | 129 | + if (tmplist.size() > 0 ) { |
| 178 | Logger.d(" setTimeText " + tmplist.get(0).getListMdItemName()); | 130 | Logger.d(" setTimeText " + tmplist.get(0).getListMdItemName()); |
| 179 | - i_view_1.setText(tmplist.get(0).getListMdItemName()); | 131 | + binding.iView1.setText(tmplist.get(0).getListMdItemName()); |
| 180 | String startTime = tmplist.get(0).getStartTimestamp(), endTime = startTime; | 132 | String startTime = tmplist.get(0).getStartTimestamp(), endTime = startTime; |
| 181 | Iterator<RecordInfoDB> iterator = tmplist.iterator(); | 133 | Iterator<RecordInfoDB> iterator = tmplist.iterator(); |
| 182 | while ( iterator.hasNext() ) { | 134 | while ( iterator.hasNext() ) { |
| ... | @@ -198,12 +150,12 @@ public class ArcDetailFragment extends BaseFragment implements CustomTimer.Timer | ... | @@ -198,12 +150,12 @@ public class ArcDetailFragment extends BaseFragment implements CustomTimer.Timer |
| 198 | 150 | ||
| 199 | } else { | 151 | } else { |
| 200 | } | 152 | } |
| 201 | - rl_sel_num.setVisibility(View.VISIBLE); | 153 | + binding.rlSelNum.setVisibility(View.VISIBLE); |
| 202 | - layout_file_info.setVisibility(View.GONE); | 154 | + binding.fgArchiveInfo.layoutFileInfo.setVisibility(View.GONE); |
| 203 | - i_view_1.setText(""); | 155 | + binding.iView1.setText(""); |
| 204 | - txt_date_value.setText(""); | 156 | + binding.fgArchiveInfo.txtDateValue.setText(""); |
| 205 | - txt_time_value.setText(""); | 157 | + binding.fgArchiveInfo.txtTimeValue.setText(""); |
| 206 | - txt_file_size.setText(""); | 158 | + binding.fgArchiveInfo.txtFileSize.setText(""); |
| 207 | } | 159 | } |
| 208 | 160 | ||
| 209 | @Override | 161 | @Override |
| ... | @@ -220,28 +172,33 @@ public class ArcDetailFragment extends BaseFragment implements CustomTimer.Timer | ... | @@ -220,28 +172,33 @@ public class ArcDetailFragment extends BaseFragment implements CustomTimer.Timer |
| 220 | Logger.d( " onHiddenChanged hidden " + hidden); | 172 | Logger.d( " onHiddenChanged hidden " + hidden); |
| 221 | hideIm(); | 173 | hideIm(); |
| 222 | if ( !Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath()) ) { | 174 | if ( !Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath()) ) { |
| 223 | - img_exp.setEnabled(false); | 175 | + binding.imgExp.setEnabled(false); |
| 224 | } else if ( Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath()) | 176 | } else if ( Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath()) |
| 225 | && SpManager.get_usb_input_enabled() ) { | 177 | && SpManager.get_usb_input_enabled() ) { |
| 226 | - img_exp.setEnabled(true); | 178 | + binding.imgExp.setEnabled(true); |
| 227 | } | 179 | } |
| 228 | if ( mFileListMg.detailList.size() <= 0 | 180 | if ( mFileListMg.detailList.size() <= 0 |
| 229 | || mDetailGdItemAdapter.getCheckNum() <= 0 | 181 | || mDetailGdItemAdapter.getCheckNum() <= 0 |
| 230 | || !SpManager.get_usb_input_enabled() ) { | 182 | || !SpManager.get_usb_input_enabled() ) { |
| 231 | //img_exp.setEnabled(false); | 183 | //img_exp.setEnabled(false); |
| 232 | } | 184 | } |
| 233 | - txt_image_num_value.setText("0"); | 185 | + binding.txtImageNumValue.setText("0"); |
| 234 | - txt_video_num_value.setText("0"); | 186 | + binding.txtVideoNumValue.setText("0"); |
| 235 | - txt_report_num_value.setText("0"); | 187 | + binding.txtReportNumValue.setText("0"); |
| 236 | 188 | ||
| 237 | initFileInfoShow(); | 189 | initFileInfoShow(); |
| 238 | 190 | ||
| 239 | showPermiss(); | 191 | showPermiss(); |
| 240 | - if (txt_all_sel.isSelected()) { | 192 | + if (binding.txtAllSel.isSelected()) { |
| 241 | - txt_all_sel.performClick(); | 193 | + binding.txtAllSel.performClick(); |
| 242 | } | 194 | } |
| 243 | } | 195 | } |
| 244 | 196 | ||
| 197 | + @Override | ||
| 198 | + protected FgArchiveDetailBinding getViewBinding(LayoutInflater inflater, ViewGroup container) { | ||
| 199 | + return FgArchiveDetailBinding.inflate(inflater,container,false); | ||
| 200 | + } | ||
| 201 | + | ||
| 245 | public void showPermiss() { | 202 | public void showPermiss() { |
| 246 | /*if (AccountManager.getInstance().isUserDbOrNoLogin()) { | 203 | /*if (AccountManager.getInstance().isUserDbOrNoLogin()) { |
| 247 | img_del.setVisibility(View.GONE); | 204 | img_del.setVisibility(View.GONE); |
| ... | @@ -251,47 +208,47 @@ public class ArcDetailFragment extends BaseFragment implements CustomTimer.Timer | ... | @@ -251,47 +208,47 @@ public class ArcDetailFragment extends BaseFragment implements CustomTimer.Timer |
| 251 | } | 208 | } |
| 252 | 209 | ||
| 253 | @Override | 210 | @Override |
| 254 | - protected int rootLayout() { | ||
| 255 | - return R.layout.fg_archive_detail; | ||
| 256 | - } | ||
| 257 | - | ||
| 258 | - @Override | ||
| 259 | protected void init() { | 211 | protected void init() { |
| 260 | //layout_home_home_guest = (ConstraintLayout) rootView.findViewById(R.id.layout_home_home_guest); | 212 | //layout_home_home_guest = (ConstraintLayout) rootView.findViewById(R.id.layout_home_home_guest); |
| 261 | mDetailGdItemAdapter = new DetailGdItemAdapter(getContext(), mFileListMg.detailList); | 213 | mDetailGdItemAdapter = new DetailGdItemAdapter(getContext(), mFileListMg.detailList); |
| 262 | mDetailGdItemAdapter.setOnClickLitener(this); | 214 | mDetailGdItemAdapter.setOnClickLitener(this); |
| 263 | 215 | ||
| 264 | - lay_sliding.setOnSlidingPositionListener(this); | 216 | + binding.laySliding.setOnSlidingPositionListener(this); |
| 265 | - gd_detail.setLayoutManager(new GridLayoutManager(getContext(), 4)); | 217 | + binding.gdDetail.setLayoutManager(new GridLayoutManager(getContext(), 4)); |
| 266 | - gd_detail.addItemDecoration(new SpaceItemDecoration(25, 0)); | 218 | + binding.gdDetail.addItemDecoration(new SpaceItemDecoration(25, 0)); |
| 267 | - gd_detail.setHasFixedSize(false); | 219 | + binding.gdDetail.setHasFixedSize(false); |
| 268 | 220 | ||
| 269 | - gd_detail.setAdapter(mDetailGdItemAdapter); | 221 | + binding.gdDetail.setAdapter(mDetailGdItemAdapter); |
| 270 | 222 | ||
| 271 | 223 | ||
| 272 | if ( !Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath()) ) { | 224 | if ( !Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath()) ) { |
| 273 | - img_exp.setEnabled(false); | 225 | + binding.imgExp.setEnabled(false); |
| 274 | } else if ( Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath()) | 226 | } else if ( Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath()) |
| 275 | && SpManager.get_usb_input_enabled() ) { | 227 | && SpManager.get_usb_input_enabled() ) { |
| 276 | - img_exp.setEnabled(true); | 228 | + binding.imgExp.setEnabled(true); |
| 277 | } | 229 | } |
| 278 | if ( mFileListMg.detailList.size() <= 0 | 230 | if ( mFileListMg.detailList.size() <= 0 |
| 279 | || mDetailGdItemAdapter.getCheckNum() <= 0 | 231 | || mDetailGdItemAdapter.getCheckNum() <= 0 |
| 280 | || !SpManager.get_usb_input_enabled() ) { | 232 | || !SpManager.get_usb_input_enabled() ) { |
| 281 | //img_exp.setEnabled(false); | 233 | //img_exp.setEnabled(false); |
| 282 | } | 234 | } |
| 283 | - txt_image_num_value.setText("0"); | 235 | + binding.txtImageNumValue.setText("0"); |
| 284 | - txt_video_num_value.setText("0"); | 236 | + binding.txtVideoNumValue.setText("0"); |
| 285 | - txt_report_num_value.setText("0"); | 237 | + binding.txtReportNumValue.setText("0"); |
| 286 | } | 238 | } |
| 287 | 239 | ||
| 288 | @Override | 240 | @Override |
| 289 | protected void setListener() { | 241 | protected void setListener() { |
| 242 | + binding.layBack.setOnClickListener(this); | ||
| 243 | + binding.txtAllSel.setOnClickListener(this); | ||
| 244 | + binding.imgExp.setOnClickListener(this); | ||
| 245 | + binding.imgDel.setOnClickListener(this); | ||
| 246 | + binding.fgArchiveInfo.txtMakeReport.setOnClickListener(this); | ||
| 247 | + binding.fgArchiveInfo.txtMakeVideo.setOnClickListener(this); | ||
| 248 | + | ||
| 290 | } | 249 | } |
| 291 | 250 | ||
| 292 | @Override | 251 | @Override |
| 293 | - @OnClick({ R.id.lay_back, R.id.img_exp, R.id.img_del, R.id.txt_all_sel, R.id.txt_make_report, | ||
| 294 | - R.id.txt_make_video, }) | ||
| 295 | public void onClick(View v) { | 252 | public void onClick(View v) { |
| 296 | switch (v.getId()) { | 253 | switch (v.getId()) { |
| 297 | case R.id.lay_back: | 254 | case R.id.lay_back: |
| ... | @@ -299,19 +256,19 @@ public class ArcDetailFragment extends BaseFragment implements CustomTimer.Timer | ... | @@ -299,19 +256,19 @@ public class ArcDetailFragment extends BaseFragment implements CustomTimer.Timer |
| 299 | break; | 256 | break; |
| 300 | case R.id.txt_all_sel: | 257 | case R.id.txt_all_sel: |
| 301 | if ( mFileListMg.detailList.size() <= 0 ) { | 258 | if ( mFileListMg.detailList.size() <= 0 ) { |
| 302 | - if ( txt_all_sel.isSelected() ) { | 259 | + if ( binding.txtAllSel.isSelected() ) { |
| 303 | - txt_all_sel.setSelected(false); | 260 | + binding.txtAllSel.setSelected(false); |
| 304 | } | 261 | } |
| 305 | break; | 262 | break; |
| 306 | } | 263 | } |
| 307 | - Logger.d(" txt_all_sel " + txt_all_sel.isSelected()); | 264 | + Logger.d(" txt_all_sel " + binding.txtAllSel.isSelected()); |
| 308 | if ( mFileListMg.detailList.size() != 0 ) { | 265 | if ( mFileListMg.detailList.size() != 0 ) { |
| 309 | - txt_all_sel.setSelected(!txt_all_sel.isSelected()); | 266 | + binding.txtAllSel.setSelected(!binding.txtAllSel.isSelected()); |
| 310 | - mDetailGdItemAdapter.setAllCheck(txt_all_sel.isSelected()); | 267 | + mDetailGdItemAdapter.setAllCheck(binding.txtAllSel.isSelected()); |
| 311 | mDetailGdItemAdapter.notifyDataSetChanged(); | 268 | mDetailGdItemAdapter.notifyDataSetChanged(); |
| 312 | - if ( txt_all_sel.isSelected() ) { | 269 | + if ( binding.txtAllSel.isSelected() ) { |
| 313 | if ( SpManager.get_usb_input_enabled() ) { | 270 | if ( SpManager.get_usb_input_enabled() ) { |
| 314 | - img_exp.setEnabled(true); | 271 | + binding.imgExp.setEnabled(true); |
| 315 | } | 272 | } |
| 316 | if ( Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath()) | 273 | if ( Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath()) |
| 317 | && SpManager.get_usb_input_enabled() ) { | 274 | && SpManager.get_usb_input_enabled() ) { |
| ... | @@ -324,15 +281,15 @@ public class ArcDetailFragment extends BaseFragment implements CustomTimer.Timer | ... | @@ -324,15 +281,15 @@ public class ArcDetailFragment extends BaseFragment implements CustomTimer.Timer |
| 324 | || !SpManager.get_usb_input_enabled() ) { | 281 | || !SpManager.get_usb_input_enabled() ) { |
| 325 | //img_exp.setEnabled(false); | 282 | //img_exp.setEnabled(false); |
| 326 | } | 283 | } |
| 327 | - txt_image_num_value.setText(mDetailGdItemAdapter.getImageNum() + ""); | 284 | + binding.txtImageNumValue.setText(mDetailGdItemAdapter.getImageNum() + ""); |
| 328 | - txt_video_num_value.setText(mDetailGdItemAdapter.getVideoNum() + ""); | 285 | + binding.txtVideoNumValue.setText(mDetailGdItemAdapter.getVideoNum() + ""); |
| 329 | break; | 286 | break; |
| 330 | case R.id.img_exp: | 287 | case R.id.img_exp: |
| 331 | //img_del.setEnabled(false); | 288 | //img_del.setEnabled(false); |
| 332 | if ( Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath()) | 289 | if ( Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath()) |
| 333 | && SpManager.get_usb_input_enabled() | 290 | && SpManager.get_usb_input_enabled() |
| 334 | && mDetailGdItemAdapter.getCheckNum() > 0 ) { | 291 | && mDetailGdItemAdapter.getCheckNum() > 0 ) { |
| 335 | - fg_archive_info.setVisibility(View.GONE); | 292 | + binding.fgArchiveInfo.getRoot().setVisibility(View.GONE); |
| 336 | //txt_usb_export.setVisibility(View.VISIBLE); | 293 | //txt_usb_export.setVisibility(View.VISIBLE); |
| 337 | if ( mFileListMg.detailList.size() <= 0 || mDetailGdItemAdapter.getCheckNum() <= 0 ) { | 294 | if ( mFileListMg.detailList.size() <= 0 || mDetailGdItemAdapter.getCheckNum() <= 0 ) { |
| 338 | break; | 295 | break; |
| ... | @@ -354,7 +311,7 @@ public class ArcDetailFragment extends BaseFragment implements CustomTimer.Timer | ... | @@ -354,7 +311,7 @@ public class ArcDetailFragment extends BaseFragment implements CustomTimer.Timer |
| 354 | showSpaceTipDailog(); | 311 | showSpaceTipDailog(); |
| 355 | break; | 312 | break; |
| 356 | } | 313 | } |
| 357 | - mDetailCopyInfoPopWindow.showAtLocation(rootView, Gravity.CENTER, 0, 0); | 314 | + mDetailCopyInfoPopWindow.showAtLocation(getRootView(), Gravity.CENTER, 0, 0); |
| 358 | } | 315 | } |
| 359 | break; | 316 | break; |
| 360 | case R.id.img_del: | 317 | case R.id.img_del: |
| ... | @@ -412,7 +369,7 @@ public class ArcDetailFragment extends BaseFragment implements CustomTimer.Timer | ... | @@ -412,7 +369,7 @@ public class ArcDetailFragment extends BaseFragment implements CustomTimer.Timer |
| 412 | if ( isChecked ) { | 369 | if ( isChecked ) { |
| 413 | if ( SpManager.get_usb_input_enabled() | 370 | if ( SpManager.get_usb_input_enabled() |
| 414 | && Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath()) ) { | 371 | && Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath()) ) { |
| 415 | - img_exp.setEnabled(true); | 372 | + binding.imgExp.setEnabled(true); |
| 416 | } | 373 | } |
| 417 | } | 374 | } |
| 418 | if ( mFileListMg.detailList.size() <= 0 || mDetailGdItemAdapter.getCheckNum() <= 0 ) { | 375 | if ( mFileListMg.detailList.size() <= 0 || mDetailGdItemAdapter.getCheckNum() <= 0 ) { |
| ... | @@ -420,9 +377,9 @@ public class ArcDetailFragment extends BaseFragment implements CustomTimer.Timer | ... | @@ -420,9 +377,9 @@ public class ArcDetailFragment extends BaseFragment implements CustomTimer.Timer |
| 420 | } else if ( Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath()) | 377 | } else if ( Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath()) |
| 421 | && SpManager.get_usb_input_enabled() ) { | 378 | && SpManager.get_usb_input_enabled() ) { |
| 422 | } | 379 | } |
| 423 | - txt_image_num_value.setText(mDetailGdItemAdapter.getImageNum() + ""); | 380 | + binding.txtImageNumValue.setText(mDetailGdItemAdapter.getImageNum() + ""); |
| 424 | - txt_video_num_value.setText(mDetailGdItemAdapter.getVideoNum() + ""); | 381 | + binding.txtVideoNumValue.setText(mDetailGdItemAdapter.getVideoNum() + ""); |
| 425 | - txt_report_num_value.setText(mDetailGdItemAdapter.getReportNum() + ""); | 382 | + binding.txtReportNumValue.setText(mDetailGdItemAdapter.getReportNum() + ""); |
| 426 | 383 | ||
| 427 | setSelDataInfo(); | 384 | setSelDataInfo(); |
| 428 | } | 385 | } |
| ... | @@ -431,9 +388,9 @@ public class ArcDetailFragment extends BaseFragment implements CustomTimer.Timer | ... | @@ -431,9 +388,9 @@ public class ArcDetailFragment extends BaseFragment implements CustomTimer.Timer |
| 431 | public void onSlidingPosition(int position) { | 388 | public void onSlidingPosition(int position) { |
| 432 | Logger.d( " onSlidingPosition position " + position); | 389 | Logger.d( " onSlidingPosition position " + position); |
| 433 | mDetailGdItemAdapter.setsingleCheck(position); | 390 | mDetailGdItemAdapter.setsingleCheck(position); |
| 434 | - txt_image_num_value.setText(mDetailGdItemAdapter.getImageNum() + ""); | 391 | + binding.txtImageNumValue.setText(mDetailGdItemAdapter.getImageNum() + ""); |
| 435 | - txt_video_num_value.setText(mDetailGdItemAdapter.getVideoNum() + ""); | 392 | + binding.txtVideoNumValue.setText(mDetailGdItemAdapter.getVideoNum() + ""); |
| 436 | - txt_report_num_value.setText(mDetailGdItemAdapter.getReportNum() + ""); | 393 | + binding.txtReportNumValue.setText(mDetailGdItemAdapter.getReportNum() + ""); |
| 437 | 394 | ||
| 438 | setSelDataInfo(); | 395 | setSelDataInfo(); |
| 439 | } | 396 | } |
| ... | @@ -442,9 +399,9 @@ public class ArcDetailFragment extends BaseFragment implements CustomTimer.Timer | ... | @@ -442,9 +399,9 @@ public class ArcDetailFragment extends BaseFragment implements CustomTimer.Timer |
| 442 | public void onSlidingRangePosition(int startPosition, int endPosition) { | 399 | public void onSlidingRangePosition(int startPosition, int endPosition) { |
| 443 | Logger.d( " onSlidingRangePosition startPosition " + startPosition + " endPosition " + endPosition); | 400 | Logger.d( " onSlidingRangePosition startPosition " + startPosition + " endPosition " + endPosition); |
| 444 | mDetailGdItemAdapter.setRangeCheck(startPosition, endPosition); | 401 | mDetailGdItemAdapter.setRangeCheck(startPosition, endPosition); |
| 445 | - txt_image_num_value.setText(mDetailGdItemAdapter.getImageNum() + ""); | 402 | + binding.txtImageNumValue.setText(mDetailGdItemAdapter.getImageNum() + ""); |
| 446 | - txt_video_num_value.setText(mDetailGdItemAdapter.getVideoNum() + ""); | 403 | + binding.txtVideoNumValue.setText(mDetailGdItemAdapter.getVideoNum() + ""); |
| 447 | - txt_report_num_value.setText(mDetailGdItemAdapter.getReportNum() + ""); | 404 | + binding.txtReportNumValue.setText(mDetailGdItemAdapter.getReportNum() + ""); |
| 448 | 405 | ||
| 449 | setSelDataInfo(); | 406 | setSelDataInfo(); |
| 450 | } | 407 | } |
| ... | @@ -460,9 +417,9 @@ public class ArcDetailFragment extends BaseFragment implements CustomTimer.Timer | ... | @@ -460,9 +417,9 @@ public class ArcDetailFragment extends BaseFragment implements CustomTimer.Timer |
| 460 | public void MountEventProc(boolean mount) { | 417 | public void MountEventProc(boolean mount) { |
| 461 | Logger.d( " MountEventProc " + mount ); | 418 | Logger.d( " MountEventProc " + mount ); |
| 462 | if ( mount && SpManager.get_usb_input_enabled() ) { | 419 | if ( mount && SpManager.get_usb_input_enabled() ) { |
| 463 | - img_exp.setEnabled(true); | 420 | + binding.imgExp.setEnabled(true); |
| 464 | } else { | 421 | } else { |
| 465 | - img_exp.setEnabled(false); | 422 | + binding.imgExp.setEnabled(false); |
| 466 | } | 423 | } |
| 467 | } | 424 | } |
| 468 | 425 | ||
| ... | @@ -506,8 +463,8 @@ public class ArcDetailFragment extends BaseFragment implements CustomTimer.Timer | ... | @@ -506,8 +463,8 @@ public class ArcDetailFragment extends BaseFragment implements CustomTimer.Timer |
| 506 | mFileListMg.detailList.get(i - 1).getFilename()); | 463 | mFileListMg.detailList.get(i - 1).getFilename()); |
| 507 | } | 464 | } |
| 508 | } | 465 | } |
| 509 | - if (txt_all_sel.isSelected()) { | 466 | + if (binding.txtAllSel.isSelected()) { |
| 510 | - txt_all_sel.performClick(); | 467 | + binding.txtAllSel.performClick(); |
| 511 | } | 468 | } |
| 512 | mFileListMg.getDetailList(listMdItemName); | 469 | mFileListMg.getDetailList(listMdItemName); |
| 513 | mDetailGdItemAdapter.setList(mFileListMg.detailList); | 470 | mDetailGdItemAdapter.setList(mFileListMg.detailList); |
| ... | @@ -664,7 +621,7 @@ public class ArcDetailFragment extends BaseFragment implements CustomTimer.Timer | ... | @@ -664,7 +621,7 @@ public class ArcDetailFragment extends BaseFragment implements CustomTimer.Timer |
| 664 | break; | 621 | break; |
| 665 | case MSG_COPY_END: | 622 | case MSG_COPY_END: |
| 666 | mDetailCopyInfoPopWindow.dismiss(); | 623 | mDetailCopyInfoPopWindow.dismiss(); |
| 667 | - fg_archive_info.setVisibility(View.VISIBLE); | 624 | + binding.fgArchiveInfo.getRoot().setVisibility(View.VISIBLE); |
| 668 | Log.d(TAG, "==.dismiss()2============"); | 625 | Log.d(TAG, "==.dismiss()2============"); |
| 669 | break; | 626 | break; |
| 670 | default: | 627 | default: |
| ... | @@ -690,42 +647,42 @@ public class ArcDetailFragment extends BaseFragment implements CustomTimer.Timer | ... | @@ -690,42 +647,42 @@ public class ArcDetailFragment extends BaseFragment implements CustomTimer.Timer |
| 690 | int size = tmpList.size(); | 647 | int size = tmpList.size(); |
| 691 | Logger.d(" setSelDataInfo size " + size); | 648 | Logger.d(" setSelDataInfo size " + size); |
| 692 | if ( size == 1 ) { | 649 | if ( size == 1 ) { |
| 693 | - layout_file_info.setVisibility(View.VISIBLE); | 650 | + binding.fgArchiveInfo.layoutFileInfo.setVisibility(View.VISIBLE); |
| 694 | - txt_date_value.setText(tmpList.get(0).getListDay()); | 651 | + binding.fgArchiveInfo.txtDateValue.setText(tmpList.get(0).getListDay()); |
| 695 | if ( tmpList.get(0).getType() == InitParam.FILE_VIDEO ) { | 652 | if ( tmpList.get(0).getType() == InitParam.FILE_VIDEO ) { |
| 696 | - txt_time_value.setText(TimeUtil.timeStamp2ZoneHm(Long.parseLong(tmpList.get(0).getStartTimestamp())) | 653 | + binding.fgArchiveInfo.txtTimeValue.setText(TimeUtil.timeStamp2ZoneHm(Long.parseLong(tmpList.get(0).getStartTimestamp())) |
| 697 | /*+ "-" + TimeUtil.timeStamp2ZoneHms(Long.parseLong(tmpList.get(0).getEndTimestamp()))*/); | 654 | /*+ "-" + TimeUtil.timeStamp2ZoneHms(Long.parseLong(tmpList.get(0).getEndTimestamp()))*/); |
| 698 | } else { | 655 | } else { |
| 699 | - txt_time_value.setText(TimeUtil.timeStamp2ZoneHm(Long.parseLong(tmpList.get(0).getStartTimestamp()))); | 656 | + binding.fgArchiveInfo.txtTimeValue.setText(TimeUtil.timeStamp2ZoneHm(Long.parseLong(tmpList.get(0).getStartTimestamp()))); |
| 700 | } | 657 | } |
| 701 | if ( (total / 1024.0f) > 1.00000000f ) { | 658 | if ( (total / 1024.0f) > 1.00000000f ) { |
| 702 | - txt_file_size.setText(Math.round(total / 1024f * 10) / 10.0f + " MB"); | 659 | + binding.fgArchiveInfo.txtFileSize.setText(Math.round(total / 1024f * 10) / 10.0f + " MB"); |
| 703 | } else { | 660 | } else { |
| 704 | - txt_file_size.setText(Math.round(total * 10) / 10.0f + " KB"); | 661 | + binding.fgArchiveInfo.txtFileSize.setText(Math.round(total * 10) / 10.0f + " KB"); |
| 705 | } | 662 | } |
| 706 | - rl_sel_num.setVisibility(View.GONE); | 663 | + binding.rlSelNum.setVisibility(View.GONE); |
| 707 | } else if ( size > 1 ) { | 664 | } else if ( size > 1 ) { |
| 708 | - layout_file_info.setVisibility(View.GONE); | 665 | + binding.fgArchiveInfo.layoutFileInfo.setVisibility(View.GONE); |
| 709 | - rl_sel_num.setVisibility(View.VISIBLE); | 666 | + binding.rlSelNum.setVisibility(View.VISIBLE); |
| 710 | if ( mFileListMg.detailList.size() > 0 && mFileListMg.detailList.get(0).isReport() ) { | 667 | if ( mFileListMg.detailList.size() > 0 && mFileListMg.detailList.get(0).isReport() ) { |
| 711 | - txt_report_num.setVisibility(View.VISIBLE); | 668 | + binding.txtReportNum.setVisibility(View.VISIBLE); |
| 712 | - txt_report_num_value.setVisibility(View.VISIBLE); | 669 | + binding.txtReportNumValue.setVisibility(View.VISIBLE); |
| 713 | - txt_image_num.setVisibility(View.GONE); | 670 | + binding.txtImageNum.setVisibility(View.GONE); |
| 714 | - txt_image_num_value.setVisibility(View.GONE); | 671 | + binding.txtImageNumValue.setVisibility(View.GONE); |
| 715 | - txt_video_num.setVisibility(View.GONE); | 672 | + binding.txtVideoNum.setVisibility(View.GONE); |
| 716 | - txt_video_num_value.setVisibility(View.GONE); | 673 | + binding.txtVideoNumValue.setVisibility(View.GONE); |
| 717 | } else { | 674 | } else { |
| 718 | - txt_report_num.setVisibility(View.GONE); | 675 | + binding.txtReportNum.setVisibility(View.GONE); |
| 719 | - txt_report_num_value.setVisibility(View.GONE); | 676 | + binding.txtReportNumValue.setVisibility(View.GONE); |
| 720 | - txt_image_num.setVisibility(View.VISIBLE); | 677 | + binding.txtImageNum.setVisibility(View.VISIBLE); |
| 721 | - txt_image_num_value.setVisibility(View.VISIBLE); | 678 | + binding.txtImageNumValue.setVisibility(View.VISIBLE); |
| 722 | - txt_video_num.setVisibility(View.VISIBLE); | 679 | + binding.txtVideoNum.setVisibility(View.VISIBLE); |
| 723 | - txt_video_num_value.setVisibility(View.VISIBLE); | 680 | + binding.txtVideoNumValue.setVisibility(View.VISIBLE); |
| 724 | } | 681 | } |
| 725 | } else { | 682 | } else { |
| 726 | - txt_date_value.setText(""); | 683 | + binding.fgArchiveInfo.txtDateValue.setText(""); |
| 727 | - txt_time_value.setText(""); | 684 | + binding.fgArchiveInfo.txtTimeValue.setText(""); |
| 728 | - txt_file_size.setText(""); | 685 | + binding.fgArchiveInfo.txtFileSize.setText(""); |
| 729 | } | 686 | } |
| 730 | } | 687 | } |
| 731 | 688 | ... | ... |
| ... | @@ -9,6 +9,7 @@ import android.net.Uri; | ... | @@ -9,6 +9,7 @@ import android.net.Uri; |
| 9 | import android.os.Handler; | 9 | import android.os.Handler; |
| 10 | import android.os.Message; | 10 | import android.os.Message; |
| 11 | import android.util.Log; | 11 | import android.util.Log; |
| 12 | +import android.view.LayoutInflater; | ||
| 12 | import android.view.View; | 13 | import android.view.View; |
| 13 | import android.view.ViewGroup; | 14 | import android.view.ViewGroup; |
| 14 | import android.view.inputmethod.InputMethodManager; | 15 | import android.view.inputmethod.InputMethodManager; |
| ... | @@ -28,6 +29,7 @@ import com.sw.laryngoscope.activity.CustomTimer; | ... | @@ -28,6 +29,7 @@ import com.sw.laryngoscope.activity.CustomTimer; |
| 28 | import com.sw.laryngoscope.activity.HomeActivity; | 29 | import com.sw.laryngoscope.activity.HomeActivity; |
| 29 | import com.sw.laryngoscope.adapter.ListAdapter; | 30 | import com.sw.laryngoscope.adapter.ListAdapter; |
| 30 | import com.sw.laryngoscope.common.InitParam; | 31 | import com.sw.laryngoscope.common.InitParam; |
| 32 | +import com.sw.laryngoscope.databinding.FgArchivePlayBinding; | ||
| 31 | import com.sw.laryngoscope.manager.SpManager; | 33 | import com.sw.laryngoscope.manager.SpManager; |
| 32 | import com.sw.laryngoscope.manager.StorageStateManager; | 34 | import com.sw.laryngoscope.manager.StorageStateManager; |
| 33 | import com.sw.laryngoscope.utils.Logger; | 35 | import com.sw.laryngoscope.utils.Logger; |
| ... | @@ -36,53 +38,15 @@ import com.sw.laryngoscope.widget.PhotoView.PhotoView; | ... | @@ -36,53 +38,15 @@ import com.sw.laryngoscope.widget.PhotoView.PhotoView; |
| 36 | 38 | ||
| 37 | import java.io.File; | 39 | import java.io.File; |
| 38 | 40 | ||
| 39 | -import butterknife.BindView; | ||
| 40 | -import butterknife.OnClick; | ||
| 41 | //import uk.co.senab.photoview.PhotoView; | 41 | //import uk.co.senab.photoview.PhotoView; |
| 42 | //import uk.co.senab.photoview.PhotoViewAttacher; | 42 | //import uk.co.senab.photoview.PhotoViewAttacher; |
| 43 | 43 | ||
| 44 | -public class ArcPlayFragment extends BaseFragment implements | 44 | +public class ArcPlayFragment extends BaseFragment<FgArchivePlayBinding> implements |
| 45 | CustomTimer.TimerCallBack, ListAdapter.OnClickLitener, RadioGroup.OnCheckedChangeListener, | 45 | CustomTimer.TimerCallBack, ListAdapter.OnClickLitener, RadioGroup.OnCheckedChangeListener, |
| 46 | - StorageStateManager.MountCallBack { | 46 | + StorageStateManager.MountCallBack,View.OnClickListener { |
| 47 | 47 | ||
| 48 | private static final String TAG = "ArcPlayFragment"; | 48 | private static final String TAG = "ArcPlayFragment"; |
| 49 | private Context context; | 49 | private Context context; |
| 50 | - | ||
| 51 | - @BindView(R.id.layout_main_play) | ||
| 52 | - ConstraintLayout layout_main_play; | ||
| 53 | - | ||
| 54 | - @BindView(R.id.lay_back) | ||
| 55 | - LinearLayout lay_back; | ||
| 56 | - | ||
| 57 | - | ||
| 58 | - @BindView(R.id.rl_pic) | ||
| 59 | - RelativeLayout rl_pic; | ||
| 60 | - @BindView(R.id.img_preview) | ||
| 61 | - PhotoView img_preview; | ||
| 62 | - | ||
| 63 | - @BindView(R.id.rl_video) | ||
| 64 | - RelativeLayout rl_video; | ||
| 65 | - @BindView(R.id.img_first_frame) | ||
| 66 | - ImageView img_first_frame; | ||
| 67 | - @BindView(R.id.video_view) | ||
| 68 | - CustomVideoView video_view; | ||
| 69 | - /*@BindView(R.id.video_surfaceview) | ||
| 70 | - SurfaceView video_surfaceview;*/ | ||
| 71 | - | ||
| 72 | - @BindView(R.id.main_controller_liner) | ||
| 73 | - RelativeLayout main_controller_liner; | ||
| 74 | - @BindView(R.id.play_pasue_image) | ||
| 75 | - ImageView play_pasue_image; | ||
| 76 | - @BindView(R.id.main_current_time) | ||
| 77 | - TextView main_current_time; | ||
| 78 | - @BindView(R.id.main_play_seek) | ||
| 79 | - SeekBar main_play_seek; | ||
| 80 | - @BindView(R.id.main_totally_time) | ||
| 81 | - TextView main_totally_time; | ||
| 82 | - | ||
| 83 | - @BindView(R.id.txt_name) | ||
| 84 | - TextView txt_name; | ||
| 85 | - | ||
| 86 | private CustomTimer scrollTimer; | 50 | private CustomTimer scrollTimer; |
| 87 | private final String timerTAG_scroll = "scroll"; | 51 | private final String timerTAG_scroll = "scroll"; |
| 88 | 52 | ||
| ... | @@ -109,7 +73,7 @@ public class ArcPlayFragment extends BaseFragment implements | ... | @@ -109,7 +73,7 @@ public class ArcPlayFragment extends BaseFragment implements |
| 109 | @Override | 73 | @Override |
| 110 | public void onResume() { | 74 | public void onResume() { |
| 111 | super.onResume(); | 75 | super.onResume(); |
| 112 | - img_preview.enable(); | 76 | + binding.imgPreview.enable(); |
| 113 | showPermiss(); | 77 | showPermiss(); |
| 114 | if ( mFileListMg.detailList.size() != 0 ) { | 78 | if ( mFileListMg.detailList.size() != 0 ) { |
| 115 | } | 79 | } |
| ... | @@ -131,12 +95,12 @@ public class ArcPlayFragment extends BaseFragment implements | ... | @@ -131,12 +95,12 @@ public class ArcPlayFragment extends BaseFragment implements |
| 131 | 95 | ||
| 132 | Logger.d(" curRecordInfoPos " + mFileListMg.curRecordInfoPos); | 96 | Logger.d(" curRecordInfoPos " + mFileListMg.curRecordInfoPos); |
| 133 | showTip(); | 97 | showTip(); |
| 134 | - layout_main_play.setVisibility(View.VISIBLE); | 98 | + binding.layoutMainPlay.setVisibility(View.VISIBLE); |
| 135 | } else { | 99 | } else { |
| 136 | stopVideo(); | 100 | stopVideo(); |
| 137 | - main_play_seek.setProgress(0); | 101 | + binding.mainPlaySeek.setProgress(0); |
| 138 | - updataTimeFormat(main_current_time, 0); | 102 | + updataTimeFormat(binding.mainCurrentTime, 0); |
| 139 | - layout_main_play.setVisibility(View.GONE); | 103 | + binding.layoutMainPlay.setVisibility(View.GONE); |
| 140 | } | 104 | } |
| 141 | hideIm(); | 105 | hideIm(); |
| 142 | 106 | ||
| ... | @@ -145,6 +109,11 @@ public class ArcPlayFragment extends BaseFragment implements | ... | @@ -145,6 +109,11 @@ public class ArcPlayFragment extends BaseFragment implements |
| 145 | showPermiss(); | 109 | showPermiss(); |
| 146 | } | 110 | } |
| 147 | 111 | ||
| 112 | + @Override | ||
| 113 | + protected FgArchivePlayBinding getViewBinding(LayoutInflater inflater, ViewGroup container) { | ||
| 114 | + return FgArchivePlayBinding.inflate(inflater,container,false); | ||
| 115 | + } | ||
| 116 | + | ||
| 148 | public void showPermiss() { | 117 | public void showPermiss() { |
| 149 | /*if (AccountManager.getInstance().isUserDbOrNoLogin()) { | 118 | /*if (AccountManager.getInstance().isUserDbOrNoLogin()) { |
| 150 | img_del.setVisibility(View.GONE); | 119 | img_del.setVisibility(View.GONE); |
| ... | @@ -154,11 +123,6 @@ public class ArcPlayFragment extends BaseFragment implements | ... | @@ -154,11 +123,6 @@ public class ArcPlayFragment extends BaseFragment implements |
| 154 | } | 123 | } |
| 155 | 124 | ||
| 156 | @Override | 125 | @Override |
| 157 | - protected int rootLayout() { | ||
| 158 | - return R.layout.fg_archive_play; | ||
| 159 | - } | ||
| 160 | - | ||
| 161 | - @Override | ||
| 162 | protected void init() { | 126 | protected void init() { |
| 163 | curPos = mFileListMg.detailList.size() - mFileListMg.curRecordInfoPos - 1; | 127 | curPos = mFileListMg.detailList.size() - mFileListMg.curRecordInfoPos - 1; |
| 164 | //video_view = new MediaPlayer(); | 128 | //video_view = new MediaPlayer(); |
| ... | @@ -183,27 +147,27 @@ public class ArcPlayFragment extends BaseFragment implements | ... | @@ -183,27 +147,27 @@ public class ArcPlayFragment extends BaseFragment implements |
| 183 | 147 | ||
| 184 | @Override | 148 | @Override |
| 185 | protected void setListener() { | 149 | protected void setListener() { |
| 186 | - video_view.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { | 150 | + binding.videoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { |
| 187 | @Override | 151 | @Override |
| 188 | public void onCompletion(MediaPlayer mp) { | 152 | public void onCompletion(MediaPlayer mp) { |
| 189 | - play_pasue_image.setImageResource(R.drawable.btn_play); | 153 | + binding.playPasueImage.setImageResource(R.drawable.btn_play); |
| 190 | mPlayHandler.removeMessages(UPDATA_VIDEO_NUM); | 154 | mPlayHandler.removeMessages(UPDATA_VIDEO_NUM); |
| 191 | mPlayHandler.removeCallbacks(null); | 155 | mPlayHandler.removeCallbacks(null); |
| 192 | - updataTimeFormat(main_current_time, 0); | 156 | + updataTimeFormat(binding.mainCurrentTime, 0); |
| 193 | - main_play_seek.setProgress(0); | 157 | + binding.mainPlaySeek.setProgress(0); |
| 194 | - video_view.setVideoPath(curPlayFile); | 158 | + binding.videoView.setVideoPath(curPlayFile); |
| 195 | 159 | ||
| 196 | - img_first_frame.setVisibility(View.VISIBLE); | 160 | + binding.imgFirstFrame.setVisibility(View.VISIBLE); |
| 197 | } | 161 | } |
| 198 | }); | 162 | }); |
| 199 | //播放进度条事件 | 163 | //播放进度条事件 |
| 200 | - main_play_seek.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { | 164 | + binding.mainPlaySeek.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { |
| 201 | @Override | 165 | @Override |
| 202 | public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { | 166 | public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { |
| 203 | //设置当前的播放时间 | 167 | //设置当前的播放时间 |
| 204 | - updataTimeFormat(main_current_time, progress > 3 * 60 * 1000 ? 3 * 60 * 1000 : progress); | 168 | + updataTimeFormat(binding.mainCurrentTime, progress > 3 * 60 * 1000 ? 3 * 60 * 1000 : progress); |
| 205 | - if (video_view.getDuration() == progress) { | 169 | + if (binding.videoView.getDuration() == progress) { |
| 206 | - play_pasue_image.setImageResource(R.drawable.btn_play); | 170 | + binding.playPasueImage.setImageResource(R.drawable.btn_play); |
| 207 | } | 171 | } |
| 208 | } | 172 | } |
| 209 | 173 | ||
| ... | @@ -220,18 +184,24 @@ public class ArcPlayFragment extends BaseFragment implements | ... | @@ -220,18 +184,24 @@ public class ArcPlayFragment extends BaseFragment implements |
| 220 | //停止拖动后,获取总进度 | 184 | //停止拖动后,获取总进度 |
| 221 | int totall = seekBar.getProgress(); | 185 | int totall = seekBar.getProgress(); |
| 222 | //设置VideoView的播放进度 | 186 | //设置VideoView的播放进度 |
| 223 | - video_view.seekTo(totall); | 187 | + binding.videoView.seekTo(totall); |
| 224 | //重新handler刷新 | 188 | //重新handler刷新 |
| 225 | mPlayHandler.sendEmptyMessage(UPDATA_VIDEO_NUM); | 189 | mPlayHandler.sendEmptyMessage(UPDATA_VIDEO_NUM); |
| 226 | Logger.d(" onStopTrackingTouch " + totall ); | 190 | Logger.d(" onStopTrackingTouch " + totall ); |
| 227 | } | 191 | } |
| 228 | }); | 192 | }); |
| 193 | + | ||
| 194 | + binding.layBack.setOnClickListener(this); | ||
| 195 | + binding.playPasueImage.setOnClickListener(this); | ||
| 196 | + binding.imgPicNext.setOnClickListener(this); | ||
| 197 | + binding.imgFilmNext.setOnClickListener(this); | ||
| 198 | + binding.imgPicForward.setOnClickListener(this); | ||
| 199 | + binding.imgFilmForward.setOnClickListener(this); | ||
| 200 | + binding.imgPicExpansion.setOnClickListener(this); | ||
| 201 | + binding.imgPicReduce.setOnClickListener(this); | ||
| 229 | } | 202 | } |
| 230 | 203 | ||
| 231 | @Override | 204 | @Override |
| 232 | - @OnClick({ R.id.lay_back, R.id.play_pasue_image, R.id.img_film_forward, R.id.img_film_next, | ||
| 233 | - R.id.img_pic_forward, R.id.img_pic_next, | ||
| 234 | - R.id.img_pic_expansion, R.id.img_pic_reduce, }) | ||
| 235 | public void onClick(View v) { | 205 | public void onClick(View v) { |
| 236 | switch (v.getId()) { | 206 | switch (v.getId()) { |
| 237 | case R.id.lay_back: | 207 | case R.id.lay_back: |
| ... | @@ -239,17 +209,17 @@ public class ArcPlayFragment extends BaseFragment implements | ... | @@ -239,17 +209,17 @@ public class ArcPlayFragment extends BaseFragment implements |
| 239 | mPlayHandler.removeCallbacks(null); | 209 | mPlayHandler.removeCallbacks(null); |
| 240 | 210 | ||
| 241 | stopVideo(); | 211 | stopVideo(); |
| 242 | - main_play_seek.setProgress(0); | 212 | + binding.mainPlaySeek.setProgress(0); |
| 243 | homeFragment.backDetailFg(); | 213 | homeFragment.backDetailFg(); |
| 244 | break; | 214 | break; |
| 245 | case R.id.play_pasue_image: | 215 | case R.id.play_pasue_image: |
| 246 | - if ( video_view.isPlaying() ) { | 216 | + if ( binding.videoView.isPlaying() ) { |
| 247 | pauseAndResumeVideo(); | 217 | pauseAndResumeVideo(); |
| 248 | Logger.d(" play_pasue_image pauseAndResumeVideo 1"); | 218 | Logger.d(" play_pasue_image pauseAndResumeVideo 1"); |
| 249 | } else { | 219 | } else { |
| 250 | String file = mFileListMg.showRecordInfoDB.getFilepath() + | 220 | String file = mFileListMg.showRecordInfoDB.getFilepath() + |
| 251 | File.separator + mFileListMg.showRecordInfoDB.getFilename(); | 221 | File.separator + mFileListMg.showRecordInfoDB.getFilename(); |
| 252 | - if ( curPlayFile.equals(file) && video_view != null ) { | 222 | + if ( curPlayFile.equals(file) && binding.videoView != null ) { |
| 253 | pauseAndResumeVideo(); | 223 | pauseAndResumeVideo(); |
| 254 | Logger.d(" play_pasue_image pauseAndResumeVideo 2"); | 224 | Logger.d(" play_pasue_image pauseAndResumeVideo 2"); |
| 255 | } else { | 225 | } else { |
| ... | @@ -283,20 +253,20 @@ public class ArcPlayFragment extends BaseFragment implements | ... | @@ -283,20 +253,20 @@ public class ArcPlayFragment extends BaseFragment implements |
| 283 | case R.id.img_pic_expansion: | 253 | case R.id.img_pic_expansion: |
| 284 | /*Logger.d(" getMaximumScale " + " getMinimumScale " + mAttacher.getMinimumScale() + mAttacher.getMaximumScale() | 254 | /*Logger.d(" getMaximumScale " + " getMinimumScale " + mAttacher.getMinimumScale() + mAttacher.getMaximumScale() |
| 285 | + " getScale " + mAttacher.getScale());*/ | 255 | + " getScale " + mAttacher.getScale());*/ |
| 286 | - curScale = img_preview.getmScale(); | 256 | + curScale = binding.imgPreview.getmScale(); |
| 287 | curScale += 0.2f; | 257 | curScale += 0.2f; |
| 288 | - if ( curScale >= img_preview.getMaxScale() ) { | 258 | + if ( curScale >= binding.imgPreview.getMaxScale() ) { |
| 289 | - curScale = img_preview.getMaxScale(); | 259 | + curScale = binding.imgPreview.getMaxScale(); |
| 290 | } | 260 | } |
| 291 | - img_preview.setScale(curScale); | 261 | + binding.imgPreview.setScale(curScale); |
| 292 | break; | 262 | break; |
| 293 | case R.id.img_pic_reduce: | 263 | case R.id.img_pic_reduce: |
| 294 | - curScale = img_preview.getmScale(); | 264 | + curScale = binding.imgPreview.getmScale(); |
| 295 | curScale -= 0.2f; | 265 | curScale -= 0.2f; |
| 296 | - if ( curScale <= img_preview.getmMinScale() ) { | 266 | + if ( curScale <= binding.imgPreview.getmMinScale() ) { |
| 297 | - curScale = img_preview.getmMinScale(); | 267 | + curScale = binding.imgPreview.getmMinScale(); |
| 298 | } | 268 | } |
| 299 | - img_preview.setScale(curScale); | 269 | + binding.imgPreview.setScale(curScale); |
| 300 | break; | 270 | break; |
| 301 | default: | 271 | default: |
| 302 | break; | 272 | break; |
| ... | @@ -316,10 +286,10 @@ public class ArcPlayFragment extends BaseFragment implements | ... | @@ -316,10 +286,10 @@ public class ArcPlayFragment extends BaseFragment implements |
| 316 | mFileListMg.curRecordInfoPos = mFileListMg.detailList.size() - position - 1;//界面显示的位置,在Adapter中的 | 286 | mFileListMg.curRecordInfoPos = mFileListMg.detailList.size() - position - 1;//界面显示的位置,在Adapter中的 |
| 317 | Logger.d("==========setListener===getFilename=====" + mFileListMg.showRecordInfoDB.getFilename()); | 287 | Logger.d("==========setListener===getFilename=====" + mFileListMg.showRecordInfoDB.getFilename()); |
| 318 | Logger.d(" curRecordInfoPos " + mFileListMg.curRecordInfoPos); | 288 | Logger.d(" curRecordInfoPos " + mFileListMg.curRecordInfoPos); |
| 319 | - txt_name.setText(mFileListMg.showRecordInfoDB.getTitle()); | 289 | + binding.txtName.setText(mFileListMg.showRecordInfoDB.getTitle()); |
| 320 | 290 | ||
| 321 | stopVideo(); | 291 | stopVideo(); |
| 322 | - main_play_seek.setProgress(0); | 292 | + binding.mainPlaySeek.setProgress(0); |
| 323 | showTip(); | 293 | showTip(); |
| 324 | 294 | ||
| 325 | showFileNum(); | 295 | showFileNum(); |
| ... | @@ -343,7 +313,7 @@ public class ArcPlayFragment extends BaseFragment implements | ... | @@ -343,7 +313,7 @@ public class ArcPlayFragment extends BaseFragment implements |
| 343 | public void showTip() { | 313 | public void showTip() { |
| 344 | //txt_time_value.setText(mFileListMg.showRecordInfoDB.getHourTime()); | 314 | //txt_time_value.setText(mFileListMg.showRecordInfoDB.getHourTime()); |
| 345 | if ( mFileListMg.detailList.size() != 0 ) { | 315 | if ( mFileListMg.detailList.size() != 0 ) { |
| 346 | - txt_name.setText(mFileListMg.showRecordInfoDB.getTitle()); | 316 | + binding.txtName.setText(mFileListMg.showRecordInfoDB.getTitle()); |
| 347 | } | 317 | } |
| 348 | 318 | ||
| 349 | String file = mFileListMg.showRecordInfoDB.getFilepath() + | 319 | String file = mFileListMg.showRecordInfoDB.getFilepath() + |
| ... | @@ -357,16 +327,16 @@ public class ArcPlayFragment extends BaseFragment implements | ... | @@ -357,16 +327,16 @@ public class ArcPlayFragment extends BaseFragment implements |
| 357 | //img_preview.getAttacher().setScaleLevels(curScale, curScale + 0.5f, curScale + 1.0f); | 327 | //img_preview.getAttacher().setScaleLevels(curScale, curScale + 0.5f, curScale + 1.0f); |
| 358 | Log.d("onDraw", "=========11============"); | 328 | Log.d("onDraw", "=========11============"); |
| 359 | 329 | ||
| 360 | - setViewParam(perSize, (int)(perSize * 1.0f * height / width), img_preview); | 330 | + setViewParam(perSize, (int)(perSize * 1.0f * height / width), binding.imgPreview); |
| 361 | //Logger.d(" file " + file + " " + (int)(perSize * 1.0f * height / width) + " curScale " + curScale); | 331 | //Logger.d(" file " + file + " " + (int)(perSize * 1.0f * height / width) + " curScale " + curScale); |
| 362 | - Glide.with(homeActivity).load( Uri.fromFile(new File(file)) ).into(img_preview); | 332 | + Glide.with(homeActivity).load( Uri.fromFile(new File(file)) ).into(binding.imgPreview); |
| 363 | - rl_pic.setVisibility(View.VISIBLE); | 333 | + binding.rlPic.setVisibility(View.VISIBLE); |
| 364 | /*Bitmap tmp = BitmapUtil.ScaleImgMax(BitmapFactory.decodeFile(file), perSize, (int)(perSize * 1.0f * height / width)); | 334 | /*Bitmap tmp = BitmapUtil.ScaleImgMax(BitmapFactory.decodeFile(file), perSize, (int)(perSize * 1.0f * height / width)); |
| 365 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); | 335 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
| 366 | tmp.compress(Bitmap.CompressFormat.PNG, 100, baos); | 336 | tmp.compress(Bitmap.CompressFormat.PNG, 100, baos); |
| 367 | Glide.with(homeActivity).load(baos.toByteArray()).into(img_preview);*/ | 337 | Glide.with(homeActivity).load(baos.toByteArray()).into(img_preview);*/ |
| 368 | //tmp.recycle(); | 338 | //tmp.recycle(); |
| 369 | - rl_video.setVisibility(View.GONE); | 339 | + binding.rlVideo.setVisibility(View.GONE); |
| 370 | //mAttacher.cleanup(); | 340 | //mAttacher.cleanup(); |
| 371 | 341 | ||
| 372 | /*rl_video.removeCallbacks(null); | 342 | /*rl_video.removeCallbacks(null); |
| ... | @@ -374,23 +344,23 @@ public class ArcPlayFragment extends BaseFragment implements | ... | @@ -374,23 +344,23 @@ public class ArcPlayFragment extends BaseFragment implements |
| 374 | 100 );*/ | 344 | 100 );*/ |
| 375 | //stopVideo(); | 345 | //stopVideo(); |
| 376 | } else if ( mFileListMg.showRecordInfoDB.getType() == InitParam.FILE_VIDEO ) { | 346 | } else if ( mFileListMg.showRecordInfoDB.getType() == InitParam.FILE_VIDEO ) { |
| 377 | - rl_pic.setVisibility(View.GONE); | 347 | + binding.rlPic.setVisibility(View.GONE); |
| 378 | - rl_video.setVisibility(View.VISIBLE); | 348 | + binding.rlVideo.setVisibility(View.VISIBLE); |
| 379 | int width = mFileListMg.showRecordInfoDB.getWidth();//Thumbnail.getVideoWidth(file); | 349 | int width = mFileListMg.showRecordInfoDB.getWidth();//Thumbnail.getVideoWidth(file); |
| 380 | int height = mFileListMg.showRecordInfoDB.getHeight();//Thumbnail.getVideoHeight(file); | 350 | int height = mFileListMg.showRecordInfoDB.getHeight();//Thumbnail.getVideoHeight(file); |
| 381 | - setViewParam(perSize, (int)(perSize * 1.0f * height / width), video_view); | 351 | + setViewParam(perSize, (int)(perSize * 1.0f * height / width), binding.videoView); |
| 382 | - setViewParam(perSize, (int)(perSize * 1.0f * height / width), img_first_frame); | 352 | + setViewParam(perSize, (int)(perSize * 1.0f * height / width), binding.imgFirstFrame); |
| 383 | - video_view.setVideoPath(file); | 353 | + binding.videoView.setVideoPath(file); |
| 384 | Glide.with(getContext()).load( Uri.fromFile(new File( | 354 | Glide.with(getContext()).load( Uri.fromFile(new File( |
| 385 | mFileListMg.showRecordInfoDB.getThumbnailpath() + | 355 | mFileListMg.showRecordInfoDB.getThumbnailpath() + |
| 386 | File.separator + mFileListMg.showRecordInfoDB.getThumbnailname() | 356 | File.separator + mFileListMg.showRecordInfoDB.getThumbnailname() |
| 387 | - )) ).into(img_first_frame); | 357 | + )) ).into(binding.imgFirstFrame); |
| 388 | - img_first_frame.setVisibility(View.VISIBLE); | 358 | + binding.imgFirstFrame.setVisibility(View.VISIBLE); |
| 389 | 359 | ||
| 390 | /*updataTimeFormat(main_totally_time, | 360 | /*updataTimeFormat(main_totally_time, |
| 391 | (int)mFileListMg.showRecordInfoDB.getDuration() > 3 * 60 * 1000 ? | 361 | (int)mFileListMg.showRecordInfoDB.getDuration() > 3 * 60 * 1000 ? |
| 392 | (int)3 * 60 * 1000 : (int)mFileListMg.showRecordInfoDB.getDuration());*/ | 362 | (int)3 * 60 * 1000 : (int)mFileListMg.showRecordInfoDB.getDuration());*/ |
| 393 | - updataTimeFormat(main_totally_time, (int)mFileListMg.showRecordInfoDB.getDuration()); | 363 | + updataTimeFormat(binding.mainTotallyTime, (int)mFileListMg.showRecordInfoDB.getDuration()); |
| 394 | } else { | 364 | } else { |
| 395 | file = mFileListMg.showRecordInfoDB.getThumbnailpath() + | 365 | file = mFileListMg.showRecordInfoDB.getThumbnailpath() + |
| 396 | File.separator + mFileListMg.showRecordInfoDB.getThumbnailname(); | 366 | File.separator + mFileListMg.showRecordInfoDB.getThumbnailname(); |
| ... | @@ -399,12 +369,12 @@ public class ArcPlayFragment extends BaseFragment implements | ... | @@ -399,12 +369,12 @@ public class ArcPlayFragment extends BaseFragment implements |
| 399 | int height = fileMap.getHeight(); | 369 | int height = fileMap.getHeight(); |
| 400 | fileMap.recycle(); | 370 | fileMap.recycle(); |
| 401 | curScale = 1.0f; | 371 | curScale = 1.0f; |
| 402 | - setViewParam((int)(perSize * 1.0f * width / height), perSize, img_preview); | 372 | + setViewParam((int)(perSize * 1.0f * width / height), perSize, binding.imgPreview); |
| 403 | - Glide.with(homeActivity).load( Uri.fromFile(new File(file)) ).into(img_preview); | 373 | + Glide.with(homeActivity).load( Uri.fromFile(new File(file)) ).into(binding.imgPreview); |
| 404 | //Logger.d(" file " + file + " " + (int)(perSize * 1.0f * width / height) + " curScale " + curScale); | 374 | //Logger.d(" file " + file + " " + (int)(perSize * 1.0f * width / height) + " curScale " + curScale); |
| 405 | 375 | ||
| 406 | - rl_pic.setVisibility(View.VISIBLE); | 376 | + binding.rlPic.setVisibility(View.VISIBLE); |
| 407 | - rl_video.setVisibility(View.GONE); | 377 | + binding.rlVideo.setVisibility(View.GONE); |
| 408 | } | 378 | } |
| 409 | } | 379 | } |
| 410 | 380 | ||
| ... | @@ -418,44 +388,44 @@ public class ArcPlayFragment extends BaseFragment implements | ... | @@ -418,44 +388,44 @@ public class ArcPlayFragment extends BaseFragment implements |
| 418 | //video_view.seekTo(currentPosition); | 388 | //video_view.seekTo(currentPosition); |
| 419 | mPlayHandler.removeMessages(UPDATA_VIDEO_NUM); | 389 | mPlayHandler.removeMessages(UPDATA_VIDEO_NUM); |
| 420 | mPlayHandler.removeCallbacks(null); | 390 | mPlayHandler.removeCallbacks(null); |
| 421 | - video_view.start(); | 391 | + binding.videoView.start(); |
| 422 | /*} else { | 392 | /*} else { |
| 423 | video_view.resume(); | 393 | video_view.resume(); |
| 424 | }*/ | 394 | }*/ |
| 425 | - play_pasue_image.setImageResource(R.mipmap.img_play_2); | 395 | + binding.playPasueImage.setImageResource(R.mipmap.img_play_2); |
| 426 | mPlayHandler.sendEmptyMessage(UPDATA_VIDEO_NUM); | 396 | mPlayHandler.sendEmptyMessage(UPDATA_VIDEO_NUM); |
| 427 | - img_first_frame.setVisibility(View.GONE); | 397 | + binding.imgFirstFrame.setVisibility(View.GONE); |
| 428 | } catch (Exception e) { | 398 | } catch (Exception e) { |
| 429 | e.printStackTrace(); | 399 | e.printStackTrace(); |
| 430 | } | 400 | } |
| 431 | } | 401 | } |
| 432 | 402 | ||
| 433 | private void pauseAndResumeVideo() { | 403 | private void pauseAndResumeVideo() { |
| 434 | - if( video_view != null && video_view.isPlaying() ) { | 404 | + if( binding.videoView != null && binding.videoView.isPlaying() ) { |
| 435 | - video_view.pause(); | 405 | + binding.videoView.pause(); |
| 436 | - play_pasue_image.setImageResource(R.drawable.btn_play); | 406 | + binding.playPasueImage.setImageResource(R.drawable.btn_play); |
| 437 | mPlayHandler.removeMessages(UPDATA_VIDEO_NUM); | 407 | mPlayHandler.removeMessages(UPDATA_VIDEO_NUM); |
| 438 | mPlayHandler.removeCallbacks(null); | 408 | mPlayHandler.removeCallbacks(null); |
| 439 | Logger.d(" play_pasue_image pauseAndResumeVideo 4"); | 409 | Logger.d(" play_pasue_image pauseAndResumeVideo 4"); |
| 440 | - } else if( video_view != null && !video_view.isPlaying() ) { | 410 | + } else if( binding.videoView != null && !binding.videoView.isPlaying() ) { |
| 441 | //video_view.resume(); | 411 | //video_view.resume(); |
| 442 | //video_view.setVideoURI(Uri.parse(curPlayFile)); | 412 | //video_view.setVideoURI(Uri.parse(curPlayFile)); |
| 443 | mPlayHandler.removeMessages(UPDATA_VIDEO_NUM); | 413 | mPlayHandler.removeMessages(UPDATA_VIDEO_NUM); |
| 444 | mPlayHandler.removeCallbacks(null); | 414 | mPlayHandler.removeCallbacks(null); |
| 445 | - video_view.start(); | 415 | + binding.videoView.start(); |
| 446 | - play_pasue_image.setImageResource(R.mipmap.img_play_2); | 416 | + binding.playPasueImage.setImageResource(R.mipmap.img_play_2); |
| 447 | mPlayHandler.sendEmptyMessage(UPDATA_VIDEO_NUM); | 417 | mPlayHandler.sendEmptyMessage(UPDATA_VIDEO_NUM); |
| 448 | - img_first_frame.setVisibility(View.GONE); | 418 | + binding.imgFirstFrame.setVisibility(View.GONE); |
| 449 | Logger.d(" play_pasue_image pauseAndResumeVideo 5"); | 419 | Logger.d(" play_pasue_image pauseAndResumeVideo 5"); |
| 450 | } | 420 | } |
| 451 | } | 421 | } |
| 452 | 422 | ||
| 453 | private void stopVideo() { | 423 | private void stopVideo() { |
| 454 | - if( video_view != null && video_view.isPlaying() ) { | 424 | + if( binding.videoView != null && binding.videoView.isPlaying() ) { |
| 455 | - video_view.pause(); | 425 | + binding.videoView.pause(); |
| 456 | //video_view.release(); | 426 | //video_view.release(); |
| 457 | //video_view = null; | 427 | //video_view = null; |
| 458 | - play_pasue_image.setImageResource(R.drawable.btn_play); | 428 | + binding.playPasueImage.setImageResource(R.drawable.btn_play); |
| 459 | mPlayHandler.removeMessages(UPDATA_VIDEO_NUM); | 429 | mPlayHandler.removeMessages(UPDATA_VIDEO_NUM); |
| 460 | mPlayHandler.removeCallbacks(null); | 430 | mPlayHandler.removeCallbacks(null); |
| 461 | Logger.d(" stopVideo ---- "); | 431 | Logger.d(" stopVideo ---- "); |
| ... | @@ -468,11 +438,11 @@ public class ArcPlayFragment extends BaseFragment implements | ... | @@ -468,11 +438,11 @@ public class ArcPlayFragment extends BaseFragment implements |
| 468 | public void handleMessage(Message msg) { | 438 | public void handleMessage(Message msg) { |
| 469 | switch (msg.what) { | 439 | switch (msg.what) { |
| 470 | case UPDATA_VIDEO_NUM: | 440 | case UPDATA_VIDEO_NUM: |
| 471 | - currentPosition = video_view.getCurrentPosition(); | 441 | + currentPosition = binding.videoView.getCurrentPosition(); |
| 472 | //获取视频播放的当前时间 | 442 | //获取视频播放的当前时间 |
| 473 | - int currentTime = video_view.getCurrentPosition(); | 443 | + int currentTime = binding.videoView.getCurrentPosition(); |
| 474 | //获取视频的总时间 | 444 | //获取视频的总时间 |
| 475 | - int totally = video_view.getDuration(); | 445 | + int totally = binding.videoView.getDuration(); |
| 476 | if ( totally - currentTime < 1000 ) { | 446 | if ( totally - currentTime < 1000 ) { |
| 477 | currentTime = totally; | 447 | currentTime = totally; |
| 478 | } | 448 | } |
| ... | @@ -482,13 +452,13 @@ public class ArcPlayFragment extends BaseFragment implements | ... | @@ -482,13 +452,13 @@ public class ArcPlayFragment extends BaseFragment implements |
| 482 | /*updataTimeFormat(main_totally_time, | 452 | /*updataTimeFormat(main_totally_time, |
| 483 | (int)mFileListMg.showRecordInfoDB.getDuration() > 3 * 60 * 1000 ? | 453 | (int)mFileListMg.showRecordInfoDB.getDuration() > 3 * 60 * 1000 ? |
| 484 | (int)3 * 60 * 1000 : (int)mFileListMg.showRecordInfoDB.getDuration());*/ | 454 | (int)3 * 60 * 1000 : (int)mFileListMg.showRecordInfoDB.getDuration());*/ |
| 485 | - updataTimeFormat(main_totally_time, (int)mFileListMg.showRecordInfoDB.getDuration()); | 455 | + updataTimeFormat(binding.mainTotallyTime, (int)mFileListMg.showRecordInfoDB.getDuration()); |
| 486 | } | 456 | } |
| 487 | 457 | ||
| 488 | - updataTimeFormat(main_current_time, currentTime > 3 * 60 * 1000 ? 3 * 60 * 1000 : currentTime/* + 500*/); | 458 | + updataTimeFormat(binding.mainCurrentTime, currentTime > 3 * 60 * 1000 ? 3 * 60 * 1000 : currentTime/* + 500*/); |
| 489 | //设置播放进度 | 459 | //设置播放进度 |
| 490 | - main_play_seek.setMax(totally); | 460 | + binding.mainPlaySeek.setMax(totally); |
| 491 | - main_play_seek.setProgress(currentTime); | 461 | + binding.mainPlaySeek.setProgress(currentTime); |
| 492 | Logger.d(" setProgress " + (int) (currentTime * 1.0 / totally * 100) | 462 | Logger.d(" setProgress " + (int) (currentTime * 1.0 / totally * 100) |
| 493 | + " totally " + totally + " currentTime " + currentTime ); | 463 | + " totally " + totally + " currentTime " + currentTime ); |
| 494 | //自己通知自己更新 | 464 | //自己通知自己更新 | ... | ... |
| ... | @@ -4,7 +4,9 @@ import android.app.FragmentManager; | ... | @@ -4,7 +4,9 @@ import android.app.FragmentManager; |
| 4 | import android.content.Context; | 4 | import android.content.Context; |
| 5 | import android.os.Handler; | 5 | import android.os.Handler; |
| 6 | import android.view.KeyEvent; | 6 | import android.view.KeyEvent; |
| 7 | +import android.view.LayoutInflater; | ||
| 7 | import android.view.View; | 8 | import android.view.View; |
| 9 | +import android.view.ViewGroup; | ||
| 8 | import android.view.inputmethod.EditorInfo; | 10 | import android.view.inputmethod.EditorInfo; |
| 9 | import android.view.inputmethod.InputMethodManager; | 11 | import android.view.inputmethod.InputMethodManager; |
| 10 | import android.widget.AdapterView; | 12 | import android.widget.AdapterView; |
| ... | @@ -25,6 +27,7 @@ import com.sw.laryngoscope.activity.HomeActivity; | ... | @@ -25,6 +27,7 @@ import com.sw.laryngoscope.activity.HomeActivity; |
| 25 | import com.sw.laryngoscope.adapter.FolderItemAdapter; | 27 | import com.sw.laryngoscope.adapter.FolderItemAdapter; |
| 26 | import com.sw.laryngoscope.adapter.SpaceItemDecoration; | 28 | import com.sw.laryngoscope.adapter.SpaceItemDecoration; |
| 27 | import com.sw.laryngoscope.common.InitParam; | 29 | import com.sw.laryngoscope.common.InitParam; |
| 30 | +import com.sw.laryngoscope.databinding.FgArchiveBinding; | ||
| 28 | import com.sw.laryngoscope.db.AccountInfoDB; | 31 | import com.sw.laryngoscope.db.AccountInfoDB; |
| 29 | import com.sw.laryngoscope.db.FileDayBean; | 32 | import com.sw.laryngoscope.db.FileDayBean; |
| 30 | import com.sw.laryngoscope.db.FileInfoMonthBean; | 33 | import com.sw.laryngoscope.db.FileInfoMonthBean; |
| ... | @@ -40,33 +43,11 @@ import java.util.ArrayList; | ... | @@ -40,33 +43,11 @@ import java.util.ArrayList; |
| 40 | import java.util.Calendar; | 43 | import java.util.Calendar; |
| 41 | import java.util.List; | 44 | import java.util.List; |
| 42 | 45 | ||
| 43 | -import butterknife.BindView; | ||
| 44 | -import butterknife.OnClick; | ||
| 45 | 46 | ||
| 46 | -public class ArchiveFragment extends BaseFragment implements CustomTimer.TimerCallBack, FolderItemAdapter.OnClickLitener { | 47 | +public class ArchiveFragment extends BaseFragment<FgArchiveBinding> implements CustomTimer.TimerCallBack, FolderItemAdapter.OnClickLitener { |
| 47 | 48 | ||
| 48 | private static final String TAG = "ArchiveFragment"; | 49 | private static final String TAG = "ArchiveFragment"; |
| 49 | private Context context; | 50 | private Context context; |
| 50 | - | ||
| 51 | - @BindView(R.id.lay_back) | ||
| 52 | - LinearLayout lay_back; | ||
| 53 | - | ||
| 54 | - @BindView(R.id.layout_time_sel) | ||
| 55 | - RelativeLayout layout_time_sel; | ||
| 56 | - @BindView(R.id.btn_time_sel) | ||
| 57 | - TextView btn_time_sel; | ||
| 58 | - | ||
| 59 | - @BindView(R.id.txt_search) | ||
| 60 | - EditText txt_search; | ||
| 61 | - | ||
| 62 | - @BindView(R.id.layout_archive_file) | ||
| 63 | - View layout_archive_file; | ||
| 64 | - @BindView(R.id.rv_file_list) | ||
| 65 | - RecyclerView rv_file_list; | ||
| 66 | - | ||
| 67 | - @BindView(R.id.archive_fragment) | ||
| 68 | - FrameLayout archive_fragment; | ||
| 69 | - | ||
| 70 | private CustomTimer scrollTimer; | 51 | private CustomTimer scrollTimer; |
| 71 | private final String timerTAG_scroll = "scroll"; | 52 | private final String timerTAG_scroll = "scroll"; |
| 72 | 53 | ||
| ... | @@ -131,6 +112,11 @@ public class ArchiveFragment extends BaseFragment implements CustomTimer.TimerCa | ... | @@ -131,6 +112,11 @@ public class ArchiveFragment extends BaseFragment implements CustomTimer.TimerCa |
| 131 | enterCurPos(); | 112 | enterCurPos(); |
| 132 | } | 113 | } |
| 133 | 114 | ||
| 115 | + @Override | ||
| 116 | + protected FgArchiveBinding getViewBinding(LayoutInflater inflater, ViewGroup container) { | ||
| 117 | + return FgArchiveBinding.inflate(inflater,container,false); | ||
| 118 | + } | ||
| 119 | + | ||
| 134 | public void hideWin() { | 120 | public void hideWin() { |
| 135 | if ( currFragment != null && currFragment == graphicReportFragment && currFragment.isVisible() ) { | 121 | if ( currFragment != null && currFragment == graphicReportFragment && currFragment.isVisible() ) { |
| 136 | backDetailFg(); | 122 | backDetailFg(); |
| ... | @@ -147,27 +133,22 @@ public class ArchiveFragment extends BaseFragment implements CustomTimer.TimerCa | ... | @@ -147,27 +133,22 @@ public class ArchiveFragment extends BaseFragment implements CustomTimer.TimerCa |
| 147 | } | 133 | } |
| 148 | 134 | ||
| 149 | @Override | 135 | @Override |
| 150 | - protected int rootLayout() { | ||
| 151 | - return R.layout.fg_archive; | ||
| 152 | - } | ||
| 153 | - | ||
| 154 | - @Override | ||
| 155 | protected void init() { | 136 | protected void init() { |
| 156 | fragmentManager = getChildFragmentManager(); | 137 | fragmentManager = getChildFragmentManager(); |
| 157 | //layout_home_home_guest = (ConstraintLayout) rootView.findViewById(R.id.layout_home_home_guest); | 138 | //layout_home_home_guest = (ConstraintLayout) rootView.findViewById(R.id.layout_home_home_guest); |
| 158 | - txt_search.setOnEditorActionListener(new EditText.OnEditorActionListener() { | 139 | + binding.layoutArchiveFile.txtSearch.setOnEditorActionListener(new EditText.OnEditorActionListener() { |
| 159 | @Override | 140 | @Override |
| 160 | public boolean onEditorAction(TextView v, int actionId, | 141 | public boolean onEditorAction(TextView v, int actionId, |
| 161 | KeyEvent event) { | 142 | KeyEvent event) { |
| 162 | if (actionId == EditorInfo.IME_ACTION_SEARCH) { | 143 | if (actionId == EditorInfo.IME_ACTION_SEARCH) { |
| 163 | // 执行搜索功能 | 144 | // 执行搜索功能 |
| 164 | hideIm(); | 145 | hideIm(); |
| 165 | - Logger.d(" onEditorAction " + txt_search.getText().toString().trim()); | 146 | + Logger.d(" onEditorAction " + binding.layoutArchiveFile.txtSearch.getText().toString().trim()); |
| 166 | if ( mFileListMg.curFoldLevel == InitParam.FOLDER_LEVEL.L_ONE.ordinal() ) { | 147 | if ( mFileListMg.curFoldLevel == InitParam.FOLDER_LEVEL.L_ONE.ordinal() ) { |
| 167 | return false; | 148 | return false; |
| 168 | } | 149 | } |
| 169 | - if ( !txt_search.getText().toString().isEmpty() ) { | 150 | + if ( !binding.layoutArchiveFile.txtSearch.getText().toString().isEmpty() ) { |
| 170 | - mFileListMg.initSearchList(txt_search.getText().toString().trim()); | 151 | + mFileListMg.initSearchList(binding.layoutArchiveFile.txtSearch.getText().toString().trim()); |
| 171 | mFolderAdapter.setList(mFileListMg.folderList); | 152 | mFolderAdapter.setList(mFileListMg.folderList); |
| 172 | mFolderAdapter.notifyDataSetChanged(); | 153 | mFolderAdapter.notifyDataSetChanged(); |
| 173 | } | 154 | } |
| ... | @@ -176,15 +157,15 @@ public class ArchiveFragment extends BaseFragment implements CustomTimer.TimerCa | ... | @@ -176,15 +157,15 @@ public class ArchiveFragment extends BaseFragment implements CustomTimer.TimerCa |
| 176 | } | 157 | } |
| 177 | }); | 158 | }); |
| 178 | 159 | ||
| 179 | - rv_file_list.setLayoutManager(new GridLayoutManager(getContext(), 4)); | 160 | + binding.layoutArchiveFile.rvFileList.setLayoutManager(new GridLayoutManager(getContext(), 4)); |
| 180 | - rv_file_list.addItemDecoration(new SpaceItemDecoration(85, 50)); | 161 | + binding.layoutArchiveFile.rvFileList.addItemDecoration(new SpaceItemDecoration(85, 50)); |
| 181 | - rv_file_list.setHasFixedSize(false); | 162 | + binding.layoutArchiveFile.rvFileList.setHasFixedSize(false); |
| 182 | 163 | ||
| 183 | mFileListMg = new FileListMg(homeActivity.getContext()); | 164 | mFileListMg = new FileListMg(homeActivity.getContext()); |
| 184 | 165 | ||
| 185 | initFile(); | 166 | initFile(); |
| 186 | mFolderAdapter = new FolderItemAdapter(getContext(), mFileListMg.folderList, mFileListMg); | 167 | mFolderAdapter = new FolderItemAdapter(getContext(), mFileListMg.folderList, mFileListMg); |
| 187 | - rv_file_list.setAdapter(mFolderAdapter); | 168 | + binding.layoutArchiveFile.rvFileList.setAdapter(mFolderAdapter); |
| 188 | /*if ( mFileListMg.curDateFileList.size() > 0 ) { | 169 | /*if ( mFileListMg.curDateFileList.size() > 0 ) { |
| 189 | mFileAdapter.notifyDataSetChanged(); | 170 | mFileAdapter.notifyDataSetChanged(); |
| 190 | }*/ | 171 | }*/ |
| ... | @@ -196,7 +177,7 @@ public class ArchiveFragment extends BaseFragment implements CustomTimer.TimerCa | ... | @@ -196,7 +177,7 @@ public class ArchiveFragment extends BaseFragment implements CustomTimer.TimerCa |
| 196 | SpManager.get_file_show_time() == i); | 177 | SpManager.get_file_show_time() == i); |
| 197 | getdata.add(timeInfoBean); | 178 | getdata.add(timeInfoBean); |
| 198 | } | 179 | } |
| 199 | - btn_time_sel.setText(InitParam.FILE_TIME_RES[SpManager.get_file_show_time()]); | 180 | + binding.layoutArchiveFile.btnTimeSel.setText(InitParam.FILE_TIME_RES[SpManager.get_file_show_time()]); |
| 200 | mTimePopWindow = new TimePopWindow<TimeInfoBean>(homeActivity, | 181 | mTimePopWindow = new TimePopWindow<TimeInfoBean>(homeActivity, |
| 201 | getdata, itemClickListener); | 182 | getdata, itemClickListener); |
| 202 | mTimePopWindow.setOnDismissListener(dismissListener); | 183 | mTimePopWindow.setOnDismissListener(dismissListener); |
| ... | @@ -208,12 +189,12 @@ public class ArchiveFragment extends BaseFragment implements CustomTimer.TimerCa | ... | @@ -208,12 +189,12 @@ public class ArchiveFragment extends BaseFragment implements CustomTimer.TimerCa |
| 208 | if ( userDb.getUserType() == InitParam.USER_TYPE_ADMIN ) { | 189 | if ( userDb.getUserType() == InitParam.USER_TYPE_ADMIN ) { |
| 209 | mFileListMg.curFoldLevel = InitParam.FOLDER_LEVEL.L_ONE.ordinal(); | 190 | mFileListMg.curFoldLevel = InitParam.FOLDER_LEVEL.L_ONE.ordinal(); |
| 210 | mFileListMg.initList(); | 191 | mFileListMg.initList(); |
| 211 | - layout_time_sel.setVisibility(View.GONE); | 192 | + binding.layoutArchiveFile.btnTimeSel.setVisibility(View.GONE); |
| 212 | - txt_search.setVisibility(View.GONE); | 193 | + binding.layoutArchiveFile.txtSearch.setVisibility(View.GONE); |
| 213 | } else { | 194 | } else { |
| 214 | selTwoFold(userDb.getName()); | 195 | selTwoFold(userDb.getName()); |
| 215 | - layout_time_sel.setVisibility(View.VISIBLE); | 196 | + binding.layoutArchiveFile.btnTimeSel.setVisibility(View.VISIBLE); |
| 216 | - txt_search.setVisibility(View.VISIBLE); | 197 | + binding.layoutArchiveFile.txtSearch.setVisibility(View.VISIBLE); |
| 217 | } | 198 | } |
| 218 | } | 199 | } |
| 219 | 200 | ||
| ... | @@ -228,7 +209,7 @@ public class ArchiveFragment extends BaseFragment implements CustomTimer.TimerCa | ... | @@ -228,7 +209,7 @@ public class ArchiveFragment extends BaseFragment implements CustomTimer.TimerCa |
| 228 | mFileListMg.curSelUserName = ""; | 209 | mFileListMg.curSelUserName = ""; |
| 229 | mFolderAdapter.setList(mFileListMg.folderList); | 210 | mFolderAdapter.setList(mFileListMg.folderList); |
| 230 | mFolderAdapter.notifyDataSetChanged(); | 211 | mFolderAdapter.notifyDataSetChanged(); |
| 231 | - lay_back.setVisibility(View.GONE); | 212 | + binding.layBack.setVisibility(View.GONE); |
| 232 | } | 213 | } |
| 233 | fileCount = tmpCount; | 214 | fileCount = tmpCount; |
| 234 | userCount = accCount; | 215 | userCount = accCount; |
| ... | @@ -236,11 +217,39 @@ public class ArchiveFragment extends BaseFragment implements CustomTimer.TimerCa | ... | @@ -236,11 +217,39 @@ public class ArchiveFragment extends BaseFragment implements CustomTimer.TimerCa |
| 236 | 217 | ||
| 237 | @Override | 218 | @Override |
| 238 | protected void setListener() { | 219 | protected void setListener() { |
| 220 | + binding.layoutArchiveFile.btnTimeSel.setOnClickListener(new View.OnClickListener() { | ||
| 221 | + @Override | ||
| 222 | + public void onClick(View v) { | ||
| 223 | + if (isShowDialog) { | ||
| 224 | + isShowDialog = false; | ||
| 225 | + if (mTimePopWindow != null) { | ||
| 226 | + mTimePopWindow.dismiss(); | ||
| 227 | + } | ||
| 228 | + } else { | ||
| 229 | + isShowDialog = true; | ||
| 230 | + mTimePopWindow.setList(getdata); | ||
| 231 | + if (mTimePopWindow != null) { | ||
| 232 | + mTimePopWindow.showAsDropDown(binding.layoutArchiveFile.btnTimeSel, 0, 5); | ||
| 233 | + } | ||
| 234 | + } | ||
| 235 | + } | ||
| 236 | + }); | ||
| 237 | + | ||
| 238 | + binding.layBack.setOnClickListener(new View.OnClickListener() { | ||
| 239 | + @Override | ||
| 240 | + public void onClick(View v) { | ||
| 241 | + binding.layBack.setVisibility(View.GONE); | ||
| 242 | + mFileListMg.curSelUserName = ""; | ||
| 243 | + initFile(); | ||
| 244 | + mFolderAdapter.setList(mFileListMg.folderList); | ||
| 245 | + mFolderAdapter.notifyDataSetChanged(); | ||
| 246 | + } | ||
| 247 | + }); | ||
| 239 | } | 248 | } |
| 240 | 249 | ||
| 241 | public void selTwoFold(String user) { | 250 | public void selTwoFold(String user) { |
| 242 | - layout_time_sel.setVisibility(View.VISIBLE); | 251 | + binding.layoutArchiveFile.layoutTimeSel.setVisibility(View.VISIBLE); |
| 243 | - txt_search.setVisibility(View.VISIBLE); | 252 | + binding.layoutArchiveFile.txtSearch.setVisibility(View.VISIBLE); |
| 244 | 253 | ||
| 245 | mFileListMg.curFoldLevel = InitParam.FOLDER_LEVEL.L_TWO.ordinal(); | 254 | mFileListMg.curFoldLevel = InitParam.FOLDER_LEVEL.L_TWO.ordinal(); |
| 246 | mFileListMg.curSelUserName = user; | 255 | mFileListMg.curSelUserName = user; |
| ... | @@ -257,7 +266,7 @@ public class ArchiveFragment extends BaseFragment implements CustomTimer.TimerCa | ... | @@ -257,7 +266,7 @@ public class ArchiveFragment extends BaseFragment implements CustomTimer.TimerCa |
| 257 | selTwoFold(user); | 266 | selTwoFold(user); |
| 258 | mFolderAdapter.setList(mFileListMg.folderList); | 267 | mFolderAdapter.setList(mFileListMg.folderList); |
| 259 | mFolderAdapter.notifyDataSetChanged(); | 268 | mFolderAdapter.notifyDataSetChanged(); |
| 260 | - lay_back.setVisibility(View.VISIBLE); | 269 | + binding.layBack.setVisibility(View.VISIBLE); |
| 261 | } | 270 | } |
| 262 | 271 | ||
| 263 | @Override | 272 | @Override |
| ... | @@ -268,7 +277,7 @@ public class ArchiveFragment extends BaseFragment implements CustomTimer.TimerCa | ... | @@ -268,7 +277,7 @@ public class ArchiveFragment extends BaseFragment implements CustomTimer.TimerCa |
| 268 | (new Handler()).post( new Runnable() { | 277 | (new Handler()).post( new Runnable() { |
| 269 | @Override | 278 | @Override |
| 270 | public void run() { | 279 | public void run() { |
| 271 | - lay_back.setVisibility(View.GONE); | 280 | + binding.layBack.setVisibility(View.GONE); |
| 272 | if (arcDetailFragment == null) { | 281 | if (arcDetailFragment == null) { |
| 273 | arcDetailFragment = new ArcDetailFragment(); | 282 | arcDetailFragment = new ArcDetailFragment(); |
| 274 | arcDetailFragment.setHomeActivity(homeActivity); | 283 | arcDetailFragment.setHomeActivity(homeActivity); |
| ... | @@ -284,45 +293,9 @@ public class ArchiveFragment extends BaseFragment implements CustomTimer.TimerCa | ... | @@ -284,45 +293,9 @@ public class ArchiveFragment extends BaseFragment implements CustomTimer.TimerCa |
| 284 | }); | 293 | }); |
| 285 | } | 294 | } |
| 286 | 295 | ||
| 287 | - @Override | ||
| 288 | - @OnClick({ R.id.btn_time_sel, R.id.lay_back, }) | ||
| 289 | - public void onClick(View v) { | ||
| 290 | - switch (v.getId()) { | ||
| 291 | - /*case R.id.lay_back: | ||
| 292 | - homeActivity.showHomeFragment(); | ||
| 293 | - break; | ||
| 294 | - case R.id.rb_recent: | ||
| 295 | - rv_file_list.scrollToPosition(0); | ||
| 296 | - break;*/ | ||
| 297 | - case R.id.lay_back: | ||
| 298 | - lay_back.setVisibility(View.GONE); | ||
| 299 | - mFileListMg.curSelUserName = ""; | ||
| 300 | - initFile(); | ||
| 301 | - mFolderAdapter.setList(mFileListMg.folderList); | ||
| 302 | - mFolderAdapter.notifyDataSetChanged(); | ||
| 303 | - break; | ||
| 304 | - case R.id.btn_time_sel: | ||
| 305 | - if (isShowDialog) { | ||
| 306 | - isShowDialog = false; | ||
| 307 | - if (mTimePopWindow != null) { | ||
| 308 | - mTimePopWindow.dismiss(); | ||
| 309 | - } | ||
| 310 | - } else { | ||
| 311 | - isShowDialog = true; | ||
| 312 | - mTimePopWindow.setList(getdata); | ||
| 313 | - if (mTimePopWindow != null) { | ||
| 314 | - mTimePopWindow.showAsDropDown(btn_time_sel, 0, 5); | ||
| 315 | - } | ||
| 316 | - } | ||
| 317 | - break; | ||
| 318 | - default: | ||
| 319 | - break; | ||
| 320 | - } | ||
| 321 | - } | ||
| 322 | - | ||
| 323 | public synchronized void showFragment(BaseFragment targetFragment) { | 296 | public synchronized void showFragment(BaseFragment targetFragment) { |
| 324 | - layout_archive_file.setVisibility(View.GONE); | 297 | + binding.layoutArchiveFile.getRoot().setVisibility(View.GONE); |
| 325 | - archive_fragment.setVisibility(View.VISIBLE); | 298 | + binding.archiveFragment.getRootView().setVisibility(View.VISIBLE); |
| 326 | if (currFragment == null) { | 299 | if (currFragment == null) { |
| 327 | Logger.d(TAG, "======showFragment======2"); | 300 | Logger.d(TAG, "======showFragment======2"); |
| 328 | fragmentManager.beginTransaction() | 301 | fragmentManager.beginTransaction() |
| ... | @@ -346,11 +319,11 @@ public class ArchiveFragment extends BaseFragment implements CustomTimer.TimerCa | ... | @@ -346,11 +319,11 @@ public class ArchiveFragment extends BaseFragment implements CustomTimer.TimerCa |
| 346 | 319 | ||
| 347 | public void backHomeFragment() { | 320 | public void backHomeFragment() { |
| 348 | if ( userDb.getUserType() == InitParam.USER_TYPE_ADMIN ) { | 321 | if ( userDb.getUserType() == InitParam.USER_TYPE_ADMIN ) { |
| 349 | - lay_back.setVisibility(View.VISIBLE); | 322 | + binding.layBack.setVisibility(View.VISIBLE); |
| 350 | } | 323 | } |
| 351 | 324 | ||
| 352 | - layout_archive_file.setVisibility(View.VISIBLE); | 325 | + binding.layoutArchiveFile.getRoot().setVisibility(View.VISIBLE); |
| 353 | - archive_fragment.setVisibility(View.GONE); | 326 | + binding.archiveFragment.getRootView().setVisibility(View.GONE); |
| 354 | if ( currFragment != null ) { | 327 | if ( currFragment != null ) { |
| 355 | fragmentManager.beginTransaction().hide(currFragment).commit(); | 328 | fragmentManager.beginTransaction().hide(currFragment).commit(); |
| 356 | } | 329 | } |
| ... | @@ -458,7 +431,7 @@ public class ArchiveFragment extends BaseFragment implements CustomTimer.TimerCa | ... | @@ -458,7 +431,7 @@ public class ArchiveFragment extends BaseFragment implements CustomTimer.TimerCa |
| 458 | isShowDialog = false; | 431 | isShowDialog = false; |
| 459 | mTimePopWindow.dismiss(); | 432 | mTimePopWindow.dismiss(); |
| 460 | if ( getdata.size() > 0 ) { | 433 | if ( getdata.size() > 0 ) { |
| 461 | - btn_time_sel.setText(getdata.get(position).getTxt_cap()); | 434 | + binding.layoutArchiveFile.btnTimeSel.setText(getdata.get(position).getTxt_cap()); |
| 462 | if ( position == 0 ) { | 435 | if ( position == 0 ) { |
| 463 | mFileListMg.curSelYear = Calendar.getInstance().get(Calendar.YEAR) + ""; | 436 | mFileListMg.curSelYear = Calendar.getInstance().get(Calendar.YEAR) + ""; |
| 464 | } else if ( position == 1 ) { | 437 | } else if ( position == 1 ) { | ... | ... |
| ... | @@ -9,6 +9,7 @@ import android.os.ParcelFileDescriptor; | ... | @@ -9,6 +9,7 @@ import android.os.ParcelFileDescriptor; |
| 9 | import android.util.Log; | 9 | import android.util.Log; |
| 10 | import android.view.LayoutInflater; | 10 | import android.view.LayoutInflater; |
| 11 | import android.view.View; | 11 | import android.view.View; |
| 12 | +import android.view.ViewGroup; | ||
| 12 | import android.view.WindowManager; | 13 | import android.view.WindowManager; |
| 13 | import android.view.inputmethod.InputMethodManager; | 14 | import android.view.inputmethod.InputMethodManager; |
| 14 | import android.widget.EditText; | 15 | import android.widget.EditText; |
| ... | @@ -34,6 +35,7 @@ import com.sw.laryngoscope.activity.HomeActivity; | ... | @@ -34,6 +35,7 @@ import com.sw.laryngoscope.activity.HomeActivity; |
| 34 | import com.sw.laryngoscope.camera.VideoManager; | 35 | import com.sw.laryngoscope.camera.VideoManager; |
| 35 | import com.sw.laryngoscope.camera.VideoModule; | 36 | import com.sw.laryngoscope.camera.VideoModule; |
| 36 | import com.sw.laryngoscope.common.InitParam; | 37 | import com.sw.laryngoscope.common.InitParam; |
| 38 | +import com.sw.laryngoscope.databinding.FgArchiveReportBinding; | ||
| 37 | import com.sw.laryngoscope.db.RecordInfoDB; | 39 | import com.sw.laryngoscope.db.RecordInfoDB; |
| 38 | import com.sw.laryngoscope.manager.SpManager; | 40 | import com.sw.laryngoscope.manager.SpManager; |
| 39 | import com.sw.laryngoscope.manager.StorageStateManager; | 41 | import com.sw.laryngoscope.manager.StorageStateManager; |
| ... | @@ -48,60 +50,18 @@ import java.util.ArrayList; | ... | @@ -48,60 +50,18 @@ import java.util.ArrayList; |
| 48 | import java.util.Date; | 50 | import java.util.Date; |
| 49 | import java.util.List; | 51 | import java.util.List; |
| 50 | 52 | ||
| 51 | -import butterknife.BindView; | ||
| 52 | -import butterknife.OnClick; | ||
| 53 | 53 | ||
| 54 | -public class GraphicReportFragment extends BaseFragment implements | 54 | +public class GraphicReportFragment extends BaseFragment<FgArchiveReportBinding> |
| 55 | - CustomTimer.TimerCallBack, RadioGroup.OnCheckedChangeListener, | 55 | + implements CustomTimer.TimerCallBack, RadioGroup.OnCheckedChangeListener, |
| 56 | StorageStateManager.MountCallBack, PdfUtil.pdfCallback { | 56 | StorageStateManager.MountCallBack, PdfUtil.pdfCallback { |
| 57 | 57 | ||
| 58 | private static final String TAG = "GraphicReportFragment"; | 58 | private static final String TAG = "GraphicReportFragment"; |
| 59 | 59 | ||
| 60 | - @BindView(R.id.lay_back) | ||
| 61 | - LinearLayout lay_back; | ||
| 62 | - | ||
| 63 | - @BindView(R.id.fg_archive_report_info) | ||
| 64 | - View fg_archive_report_info; | ||
| 65 | - @BindView(R.id.ed_name) | ||
| 66 | - EditText ed_name; | ||
| 67 | - @BindView(R.id.ed_age) | ||
| 68 | - EditText ed_age; | ||
| 69 | - @BindView(R.id.ed_patient_id) | ||
| 70 | - EditText ed_patient_id; | ||
| 71 | - @BindView(R.id.ed_hospital) | ||
| 72 | - EditText ed_hospital; | ||
| 73 | - @BindView(R.id.ed_department) | ||
| 74 | - EditText ed_department; | ||
| 75 | - @BindView(R.id.ed_diagnosis) | ||
| 76 | - EditText ed_diagnosis; | ||
| 77 | - | ||
| 78 | - @BindView(R.id.rg_sex) | ||
| 79 | - RadioGroup rg_sex; | ||
| 80 | - @BindView(R.id.rb_male) | ||
| 81 | - RadioButton rb_male; | ||
| 82 | - @BindView(R.id.rb_female) | ||
| 83 | - RadioButton rb_female; | ||
| 84 | - | ||
| 85 | - @BindView(R.id.txt_report_pdf) | ||
| 86 | - TextView txt_report_pdf; | ||
| 87 | - | ||
| 88 | - @BindView(R.id.lay_doctor_sign) | ||
| 89 | - RelativeLayout lay_doctor_sign; | ||
| 90 | - @BindView(R.id.img_doc_sign) | ||
| 91 | - ImageView img_doc_sign; | ||
| 92 | - | ||
| 93 | - @BindView(R.id.txt_image_num_value) | ||
| 94 | - TextView txt_image_num_value; | ||
| 95 | - | ||
| 96 | - @BindView(R.id.pdf_view) | ||
| 97 | - PDFView pdf_view; | ||
| 98 | - | ||
| 99 | private CustomTimer scrollTimer; | 60 | private CustomTimer scrollTimer; |
| 100 | private final String timerTAG_scroll = "scroll"; | 61 | private final String timerTAG_scroll = "scroll"; |
| 101 | 62 | ||
| 102 | FileListMg mFileListMg; | 63 | FileListMg mFileListMg; |
| 103 | PdfUtil mPdfUtil; | 64 | PdfUtil mPdfUtil; |
| 104 | - | ||
| 105 | String signPath = ""; | 65 | String signPath = ""; |
| 106 | List<String> selPic = new ArrayList<>(); | 66 | List<String> selPic = new ArrayList<>(); |
| 107 | String createTime = ""; | 67 | String createTime = ""; |
| ... | @@ -111,6 +71,11 @@ public class GraphicReportFragment extends BaseFragment implements | ... | @@ -111,6 +71,11 @@ public class GraphicReportFragment extends BaseFragment implements |
| 111 | RecordInfoDB mCurPdfDB; | 71 | RecordInfoDB mCurPdfDB; |
| 112 | 72 | ||
| 113 | @Override | 73 | @Override |
| 74 | + protected FgArchiveReportBinding getViewBinding(LayoutInflater inflater, ViewGroup container) { | ||
| 75 | + return FgArchiveReportBinding.inflate(inflater, container, false); | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + @Override | ||
| 114 | public void onAttach(Context context) { | 79 | public void onAttach(Context context) { |
| 115 | super.onAttach(context); | 80 | super.onAttach(context); |
| 116 | homeActivity = (HomeActivity) context; | 81 | homeActivity = (HomeActivity) context; |
| ... | @@ -141,21 +106,16 @@ public class GraphicReportFragment extends BaseFragment implements | ... | @@ -141,21 +106,16 @@ public class GraphicReportFragment extends BaseFragment implements |
| 141 | } | 106 | } |
| 142 | 107 | ||
| 143 | @Override | 108 | @Override |
| 144 | - protected int rootLayout() { | ||
| 145 | - return R.layout.fg_archive_report; | ||
| 146 | - } | ||
| 147 | - | ||
| 148 | - @Override | ||
| 149 | protected void init() { | 109 | protected void init() { |
| 150 | Logger.d(" curRecordInfoPos " + mFileListMg.curRecordInfoPos); | 110 | Logger.d(" curRecordInfoPos " + mFileListMg.curRecordInfoPos); |
| 151 | initView(); | 111 | initView(); |
| 152 | - ed_diagnosis.setHorizontallyScrolling(false); | 112 | + binding.fgArchiveReportInfo.edDiagnosis.setHorizontallyScrolling(false); |
| 153 | - ed_diagnosis.setMaxLines(Integer.MAX_VALUE); | 113 | + binding.fgArchiveReportInfo.edDiagnosis.setMaxLines(Integer.MAX_VALUE); |
| 154 | } | 114 | } |
| 155 | 115 | ||
| 156 | public void initView() { | 116 | public void initView() { |
| 157 | - ed_hospital.setText(SpManager.get_value_hospital()); | 117 | + binding.fgArchiveReportInfo.edHospital.setText(SpManager.get_value_hospital()); |
| 158 | - ed_department.setText(SpManager.get_value_department()); | 118 | + binding.fgArchiveReportInfo.edDepartment.setText(SpManager.get_value_department()); |
| 159 | selPic.clear(); | 119 | selPic.clear(); |
| 160 | for ( RecordInfoDB tmp:mFileListMg.selectList ) { | 120 | for ( RecordInfoDB tmp:mFileListMg.selectList ) { |
| 161 | if ( tmp.getType() == InitParam.FILE_PHOTO ) { | 121 | if ( tmp.getType() == InitParam.FILE_PHOTO ) { |
| ... | @@ -165,112 +125,122 @@ public class GraphicReportFragment extends BaseFragment implements | ... | @@ -165,112 +125,122 @@ public class GraphicReportFragment extends BaseFragment implements |
| 165 | } | 125 | } |
| 166 | } | 126 | } |
| 167 | mVideoManager = homeActivity.getmVideoModule().getmVideoManager(); | 127 | mVideoManager = homeActivity.getmVideoModule().getmVideoManager(); |
| 168 | - txt_image_num_value.setText(mFileListMg.selectList.size() + ""); | 128 | + binding.txtImageNumValue.setText(mFileListMg.selectList.size() + ""); |
| 169 | - img_doc_sign.setVisibility(View.GONE); | 129 | + binding.fgArchiveReportInfo.imgDocSign.setVisibility(View.GONE); |
| 170 | - | 130 | + |
| 171 | - ed_name.setText(""); | 131 | + binding.fgArchiveReportInfo.edName.setText(""); |
| 172 | - ed_age.setText(""); | 132 | + binding.fgArchiveReportInfo.edAge.setText(""); |
| 173 | - ed_patient_id.setText(""); | 133 | + binding.fgArchiveReportInfo.edPatientId.setText(""); |
| 174 | - ed_diagnosis.setText(""); | 134 | + binding.fgArchiveReportInfo.edDiagnosis.setText(""); |
| 175 | - rb_male.setChecked(true); | 135 | + binding.fgArchiveReportInfo.rbMale.setChecked(true); |
| 176 | - | 136 | + |
| 177 | - fg_archive_report_info.setVisibility(View.VISIBLE); | 137 | + binding.fgArchiveReportInfo.getRoot().setVisibility(View.VISIBLE); |
| 178 | - pdf_view.setVisibility(View.GONE); | 138 | + binding.pdfView.setVisibility(View.GONE); |
| 179 | - txt_report_pdf.setVisibility(View.VISIBLE); | 139 | + binding.txtReportPdf.setVisibility(View.VISIBLE); |
| 180 | } | 140 | } |
| 181 | 141 | ||
| 182 | @Override | 142 | @Override |
| 183 | protected void setListener() { | 143 | protected void setListener() { |
| 184 | - rg_sex.setOnCheckedChangeListener(this); | 144 | + binding.fgArchiveReportInfo.rgSex.setOnCheckedChangeListener(this); |
| 145 | + binding.layBack.setOnClickListener(new View.OnClickListener() { | ||
| 146 | + @Override | ||
| 147 | + public void onClick(View v) { | ||
| 148 | + exitCurWin(); | ||
| 149 | + } | ||
| 150 | + }); | ||
| 151 | + binding.fgArchiveReportInfo.layDoctorSign.setOnClickListener(new View.OnClickListener() { | ||
| 152 | + @Override | ||
| 153 | + public void onClick(View v) { | ||
| 154 | + showSignDailog(); | ||
| 155 | + } | ||
| 156 | + } ); | ||
| 157 | + binding.txtReportPdf.setOnClickListener(new View.OnClickListener() { | ||
| 158 | + @Override | ||
| 159 | + public void onClick(View v) { | ||
| 160 | + generatePdf(); | ||
| 161 | + } | ||
| 162 | + }); | ||
| 185 | } | 163 | } |
| 186 | 164 | ||
| 187 | - public void exitCurWin() { | 165 | + private void generatePdf() { |
| 188 | - fg_archive_report_info.setVisibility(View.VISIBLE); | 166 | + final int sex = binding.fgArchiveReportInfo.rbMale.isChecked() ? 0 : 1; |
| 189 | - pdf_view.setVisibility(View.GONE); | 167 | + SpManager.set_value_hospital(binding.fgArchiveReportInfo.edHospital.getText().toString()); |
| 190 | - txt_report_pdf.setVisibility(View.VISIBLE); | 168 | + SpManager.set_value_department(binding.fgArchiveReportInfo.edDepartment.getText().toString()); |
| 191 | - | 169 | + hideIm(); |
| 192 | - homeFragment.backDetailFg(); | ||
| 193 | - signPath = ""; | ||
| 194 | - } | ||
| 195 | 170 | ||
| 196 | - @Override | 171 | + if (!binding.fgArchiveReportInfo.edName.getText().toString().isEmpty() |
| 197 | - @OnClick({ R.id.lay_back, R.id.lay_doctor_sign, R.id.txt_report_pdf, }) | 172 | + && !binding.fgArchiveReportInfo.edAge.getText().toString().isEmpty() |
| 198 | - public void onClick(View v) { | 173 | + && !binding.fgArchiveReportInfo.edPatientId.getText().toString().isEmpty()) { |
| 199 | - switch (v.getId()) { | 174 | + binding.txtReportPdf.setEnabled(false); |
| 200 | - case R.id.lay_back: | 175 | + new Thread(new Runnable() { |
| 201 | - /*if ( pdf_view.getVisibility() == View.VISIBLE ) { | 176 | + @Override |
| 202 | - fg_archive_report_info.setVisibility(View.VISIBLE); | 177 | + public void run() { |
| 203 | - pdf_view.setVisibility(View.GONE); | 178 | + try { |
| 204 | - txt_report_pdf.setVisibility(View.VISIBLE); | 179 | + saveDataDb(); |
| 205 | - } else {*/ | 180 | + mPdfUtil.setParam( |
| 206 | - exitCurWin(); | 181 | + binding.fgArchiveReportInfo.edName.getText().toString(), |
| 207 | - //} | 182 | + sex, |
| 208 | - break; | 183 | + binding.fgArchiveReportInfo.edAge.getText().toString(), |
| 209 | - case R.id.lay_doctor_sign: | 184 | + binding.fgArchiveReportInfo.edPatientId.getText().toString(), |
| 210 | - showSignDailog(); | 185 | + binding.fgArchiveReportInfo.edDiagnosis.getText().toString(), |
| 211 | - break; | 186 | + binding.fgArchiveReportInfo.edHospital.getText().toString(), |
| 212 | - case R.id.txt_report_pdf: | 187 | + binding.fgArchiveReportInfo.edDepartment.getText().toString(), |
| 213 | - int sex = rb_male.isChecked() ? 0 : 1;//0 男 1 女 | 188 | + signPath, selPic.toArray(new String[0]), createTime |
| 214 | - SpManager.set_value_hospital(ed_hospital.getText().toString()); | 189 | + ); |
| 215 | - SpManager.set_value_department(ed_department.getText().toString()); | 190 | + mPdfUtil.createPDF(mCurPdfDB.getFilepath() + "/" + mCurPdfDB.getFilename()); |
| 216 | - hideIm(); | 191 | + } catch (Exception e) { |
| 217 | - | 192 | + Logger.d("PDF 生成失败: " + e.getMessage()); |
| 218 | - if ( !ed_name.getText().toString().isEmpty() | 193 | + } |
| 219 | - && !ed_age.getText().toString().isEmpty() | ||
| 220 | - && !ed_patient_id.getText().toString().isEmpty() ) { | ||
| 221 | - txt_report_pdf.setEnabled(false); | ||
| 222 | - new Thread(new Runnable() { | ||
| 223 | - @Override | ||
| 224 | - public void run() { | ||
| 225 | - try { | ||
| 226 | - saveDataDb(); | ||
| 227 | - mPdfUtil.setParam(ed_name.getText().toString(), sex, ed_age.getText().toString(), | ||
| 228 | - ed_patient_id.getText().toString(), ed_diagnosis.getText().toString(), | ||
| 229 | - ed_hospital.getText().toString(), ed_department.getText().toString(), | ||
| 230 | - signPath, selPic.toArray(new String[selPic.size()]), createTime); | ||
| 231 | - mPdfUtil.createPDF(mCurPdfDB.getFilepath() + "/" + mCurPdfDB.getFilename()); | ||
| 232 | - } catch (Exception e) { | ||
| 233 | - } | ||
| 234 | - } | ||
| 235 | - }).start(); | ||
| 236 | - } else { | ||
| 237 | - MyApplication.showToastLong1(getActivity().getString(R.string.string_write_info)); | ||
| 238 | } | 194 | } |
| 239 | - break; | 195 | + }).start(); |
| 240 | - default: | 196 | + } else { |
| 241 | - break; | 197 | + MyApplication.showToastLong1(getActivity().getString(R.string.string_write_info)); |
| 242 | } | 198 | } |
| 243 | } | 199 | } |
| 200 | + public void exitCurWin() { | ||
| 201 | + binding.fgArchiveReportInfo.getRoot().setVisibility(View.VISIBLE); | ||
| 202 | + binding.pdfView.setVisibility(View.GONE); | ||
| 203 | + binding.txtReportPdf.setVisibility(View.VISIBLE); | ||
| 244 | 204 | ||
| 205 | + homeFragment.backDetailFg(); | ||
| 206 | + signPath = ""; | ||
| 207 | + } | ||
| 245 | @Override | 208 | @Override |
| 246 | public void createPdfSuc(String path1) { | 209 | public void createPdfSuc(String path1) { |
| 247 | - getActivity().runOnUiThread( () -> { | 210 | + getActivity().runOnUiThread(new Runnable() { |
| 248 | - String path = mCurPdfDB.getFilepath() + "/" + mCurPdfDB.getFilename(); | 211 | + @Override |
| 249 | - fg_archive_report_info.setVisibility(View.GONE); | 212 | + public void run() { |
| 250 | - pdf_view.setVisibility(View.VISIBLE); | 213 | + String path = mCurPdfDB.getFilepath() + "/" + mCurPdfDB.getFilename(); |
| 251 | - pdf_view.fromFile(new File(path)) | 214 | + binding.fgArchiveReportInfo.getRoot().setVisibility(View.GONE); |
| 252 | - .enableSwipe(true) | 215 | + binding.pdfView.setVisibility(View.VISIBLE); |
| 253 | - //禁用双击 | 216 | + binding.pdfView.fromFile(new File(path)) |
| 254 | - .enableDoubletap(false) | 217 | + .enableSwipe(true) |
| 255 | - //.pageFitPolicy(FitPolicy.BOTH) | 218 | + //禁用双击 |
| 256 | - .load(); | 219 | + .enableDoubletap(false) |
| 257 | - generateImageFromPdf(Uri.fromFile(new File(path)), mCurPdfDB.getThumbnailpath()+"/", mCurPdfDB.getThumbnailname()); | 220 | + //.pageFitPolicy(FitPolicy.BOTH) |
| 258 | - txt_report_pdf.setEnabled(true); | 221 | + .load(); |
| 259 | - txt_report_pdf.setVisibility(View.GONE); | 222 | + generateImageFromPdf(Uri.fromFile(new File(path)), mCurPdfDB.getThumbnailpath()+"/", mCurPdfDB.getThumbnailname()); |
| 260 | - | 223 | + binding.txtReportPdf.setEnabled(true); |
| 261 | - mFileListMg.getDetailList(mPicDB.getListMdItemName()); | 224 | + binding.txtReportPdf.setVisibility(View.GONE); |
| 262 | - } ); | 225 | + |
| 226 | + mFileListMg.getDetailList(mPicDB.getListMdItemName()); | ||
| 227 | + } | ||
| 228 | + } | ||
| 229 | + ); | ||
| 263 | } | 230 | } |
| 264 | 231 | ||
| 265 | @Override | 232 | @Override |
| 266 | public void createPdfFail() { | 233 | public void createPdfFail() { |
| 267 | - getActivity().runOnUiThread( ()-> { | 234 | + getActivity().runOnUiThread(new Runnable() { |
| 268 | - fg_archive_report_info.setVisibility(View.VISIBLE); | 235 | + @Override |
| 269 | - pdf_view.setVisibility(View.GONE); | 236 | + public void run() { |
| 270 | - txt_report_pdf.setEnabled(true); | 237 | + binding.fgArchiveReportInfo.getRoot().setVisibility(View.VISIBLE); |
| 271 | - mCurPdfDB.delete(); | 238 | + binding.pdfView.setVisibility(View.GONE); |
| 272 | - Logger.d("=======createPdfFail==========="); | 239 | + binding.txtReportPdf.setEnabled(true); |
| 273 | - } ); | 240 | + mCurPdfDB.delete(); |
| 241 | + Logger.d("=======createPdfFail==========="); | ||
| 242 | + } | ||
| 243 | + }); | ||
| 274 | } | 244 | } |
| 275 | 245 | ||
| 276 | public void saveDataDb() { | 246 | public void saveDataDb() { |
| ... | @@ -293,7 +263,7 @@ public class GraphicReportFragment extends BaseFragment implements | ... | @@ -293,7 +263,7 @@ public class GraphicReportFragment extends BaseFragment implements |
| 293 | 263 | ||
| 294 | @Override | 264 | @Override |
| 295 | public void onCheckedChanged(RadioGroup radioGroup, int i) { | 265 | public void onCheckedChanged(RadioGroup radioGroup, int i) { |
| 296 | - switch (rg_sex.getCheckedRadioButtonId()) { | 266 | + switch (binding.fgArchiveReportInfo.rgSex.getCheckedRadioButtonId()) { |
| 297 | case R.id.rb_male: | 267 | case R.id.rb_male: |
| 298 | Logger.d(TAG, "============rb_male"); | 268 | Logger.d(TAG, "============rb_male"); |
| 299 | break; | 269 | break; |
| ... | @@ -328,7 +298,7 @@ public class GraphicReportFragment extends BaseFragment implements | ... | @@ -328,7 +298,7 @@ public class GraphicReportFragment extends BaseFragment implements |
| 328 | AlertDialog.Builder builder = new AlertDialog.Builder(getContext(), 0);//, AlertDialog.THEME_HOLO_DARK | 298 | AlertDialog.Builder builder = new AlertDialog.Builder(getContext(), 0);//, AlertDialog.THEME_HOLO_DARK |
| 329 | builder.setView(layout); | 299 | builder.setView(layout); |
| 330 | builder.setCancelable(false); | 300 | builder.setCancelable(false); |
| 331 | - SignaturePad sign_view = layout.findViewById(R.id.sign_view); | 301 | + final SignaturePad sign_view = layout.findViewById(R.id.sign_view); |
| 332 | layout.findViewById(R.id.img_export_close).setOnClickListener(new View.OnClickListener(){ | 302 | layout.findViewById(R.id.img_export_close).setOnClickListener(new View.OnClickListener(){ |
| 333 | public void onClick(View v) { | 303 | public void onClick(View v) { |
| 334 | signTipdialog.dismiss(); | 304 | signTipdialog.dismiss(); |
| ... | @@ -343,8 +313,8 @@ public class GraphicReportFragment extends BaseFragment implements | ... | @@ -343,8 +313,8 @@ public class GraphicReportFragment extends BaseFragment implements |
| 343 | public void onClick(View v) { | 313 | public void onClick(View v) { |
| 344 | File file = sign_view.getFile(); | 314 | File file = sign_view.getFile(); |
| 345 | Logger.d(" getAbsolutePath " + file.getAbsolutePath()); | 315 | Logger.d(" getAbsolutePath " + file.getAbsolutePath()); |
| 346 | - img_doc_sign.setVisibility(View.VISIBLE); | 316 | + binding.fgArchiveReportInfo.imgDocSign.setVisibility(View.VISIBLE); |
| 347 | - setViewIcon(getActivity(), img_doc_sign, file.getAbsolutePath()); | 317 | + setViewIcon(getActivity(), binding.fgArchiveReportInfo.imgDocSign, file.getAbsolutePath()); |
| 348 | //Glide.with(getActivity()).load( Uri.fromFile(file) ).into(img_doc_sign); | 318 | //Glide.with(getActivity()).load( Uri.fromFile(file) ).into(img_doc_sign); |
| 349 | signPath = file.getAbsolutePath(); | 319 | signPath = file.getAbsolutePath(); |
| 350 | signTipdialog.dismiss(); | 320 | signTipdialog.dismiss(); | ... | ... |
| ... | @@ -10,7 +10,9 @@ import android.graphics.Color; | ... | @@ -10,7 +10,9 @@ import android.graphics.Color; |
| 10 | import android.graphics.Paint; | 10 | import android.graphics.Paint; |
| 11 | import android.graphics.Rect; | 11 | import android.graphics.Rect; |
| 12 | import android.view.Gravity; | 12 | import android.view.Gravity; |
| 13 | +import android.view.LayoutInflater; | ||
| 13 | import android.view.View; | 14 | import android.view.View; |
| 15 | +import android.view.ViewGroup; | ||
| 14 | import android.view.inputmethod.InputMethodManager; | 16 | import android.view.inputmethod.InputMethodManager; |
| 15 | import android.widget.EditText; | 17 | import android.widget.EditText; |
| 16 | import android.widget.ImageView; | 18 | import android.widget.ImageView; |
| ... | @@ -27,6 +29,7 @@ import com.sw.laryngoscope.activity.CustomTimer; | ... | @@ -27,6 +29,7 @@ import com.sw.laryngoscope.activity.CustomTimer; |
| 27 | import com.sw.laryngoscope.activity.HomeActivity; | 29 | import com.sw.laryngoscope.activity.HomeActivity; |
| 28 | import com.sw.laryngoscope.camera.VideoManager; | 30 | import com.sw.laryngoscope.camera.VideoManager; |
| 29 | import com.sw.laryngoscope.common.InitParam; | 31 | import com.sw.laryngoscope.common.InitParam; |
| 32 | +import com.sw.laryngoscope.databinding.FgArchiveVideoReportBinding; | ||
| 30 | import com.sw.laryngoscope.db.RecordInfoDB; | 33 | import com.sw.laryngoscope.db.RecordInfoDB; |
| 31 | import com.sw.laryngoscope.imageToVideo.VideoConUtil; | 34 | import com.sw.laryngoscope.imageToVideo.VideoConUtil; |
| 32 | import com.sw.laryngoscope.manager.SpManager; | 35 | import com.sw.laryngoscope.manager.SpManager; |
| ... | @@ -39,48 +42,14 @@ import com.sw.laryngoscope.utils.Thumbnail; | ... | @@ -39,48 +42,14 @@ import com.sw.laryngoscope.utils.Thumbnail; |
| 39 | import java.text.SimpleDateFormat; | 42 | import java.text.SimpleDateFormat; |
| 40 | import java.util.Date; | 43 | import java.util.Date; |
| 41 | 44 | ||
| 42 | -import butterknife.BindView; | ||
| 43 | -import butterknife.OnClick; | ||
| 44 | 45 | ||
| 45 | -public class VideoReportFragment extends BaseFragment implements | 46 | + |
| 47 | +public class VideoReportFragment extends BaseFragment<FgArchiveVideoReportBinding> implements | ||
| 46 | CustomTimer.TimerCallBack, RadioGroup.OnCheckedChangeListener, | 48 | CustomTimer.TimerCallBack, RadioGroup.OnCheckedChangeListener, |
| 47 | - StorageStateManager.MountCallBack, VideoConUtil.VideoCallback { | 49 | + StorageStateManager.MountCallBack, VideoConUtil.VideoCallback,View.OnClickListener { |
| 48 | 50 | ||
| 49 | private static final String TAG = "GraphicReportFragment"; | 51 | private static final String TAG = "GraphicReportFragment"; |
| 50 | 52 | ||
| 51 | - @BindView(R.id.lay_back) | ||
| 52 | - LinearLayout lay_back; | ||
| 53 | - | ||
| 54 | - @BindView(R.id.fg_archive_report_info) | ||
| 55 | - View fg_archive_report_info; | ||
| 56 | - @BindView(R.id.ed_name) | ||
| 57 | - EditText ed_name; | ||
| 58 | - @BindView(R.id.ed_age) | ||
| 59 | - EditText ed_age; | ||
| 60 | - @BindView(R.id.ed_patient_id) | ||
| 61 | - EditText ed_patient_id; | ||
| 62 | - @BindView(R.id.ed_hospital) | ||
| 63 | - EditText ed_hospital; | ||
| 64 | - @BindView(R.id.ed_department) | ||
| 65 | - EditText ed_department; | ||
| 66 | - @BindView(R.id.ed_diagnosis) | ||
| 67 | - EditText ed_diagnosis; | ||
| 68 | - @BindView(R.id.lay_doctor_sign) | ||
| 69 | - RelativeLayout lay_doctor_sign; | ||
| 70 | - | ||
| 71 | - @BindView(R.id.rg_sex) | ||
| 72 | - RadioGroup rg_sex; | ||
| 73 | - @BindView(R.id.rb_male) | ||
| 74 | - RadioButton rb_male; | ||
| 75 | - @BindView(R.id.rb_female) | ||
| 76 | - RadioButton rb_female; | ||
| 77 | - | ||
| 78 | - @BindView(R.id.txt_report_video) | ||
| 79 | - TextView txt_report_video; | ||
| 80 | - | ||
| 81 | - @BindView(R.id.txt_video_num_value) | ||
| 82 | - TextView txt_video_num_value; | ||
| 83 | - | ||
| 84 | private CustomTimer scrollTimer; | 53 | private CustomTimer scrollTimer; |
| 85 | private final String timerTAG_scroll = "scroll"; | 54 | private final String timerTAG_scroll = "scroll"; |
| 86 | 55 | ||
| ... | @@ -105,7 +74,7 @@ public class VideoReportFragment extends BaseFragment implements | ... | @@ -105,7 +74,7 @@ public class VideoReportFragment extends BaseFragment implements |
| 105 | mVideoConUtil = new VideoConUtil(); | 74 | mVideoConUtil = new VideoConUtil(); |
| 106 | mVideoConUtil.setVideoCallback(this); | 75 | mVideoConUtil.setVideoCallback(this); |
| 107 | mVideoMakePopWindow = new VideoMakePopWindow(homeActivity, homeActivity); | 76 | mVideoMakePopWindow = new VideoMakePopWindow(homeActivity, homeActivity); |
| 108 | - lay_doctor_sign.setVisibility(View.GONE); | 77 | + binding.fgArchiveReportInfo.layDoctorSign.getRootView().setVisibility(View.GONE); |
| 109 | } | 78 | } |
| 110 | 79 | ||
| 111 | public void setMountCallBack() { | 80 | public void setMountCallBack() { |
| ... | @@ -124,60 +93,62 @@ public class VideoReportFragment extends BaseFragment implements | ... | @@ -124,60 +93,62 @@ public class VideoReportFragment extends BaseFragment implements |
| 124 | } | 93 | } |
| 125 | 94 | ||
| 126 | @Override | 95 | @Override |
| 127 | - protected int rootLayout() { | 96 | + protected FgArchiveVideoReportBinding getViewBinding(LayoutInflater inflater, ViewGroup container) { |
| 128 | - return R.layout.fg_archive_video_report; | 97 | + return FgArchiveVideoReportBinding.inflate(inflater,container,false); |
| 129 | } | 98 | } |
| 130 | 99 | ||
| 100 | + | ||
| 131 | @Override | 101 | @Override |
| 132 | protected void init() { | 102 | protected void init() { |
| 133 | Logger.d(" curRecordInfoPos " + mFileListMg.curRecordInfoPos); | 103 | Logger.d(" curRecordInfoPos " + mFileListMg.curRecordInfoPos); |
| 134 | initView(); | 104 | initView(); |
| 135 | - ed_diagnosis.setHorizontallyScrolling(false); | 105 | + binding.fgArchiveReportInfo.edDiagnosis.setHorizontallyScrolling(false); |
| 136 | - ed_diagnosis.setMaxLines(Integer.MAX_VALUE); | 106 | + binding.fgArchiveReportInfo.edDiagnosis.setMaxLines(Integer.MAX_VALUE); |
| 137 | } | 107 | } |
| 138 | 108 | ||
| 139 | public void initView() { | 109 | public void initView() { |
| 140 | - ed_hospital.setText(SpManager.get_value_hospital()); | 110 | + binding.fgArchiveReportInfo.edHospital.setText(SpManager.get_value_hospital()); |
| 141 | - ed_department.setText(SpManager.get_value_department()); | 111 | + binding.fgArchiveReportInfo.edDepartment.setText(SpManager.get_value_department()); |
| 142 | for ( RecordInfoDB tmp:mFileListMg.selectList ) { | 112 | for ( RecordInfoDB tmp:mFileListMg.selectList ) { |
| 143 | if ( tmp.getType() == InitParam.FILE_VIDEO ) { | 113 | if ( tmp.getType() == InitParam.FILE_VIDEO ) { |
| 144 | mVideoDB = tmp; | 114 | mVideoDB = tmp; |
| 145 | } | 115 | } |
| 146 | } | 116 | } |
| 147 | mVideoManager = homeActivity.getmVideoModule().getmVideoManager(); | 117 | mVideoManager = homeActivity.getmVideoModule().getmVideoManager(); |
| 148 | - txt_video_num_value.setText(mFileListMg.selectList.size() + ""); | 118 | + binding.txtVideoNumValue.setText(mFileListMg.selectList.size() + ""); |
| 149 | 119 | ||
| 150 | - ed_name.setText(""); | 120 | + binding.fgArchiveReportInfo.edName.setText(""); |
| 151 | - ed_age.setText(""); | 121 | + binding.fgArchiveReportInfo.edAge.setText(""); |
| 152 | - rb_male.setChecked(true); | 122 | + binding.fgArchiveReportInfo.rbMale.setChecked(true); |
| 153 | - ed_patient_id.setText(""); | 123 | + binding.fgArchiveReportInfo.edPatientId.setText(""); |
| 154 | - ed_diagnosis.setText(""); | 124 | + binding.fgArchiveReportInfo.edDiagnosis.setText(""); |
| 155 | } | 125 | } |
| 156 | 126 | ||
| 157 | @Override | 127 | @Override |
| 158 | protected void setListener() { | 128 | protected void setListener() { |
| 159 | - rg_sex.setOnCheckedChangeListener(this); | 129 | + binding.fgArchiveReportInfo.rgSex.setOnCheckedChangeListener(this); |
| 130 | + binding.layBack.setOnClickListener(this); | ||
| 131 | + binding.txtReportVideo.setOnClickListener(this); | ||
| 160 | } | 132 | } |
| 161 | 133 | ||
| 162 | @Override | 134 | @Override |
| 163 | - @OnClick({ R.id.lay_back, R.id.txt_report_video, }) | ||
| 164 | public void onClick(View v) { | 135 | public void onClick(View v) { |
| 165 | switch (v.getId()) { | 136 | switch (v.getId()) { |
| 166 | case R.id.lay_back: | 137 | case R.id.lay_back: |
| 167 | homeFragment.backDetailFg(); | 138 | homeFragment.backDetailFg(); |
| 168 | break; | 139 | break; |
| 169 | case R.id.txt_report_video: | 140 | case R.id.txt_report_video: |
| 170 | - int sex = rb_male.isChecked() ? 0 : 1;//0 男 1 女 | 141 | + final int sex = binding.fgArchiveReportInfo.rbMale.isChecked() ? 0 : 1;//0 男 1 女 |
| 171 | - SpManager.set_value_hospital(ed_hospital.getText().toString()); | 142 | + SpManager.set_value_hospital(binding.fgArchiveReportInfo.edHospital.getText().toString()); |
| 172 | - SpManager.set_value_department(ed_department.getText().toString()); | 143 | + SpManager.set_value_department(binding.fgArchiveReportInfo.edDepartment.getText().toString()); |
| 173 | hideIm(); | 144 | hideIm(); |
| 174 | 145 | ||
| 175 | - if ( !ed_name.getText().toString().isEmpty() | 146 | + if ( !binding.fgArchiveReportInfo.edName.getText().toString().isEmpty() |
| 176 | - && !ed_age.getText().toString().isEmpty() | 147 | + && !binding.fgArchiveReportInfo.edAge.getText().toString().isEmpty() |
| 177 | - && !ed_patient_id.getText().toString().isEmpty() ) { | 148 | + && !binding.fgArchiveReportInfo.edPatientId.getText().toString().isEmpty() ) { |
| 178 | - mVideoMakePopWindow.showAtLocation(rootView, Gravity.CENTER, 0, 0); | 149 | + mVideoMakePopWindow.showAtLocation(getRootView(), Gravity.CENTER, 0, 0); |
| 179 | 150 | ||
| 180 | - txt_report_video.setEnabled(false); | 151 | + binding.txtReportVideo.setEnabled(false); |
| 181 | new Thread(new Runnable() { | 152 | new Thread(new Runnable() { |
| 182 | @Override | 153 | @Override |
| 183 | public void run() { | 154 | public void run() { |
| ... | @@ -191,9 +162,9 @@ public class VideoReportFragment extends BaseFragment implements | ... | @@ -191,9 +162,9 @@ public class VideoReportFragment extends BaseFragment implements |
| 191 | Logger.d("=======onVideoFail========2===" + width + height); | 162 | Logger.d("=======onVideoFail========2===" + width + height); |
| 192 | 163 | ||
| 193 | pngbitmap = drawText2Bitmap(homeActivity, | 164 | pngbitmap = drawText2Bitmap(homeActivity, |
| 194 | - ed_name.getText().toString(), sex, ed_age.getText().toString(), | 165 | + binding.fgArchiveReportInfo.edName.getText().toString(), sex, binding.fgArchiveReportInfo.edAge.getText().toString(), |
| 195 | - ed_patient_id.getText().toString(), ed_diagnosis.getText().toString(), | 166 | + binding.fgArchiveReportInfo.edPatientId.getText().toString(), binding.fgArchiveReportInfo.edDiagnosis.getText().toString(), |
| 196 | - ed_hospital.getText().toString(), ed_department.getText().toString(), | 167 | + binding.fgArchiveReportInfo.edHospital.getText().toString(), binding.fgArchiveReportInfo.edDepartment.getText().toString(), |
| 197 | width, height); | 168 | width, height); |
| 198 | //pngbitmap = mVideoConUtil.saveViewBitmap(fg_archive_report_info, 1280, 720); | 169 | //pngbitmap = mVideoConUtil.saveViewBitmap(fg_archive_report_info, 1280, 720); |
| 199 | mVideoConUtil.createVideo( | 170 | mVideoConUtil.createVideo( |
| ... | @@ -216,41 +187,50 @@ public class VideoReportFragment extends BaseFragment implements | ... | @@ -216,41 +187,50 @@ public class VideoReportFragment extends BaseFragment implements |
| 216 | 187 | ||
| 217 | @Override | 188 | @Override |
| 218 | public void onVideoSuc(String path1) { | 189 | public void onVideoSuc(String path1) { |
| 219 | - getActivity().runOnUiThread( () -> { | 190 | + getActivity().runOnUiThread(new Runnable() { |
| 220 | - mVideoConUtil.saveImage(pngbitmap, mCurReportDB.getThumbnailpath(), mCurReportDB.getThumbnailname()); | 191 | + @Override |
| 221 | - long time = Thumbnail.getVideoDur( | 192 | + public void run() { |
| 222 | - mCurReportDB.getFilepath() + "/" + mCurReportDB.getFilename()); | 193 | + mVideoConUtil.saveImage(pngbitmap, mCurReportDB.getThumbnailpath(), mCurReportDB.getThumbnailname()); |
| 223 | - Logger.d("=======onVideoSuc=========time==" + time); | 194 | + long time = Thumbnail.getVideoDur( |
| 224 | - mCurReportDB.setDuration(time); | 195 | + mCurReportDB.getFilepath() + "/" + mCurReportDB.getFilename()); |
| 225 | - mCurReportDB.saveOrUpdate("title = ?", mCurReportDB.getTitle()); | 196 | + Logger.d("=======onVideoSuc=========time==" + time); |
| 226 | - | 197 | + mCurReportDB.setDuration(time); |
| 227 | - mVideoMakePopWindow.dismiss(); | 198 | + mCurReportDB.saveOrUpdate("title = ?", mCurReportDB.getTitle()); |
| 228 | - homeFragment.backDetailFg(); | 199 | + |
| 229 | - | 200 | + mVideoMakePopWindow.dismiss(); |
| 230 | - txt_report_video.setEnabled(true); | 201 | + homeFragment.backDetailFg(); |
| 231 | - txt_report_video.setVisibility(View.VISIBLE); | 202 | + |
| 232 | - | 203 | + binding.txtReportVideo.setEnabled(true); |
| 233 | - mFileListMg.getDetailList(mVideoDB.getListMdItemName()); | 204 | + binding.txtReportVideo.setVisibility(View.VISIBLE); |
| 234 | - } ); | 205 | + |
| 206 | + mFileListMg.getDetailList(mVideoDB.getListMdItemName()); | ||
| 207 | + } | ||
| 208 | + }); | ||
| 235 | } | 209 | } |
| 236 | 210 | ||
| 237 | @Override | 211 | @Override |
| 238 | public void onVideoFail() { | 212 | public void onVideoFail() { |
| 239 | - getActivity().runOnUiThread( ()-> { | 213 | + getActivity().runOnUiThread(new Runnable() { |
| 240 | - mVideoMakePopWindow.dismiss(); | 214 | + @Override |
| 241 | - txt_report_video.setEnabled(true); | 215 | + public void run() { |
| 242 | - txt_report_video.setVisibility(View.VISIBLE); | 216 | + mVideoMakePopWindow.dismiss(); |
| 243 | - mCurReportDB.delete(); | 217 | + binding.txtReportVideo.setEnabled(true); |
| 244 | - Logger.d("=======onVideoFail==========="); | 218 | + binding.txtReportVideo.setVisibility(View.VISIBLE); |
| 245 | - } ); | 219 | + mCurReportDB.delete(); |
| 220 | + Logger.d("=======onVideoFail==========="); | ||
| 221 | + } | ||
| 222 | + }); | ||
| 246 | } | 223 | } |
| 247 | 224 | ||
| 248 | @Override | 225 | @Override |
| 249 | - public void onVideoProgress(int pro) { | 226 | + public void onVideoProgress(final int pro) { |
| 250 | - getActivity().runOnUiThread( ()-> { | 227 | + getActivity().runOnUiThread(new Runnable() { |
| 251 | - mVideoMakePopWindow.setSb_con(pro); | 228 | + @Override |
| 252 | - Logger.d("=======onVideoProgress==========="); | 229 | + public void run() { |
| 253 | - } ); | 230 | + mVideoMakePopWindow.setSb_con(pro); |
| 231 | + Logger.d("=======onVideoProgress==========="); | ||
| 232 | + } | ||
| 233 | + }); | ||
| 254 | } | 234 | } |
| 255 | 235 | ||
| 256 | public void saveDataDb() { | 236 | public void saveDataDb() { |
| ... | @@ -273,7 +253,7 @@ public class VideoReportFragment extends BaseFragment implements | ... | @@ -273,7 +253,7 @@ public class VideoReportFragment extends BaseFragment implements |
| 273 | 253 | ||
| 274 | @Override | 254 | @Override |
| 275 | public void onCheckedChanged(RadioGroup radioGroup, int i) { | 255 | public void onCheckedChanged(RadioGroup radioGroup, int i) { |
| 276 | - switch (rg_sex.getCheckedRadioButtonId()) { | 256 | + switch (binding.fgArchiveReportInfo.rgSex.getCheckedRadioButtonId()) { |
| 277 | case R.id.rb_male: | 257 | case R.id.rb_male: |
| 278 | Logger.d(TAG, "============rb_male"); | 258 | Logger.d(TAG, "============rb_male"); |
| 279 | break; | 259 | break; | ... | ... |
| ... | @@ -3,7 +3,9 @@ package com.sw.laryngoscope.activity.fragment.setting; | ... | @@ -3,7 +3,9 @@ package com.sw.laryngoscope.activity.fragment.setting; |
| 3 | import android.content.Context; | 3 | import android.content.Context; |
| 4 | import android.content.Intent; | 4 | import android.content.Intent; |
| 5 | import android.os.Environment; | 5 | import android.os.Environment; |
| 6 | +import android.view.LayoutInflater; | ||
| 6 | import android.view.View; | 7 | import android.view.View; |
| 8 | +import android.view.ViewGroup; | ||
| 7 | import android.widget.LinearLayout; | 9 | import android.widget.LinearLayout; |
| 8 | import android.widget.ListView; | 10 | import android.widget.ListView; |
| 9 | import android.widget.RadioButton; | 11 | import android.widget.RadioButton; |
| ... | @@ -17,6 +19,7 @@ import com.sw.laryngoscope.activity.BaseFragment; | ... | @@ -17,6 +19,7 @@ import com.sw.laryngoscope.activity.BaseFragment; |
| 17 | import com.sw.laryngoscope.activity.CustomTimer; | 19 | import com.sw.laryngoscope.activity.CustomTimer; |
| 18 | import com.sw.laryngoscope.activity.HomeActivity; | 20 | import com.sw.laryngoscope.activity.HomeActivity; |
| 19 | import com.sw.laryngoscope.adapter.DeviceInfoItemAdapter; | 21 | import com.sw.laryngoscope.adapter.DeviceInfoItemAdapter; |
| 22 | +import com.sw.laryngoscope.databinding.FgSettingAbBinding; | ||
| 20 | import com.sw.laryngoscope.db.DeviceInfoBean; | 23 | import com.sw.laryngoscope.db.DeviceInfoBean; |
| 21 | import com.sw.laryngoscope.manager.AccountManager; | 24 | import com.sw.laryngoscope.manager.AccountManager; |
| 22 | import com.sw.laryngoscope.manager.OtaUpgradeUtils; | 25 | import com.sw.laryngoscope.manager.OtaUpgradeUtils; |
| ... | @@ -31,56 +34,15 @@ import java.io.File; | ... | @@ -31,56 +34,15 @@ import java.io.File; |
| 31 | import java.util.ArrayList; | 34 | import java.util.ArrayList; |
| 32 | import java.util.List; | 35 | import java.util.List; |
| 33 | 36 | ||
| 34 | -import butterknife.BindView; | ||
| 35 | -import butterknife.OnClick; | ||
| 36 | 37 | ||
| 37 | import static java.lang.Long.getLong; | 38 | import static java.lang.Long.getLong; |
| 38 | 39 | ||
| 39 | -public class AboutFragment extends BaseFragment implements CustomTimer.TimerCallBack, | 40 | +public class AboutFragment extends BaseFragment<FgSettingAbBinding> implements CustomTimer.TimerCallBack, |
| 40 | - RadioGroup.OnCheckedChangeListener, StorageStateManager.MountCallBack { | 41 | + RadioGroup.OnCheckedChangeListener, StorageStateManager.MountCallBack,View.OnClickListener { |
| 41 | 42 | ||
| 42 | private static final String TAG = "AboutFragment"; | 43 | private static final String TAG = "AboutFragment"; |
| 43 | private Context context; | 44 | private Context context; |
| 44 | 45 | ||
| 45 | - @BindView(R.id.lay_back) | ||
| 46 | - LinearLayout lay_back; | ||
| 47 | - | ||
| 48 | - @BindView(R.id.rg_setting_about) | ||
| 49 | - RadioGroup rg_setting_about; | ||
| 50 | - @BindView(R.id.rb_device_info) | ||
| 51 | - public RadioButton rb_device_info; | ||
| 52 | - @BindView(R.id.rb_sys_upgrade) | ||
| 53 | - public RadioButton rb_sys_upgrade; | ||
| 54 | - @BindView(R.id.rb_export_file) | ||
| 55 | - public RadioButton rb_export_file; | ||
| 56 | - | ||
| 57 | - @BindView(R.id.layout_fragment_about_devinfo) | ||
| 58 | - public View layout_fragment_about_devinfo; | ||
| 59 | - @BindView(R.id.txt_refresh_info) | ||
| 60 | - public TextView txt_refresh_info; | ||
| 61 | - @BindView(R.id.listView_deviceinfo) | ||
| 62 | - public ListView listView_deviceinfo; | ||
| 63 | - @BindView(R.id.txt_export_soft_lic) | ||
| 64 | - public TextView txt_export_soft_lic; | ||
| 65 | - | ||
| 66 | - | ||
| 67 | - @BindView(R.id.layout_fg_ab_system_upgrade) | ||
| 68 | - public View layout_fg_ab_system_upgrade; | ||
| 69 | - @BindView(R.id.txt_software_version) | ||
| 70 | - public TextView txt_software_version; | ||
| 71 | - @BindView(R.id.txt_build_time) | ||
| 72 | - public TextView txt_build_time; | ||
| 73 | - | ||
| 74 | - | ||
| 75 | - @BindView(R.id.layout_fg_ab_export_files) | ||
| 76 | - public View layout_fg_ab_export_files; | ||
| 77 | - @BindView(R.id.txt_usb_tip) | ||
| 78 | - public TextView txt_usb_tip; | ||
| 79 | - @BindView(R.id.txt_export_log_tip) | ||
| 80 | - public TextView txt_export_log_tip; | ||
| 81 | - @BindView(R.id.txt_log_export) | ||
| 82 | - public TextView txt_log_export; | ||
| 83 | - | ||
| 84 | private CustomTimer scrollTimer; | 46 | private CustomTimer scrollTimer; |
| 85 | private final String timerTAG_scroll = "scroll"; | 47 | private final String timerTAG_scroll = "scroll"; |
| 86 | 48 | ||
| ... | @@ -104,19 +66,19 @@ public class AboutFragment extends BaseFragment implements CustomTimer.TimerCall | ... | @@ -104,19 +66,19 @@ public class AboutFragment extends BaseFragment implements CustomTimer.TimerCall |
| 104 | /*txt_usb_tip.setText(R.string.string_about_export_no_usb); | 66 | /*txt_usb_tip.setText(R.string.string_about_export_no_usb); |
| 105 | txt_export_log_tip.setText(R.string.string_about_export_not_avail);*/ | 67 | txt_export_log_tip.setText(R.string.string_about_export_not_avail);*/ |
| 106 | if ( !Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath()) ) { | 68 | if ( !Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath()) ) { |
| 107 | - txt_log_export.setEnabled(false); | 69 | + binding.layoutFgAbExportFiles.txtLogExport.setEnabled(false); |
| 108 | - txt_usb_tip.setText(R.string.string_about_export_no_usb); | 70 | + binding.layoutFgAbExportFiles.txtUsbTip.setText(R.string.string_about_export_no_usb); |
| 109 | - txt_export_log_tip.setVisibility(View.VISIBLE); | 71 | + binding.layoutFgAbExportFiles.txtExportLogTip.setVisibility(View.VISIBLE); |
| 110 | } else if ( Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath()) | 72 | } else if ( Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath()) |
| 111 | && SpManager.get_usb_input_enabled() ) { | 73 | && SpManager.get_usb_input_enabled() ) { |
| 112 | - txt_log_export.setEnabled(true); | 74 | + binding.layoutFgAbExportFiles.txtLogExport.setEnabled(true); |
| 113 | - txt_usb_tip.setText(Storage.getUName(getContext())); | 75 | + binding.layoutFgAbExportFiles.txtUsbTip.setText(Storage.getUName(getContext())); |
| 114 | - txt_export_log_tip.setVisibility(View.GONE); | 76 | + binding.layoutFgAbExportFiles.txtExportLogTip.setVisibility(View.GONE); |
| 115 | } | 77 | } |
| 116 | if (AccountManager.getInstance().isUserDbOrNoLogin()) { | 78 | if (AccountManager.getInstance().isUserDbOrNoLogin()) { |
| 117 | - rb_sys_upgrade.setVisibility(View.GONE); | 79 | + binding.rbSysUpgrade.setVisibility(View.GONE); |
| 118 | } else { | 80 | } else { |
| 119 | - rb_sys_upgrade.setVisibility(View.VISIBLE); | 81 | + binding.rbSysUpgrade.setVisibility(View.VISIBLE); |
| 120 | } | 82 | } |
| 121 | } | 83 | } |
| 122 | 84 | ||
| ... | @@ -138,25 +100,25 @@ public class AboutFragment extends BaseFragment implements CustomTimer.TimerCall | ... | @@ -138,25 +100,25 @@ public class AboutFragment extends BaseFragment implements CustomTimer.TimerCall |
| 138 | Logger.d(" -=- " + StorageStateManager.getInstance().getUdiskPath()); | 100 | Logger.d(" -=- " + StorageStateManager.getInstance().getUdiskPath()); |
| 139 | 101 | ||
| 140 | if ( !Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath()) ) { | 102 | if ( !Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath()) ) { |
| 141 | - txt_log_export.setEnabled(false); | 103 | + binding.layoutFgAbExportFiles.txtLogExport.setEnabled(false); |
| 142 | - txt_usb_tip.setText(R.string.string_about_export_no_usb); | 104 | + binding.layoutFgAbExportFiles.txtUsbTip.setText(R.string.string_about_export_no_usb); |
| 143 | - txt_export_log_tip.setVisibility(View.VISIBLE); | 105 | + binding.layoutFgAbExportFiles.txtExportLogTip.setVisibility(View.VISIBLE); |
| 144 | } else if ( Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath()) | 106 | } else if ( Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath()) |
| 145 | && SpManager.get_usb_input_enabled() ) { | 107 | && SpManager.get_usb_input_enabled() ) { |
| 146 | - txt_log_export.setEnabled(true); | 108 | + binding.layoutFgAbExportFiles.txtLogExport.setEnabled(true); |
| 147 | - txt_usb_tip.setText(Storage.getUName(getContext())); | 109 | + binding.layoutFgAbExportFiles.txtUsbTip.setText(Storage.getUName(getContext())); |
| 148 | - txt_export_log_tip.setVisibility(View.GONE); | 110 | + binding.layoutFgAbExportFiles.txtExportLogTip.setVisibility(View.GONE); |
| 149 | } | 111 | } |
| 150 | if (AccountManager.getInstance().isUserDbOrNoLogin()) { | 112 | if (AccountManager.getInstance().isUserDbOrNoLogin()) { |
| 151 | - rb_sys_upgrade.setVisibility(View.GONE); | 113 | + binding.rbSysUpgrade.setVisibility(View.GONE); |
| 152 | } else { | 114 | } else { |
| 153 | - rb_sys_upgrade.setVisibility(View.VISIBLE); | 115 | + binding.rbSysUpgrade.setVisibility(View.VISIBLE); |
| 154 | } | 116 | } |
| 155 | } | 117 | } |
| 156 | 118 | ||
| 157 | @Override | 119 | @Override |
| 158 | - protected int rootLayout() { | 120 | + protected FgSettingAbBinding getViewBinding(LayoutInflater inflater, ViewGroup container) { |
| 159 | - return R.layout.fg_setting_ab; | 121 | + return FgSettingAbBinding.inflate(inflater,container,false); |
| 160 | } | 122 | } |
| 161 | 123 | ||
| 162 | @Override | 124 | @Override |
| ... | @@ -164,25 +126,28 @@ public class AboutFragment extends BaseFragment implements CustomTimer.TimerCall | ... | @@ -164,25 +126,28 @@ public class AboutFragment extends BaseFragment implements CustomTimer.TimerCall |
| 164 | //layout_home_home_guest = (ConstraintLayout) rootView.findViewById(R.id.layout_home_home_guest); | 126 | //layout_home_home_guest = (ConstraintLayout) rootView.findViewById(R.id.layout_home_home_guest); |
| 165 | initDeviceInfoList(); | 127 | initDeviceInfoList(); |
| 166 | mDeviceInfoItemAdapter = new DeviceInfoItemAdapter(getContext(), listInfoBean); | 128 | mDeviceInfoItemAdapter = new DeviceInfoItemAdapter(getContext(), listInfoBean); |
| 167 | - listView_deviceinfo.setAdapter(mDeviceInfoItemAdapter); | 129 | + binding.layoutFragmentAboutDevinfo.listViewDeviceinfo.setAdapter(mDeviceInfoItemAdapter); |
| 168 | 130 | ||
| 169 | // | 131 | // |
| 170 | Logger.d("" + android.os.Build.TIME + " " + getLong("ro.build.date.utc")); | 132 | Logger.d("" + android.os.Build.TIME + " " + getLong("ro.build.date.utc")); |
| 171 | - txt_software_version.setText("v" + VersionManager.getSdkVersion()); | 133 | + binding.layoutFgAbSystemUpgrade.txtSoftwareVersion.setText("v" + VersionManager.getSdkVersion()); |
| 172 | - txt_build_time.setText( DateUtils.getTimeOfMMM(android.os.Build.TIME) ); | 134 | + binding.layoutFgAbSystemUpgrade.txtBuildTime.setText( DateUtils.getTimeOfMMM(android.os.Build.TIME) ); |
| 173 | 135 | ||
| 174 | 136 | ||
| 175 | } | 137 | } |
| 176 | 138 | ||
| 177 | @Override | 139 | @Override |
| 178 | protected void setListener() { | 140 | protected void setListener() { |
| 179 | - rg_setting_about.setOnCheckedChangeListener(this); | 141 | + binding.rgSettingAbout.setOnCheckedChangeListener(this); |
| 142 | + binding.layBack.setOnClickListener(this); | ||
| 143 | + binding.layoutFragmentAboutDevinfo.txtRefreshInfo.setOnClickListener(this); | ||
| 144 | + binding.layoutFragmentAboutDevinfo.txtExportSoftLic.setOnClickListener(this); | ||
| 145 | + binding.layoutFgAbSystemUpgrade.txtSystemUpgrade.setOnClickListener(this); | ||
| 146 | + binding.layoutFgAbSystemUpgrade.txtApkUpgrade.setOnClickListener(this); | ||
| 147 | + binding.layoutFgAbExportFiles.txtLogExport.setOnClickListener(this); | ||
| 180 | } | 148 | } |
| 181 | 149 | ||
| 182 | @Override | 150 | @Override |
| 183 | - @OnClick({ R.id.lay_back, R.id.txt_refresh_info, R.id.txt_export_soft_lic, | ||
| 184 | - R.id.txt_system_upgrade, R.id.txt_apk_upgrade, | ||
| 185 | - R.id.txt_log_export, }) | ||
| 186 | public void onClick(View v) { | 151 | public void onClick(View v) { |
| 187 | switch (v.getId()) { | 152 | switch (v.getId()) { |
| 188 | case R.id.lay_back: | 153 | case R.id.lay_back: |
| ... | @@ -196,7 +161,7 @@ public class AboutFragment extends BaseFragment implements CustomTimer.TimerCall | ... | @@ -196,7 +161,7 @@ public class AboutFragment extends BaseFragment implements CustomTimer.TimerCall |
| 196 | break; | 161 | break; |
| 197 | 162 | ||
| 198 | case R.id.txt_system_upgrade: | 163 | case R.id.txt_system_upgrade: |
| 199 | - String path = StorageStateManager.getInstance().getUdiskPath() + OtaUpgradeUtils.DEFAULT_PACKAGE_NAME; | 164 | + final String path = StorageStateManager.getInstance().getUdiskPath() + OtaUpgradeUtils.DEFAULT_PACKAGE_NAME; |
| 200 | if ( !Storage.isCheckExist(path) || !SpManager.get_usb_input_enabled() ) { | 165 | if ( !Storage.isCheckExist(path) || !SpManager.get_usb_input_enabled() ) { |
| 201 | Toast.makeText(getActivity(), | 166 | Toast.makeText(getActivity(), |
| 202 | getString(R.string.string_about_export_no_file), Toast.LENGTH_SHORT).show(); | 167 | getString(R.string.string_about_export_no_file), Toast.LENGTH_SHORT).show(); |
| ... | @@ -283,24 +248,24 @@ public class AboutFragment extends BaseFragment implements CustomTimer.TimerCall | ... | @@ -283,24 +248,24 @@ public class AboutFragment extends BaseFragment implements CustomTimer.TimerCall |
| 283 | 248 | ||
| 284 | @Override | 249 | @Override |
| 285 | public void onCheckedChanged(RadioGroup radioGroup, int i) { | 250 | public void onCheckedChanged(RadioGroup radioGroup, int i) { |
| 286 | - switch (rg_setting_about.getCheckedRadioButtonId()) { | 251 | + switch (binding.rgSettingAbout.getCheckedRadioButtonId()) { |
| 287 | case R.id.rb_device_info: | 252 | case R.id.rb_device_info: |
| 288 | Logger.d(TAG, "======showFragment======rb_device_info"); | 253 | Logger.d(TAG, "======showFragment======rb_device_info"); |
| 289 | - layout_fragment_about_devinfo.setVisibility(View.VISIBLE); | 254 | + binding.layoutFragmentAboutDevinfo.getRoot().setVisibility(View.VISIBLE); |
| 290 | - layout_fg_ab_system_upgrade.setVisibility(View.GONE); | 255 | + binding.layoutFgAbSystemUpgrade.getRoot().setVisibility(View.GONE); |
| 291 | - layout_fg_ab_export_files.setVisibility(View.GONE); | 256 | + binding.layoutFgAbExportFiles.getRoot().setVisibility(View.GONE); |
| 292 | break; | 257 | break; |
| 293 | case R.id.rb_sys_upgrade: | 258 | case R.id.rb_sys_upgrade: |
| 294 | Logger.d(TAG, "======showFragment======rb_sys_upgrade"); | 259 | Logger.d(TAG, "======showFragment======rb_sys_upgrade"); |
| 295 | - layout_fragment_about_devinfo.setVisibility(View.GONE); | 260 | + binding.layoutFragmentAboutDevinfo.getRoot().setVisibility(View.GONE); |
| 296 | - layout_fg_ab_system_upgrade.setVisibility(View.VISIBLE); | 261 | + binding.layoutFgAbSystemUpgrade.getRoot().setVisibility(View.VISIBLE); |
| 297 | - layout_fg_ab_export_files.setVisibility(View.GONE); | 262 | + binding.layoutFgAbExportFiles.getRoot().setVisibility(View.GONE); |
| 298 | break; | 263 | break; |
| 299 | case R.id.rb_export_file: | 264 | case R.id.rb_export_file: |
| 300 | Logger.d(TAG, "======showFragment======rb_export_file"); | 265 | Logger.d(TAG, "======showFragment======rb_export_file"); |
| 301 | - layout_fragment_about_devinfo.setVisibility(View.GONE); | 266 | + binding.layoutFragmentAboutDevinfo.getRoot().setVisibility(View.GONE); |
| 302 | - layout_fg_ab_system_upgrade.setVisibility(View.GONE); | 267 | + binding.layoutFgAbSystemUpgrade.getRoot().setVisibility(View.GONE); |
| 303 | - layout_fg_ab_export_files.setVisibility(View.VISIBLE); | 268 | + binding.layoutFgAbExportFiles.getRoot().setVisibility(View.VISIBLE); |
| 304 | break; | 269 | break; |
| 305 | default: | 270 | default: |
| 306 | break; | 271 | break; | ... | ... |
| ... | @@ -8,7 +8,9 @@ import android.os.Environment; | ... | @@ -8,7 +8,9 @@ import android.os.Environment; |
| 8 | import android.os.Handler; | 8 | import android.os.Handler; |
| 9 | import android.os.Message; | 9 | import android.os.Message; |
| 10 | import android.util.Log; | 10 | import android.util.Log; |
| 11 | +import android.view.LayoutInflater; | ||
| 11 | import android.view.View; | 12 | import android.view.View; |
| 13 | +import android.view.ViewGroup; | ||
| 12 | import android.view.WindowManager; | 14 | import android.view.WindowManager; |
| 13 | import android.widget.RelativeLayout; | 15 | import android.widget.RelativeLayout; |
| 14 | import android.widget.ScrollView; | 16 | import android.widget.ScrollView; |
| ... | @@ -21,6 +23,7 @@ import com.sw.laryngoscope.R; | ... | @@ -21,6 +23,7 @@ import com.sw.laryngoscope.R; |
| 21 | import com.sw.laryngoscope.activity.BaseFragment; | 23 | import com.sw.laryngoscope.activity.BaseFragment; |
| 22 | import com.sw.laryngoscope.activity.CustomTimer; | 24 | import com.sw.laryngoscope.activity.CustomTimer; |
| 23 | import com.sw.laryngoscope.activity.HomeActivity; | 25 | import com.sw.laryngoscope.activity.HomeActivity; |
| 26 | +import com.sw.laryngoscope.databinding.FgSettingDevinfoBinding; | ||
| 24 | import com.sw.laryngoscope.manager.CameraInfoMg; | 27 | import com.sw.laryngoscope.manager.CameraInfoMg; |
| 25 | import com.sw.laryngoscope.manager.OtaUpgradeUtils; | 28 | import com.sw.laryngoscope.manager.OtaUpgradeUtils; |
| 26 | import com.sw.laryngoscope.manager.SpManager; | 29 | import com.sw.laryngoscope.manager.SpManager; |
| ... | @@ -32,11 +35,9 @@ import com.sw.laryngoscope.utils.Logger; | ... | @@ -32,11 +35,9 @@ import com.sw.laryngoscope.utils.Logger; |
| 32 | 35 | ||
| 33 | import java.io.File; | 36 | import java.io.File; |
| 34 | 37 | ||
| 35 | -import butterknife.BindView; | ||
| 36 | -import butterknife.OnClick; | ||
| 37 | 38 | ||
| 38 | -public class DevInfoFragment extends BaseFragment implements | 39 | +public class DevInfoFragment extends BaseFragment<FgSettingDevinfoBinding> implements |
| 39 | - CustomTimer.TimerCallBack, StorageStateManager.MountCallBack, CameraInfoMg.CameraInfoback { | 40 | + CustomTimer.TimerCallBack, StorageStateManager.MountCallBack, CameraInfoMg.CameraInfoback,View.OnClickListener { |
| 40 | 41 | ||
| 41 | private static final String TAG = "DevInfoFragment"; | 42 | private static final String TAG = "DevInfoFragment"; |
| 42 | private Context context; | 43 | private Context context; |
| ... | @@ -44,42 +45,6 @@ public class DevInfoFragment extends BaseFragment implements | ... | @@ -44,42 +45,6 @@ public class DevInfoFragment extends BaseFragment implements |
| 44 | private CustomTimer scrollTimer; | 45 | private CustomTimer scrollTimer; |
| 45 | private final String timerTAG_scroll = "scroll"; | 46 | private final String timerTAG_scroll = "scroll"; |
| 46 | 47 | ||
| 47 | - @BindView(R.id.scrollView) | ||
| 48 | - ScrollView scrollView; | ||
| 49 | - | ||
| 50 | - @BindView(R.id.txt_ver) | ||
| 51 | - TextView txt_ver; | ||
| 52 | - @BindView(R.id.txt_production_date) | ||
| 53 | - TextView txt_production_date; | ||
| 54 | - @BindView(R.id.txt_screen) | ||
| 55 | - TextView txt_screen; | ||
| 56 | - @BindView(R.id.txt_storage_size) | ||
| 57 | - TextView txt_storage_size; | ||
| 58 | - | ||
| 59 | - @BindView(R.id.view_2) | ||
| 60 | - TextView view_2; | ||
| 61 | - @BindView(R.id.lay_1) | ||
| 62 | - RelativeLayout lay_1; | ||
| 63 | - @BindView(R.id.txt_len_model) | ||
| 64 | - TextView txt_len_model; | ||
| 65 | - @BindView(R.id.txt_len_sn) | ||
| 66 | - TextView txt_len_sn; | ||
| 67 | - @BindView(R.id.txt_inner_outer_diameter) | ||
| 68 | - TextView txt_inner_outer_diameter; | ||
| 69 | - @BindView(R.id.txt_use_times) | ||
| 70 | - TextView txt_use_times; | ||
| 71 | - @BindView(R.id.txt_total_usage_time) | ||
| 72 | - TextView txt_total_usage_time; | ||
| 73 | - @BindView(R.id.txt_version_number) | ||
| 74 | - TextView txt_version_number; | ||
| 75 | - | ||
| 76 | - @BindView(R.id.txt_sys_update) | ||
| 77 | - TextView txt_sys_update; | ||
| 78 | - @BindView(R.id.txt_app_update) | ||
| 79 | - TextView txt_app_update; | ||
| 80 | - @BindView(R.id.sb_update) | ||
| 81 | - SeekBar sb_update; | ||
| 82 | - | ||
| 83 | int mProgress = 0; | 48 | int mProgress = 0; |
| 84 | 49 | ||
| 85 | @Override | 50 | @Override |
| ... | @@ -101,72 +66,72 @@ public class DevInfoFragment extends BaseFragment implements | ... | @@ -101,72 +66,72 @@ public class DevInfoFragment extends BaseFragment implements |
| 101 | if (!hidden) { | 66 | if (!hidden) { |
| 102 | /*homeActivity.changeViewPage(); | 67 | /*homeActivity.changeViewPage(); |
| 103 | homeActivity.headIconStateChange(0);*/ | 68 | homeActivity.headIconStateChange(0);*/ |
| 104 | - txt_app_update.setEnabled(false); | 69 | + binding.txtAppUpdate.setEnabled(false); |
| 105 | - txt_sys_update.setEnabled(false); | 70 | + binding.txtSysUpdate.setEnabled(false); |
| 106 | initValue(); | 71 | initValue(); |
| 107 | StorageStateManager.getInstance().setMountCallBackFun(this); | 72 | StorageStateManager.getInstance().setMountCallBackFun(this); |
| 108 | CameraInfoMg.getInstance(null).setCameraInfoCb(this); | 73 | CameraInfoMg.getInstance(null).setCameraInfoCb(this); |
| 109 | } else { | 74 | } else { |
| 110 | mHandler.removeMessages(MSG_COPY_LOG); | 75 | mHandler.removeMessages(MSG_COPY_LOG); |
| 111 | //StorageStateManager.getInstance().setMountCallBackFun(null); | 76 | //StorageStateManager.getInstance().setMountCallBackFun(null); |
| 112 | - sb_update.setVisibility(View.GONE); | 77 | + binding.sbUpdate.setVisibility(View.GONE); |
| 113 | } | 78 | } |
| 114 | Logger.d(TAG, "======showFragment======2 " + hidden); | 79 | Logger.d(TAG, "======showFragment======2 " + hidden); |
| 115 | } | 80 | } |
| 116 | 81 | ||
| 117 | @Override | 82 | @Override |
| 118 | - protected int rootLayout() { | 83 | + protected FgSettingDevinfoBinding getViewBinding(LayoutInflater inflater, ViewGroup container) { |
| 119 | - return R.layout.fg_setting_devinfo; | 84 | + return FgSettingDevinfoBinding.inflate(inflater,container,false); |
| 120 | } | 85 | } |
| 121 | 86 | ||
| 122 | @Override | 87 | @Override |
| 123 | protected void init() { | 88 | protected void init() { |
| 124 | //layout_home_home_guest = (ConstraintLayout) rootView.findViewById(R.id.layout_home_home_guest); | 89 | //layout_home_home_guest = (ConstraintLayout) rootView.findViewById(R.id.layout_home_home_guest); |
| 125 | - txt_app_update.setEnabled(false); | 90 | + binding.txtAppUpdate.setEnabled(false); |
| 126 | - txt_sys_update.setEnabled(false); | 91 | + binding.txtSysUpdate.setEnabled(false); |
| 127 | - sb_update.setVisibility(View.GONE); | 92 | + binding.sbUpdate.setVisibility(View.GONE); |
| 128 | initValue(); | 93 | initValue(); |
| 129 | //禁用状态 | 94 | //禁用状态 |
| 130 | - sb_update.setClickable(false); | 95 | + binding.sbUpdate.setClickable(false); |
| 131 | - sb_update.setEnabled(false); | 96 | + binding.sbUpdate.setEnabled(false); |
| 132 | - sb_update.setFocusable(false); | 97 | + binding.sbUpdate.setFocusable(false); |
| 133 | } | 98 | } |
| 134 | 99 | ||
| 135 | void setCameraInfo() { | 100 | void setCameraInfo() { |
| 136 | if ( CameraInfoMg.getInstance(null).data_mirror_model.isEmpty() ) { | 101 | if ( CameraInfoMg.getInstance(null).data_mirror_model.isEmpty() ) { |
| 137 | - view_2.setVisibility(View.GONE); | 102 | + binding.view2.setVisibility(View.GONE); |
| 138 | - lay_1.setVisibility(View.GONE); | 103 | + binding.lay1.setVisibility(View.GONE); |
| 139 | } else { | 104 | } else { |
| 140 | - view_2.setVisibility(View.VISIBLE); | 105 | + binding.view2.setVisibility(View.VISIBLE); |
| 141 | - lay_1.setVisibility(View.VISIBLE); | 106 | + binding.lay1.setVisibility(View.VISIBLE); |
| 142 | } | 107 | } |
| 143 | - txt_len_model.setText(CameraInfoMg.getInstance(null).data_mirror_model); | 108 | + binding.txtLenModel.setText(CameraInfoMg.getInstance(null).data_mirror_model); |
| 144 | - txt_len_sn.setText(CameraInfoMg.getInstance(null).data_serial_number); | 109 | + binding.txtLenSn.setText(CameraInfoMg.getInstance(null).data_serial_number); |
| 145 | - txt_inner_outer_diameter.setText(CameraInfoMg.getInstance(null).data_internal_diameter + "/" + CameraInfoMg.getInstance(null).data_external_diameter); | 110 | + binding.txtInnerOuterDiameter.setText(CameraInfoMg.getInstance(null).data_internal_diameter + "/" + CameraInfoMg.getInstance(null).data_external_diameter); |
| 146 | - txt_use_times.setText(CameraInfoMg.getInstance(null).data_number_insertions); | 111 | + binding.txtUseTimes.setText(CameraInfoMg.getInstance(null).data_number_insertions); |
| 147 | - txt_total_usage_time.setText(CameraInfoMg.getInstance(null).data_usage_time); | 112 | + binding.txtTotalUsageTime.setText(CameraInfoMg.getInstance(null).data_usage_time); |
| 148 | - txt_version_number.setText("V1.0.0"); | 113 | + binding.txtVersionNumber.setText("V1.0.0"); |
| 149 | } | 114 | } |
| 150 | 115 | ||
| 151 | public void initValue() { | 116 | public void initValue() { |
| 152 | - txt_ver.setText(VersionManager.getAppVersionName(getContext())); | 117 | + binding.txtVer.setText(VersionManager.getAppVersionName(getContext())); |
| 153 | - txt_production_date.setText(DateUtils.getTimeOfMMM(BuildConfig.BUILD_TIMESTAMP)); | 118 | + binding.txtProductionDate.setText(DateUtils.getTimeOfMMM(BuildConfig.BUILD_TIMESTAMP)); |
| 154 | - txt_storage_size.setText(getDataSize() + " MB"); | 119 | + binding.txtStorageSize.setText(getDataSize() + " MB"); |
| 155 | - txt_use_times.setText(""); | 120 | + binding.txtUseTimes.setText(""); |
| 156 | - txt_total_usage_time.setText(""); | 121 | + binding.txtTotalUsageTime.setText(""); |
| 157 | 122 | ||
| 158 | if ( !Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath()) ) { | 123 | if ( !Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath()) ) { |
| 159 | } else if ( Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath() + "Laryngoscope.apk") | 124 | } else if ( Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath() + "Laryngoscope.apk") |
| 160 | /*&& SpManager.get_usb_input_enabled()*/ ) { | 125 | /*&& SpManager.get_usb_input_enabled()*/ ) { |
| 161 | - txt_app_update.setEnabled(true); | 126 | + binding.txtAppUpdate.setEnabled(true); |
| 162 | } | 127 | } |
| 163 | if ( Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath() + OtaUpgradeUtils.DEFAULT_PACKAGE_NAME) | 128 | if ( Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath() + OtaUpgradeUtils.DEFAULT_PACKAGE_NAME) |
| 164 | /*&& SpManager.get_usb_input_enabled()*/ ) { | 129 | /*&& SpManager.get_usb_input_enabled()*/ ) { |
| 165 | - txt_sys_update.setEnabled(true); | 130 | + binding.txtSysUpdate.setEnabled(true); |
| 166 | } | 131 | } |
| 167 | 132 | ||
| 168 | - sb_update.setProgress(0); | 133 | + binding.sbUpdate.setProgress(0); |
| 169 | - sb_update.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { | 134 | + binding.sbUpdate.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { |
| 170 | @Override | 135 | @Override |
| 171 | public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { | 136 | public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { |
| 172 | if (!fromUser) { | 137 | if (!fromUser) { |
| ... | @@ -190,19 +155,20 @@ public class DevInfoFragment extends BaseFragment implements | ... | @@ -190,19 +155,20 @@ public class DevInfoFragment extends BaseFragment implements |
| 190 | int width = point.x; | 155 | int width = point.x; |
| 191 | //屏幕实际高度(像素个数) | 156 | //屏幕实际高度(像素个数) |
| 192 | int height = point.y; | 157 | int height = point.y; |
| 193 | - txt_screen.setText(width + "x" + height); | 158 | + binding.txtScreen.setText(width + "x" + height); |
| 194 | } | 159 | } |
| 195 | 160 | ||
| 196 | @Override | 161 | @Override |
| 197 | protected void setListener() { | 162 | protected void setListener() { |
| 163 | + binding.txtAppUpdate.setOnClickListener(this); | ||
| 164 | + binding.txtSysUpdate.setOnClickListener(this); | ||
| 198 | } | 165 | } |
| 199 | 166 | ||
| 200 | @Override | 167 | @Override |
| 201 | - @OnClick({ R.id.txt_app_update, R.id.txt_sys_update, }) | ||
| 202 | public void onClick(View v) { | 168 | public void onClick(View v) { |
| 203 | switch (v.getId()) { | 169 | switch (v.getId()) { |
| 204 | case R.id.txt_sys_update: | 170 | case R.id.txt_sys_update: |
| 205 | - String path = StorageStateManager.getInstance().getUdiskPath() + OtaUpgradeUtils.DEFAULT_PACKAGE_NAME; | 171 | + final String path = StorageStateManager.getInstance().getUdiskPath() + OtaUpgradeUtils.DEFAULT_PACKAGE_NAME; |
| 206 | if ( !Storage.isCheckExist(path) || !SpManager.get_usb_input_enabled() ) { | 172 | if ( !Storage.isCheckExist(path) || !SpManager.get_usb_input_enabled() ) { |
| 207 | Toast.makeText(getActivity(), | 173 | Toast.makeText(getActivity(), |
| 208 | getString(R.string.string_about_export_no_file), Toast.LENGTH_SHORT).show(); | 174 | getString(R.string.string_about_export_no_file), Toast.LENGTH_SHORT).show(); |
| ... | @@ -236,15 +202,20 @@ public class DevInfoFragment extends BaseFragment implements | ... | @@ -236,15 +202,20 @@ public class DevInfoFragment extends BaseFragment implements |
| 236 | } | 202 | } |
| 237 | Logger.d(" txt_apk_upgrade " + VersionManager.getAppVersionCode(getContext())); | 203 | Logger.d(" txt_apk_upgrade " + VersionManager.getAppVersionCode(getContext())); |
| 238 | Logger.d(" txt_apk_upgrade " + VersionManager.getAppVersionCode(getContext(), path1)); | 204 | Logger.d(" txt_apk_upgrade " + VersionManager.getAppVersionCode(getContext(), path1)); |
| 239 | - txt_app_update.setEnabled(false); | 205 | + binding.txtAppUpdate.setEnabled(false); |
| 240 | - sb_update.setProgress(0); | 206 | + binding.sbUpdate.setProgress(0); |
| 241 | - sb_update.setVisibility(View.VISIBLE); | 207 | + binding.sbUpdate.setVisibility(View.VISIBLE); |
| 242 | mHandler.sendEmptyMessageDelayed(MSG_COPY_LOG, 1000); | 208 | mHandler.sendEmptyMessageDelayed(MSG_COPY_LOG, 1000); |
| 243 | /*if ( VersionManager.getAppVersionCode(getContext()) <= | 209 | /*if ( VersionManager.getAppVersionCode(getContext()) <= |
| 244 | VersionManager.getAppVersionCode(getContext(), path1) ) { | 210 | VersionManager.getAppVersionCode(getContext(), path1) ) { |
| 245 | VersionManager.installApk(getContext(), path1); | 211 | VersionManager.installApk(getContext(), path1); |
| 246 | }*/ | 212 | }*/ |
| 247 | - sb_update.postDelayed( () -> {scrollView.fullScroll(ScrollView.FOCUS_DOWN);}, 100 ); | 213 | + binding.sbUpdate.postDelayed(new Runnable() { |
| 214 | + @Override | ||
| 215 | + public void run() { | ||
| 216 | + binding.scrollView.fullScroll(ScrollView.FOCUS_DOWN); | ||
| 217 | + } | ||
| 218 | + }, 100); | ||
| 248 | //scrollView.smoothScrollTo(0, sb_update.getMeasuredHeight()); | 219 | //scrollView.smoothScrollTo(0, sb_update.getMeasuredHeight()); |
| 249 | break; | 220 | break; |
| 250 | default: | 221 | default: |
| ... | @@ -273,15 +244,15 @@ public class DevInfoFragment extends BaseFragment implements | ... | @@ -273,15 +244,15 @@ public class DevInfoFragment extends BaseFragment implements |
| 273 | public void MountEventProc(boolean mount) { | 244 | public void MountEventProc(boolean mount) { |
| 274 | if ( mount /*&& SpManager.get_usb_input_enabled()*/ ) { | 245 | if ( mount /*&& SpManager.get_usb_input_enabled()*/ ) { |
| 275 | if ( Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath() + "Laryngoscope.apk") ) { | 246 | if ( Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath() + "Laryngoscope.apk") ) { |
| 276 | - txt_app_update.setEnabled(true); | 247 | + binding.txtAppUpdate.setEnabled(true); |
| 277 | } | 248 | } |
| 278 | if ( Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath() + OtaUpgradeUtils.DEFAULT_PACKAGE_NAME) ) { | 249 | if ( Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath() + OtaUpgradeUtils.DEFAULT_PACKAGE_NAME) ) { |
| 279 | - txt_sys_update.setEnabled(true); | 250 | + binding.txtSysUpdate.setEnabled(true); |
| 280 | } | 251 | } |
| 281 | } else { | 252 | } else { |
| 282 | - txt_app_update.setEnabled(false); | 253 | + binding.txtAppUpdate.setEnabled(false); |
| 283 | - txt_sys_update.setEnabled(false); | 254 | + binding.txtSysUpdate.setEnabled(false); |
| 284 | - sb_update.setVisibility(View.GONE); | 255 | + binding.sbUpdate.setVisibility(View.GONE); |
| 285 | mHandler.removeMessages(MSG_COPY_LOG); | 256 | mHandler.removeMessages(MSG_COPY_LOG); |
| 286 | } | 257 | } |
| 287 | } | 258 | } |
| ... | @@ -290,52 +261,61 @@ public class DevInfoFragment extends BaseFragment implements | ... | @@ -290,52 +261,61 @@ public class DevInfoFragment extends BaseFragment implements |
| 290 | private static final int MSG_COPY_LOG = 10000001; | 261 | private static final int MSG_COPY_LOG = 10000001; |
| 291 | 262 | ||
| 292 | @Override | 263 | @Override |
| 293 | - public void setCamInfo(String data_internal_diameter, String data_external_diameter, | 264 | + public void setCamInfo(final String data_internal_diameter, final String data_external_diameter, |
| 294 | - String data_number_insertions, String data_usage_time, | 265 | + final String data_number_insertions, final String data_usage_time, |
| 295 | - String data_serial_number, String data_mirror_model) { | 266 | + final String data_serial_number, final String data_mirror_model) { |
| 296 | - homeActivity.runOnUiThread( () -> { | 267 | + homeActivity.runOnUiThread(new Runnable() { |
| 297 | - Log.d(TAG,"setCamInfo : "); | 268 | + @Override |
| 298 | - txt_len_model.setText(data_mirror_model); | 269 | + public void run() { |
| 299 | - txt_len_sn.setText(data_serial_number); | 270 | + Log.d(TAG,"setCamInfo : "); |
| 300 | - txt_inner_outer_diameter.setText(data_internal_diameter + "/" + data_external_diameter); | 271 | + binding.txtLenModel.setText(data_mirror_model); |
| 301 | - txt_use_times.setText(data_number_insertions); | 272 | + binding.txtLenSn.setText(data_serial_number); |
| 302 | - txt_total_usage_time.setText(data_usage_time); | 273 | + binding.txtInnerOuterDiameter.setText(data_internal_diameter + "/" + data_external_diameter); |
| 303 | - txt_version_number.setText("V1.0.0"); | 274 | + binding.txtUseTimes.setText(data_number_insertions); |
| 304 | - if ( CameraInfoMg.getInstance(null).data_mirror_model.isEmpty() ) { | 275 | + binding.txtTotalUsageTime.setText(data_usage_time); |
| 305 | - view_2.setVisibility(View.GONE); | 276 | + binding.txtVersionNumber.setText("V1.0.0"); |
| 306 | - lay_1.setVisibility(View.GONE); | 277 | + if ( CameraInfoMg.getInstance(null).data_mirror_model.isEmpty() ) { |
| 307 | - } else { | 278 | + binding.view2.setVisibility(View.GONE); |
| 308 | - view_2.setVisibility(View.VISIBLE); | 279 | + binding.lay1.setVisibility(View.GONE); |
| 309 | - lay_1.setVisibility(View.VISIBLE); | 280 | + } else { |
| 281 | + binding.view2.setVisibility(View.VISIBLE); | ||
| 282 | + binding.lay1.setVisibility(View.VISIBLE); | ||
| 283 | + } | ||
| 310 | } | 284 | } |
| 311 | - } ); | 285 | + }); |
| 312 | } | 286 | } |
| 313 | 287 | ||
| 314 | @Override | 288 | @Override |
| 315 | public void resetCamInfo() { | 289 | public void resetCamInfo() { |
| 316 | - homeActivity.runOnUiThread( () -> { | 290 | + homeActivity.runOnUiThread(new Runnable() { |
| 317 | - Log.d(TAG,"setCamInfo : "); | 291 | + @Override |
| 318 | - txt_len_model.setText(""); | 292 | + public void run() { |
| 319 | - txt_len_sn.setText(""); | 293 | + Log.d(TAG,"setCamInfo : "); |
| 320 | - txt_inner_outer_diameter.setText(""); | 294 | + binding.txtLenModel.setText(""); |
| 321 | - txt_use_times.setText(""); | 295 | + binding.txtLenSn.setText(""); |
| 322 | - txt_total_usage_time.setText(""); | 296 | + binding.txtInnerOuterDiameter.setText(""); |
| 323 | - txt_version_number.setText(""); | 297 | + binding.txtUseTimes.setText(""); |
| 324 | - if ( CameraInfoMg.getInstance(null).data_mirror_model.isEmpty() ) { | 298 | + binding.txtTotalUsageTime.setText(""); |
| 325 | - view_2.setVisibility(View.GONE); | 299 | + binding.txtVersionNumber.setText(""); |
| 326 | - lay_1.setVisibility(View.GONE); | 300 | + if ( CameraInfoMg.getInstance(null).data_mirror_model.isEmpty() ) { |
| 327 | - } else { | 301 | + binding.view2.setVisibility(View.GONE); |
| 328 | - view_2.setVisibility(View.VISIBLE); | 302 | + binding.lay1.setVisibility(View.GONE); |
| 329 | - lay_1.setVisibility(View.VISIBLE); | 303 | + } else { |
| 304 | + binding.view2.setVisibility(View.VISIBLE); | ||
| 305 | + binding.lay1.setVisibility(View.VISIBLE); | ||
| 306 | + } | ||
| 330 | } | 307 | } |
| 331 | - } ); | 308 | + }); |
| 332 | } | 309 | } |
| 333 | 310 | ||
| 334 | @Override | 311 | @Override |
| 335 | - public void setCamTime(String data_usage_time) { | 312 | + public void setCamTime(final String data_usage_time) { |
| 336 | - homeActivity.runOnUiThread( () -> { | 313 | + homeActivity.runOnUiThread(new Runnable() { |
| 337 | - txt_total_usage_time.setText(data_usage_time); | 314 | + @Override |
| 338 | - } ); | 315 | + public void run() { |
| 316 | + binding.txtTotalUsageTime.setText(data_usage_time); | ||
| 317 | + } | ||
| 318 | + }); | ||
| 339 | } | 319 | } |
| 340 | 320 | ||
| 341 | private class CpHandler extends Handler { | 321 | private class CpHandler extends Handler { |
| ... | @@ -344,17 +324,17 @@ public class DevInfoFragment extends BaseFragment implements | ... | @@ -344,17 +324,17 @@ public class DevInfoFragment extends BaseFragment implements |
| 344 | switch (msg.what) { | 324 | switch (msg.what) { |
| 345 | case MSG_COPY_LOG: | 325 | case MSG_COPY_LOG: |
| 346 | Log.d(TAG, "==.copyToUsb()1============"); | 326 | Log.d(TAG, "==.copyToUsb()1============"); |
| 347 | - int num = sb_update.getProgress(); | 327 | + int num = binding.sbUpdate.getProgress(); |
| 348 | - int max = sb_update.getMax(); | 328 | + int max = binding.sbUpdate.getMax(); |
| 349 | if ( num < max ) { | 329 | if ( num < max ) { |
| 350 | num += 1; | 330 | num += 1; |
| 351 | } else { | 331 | } else { |
| 352 | mProgress = 0; | 332 | mProgress = 0; |
| 353 | //ptv_open_persentage.setProgress(0, 0 + "%"); | 333 | //ptv_open_persentage.setProgress(0, 0 + "%"); |
| 354 | - sb_update.setProgress(0); | 334 | + binding.sbUpdate.setProgress(0); |
| 355 | - sb_update.setVisibility(View.GONE); | 335 | + binding.sbUpdate.setVisibility(View.GONE); |
| 356 | mHandler.removeMessages(MSG_COPY_LOG); | 336 | mHandler.removeMessages(MSG_COPY_LOG); |
| 357 | - txt_app_update.setEnabled(true); | 337 | + binding.txtAppUpdate.setEnabled(true); |
| 358 | 338 | ||
| 359 | String path1 = StorageStateManager.getInstance().getUdiskPath() + "Laryngoscope.apk"; | 339 | String path1 = StorageStateManager.getInstance().getUdiskPath() + "Laryngoscope.apk"; |
| 360 | if ( VersionManager.getAppVersionCode(getContext()) <= | 340 | if ( VersionManager.getAppVersionCode(getContext()) <= |
| ... | @@ -364,7 +344,7 @@ public class DevInfoFragment extends BaseFragment implements | ... | @@ -364,7 +344,7 @@ public class DevInfoFragment extends BaseFragment implements |
| 364 | 344 | ||
| 365 | break; | 345 | break; |
| 366 | } | 346 | } |
| 367 | - sb_update.setProgress(num); | 347 | + binding.sbUpdate.setProgress(num); |
| 368 | mHandler.sendEmptyMessageDelayed(MSG_COPY_LOG, 100); | 348 | mHandler.sendEmptyMessageDelayed(MSG_COPY_LOG, 100); |
| 369 | break; | 349 | break; |
| 370 | default: | 350 | default: | ... | ... |
| ... | @@ -6,7 +6,9 @@ import android.provider.Settings; | ... | @@ -6,7 +6,9 @@ import android.provider.Settings; |
| 6 | import android.text.Editable; | 6 | import android.text.Editable; |
| 7 | import android.text.TextWatcher; | 7 | import android.text.TextWatcher; |
| 8 | import android.view.KeyEvent; | 8 | import android.view.KeyEvent; |
| 9 | +import android.view.LayoutInflater; | ||
| 9 | import android.view.View; | 10 | import android.view.View; |
| 11 | +import android.view.ViewGroup; | ||
| 10 | import android.view.inputmethod.EditorInfo; | 12 | import android.view.inputmethod.EditorInfo; |
| 11 | import android.view.inputmethod.InputMethodManager; | 13 | import android.view.inputmethod.InputMethodManager; |
| 12 | import android.widget.EditText; | 14 | import android.widget.EditText; |
| ... | @@ -20,53 +22,17 @@ import com.sw.laryngoscope.R; | ... | @@ -20,53 +22,17 @@ import com.sw.laryngoscope.R; |
| 20 | import com.sw.laryngoscope.activity.BaseFragment; | 22 | import com.sw.laryngoscope.activity.BaseFragment; |
| 21 | import com.sw.laryngoscope.activity.CustomTimer; | 23 | import com.sw.laryngoscope.activity.CustomTimer; |
| 22 | import com.sw.laryngoscope.activity.HomeActivity; | 24 | import com.sw.laryngoscope.activity.HomeActivity; |
| 25 | +import com.sw.laryngoscope.databinding.FgSettingDicomBinding; | ||
| 23 | import com.sw.laryngoscope.manager.SpManager; | 26 | import com.sw.laryngoscope.manager.SpManager; |
| 24 | import com.sw.laryngoscope.utils.Logger; | 27 | import com.sw.laryngoscope.utils.Logger; |
| 25 | 28 | ||
| 26 | -import butterknife.BindView; | ||
| 27 | -import butterknife.OnClick; | ||
| 28 | 29 | ||
| 29 | -public class DicomFragment extends BaseFragment implements CustomTimer.TimerCallBack, | 30 | +public class DicomFragment extends BaseFragment<FgSettingDicomBinding> implements CustomTimer.TimerCallBack, |
| 30 | - RadioGroup.OnCheckedChangeListener { | 31 | + RadioGroup.OnCheckedChangeListener,View.OnClickListener { |
| 31 | 32 | ||
| 32 | private static final String TAG = "DicomFragment"; | 33 | private static final String TAG = "DicomFragment"; |
| 33 | private Context context; | 34 | private Context context; |
| 34 | 35 | ||
| 35 | - @BindView(R.id.lay_show_dicom) | ||
| 36 | - RelativeLayout lay_show_dicom; | ||
| 37 | - @BindView(R.id.ed_ae_name) | ||
| 38 | - EditText ed_ae_name; | ||
| 39 | - | ||
| 40 | - @BindView(R.id.rg_sn) | ||
| 41 | - RadioGroup rg_sn; | ||
| 42 | - @BindView(R.id.rb_use_sn) | ||
| 43 | - RadioButton rb_use_sn; | ||
| 44 | - @BindView(R.id.rb_define_name) | ||
| 45 | - RadioButton rb_define_name; | ||
| 46 | - @BindView(R.id.ed_station_name) | ||
| 47 | - EditText ed_station_name; | ||
| 48 | - | ||
| 49 | - @BindView(R.id.txt_show_dicom) | ||
| 50 | - TextView txt_show_dicom; | ||
| 51 | - @BindView(R.id.txt_new_create) | ||
| 52 | - TextView txt_new_create; | ||
| 53 | - | ||
| 54 | - @BindView(R.id.lay_set_dicom) | ||
| 55 | - RelativeLayout lay_set_dicom; | ||
| 56 | - @BindView(R.id.ed_pacs_name) | ||
| 57 | - EditText ed_pacs_name; | ||
| 58 | - @BindView(R.id.ed_pacs_ae_title) | ||
| 59 | - EditText ed_pacs_ae_title; | ||
| 60 | - @BindView(R.id.ed_host_name) | ||
| 61 | - EditText ed_host_name; | ||
| 62 | - @BindView(R.id.ed_port) | ||
| 63 | - EditText ed_port; | ||
| 64 | - | ||
| 65 | - @BindView(R.id.txt_create) | ||
| 66 | - TextView txt_create; | ||
| 67 | - @BindView(R.id.txt_cancel) | ||
| 68 | - TextView txt_cancel; | ||
| 69 | - | ||
| 70 | private CustomTimer scrollTimer; | 36 | private CustomTimer scrollTimer; |
| 71 | private final String timerTAG_scroll = "scroll"; | 37 | private final String timerTAG_scroll = "scroll"; |
| 72 | private InputMethodManager imm; | 38 | private InputMethodManager imm; |
| ... | @@ -98,8 +64,8 @@ public class DicomFragment extends BaseFragment implements CustomTimer.TimerCall | ... | @@ -98,8 +64,8 @@ public class DicomFragment extends BaseFragment implements CustomTimer.TimerCall |
| 98 | } | 64 | } |
| 99 | 65 | ||
| 100 | @Override | 66 | @Override |
| 101 | - protected int rootLayout() { | 67 | + protected FgSettingDicomBinding getViewBinding(LayoutInflater inflater, ViewGroup container) { |
| 102 | - return R.layout.fg_setting_dicom; | 68 | + return FgSettingDicomBinding.inflate(inflater,container,false); |
| 103 | } | 69 | } |
| 104 | 70 | ||
| 105 | @Override | 71 | @Override |
| ... | @@ -110,50 +76,50 @@ public class DicomFragment extends BaseFragment implements CustomTimer.TimerCall | ... | @@ -110,50 +76,50 @@ public class DicomFragment extends BaseFragment implements CustomTimer.TimerCall |
| 110 | 76 | ||
| 111 | public void initValue() { | 77 | public void initValue() { |
| 112 | if ( !SpManager.get_dev_ae_name().isEmpty() ) { | 78 | if ( !SpManager.get_dev_ae_name().isEmpty() ) { |
| 113 | - ed_ae_name.setText(SpManager.get_dev_ae_name()); | 79 | + binding.edAeName.setText(SpManager.get_dev_ae_name()); |
| 114 | } | 80 | } |
| 115 | if ( SpManager.get_station_sel() ) { | 81 | if ( SpManager.get_station_sel() ) { |
| 116 | - rb_use_sn.setChecked(true); | 82 | + binding.rbUseSn.setChecked(true); |
| 117 | //ed_station_name.setFocusable(false); | 83 | //ed_station_name.setFocusable(false); |
| 118 | - ed_station_name.setText( | 84 | + binding.edStationName.setText( |
| 119 | Settings.Secure.getString(homeActivity.getContentResolver(), Settings.Secure.ANDROID_ID)); | 85 | Settings.Secure.getString(homeActivity.getContentResolver(), Settings.Secure.ANDROID_ID)); |
| 120 | } else { | 86 | } else { |
| 121 | - rb_define_name.setChecked(true); | 87 | + binding.rbDefineName.setChecked(true); |
| 122 | if ( !SpManager.get_station_name().isEmpty() ) { | 88 | if ( !SpManager.get_station_name().isEmpty() ) { |
| 123 | - ed_station_name.setText(SpManager.get_station_name()); | 89 | + binding.edStationName.setText(SpManager.get_station_name()); |
| 124 | } | 90 | } |
| 125 | } | 91 | } |
| 126 | if ( !SpManager.get_pacs_name().isEmpty() ) { | 92 | if ( !SpManager.get_pacs_name().isEmpty() ) { |
| 127 | - txt_show_dicom.setText(getString(R.string.string_pacs_name) + " : " + SpManager.get_pacs_name()); | 93 | + binding.txtShowDicom.setText(getString(R.string.string_pacs_name) + " : " + SpManager.get_pacs_name()); |
| 128 | - txt_new_create.setText(R.string.string_modify); | 94 | + binding.txtNewCreate.setText(R.string.string_modify); |
| 129 | } | 95 | } |
| 130 | if ( !SpManager.get_pacs_name().isEmpty() ) { | 96 | if ( !SpManager.get_pacs_name().isEmpty() ) { |
| 131 | - ed_pacs_name.setText(SpManager.get_pacs_name()); | 97 | + binding.edPacsName.setText(SpManager.get_pacs_name()); |
| 132 | } | 98 | } |
| 133 | if ( !SpManager.get_pacs_ae_name().isEmpty() ) { | 99 | if ( !SpManager.get_pacs_ae_name().isEmpty() ) { |
| 134 | - ed_pacs_ae_title.setText(SpManager.get_pacs_ae_name()); | 100 | + binding.edPacsAeTitle.setText(SpManager.get_pacs_ae_name()); |
| 135 | } | 101 | } |
| 136 | if ( !SpManager.get_host_name().isEmpty() ) { | 102 | if ( !SpManager.get_host_name().isEmpty() ) { |
| 137 | - ed_host_name.setText(SpManager.get_host_name()); | 103 | + binding.edHostName.setText(SpManager.get_host_name()); |
| 138 | } | 104 | } |
| 139 | if ( SpManager.get_port() != 0 ) { | 105 | if ( SpManager.get_port() != 0 ) { |
| 140 | - ed_port.setText(SpManager.get_port() + ""); | 106 | + binding.edPort.setText(SpManager.get_port() + ""); |
| 141 | } | 107 | } |
| 142 | - lay_show_dicom.setVisibility(View.VISIBLE); | 108 | + binding.layShowDicom.setVisibility(View.VISIBLE); |
| 143 | - lay_set_dicom.setVisibility(View.GONE); | 109 | + binding.laySetDicom.setVisibility(View.GONE); |
| 144 | } | 110 | } |
| 145 | 111 | ||
| 146 | @Override | 112 | @Override |
| 147 | protected void setListener() { | 113 | protected void setListener() { |
| 148 | - rg_sn.setOnCheckedChangeListener(this); | 114 | + binding.rgSn.setOnCheckedChangeListener(this); |
| 149 | - ed_ae_name.setOnEditorActionListener(new TextView.OnEditorActionListener() { | 115 | + binding.edAeName.setOnEditorActionListener(new TextView.OnEditorActionListener() { |
| 150 | @Override | 116 | @Override |
| 151 | public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { | 117 | public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { |
| 152 | if (actionId == EditorInfo.IME_ACTION_DONE) { | 118 | if (actionId == EditorInfo.IME_ACTION_DONE) { |
| 153 | if (imm != null) { | 119 | if (imm != null) { |
| 154 | - imm.hideSoftInputFromWindow(ed_ae_name.getWindowToken(), 0); | 120 | + imm.hideSoftInputFromWindow(binding.edAeName.getWindowToken(), 0); |
| 155 | } | 121 | } |
| 156 | - String str = ed_ae_name.getText().toString().trim(); | 122 | + String str = binding.edAeName.getText().toString().trim(); |
| 157 | if (str.trim().length() <= 0) { | 123 | if (str.trim().length() <= 0) { |
| 158 | return false; | 124 | return false; |
| 159 | } | 125 | } |
| ... | @@ -162,7 +128,7 @@ public class DicomFragment extends BaseFragment implements CustomTimer.TimerCall | ... | @@ -162,7 +128,7 @@ public class DicomFragment extends BaseFragment implements CustomTimer.TimerCall |
| 162 | return false; | 128 | return false; |
| 163 | } | 129 | } |
| 164 | }); | 130 | }); |
| 165 | - ed_ae_name.addTextChangedListener(new TextWatcher() { | 131 | + binding.edAeName.addTextChangedListener(new TextWatcher() { |
| 166 | @Override | 132 | @Override |
| 167 | public void beforeTextChanged(CharSequence s, int start, int count, int after) {} | 133 | public void beforeTextChanged(CharSequence s, int start, int count, int after) {} |
| 168 | @Override | 134 | @Override |
| ... | @@ -171,14 +137,14 @@ public class DicomFragment extends BaseFragment implements CustomTimer.TimerCall | ... | @@ -171,14 +137,14 @@ public class DicomFragment extends BaseFragment implements CustomTimer.TimerCall |
| 171 | public void afterTextChanged(Editable s) {} | 137 | public void afterTextChanged(Editable s) {} |
| 172 | }); | 138 | }); |
| 173 | 139 | ||
| 174 | - ed_station_name.setOnEditorActionListener(new TextView.OnEditorActionListener() { | 140 | + binding.edStationName.setOnEditorActionListener(new TextView.OnEditorActionListener() { |
| 175 | @Override | 141 | @Override |
| 176 | public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { | 142 | public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { |
| 177 | if (actionId == EditorInfo.IME_ACTION_DONE) { | 143 | if (actionId == EditorInfo.IME_ACTION_DONE) { |
| 178 | if (imm != null) { | 144 | if (imm != null) { |
| 179 | - imm.hideSoftInputFromWindow(ed_station_name.getWindowToken(), 0); | 145 | + imm.hideSoftInputFromWindow(binding.edStationName.getWindowToken(), 0); |
| 180 | } | 146 | } |
| 181 | - String str = ed_station_name.getText().toString().trim(); | 147 | + String str = binding.edStationName.getText().toString().trim(); |
| 182 | if (str.trim().length() <= 0) { | 148 | if (str.trim().length() <= 0) { |
| 183 | return false; | 149 | return false; |
| 184 | } | 150 | } |
| ... | @@ -187,7 +153,7 @@ public class DicomFragment extends BaseFragment implements CustomTimer.TimerCall | ... | @@ -187,7 +153,7 @@ public class DicomFragment extends BaseFragment implements CustomTimer.TimerCall |
| 187 | return false; | 153 | return false; |
| 188 | } | 154 | } |
| 189 | }); | 155 | }); |
| 190 | - ed_station_name.addTextChangedListener(new TextWatcher() { | 156 | + binding.edStationName.addTextChangedListener(new TextWatcher() { |
| 191 | @Override | 157 | @Override |
| 192 | public void beforeTextChanged(CharSequence s, int start, int count, int after) {} | 158 | public void beforeTextChanged(CharSequence s, int start, int count, int after) {} |
| 193 | @Override | 159 | @Override |
| ... | @@ -195,39 +161,42 @@ public class DicomFragment extends BaseFragment implements CustomTimer.TimerCall | ... | @@ -195,39 +161,42 @@ public class DicomFragment extends BaseFragment implements CustomTimer.TimerCall |
| 195 | @Override | 161 | @Override |
| 196 | public void afterTextChanged(Editable s) {} | 162 | public void afterTextChanged(Editable s) {} |
| 197 | }); | 163 | }); |
| 164 | + | ||
| 165 | + binding.txtNewCreate.setOnClickListener(this); | ||
| 166 | + binding.txtCancel.setOnClickListener(this); | ||
| 167 | + binding.txtCreate.setOnClickListener(this); | ||
| 198 | } | 168 | } |
| 199 | 169 | ||
| 200 | @Override | 170 | @Override |
| 201 | - @OnClick({ R.id.txt_new_create, R.id.txt_create, R.id.txt_cancel }) | ||
| 202 | public void onClick(View v) { | 171 | public void onClick(View v) { |
| 203 | switch (v.getId()) { | 172 | switch (v.getId()) { |
| 204 | case R.id.txt_new_create: | 173 | case R.id.txt_new_create: |
| 205 | hideIm(); | 174 | hideIm(); |
| 206 | - lay_show_dicom.setVisibility(View.GONE); | 175 | + binding.layShowDicom.setVisibility(View.GONE); |
| 207 | - lay_set_dicom.setVisibility(View.VISIBLE); | 176 | + binding.laySetDicom.setVisibility(View.VISIBLE); |
| 208 | break; | 177 | break; |
| 209 | case R.id.txt_create: | 178 | case R.id.txt_create: |
| 210 | hideIm(); | 179 | hideIm(); |
| 211 | - if ( ed_pacs_name.getText().toString().isEmpty() | 180 | + if ( binding.edPacsName.getText().toString().isEmpty() |
| 212 | - || ed_pacs_ae_title.getText().toString().isEmpty() | 181 | + || binding.edPacsAeTitle.getText().toString().isEmpty() |
| 213 | - || ed_host_name.getText().toString().isEmpty() | 182 | + || binding.edHostName.getText().toString().isEmpty() |
| 214 | - || ed_port.getText().toString().isEmpty() ) { | 183 | + || binding.edPort.getText().toString().isEmpty() ) { |
| 215 | MyApplication.showToastLong1(getActivity().getString(R.string.string_data_no)); | 184 | MyApplication.showToastLong1(getActivity().getString(R.string.string_data_no)); |
| 216 | break; | 185 | break; |
| 217 | } | 186 | } |
| 218 | - SpManager.set_dev_ae_name(ed_pacs_name.getText().toString().trim()); | 187 | + SpManager.set_dev_ae_name(binding.edPacsName.getText().toString().trim()); |
| 219 | 188 | ||
| 220 | - SpManager.set_pacs_name(ed_pacs_name.getText().toString().trim()); | 189 | + SpManager.set_pacs_name(binding.edPacsName.getText().toString().trim()); |
| 221 | - SpManager.set_pacs_ae_name(ed_pacs_ae_title.getText().toString().trim()); | 190 | + SpManager.set_pacs_ae_name(binding.edPacsAeTitle.getText().toString().trim()); |
| 222 | - SpManager.set_host_name(ed_host_name.getText().toString().trim()); | 191 | + SpManager.set_host_name(binding.edHostName.getText().toString().trim()); |
| 223 | - SpManager.set_port(Integer.parseInt(ed_port.getText().toString().trim())); | 192 | + SpManager.set_port(Integer.parseInt(binding.edPort.getText().toString().trim())); |
| 224 | - lay_show_dicom.setVisibility(View.VISIBLE); | 193 | + binding.layShowDicom.setVisibility(View.VISIBLE); |
| 225 | - lay_set_dicom.setVisibility(View.GONE); | 194 | + binding.laySetDicom.setVisibility(View.GONE); |
| 226 | break; | 195 | break; |
| 227 | case R.id.txt_cancel: | 196 | case R.id.txt_cancel: |
| 228 | hideIm(); | 197 | hideIm(); |
| 229 | - lay_show_dicom.setVisibility(View.VISIBLE); | 198 | + binding.layShowDicom.setVisibility(View.VISIBLE); |
| 230 | - lay_set_dicom.setVisibility(View.GONE); | 199 | + binding.laySetDicom.setVisibility(View.GONE); |
| 231 | break; | 200 | break; |
| 232 | default: | 201 | default: |
| 233 | break; | 202 | break; |
| ... | @@ -240,23 +209,23 @@ public class DicomFragment extends BaseFragment implements CustomTimer.TimerCall | ... | @@ -240,23 +209,23 @@ public class DicomFragment extends BaseFragment implements CustomTimer.TimerCall |
| 240 | case R.id.rb_use_sn: | 209 | case R.id.rb_use_sn: |
| 241 | Logger.d(" rb_use_sn " ); | 210 | Logger.d(" rb_use_sn " ); |
| 242 | SpManager.set_station_sel(true); | 211 | SpManager.set_station_sel(true); |
| 243 | - ed_station_name.setFocusable(false); | 212 | + binding.edStationName.setFocusable(false); |
| 244 | - ed_station_name.setFocusableInTouchMode(false); | 213 | + binding.edStationName.setFocusableInTouchMode(false); |
| 245 | - ed_station_name.clearFocus(); | 214 | + binding.edStationName.clearFocus(); |
| 246 | - ed_station_name.setText( | 215 | + binding.edStationName.setText( |
| 247 | Settings.Secure.getString(homeActivity.getContentResolver(), Settings.Secure.ANDROID_ID)); | 216 | Settings.Secure.getString(homeActivity.getContentResolver(), Settings.Secure.ANDROID_ID)); |
| 248 | break; | 217 | break; |
| 249 | case R.id.rb_define_name: | 218 | case R.id.rb_define_name: |
| 250 | Logger.d(" rb_define_name " ); | 219 | Logger.d(" rb_define_name " ); |
| 251 | SpManager.set_station_sel(false); | 220 | SpManager.set_station_sel(false); |
| 252 | - ed_station_name.setFocusable(true); | 221 | + binding.edStationName.setFocusable(true); |
| 253 | - ed_station_name.setFocusableInTouchMode(true); | 222 | + binding.edStationName.setFocusableInTouchMode(true); |
| 254 | - ed_station_name.requestFocus(); | 223 | + binding.edStationName.requestFocus(); |
| 255 | if ( !SpManager.get_station_name().isEmpty() ) { | 224 | if ( !SpManager.get_station_name().isEmpty() ) { |
| 256 | - ed_station_name.setText(SpManager.get_station_name()); | 225 | + binding.edStationName.setText(SpManager.get_station_name()); |
| 257 | - ed_station_name.setSelection(ed_station_name.getText().length()); | 226 | + binding.edStationName.setSelection(binding.edStationName.getText().length()); |
| 258 | } else { | 227 | } else { |
| 259 | - ed_station_name.setText(""); | 228 | + binding.edStationName.setText(""); |
| 260 | } | 229 | } |
| 261 | break; | 230 | break; |
| 262 | } | 231 | } | ... | ... |
| ... | @@ -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: | ... | ... |
| ... | @@ -17,7 +17,9 @@ import android.text.Editable; | ... | @@ -17,7 +17,9 @@ import android.text.Editable; |
| 17 | import android.text.TextUtils; | 17 | import android.text.TextUtils; |
| 18 | import android.text.TextWatcher; | 18 | import android.text.TextWatcher; |
| 19 | import android.view.KeyEvent; | 19 | import android.view.KeyEvent; |
| 20 | +import android.view.LayoutInflater; | ||
| 20 | import android.view.View; | 21 | import android.view.View; |
| 22 | +import android.view.ViewGroup; | ||
| 21 | import android.view.animation.Animation; | 23 | import android.view.animation.Animation; |
| 22 | import android.view.animation.AnimationUtils; | 24 | import android.view.animation.AnimationUtils; |
| 23 | import android.view.animation.LinearInterpolator; | 25 | import android.view.animation.LinearInterpolator; |
| ... | @@ -43,6 +45,7 @@ import com.sw.laryngoscope.activity.CustomTimer; | ... | @@ -43,6 +45,7 @@ import com.sw.laryngoscope.activity.CustomTimer; |
| 43 | import com.sw.laryngoscope.activity.HomeActivity; | 45 | import com.sw.laryngoscope.activity.HomeActivity; |
| 44 | import com.sw.laryngoscope.adapter.WifiListAdapter; | 46 | import com.sw.laryngoscope.adapter.WifiListAdapter; |
| 45 | import com.sw.laryngoscope.common.Constant; | 47 | import com.sw.laryngoscope.common.Constant; |
| 48 | +import com.sw.laryngoscope.databinding.FgSettingNetBinding; | ||
| 46 | import com.sw.laryngoscope.floatwindow.FloatWindowManager; | 49 | import com.sw.laryngoscope.floatwindow.FloatWindowManager; |
| 47 | import com.sw.laryngoscope.manager.SpManager; | 50 | import com.sw.laryngoscope.manager.SpManager; |
| 48 | import com.sw.laryngoscope.manager.WifiDataManager; | 51 | import com.sw.laryngoscope.manager.WifiDataManager; |
| ... | @@ -57,13 +60,10 @@ import java.net.InetAddress; | ... | @@ -57,13 +60,10 @@ import java.net.InetAddress; |
| 57 | import java.net.UnknownHostException; | 60 | import java.net.UnknownHostException; |
| 58 | import java.util.List; | 61 | import java.util.List; |
| 59 | 62 | ||
| 60 | -import butterknife.BindView; | ||
| 61 | -import butterknife.OnCheckedChanged; | ||
| 62 | -import butterknife.OnClick; | ||
| 63 | 63 | ||
| 64 | -public class NetWorkFragment extends BaseFragment implements | 64 | +public class NetWorkFragment extends BaseFragment<FgSettingNetBinding> implements |
| 65 | CustomTimer.TimerCallBack, Switch.OnCheckedChangeListener, OnWifiEnabledListener, OnWifiScanResultsListener, | 65 | CustomTimer.TimerCallBack, Switch.OnCheckedChangeListener, OnWifiEnabledListener, OnWifiScanResultsListener, |
| 66 | - OnWifiConnectListener, AdapterView.OnItemClickListener, AdapterView.OnItemLongClickListener { | 66 | + OnWifiConnectListener, AdapterView.OnItemClickListener, AdapterView.OnItemLongClickListener ,View.OnClickListener{ |
| 67 | 67 | ||
| 68 | private static final String TAG = "NetWorkFragment"; | 68 | private static final String TAG = "NetWorkFragment"; |
| 69 | private Context context; | 69 | private Context context; |
| ... | @@ -75,39 +75,6 @@ public class NetWorkFragment extends BaseFragment implements | ... | @@ -75,39 +75,6 @@ public class NetWorkFragment extends BaseFragment implements |
| 75 | private CustomTimer scrollTimer; | 75 | private CustomTimer scrollTimer; |
| 76 | private final String timerTAG_scroll = "scroll"; | 76 | private final String timerTAG_scroll = "scroll"; |
| 77 | 77 | ||
| 78 | - @BindView(R.id.lay_net_main) | ||
| 79 | - RelativeLayout lay_net_main; | ||
| 80 | - @BindView(R.id.switch_network) | ||
| 81 | - Switch switch_network; | ||
| 82 | - @BindView(R.id.ed_host_name) | ||
| 83 | - EditText ed_host_name; | ||
| 84 | - | ||
| 85 | - @BindView(R.id.txt_ip) | ||
| 86 | - TextView txt_ip; | ||
| 87 | - | ||
| 88 | - @BindView(R.id.lay_wifi_flush) | ||
| 89 | - View lay_wifi_flush; | ||
| 90 | - @BindView(R.id.switch_wifi) | ||
| 91 | - Switch switch_wifi; | ||
| 92 | - @BindView(R.id.img_flush) | ||
| 93 | - ImageView img_flush; | ||
| 94 | - @BindView(R.id.listview) | ||
| 95 | - ListView listview; | ||
| 96 | - | ||
| 97 | - @BindView(R.id.lay_wifi_psd) | ||
| 98 | - View lay_wifi_psd; | ||
| 99 | - @BindView(R.id.txt_wifi_name) | ||
| 100 | - TextView txt_wifi_name; | ||
| 101 | - @BindView(R.id.switch_auto) | ||
| 102 | - Switch switch_auto; | ||
| 103 | - @BindView(R.id.ed_wifi_psd) | ||
| 104 | - EditText ed_wifi_psd; | ||
| 105 | - @BindView(R.id.txt_status) | ||
| 106 | - TextView txt_status; | ||
| 107 | - @BindView(R.id.txt_ip_addr) | ||
| 108 | - TextView txt_ip_addr; | ||
| 109 | - @BindView(R.id.txt_save) | ||
| 110 | - TextView txt_save; | ||
| 111 | 78 | ||
| 112 | private ScanResult connScanResult; | 79 | private ScanResult connScanResult; |
| 113 | private WiFiManager mWiFiManager; | 80 | private WiFiManager mWiFiManager; |
| ... | @@ -135,10 +102,10 @@ public class NetWorkFragment extends BaseFragment implements | ... | @@ -135,10 +102,10 @@ public class NetWorkFragment extends BaseFragment implements |
| 135 | mWiFiManager.setOnWifiEnabledListener(this); | 102 | mWiFiManager.setOnWifiEnabledListener(this); |
| 136 | mWiFiManager.setOnWifiScanResultsListener(this); | 103 | mWiFiManager.setOnWifiScanResultsListener(this); |
| 137 | mWiFiManager.setOnWifiConnectListener(this); | 104 | mWiFiManager.setOnWifiConnectListener(this); |
| 138 | - switch_wifi.setChecked(!mWiFiManager.isWifiEnabled()); | 105 | + binding.layWifiFlush.switchWifi.setChecked(!mWiFiManager.isWifiEnabled()); |
| 139 | 106 | ||
| 140 | - ed_host_name.setText(SpManager.get_dev_host_name()); | 107 | + binding.edHostName.setText(SpManager.get_dev_host_name()); |
| 141 | - ed_host_name.setSelection(ed_host_name.getText().length()); | 108 | + binding.edHostName.setSelection(binding.edHostName.getText().length()); |
| 142 | new Thread(new Runnable() { | 109 | new Thread(new Runnable() { |
| 143 | @Override | 110 | @Override |
| 144 | public void run() { | 111 | public void run() { |
| ... | @@ -167,8 +134,8 @@ public class NetWorkFragment extends BaseFragment implements | ... | @@ -167,8 +134,8 @@ public class NetWorkFragment extends BaseFragment implements |
| 167 | } | 134 | } |
| 168 | 135 | ||
| 169 | @Override | 136 | @Override |
| 170 | - protected int rootLayout() { | 137 | + protected FgSettingNetBinding getViewBinding(LayoutInflater inflater, ViewGroup container) { |
| 171 | - return R.layout.fg_setting_net; | 138 | + return FgSettingNetBinding.inflate(inflater,container,false); |
| 172 | } | 139 | } |
| 173 | 140 | ||
| 174 | @Override | 141 | @Override |
| ... | @@ -184,24 +151,24 @@ public class NetWorkFragment extends BaseFragment implements | ... | @@ -184,24 +151,24 @@ public class NetWorkFragment extends BaseFragment implements |
| 184 | ConnectivityManager connectMgr = (ConnectivityManager) getActivity().getSystemService(Context.CONNECTIVITY_SERVICE); | 151 | ConnectivityManager connectMgr = (ConnectivityManager) getActivity().getSystemService(Context.CONNECTIVITY_SERVICE); |
| 185 | NetworkInfo ethNetInfo = connectMgr.getNetworkInfo(ConnectivityManager.TYPE_ETHERNET); | 152 | NetworkInfo ethNetInfo = connectMgr.getNetworkInfo(ConnectivityManager.TYPE_ETHERNET); |
| 186 | if (ethNetInfo != null && ethNetInfo.isConnected()) { | 153 | if (ethNetInfo != null && ethNetInfo.isConnected()) { |
| 187 | - switch_network.setChecked(true); | 154 | + binding.switchNetwork.setChecked(true); |
| 188 | - txt_ip.setText(NetIp.getIpAddressForInterfaces()); | 155 | + binding.txtIp.setText(NetIp.getIpAddressForInterfaces()); |
| 189 | } else { | 156 | } else { |
| 190 | - switch_network.setChecked(false); | 157 | + binding.switchNetwork.setChecked(false); |
| 191 | - txt_ip.setText(""); | 158 | + binding.txtIp.setText(""); |
| 192 | } | 159 | } |
| 193 | //mEthernetManager.isEnabled();//判断有线是否开启 | 160 | //mEthernetManager.isEnabled();//判断有线是否开启 |
| 194 | //mEthernetManager.setEnabled(false); | 161 | //mEthernetManager.setEnabled(false); |
| 195 | //switch_network.setChecked(!SpManager.get_usb_input_enabled()); | 162 | //switch_network.setChecked(!SpManager.get_usb_input_enabled()); |
| 196 | 163 | ||
| 197 | - ed_host_name.setOnEditorActionListener(new TextView.OnEditorActionListener() { | 164 | + binding.edHostName.setOnEditorActionListener(new TextView.OnEditorActionListener() { |
| 198 | @Override | 165 | @Override |
| 199 | public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { | 166 | public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { |
| 200 | if (actionId == EditorInfo.IME_ACTION_DONE) { | 167 | if (actionId == EditorInfo.IME_ACTION_DONE) { |
| 201 | String outValue; | 168 | String outValue; |
| 202 | - outValue = ed_host_name.getText().toString(); | 169 | + outValue = binding.edHostName.getText().toString(); |
| 203 | - if ( ed_host_name.getText().length() >= 0 ) { | 170 | + if ( binding.edHostName.getText().length() >= 0 ) { |
| 204 | - ed_host_name.setSelection(ed_host_name.getText().length()); | 171 | + binding.edHostName.setSelection(binding.edHostName.getText().length()); |
| 205 | SpManager.set_dev_host_name(outValue); | 172 | SpManager.set_dev_host_name(outValue); |
| 206 | } | 173 | } |
| 207 | Logger.d(TAG, "onEditorAction outValue: " + outValue); | 174 | Logger.d(TAG, "onEditorAction outValue: " + outValue); |
| ... | @@ -209,7 +176,7 @@ public class NetWorkFragment extends BaseFragment implements | ... | @@ -209,7 +176,7 @@ public class NetWorkFragment extends BaseFragment implements |
| 209 | return false; | 176 | return false; |
| 210 | } | 177 | } |
| 211 | }); | 178 | }); |
| 212 | - ed_host_name.addTextChangedListener(new TextWatcher() { | 179 | + binding.edHostName.addTextChangedListener(new TextWatcher() { |
| 213 | @Override | 180 | @Override |
| 214 | public void beforeTextChanged(CharSequence s, int start, int count, | 181 | public void beforeTextChanged(CharSequence s, int start, int count, |
| 215 | int after) { | 182 | int after) { |
| ... | @@ -217,8 +184,8 @@ public class NetWorkFragment extends BaseFragment implements | ... | @@ -217,8 +184,8 @@ public class NetWorkFragment extends BaseFragment implements |
| 217 | @Override | 184 | @Override |
| 218 | public void onTextChanged(CharSequence s, int start, int before, | 185 | public void onTextChanged(CharSequence s, int start, int before, |
| 219 | int count) { | 186 | int count) { |
| 220 | - if ( ed_host_name.getText().length() >= 0 ) { | 187 | + if ( binding.edHostName.getText().length() >= 0 ) { |
| 221 | - SpManager.set_dev_host_name(ed_host_name.getText().toString()); | 188 | + SpManager.set_dev_host_name(binding.edHostName.getText().toString()); |
| 222 | } | 189 | } |
| 223 | } | 190 | } |
| 224 | @Override | 191 | @Override |
| ... | @@ -228,46 +195,50 @@ public class NetWorkFragment extends BaseFragment implements | ... | @@ -228,46 +195,50 @@ public class NetWorkFragment extends BaseFragment implements |
| 228 | 195 | ||
| 229 | mWiFiManager = WiFiManager.getInstance(getContext()); | 196 | mWiFiManager = WiFiManager.getInstance(getContext()); |
| 230 | mWifiListAdapter = new WifiListAdapter(getContext()); | 197 | mWifiListAdapter = new WifiListAdapter(getContext()); |
| 231 | - listview.setAdapter(this.mWifiListAdapter); | 198 | + binding.layWifiFlush.listview.setAdapter(this.mWifiListAdapter); |
| 232 | - listview.setOnItemClickListener(this); | 199 | + binding.layWifiFlush.listview.setOnItemClickListener(this); |
| 233 | - listview.setOnItemLongClickListener(this); | 200 | + binding.layWifiFlush.listview.setOnItemLongClickListener(this); |
| 234 | - listview.setVerticalFadingEdgeEnabled(true); | 201 | + binding.layWifiFlush.listview.setVerticalFadingEdgeEnabled(true); |
| 235 | - listview.setFadingEdgeLength(120); | 202 | + binding.layWifiFlush.listview.setFadingEdgeLength(120); |
| 236 | } | 203 | } |
| 237 | 204 | ||
| 238 | 205 | ||
| 239 | @Override | 206 | @Override |
| 240 | protected void setListener() { | 207 | protected void setListener() { |
| 208 | + binding.layWifi.getRootView().setOnClickListener(this); | ||
| 209 | + binding.layWifiFlush.imgFlush.setOnClickListener(this); | ||
| 210 | + binding.layWifiPsd.txtSave.setOnClickListener(this); | ||
| 211 | + binding.switchNetwork.setOnCheckedChangeListener(this); | ||
| 212 | + binding.layWifiFlush.switchWifi.setOnCheckedChangeListener(this); | ||
| 241 | } | 213 | } |
| 242 | 214 | ||
| 243 | @Override | 215 | @Override |
| 244 | - @OnClick({ R.id.lay_wifi, R.id.img_flush, R.id.txt_save }) | ||
| 245 | public void onClick(View v) { | 216 | public void onClick(View v) { |
| 246 | switch (v.getId()) { | 217 | switch (v.getId()) { |
| 247 | case R.id.lay_wifi: | 218 | case R.id.lay_wifi: |
| 248 | /*FloatWindowManager.getInstance(getContext()).stopOtherBackFloatWindow(); | 219 | /*FloatWindowManager.getInstance(getContext()).stopOtherBackFloatWindow(); |
| 249 | FloatWindowManager.getInstance(getContext()).startOtherBackFloatWindow(); | 220 | FloatWindowManager.getInstance(getContext()).startOtherBackFloatWindow(); |
| 250 | Support.doStartApplicationWithPackageName(getContext(), androidSetting, androidWIFI);*/ | 221 | Support.doStartApplicationWithPackageName(getContext(), androidSetting, androidWIFI);*/ |
| 251 | - lay_net_main.setVisibility(View.GONE); | 222 | + binding.layNetMain.setVisibility(View.GONE); |
| 252 | - lay_wifi_flush.setVisibility(View.VISIBLE); | 223 | + binding.layWifiFlush.getRoot().setVisibility(View.VISIBLE); |
| 253 | startScanWifi(); | 224 | startScanWifi(); |
| 254 | break; | 225 | break; |
| 255 | case R.id.img_flush: | 226 | case R.id.img_flush: |
| 256 | startScanWifi(); | 227 | startScanWifi(); |
| 257 | break; | 228 | break; |
| 258 | case R.id.txt_save: | 229 | case R.id.txt_save: |
| 259 | - if ( txt_save.getTag().equals("0") ) { | 230 | + if ( binding.layWifiPsd.txtSave.getTag().equals("0") ) { |
| 260 | WifiConfiguration mWifiConfiguration = | 231 | WifiConfiguration mWifiConfiguration = |
| 261 | - mWiFiManager.getConfigFromConfiguredNetworksBySsid(txt_wifi_name.getText().toString()); | 232 | + mWiFiManager.getConfigFromConfiguredNetworksBySsid(binding.layWifiPsd.txtWifiName.getText().toString()); |
| 262 | if ( mWifiConfiguration != null ) { | 233 | if ( mWifiConfiguration != null ) { |
| 263 | mWiFiManager.deleteConfig(mWifiConfiguration.networkId); | 234 | mWiFiManager.deleteConfig(mWifiConfiguration.networkId); |
| 264 | } | 235 | } |
| 265 | mWiFiManager.disconnectCurrentWifi(); | 236 | mWiFiManager.disconnectCurrentWifi(); |
| 266 | - txt_save.setTag("1"); | 237 | + binding.layWifiPsd.txtSave.setTag("1"); |
| 267 | - txt_save.setText(R.string.string_ok); | 238 | + binding.layWifiPsd.txtSave.setText(R.string.string_ok); |
| 268 | break; | 239 | break; |
| 269 | } | 240 | } |
| 270 | - wifiPassword = ed_wifi_psd.getText().toString(); | 241 | + wifiPassword = binding.layWifiPsd.edWifiPsd.getText().toString(); |
| 271 | if (TextUtils.isEmpty(wifiPassword)) { | 242 | if (TextUtils.isEmpty(wifiPassword)) { |
| 272 | break; | 243 | break; |
| 273 | } | 244 | } |
| ... | @@ -300,7 +271,6 @@ public class NetWorkFragment extends BaseFragment implements | ... | @@ -300,7 +271,6 @@ public class NetWorkFragment extends BaseFragment implements |
| 300 | } | 271 | } |
| 301 | 272 | ||
| 302 | @Override | 273 | @Override |
| 303 | - @OnCheckedChanged({ R.id.switch_network, R.id.switch_wifi, }) | ||
| 304 | public void onCheckedChanged(CompoundButton compoundButton, boolean b) { | 274 | public void onCheckedChanged(CompoundButton compoundButton, boolean b) { |
| 305 | switch (compoundButton.getId()) { | 275 | switch (compoundButton.getId()) { |
| 306 | case R.id.switch_network: | 276 | case R.id.switch_network: |
| ... | @@ -310,15 +280,15 @@ public class NetWorkFragment extends BaseFragment implements | ... | @@ -310,15 +280,15 @@ public class NetWorkFragment extends BaseFragment implements |
| 310 | } | 280 | } |
| 311 | break; | 281 | break; |
| 312 | case R.id.switch_wifi: | 282 | case R.id.switch_wifi: |
| 313 | - if ( !switch_wifi.isPressed() ) { | 283 | + if ( !binding.layWifiFlush.switchWifi.isPressed() ) { |
| 314 | break; | 284 | break; |
| 315 | } | 285 | } |
| 316 | if (!b) { | 286 | if (!b) { |
| 317 | mWiFiManager.openWiFi(); | 287 | mWiFiManager.openWiFi(); |
| 318 | - listview.setVisibility(View.VISIBLE); | 288 | + binding.layWifiFlush.listview.setVisibility(View.VISIBLE); |
| 319 | } else { | 289 | } else { |
| 320 | mWiFiManager.closeWiFi(); | 290 | mWiFiManager.closeWiFi(); |
| 321 | - listview.setVisibility(View.GONE); | 291 | + binding.layWifiFlush.listview.setVisibility(View.GONE); |
| 322 | } | 292 | } |
| 323 | break; | 293 | break; |
| 324 | case R.id.switch_auto: | 294 | case R.id.switch_auto: |
| ... | @@ -445,7 +415,7 @@ public class NetWorkFragment extends BaseFragment implements | ... | @@ -445,7 +415,7 @@ public class NetWorkFragment extends BaseFragment implements |
| 445 | 415 | ||
| 446 | @Override | 416 | @Override |
| 447 | public void onWifiEnabled(boolean enabled) { | 417 | public void onWifiEnabled(boolean enabled) { |
| 448 | - switch_wifi.setChecked(!enabled); | 418 | + binding.layWifiFlush.switchWifi.setChecked(!enabled); |
| 449 | if ( enabled ) { | 419 | if ( enabled ) { |
| 450 | startScanWifi(); | 420 | startScanWifi(); |
| 451 | } else { | 421 | } else { |
| ... | @@ -480,24 +450,24 @@ public class NetWorkFragment extends BaseFragment implements | ... | @@ -480,24 +450,24 @@ public class NetWorkFragment extends BaseFragment implements |
| 480 | } | 450 | } |
| 481 | 451 | ||
| 482 | public void enterWifiInfo(String SSID) { | 452 | public void enterWifiInfo(String SSID) { |
| 483 | - ed_wifi_psd.setText(""); | 453 | + binding.layWifiPsd.edWifiPsd.setText(""); |
| 484 | - lay_wifi_flush.setVisibility(View.GONE); | 454 | + binding.layWifiFlush.getRoot().setVisibility(View.GONE); |
| 485 | - lay_wifi_psd.setVisibility(View.VISIBLE); | 455 | + binding.layWifiPsd.getRoot().setVisibility(View.VISIBLE); |
| 486 | - txt_wifi_name.setText(SSID); | 456 | + binding.layWifiPsd.txtWifiName.setText(SSID); |
| 487 | setWifiDetailInfo(SSID); | 457 | setWifiDetailInfo(SSID); |
| 488 | } | 458 | } |
| 489 | 459 | ||
| 490 | public void setWifiDetailInfo(String SSID) { | 460 | public void setWifiDetailInfo(String SSID) { |
| 491 | Logger.d(" setWifiDetailInfo SSID " + SSID); | 461 | Logger.d(" setWifiDetailInfo SSID " + SSID); |
| 492 | - if ( lay_wifi_psd.getVisibility() == View.VISIBLE ) { | 462 | + if ( binding.layWifiPsd.getRoot().getVisibility() == View.VISIBLE ) { |
| 493 | WifiInfo curWifiInfo = ((WifiManager) getActivity().getApplicationContext().getSystemService(Context.WIFI_SERVICE)) | 463 | WifiInfo curWifiInfo = ((WifiManager) getActivity().getApplicationContext().getSystemService(Context.WIFI_SERVICE)) |
| 494 | .getConnectionInfo(); | 464 | .getConnectionInfo(); |
| 495 | Logger.d(" setWifiDetailInfo curWifiInfo.getSSID() " + curWifiInfo.getSSID()); | 465 | Logger.d(" setWifiDetailInfo curWifiInfo.getSSID() " + curWifiInfo.getSSID()); |
| 496 | if ( curWifiInfo != null && ("\"" + SSID + "\"").equals(curWifiInfo.getSSID())) { | 466 | if ( curWifiInfo != null && ("\"" + SSID + "\"").equals(curWifiInfo.getSSID())) { |
| 497 | - txt_status.setText(R.string.string_wifi_con); | 467 | + binding.layWifiPsd.txtStatus.setText(R.string.string_wifi_con); |
| 498 | - txt_ip_addr.setText(intToIp(curWifiInfo.getIpAddress())); | 468 | + binding.layWifiPsd.txtIpAddr.setText(intToIp(curWifiInfo.getIpAddress())); |
| 499 | - txt_save.setText(R.string.string_cancel); | 469 | + binding.layWifiPsd.txtSave.setText(R.string.string_cancel); |
| 500 | - txt_save.setTag("0"); | 470 | + binding.layWifiPsd.txtSave.setTag("0"); |
| 501 | WifiConfiguration mWifiConfiguration = mWiFiManager.getConfigFromConfiguredNetworksBySsid(SSID); | 471 | WifiConfiguration mWifiConfiguration = mWiFiManager.getConfigFromConfiguredNetworksBySsid(SSID); |
| 502 | if ( mWifiConfiguration != null ) { | 472 | if ( mWifiConfiguration != null ) { |
| 503 | //ed_wifi_psd.setText(mWifiConfiguration.preSharedKey); | 473 | //ed_wifi_psd.setText(mWifiConfiguration.preSharedKey); |
| ... | @@ -505,14 +475,14 @@ public class NetWorkFragment extends BaseFragment implements | ... | @@ -505,14 +475,14 @@ public class NetWorkFragment extends BaseFragment implements |
| 505 | } | 475 | } |
| 506 | String psd = WifiDataManager.getInstance().findWifiPsd(SSID); | 476 | String psd = WifiDataManager.getInstance().findWifiPsd(SSID); |
| 507 | if ( !psd.isEmpty() ) { | 477 | if ( !psd.isEmpty() ) { |
| 508 | - ed_wifi_psd.setText(psd); | 478 | + binding.layWifiPsd.edWifiPsd.setText(psd); |
| 509 | } | 479 | } |
| 510 | } else { | 480 | } else { |
| 511 | - ed_wifi_psd.setText(""); | 481 | + binding.layWifiPsd.edWifiPsd.setText(""); |
| 512 | - txt_status.setText(R.string.string_wifi_uncon); | 482 | + binding.layWifiPsd.txtStatus.setText(R.string.string_wifi_uncon); |
| 513 | - txt_ip_addr.setText(""); | 483 | + binding.layWifiPsd.txtIpAddr.setText(""); |
| 514 | - txt_save.setText(R.string.string_ok); | 484 | + binding.layWifiPsd.txtSave.setText(R.string.string_ok); |
| 515 | - txt_save.setTag("1"); | 485 | + binding.layWifiPsd.txtSave.setTag("1"); |
| 516 | } | 486 | } |
| 517 | } | 487 | } |
| 518 | } | 488 | } |
| ... | @@ -526,12 +496,12 @@ public class NetWorkFragment extends BaseFragment implements | ... | @@ -526,12 +496,12 @@ public class NetWorkFragment extends BaseFragment implements |
| 526 | 496 | ||
| 527 | public boolean isBackProc() { | 497 | public boolean isBackProc() { |
| 528 | boolean ret = false; | 498 | boolean ret = false; |
| 529 | - if ( lay_wifi_flush.getVisibility() == View.VISIBLE ) { | 499 | + if ( binding.layWifiFlush.getRoot().getVisibility() == View.VISIBLE ) { |
| 530 | - lay_wifi_flush.setVisibility(View.GONE); | 500 | + binding.layWifiFlush.getRoot().setVisibility(View.GONE); |
| 531 | - lay_net_main.setVisibility(View.VISIBLE); | 501 | + binding.layNetMain.setVisibility(View.VISIBLE); |
| 532 | - } else if ( lay_wifi_psd.getVisibility() == View.VISIBLE ) { | 502 | + } else if ( binding.layWifiPsd.getRoot().getVisibility() == View.VISIBLE ) { |
| 533 | - lay_wifi_psd.setVisibility(View.GONE); | 503 | + binding.layWifiPsd.getRoot().setVisibility(View.GONE); |
| 534 | - lay_wifi_flush.setVisibility(View.VISIBLE); | 504 | + binding.layWifiFlush.getRoot().setVisibility(View.VISIBLE); |
| 535 | startScanWifi(); | 505 | startScanWifi(); |
| 536 | hideIm(); | 506 | hideIm(); |
| 537 | } else { | 507 | } else { |
| ... | @@ -555,13 +525,13 @@ public class NetWorkFragment extends BaseFragment implements | ... | @@ -555,13 +525,13 @@ public class NetWorkFragment extends BaseFragment implements |
| 555 | || action.equals("android.net.conn.CONNECTIVITY_CHANGE")) { | 525 | || action.equals("android.net.conn.CONNECTIVITY_CHANGE")) { |
| 556 | switch (isNetworkAvailable(context)) { | 526 | switch (isNetworkAvailable(context)) { |
| 557 | case NET_ETHERNET: | 527 | case NET_ETHERNET: |
| 558 | - switch_network.setChecked(true); | 528 | + binding.switchNetwork.setChecked(true); |
| 559 | - txt_ip.setText(NetIp.getIpAddressForInterfaces()); | 529 | + binding.txtIp.setText(NetIp.getIpAddressForInterfaces()); |
| 560 | Logger.d(" getIpAddress ---- " + NetIp.getIpAddressForInterfaces()); | 530 | Logger.d(" getIpAddress ---- " + NetIp.getIpAddressForInterfaces()); |
| 561 | break; | 531 | break; |
| 562 | case NET_NOCONNECT: | 532 | case NET_NOCONNECT: |
| 563 | - switch_network.setChecked(false); | 533 | + binding.switchNetwork.setChecked(false); |
| 564 | - txt_ip.setText(""); | 534 | + binding.txtIp.setText(""); |
| 565 | break; | 535 | break; |
| 566 | default: | 536 | default: |
| 567 | break; | 537 | break; |
| ... | @@ -608,20 +578,20 @@ public class NetWorkFragment extends BaseFragment implements | ... | @@ -608,20 +578,20 @@ public class NetWorkFragment extends BaseFragment implements |
| 608 | Logger.e("WifiReciever WIFI_STATE_CHANGED_ACTION " + i); | 578 | Logger.e("WifiReciever WIFI_STATE_CHANGED_ACTION " + i); |
| 609 | if (i == 1) { | 579 | if (i == 1) { |
| 610 | Constant.isWifiOk = false; | 580 | Constant.isWifiOk = false; |
| 611 | - listview.setVisibility(View.GONE); | 581 | + binding.layWifiFlush.listview.setVisibility(View.GONE); |
| 612 | } | 582 | } |
| 613 | if (i == 3) { | 583 | if (i == 3) { |
| 614 | - listview.setVisibility(View.VISIBLE); | 584 | + binding.layWifiFlush.listview.setVisibility(View.VISIBLE); |
| 615 | mWiFiManager.startScan(); | 585 | mWiFiManager.startScan(); |
| 616 | } | 586 | } |
| 617 | if (i == 0) { | 587 | if (i == 0) { |
| 618 | - listview.setVisibility(View.GONE); | 588 | + binding.layWifiFlush.listview.setVisibility(View.GONE); |
| 619 | } | 589 | } |
| 620 | if (i == 2) { | 590 | if (i == 2) { |
| 621 | - listview.setVisibility(View.GONE); | 591 | + binding.layWifiFlush.listview.setVisibility(View.GONE); |
| 622 | } | 592 | } |
| 623 | if (i == 4) { | 593 | if (i == 4) { |
| 624 | - listview.setVisibility(View.GONE); | 594 | + binding.layWifiFlush.listview.setVisibility(View.GONE); |
| 625 | } | 595 | } |
| 626 | } else if ( ConnectivityManager.CONNECTIVITY_ACTION.equals(intent.getAction()) ) { | 596 | } else if ( ConnectivityManager.CONNECTIVITY_ACTION.equals(intent.getAction()) ) { |
| 627 | connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); | 597 | connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); |
| ... | @@ -703,14 +673,14 @@ public class NetWorkFragment extends BaseFragment implements | ... | @@ -703,14 +673,14 @@ public class NetWorkFragment extends BaseFragment implements |
| 703 | } | 673 | } |
| 704 | 674 | ||
| 705 | public void showFlush() { | 675 | public void showFlush() { |
| 706 | - img_flush.setImageResource(R.mipmap.img_flush_1); | 676 | + binding.layWifiFlush.imgFlush.setImageResource(R.mipmap.img_flush_1); |
| 707 | animation.setInterpolator(new LinearInterpolator()); | 677 | animation.setInterpolator(new LinearInterpolator()); |
| 708 | - img_flush.startAnimation(animation); | 678 | + binding.layWifiFlush.imgFlush.startAnimation(animation); |
| 709 | } | 679 | } |
| 710 | 680 | ||
| 711 | public void hideFlush() { | 681 | public void hideFlush() { |
| 712 | - img_flush.clearAnimation(); | 682 | + binding.layWifiFlush.imgFlush.clearAnimation(); |
| 713 | - img_flush.setImageResource(R.mipmap.img_flush_2); | 683 | + binding.layWifiFlush.imgFlush.setImageResource(R.mipmap.img_flush_2); |
| 714 | } | 684 | } |
| 715 | 685 | ||
| 716 | public static final int WIFI_STATE_DISABLING = 0; | 686 | public static final int WIFI_STATE_DISABLING = 0; | ... | ... |
| ... | @@ -5,7 +5,9 @@ import android.content.Context; | ... | @@ -5,7 +5,9 @@ import android.content.Context; |
| 5 | import android.content.Intent; | 5 | import android.content.Intent; |
| 6 | import android.provider.Settings; | 6 | import android.provider.Settings; |
| 7 | import android.text.format.DateFormat; | 7 | import android.text.format.DateFormat; |
| 8 | +import android.view.LayoutInflater; | ||
| 8 | import android.view.View; | 9 | import android.view.View; |
| 10 | +import android.view.ViewGroup; | ||
| 9 | import android.widget.DatePicker; | 11 | import android.widget.DatePicker; |
| 10 | import android.widget.ImageView; | 12 | import android.widget.ImageView; |
| 11 | import android.widget.LinearLayout; | 13 | import android.widget.LinearLayout; |
| ... | @@ -18,6 +20,7 @@ import com.sw.laryngoscope.R; | ... | @@ -18,6 +20,7 @@ import com.sw.laryngoscope.R; |
| 18 | import com.sw.laryngoscope.activity.BaseFragment; | 20 | import com.sw.laryngoscope.activity.BaseFragment; |
| 19 | import com.sw.laryngoscope.activity.CustomTimer; | 21 | import com.sw.laryngoscope.activity.CustomTimer; |
| 20 | import com.sw.laryngoscope.activity.HomeActivity; | 22 | import com.sw.laryngoscope.activity.HomeActivity; |
| 23 | +import com.sw.laryngoscope.databinding.FgSettingTimedateBinding; | ||
| 21 | import com.sw.laryngoscope.utils.DateUtils; | 24 | import com.sw.laryngoscope.utils.DateUtils; |
| 22 | import com.sw.laryngoscope.utils.Logger; | 25 | import com.sw.laryngoscope.utils.Logger; |
| 23 | import com.sw.laryngoscope.utils.SystemTimeUtil; | 26 | import com.sw.laryngoscope.utils.SystemTimeUtil; |
| ... | @@ -26,47 +29,13 @@ import com.sw.laryngoscope.widget.ChargeNumberPicker; | ... | @@ -26,47 +29,13 @@ import com.sw.laryngoscope.widget.ChargeNumberPicker; |
| 26 | import java.util.Calendar; | 29 | import java.util.Calendar; |
| 27 | import java.util.TimeZone; | 30 | import java.util.TimeZone; |
| 28 | 31 | ||
| 29 | -import butterknife.BindView; | ||
| 30 | -import butterknife.OnClick; | ||
| 31 | 32 | ||
| 32 | -public class TimeDateFragment extends BaseFragment implements CustomTimer.TimerCallBack, | 33 | +public class TimeDateFragment extends BaseFragment<FgSettingTimedateBinding> implements CustomTimer.TimerCallBack, |
| 33 | - RadioGroup.OnCheckedChangeListener, DatePicker.OnDateChangedListener { | 34 | + RadioGroup.OnCheckedChangeListener, DatePicker.OnDateChangedListener,View.OnClickListener { |
| 34 | 35 | ||
| 35 | private static final String TAG = "TimeDateFragment"; | 36 | private static final String TAG = "TimeDateFragment"; |
| 36 | private Context context; | 37 | private Context context; |
| 37 | 38 | ||
| 38 | - | ||
| 39 | - @BindView(R.id.lin_zone) | ||
| 40 | - public LinearLayout lin_zone; | ||
| 41 | - @BindView(R.id.txt_zone) | ||
| 42 | - public TextView txt_zone; | ||
| 43 | - @BindView(R.id.img_zone_next) | ||
| 44 | - public ImageView img_zone_next; | ||
| 45 | - | ||
| 46 | - @BindView(R.id.rg_1) | ||
| 47 | - public RadioGroup rg_1; | ||
| 48 | - @BindView(R.id.rb_12) | ||
| 49 | - public RadioButton rb_12; | ||
| 50 | - @BindView(R.id.rb_24) | ||
| 51 | - public RadioButton rb_24; | ||
| 52 | - | ||
| 53 | - @BindView(R.id.hourNumberPicker) | ||
| 54 | - ChargeNumberPicker hourNumberPicker; | ||
| 55 | - @BindView(R.id.minNumberPicker) | ||
| 56 | - ChargeNumberPicker minNumberPicker; | ||
| 57 | - | ||
| 58 | - @BindView(R.id.txt_calendar_title) | ||
| 59 | - TextView txt_calendar_title; | ||
| 60 | - @BindView(R.id.yearNumberPicker) | ||
| 61 | - ChargeNumberPicker yearNumberPicker; | ||
| 62 | - @BindView(R.id.monthNumberPicker) | ||
| 63 | - ChargeNumberPicker monthNumberPicker; | ||
| 64 | - @BindView(R.id.dateNumberPicker) | ||
| 65 | - ChargeNumberPicker dateNumberPicker; | ||
| 66 | - | ||
| 67 | - /*@BindView(R.id.datepicker) | ||
| 68 | - DatePicker datepicker;*/ | ||
| 69 | - | ||
| 70 | private CustomTimer scrollTimer; | 39 | private CustomTimer scrollTimer; |
| 71 | private final String timerTAG_scroll = "scroll"; | 40 | private final String timerTAG_scroll = "scroll"; |
| 72 | 41 | ||
| ... | @@ -101,14 +70,15 @@ public class TimeDateFragment extends BaseFragment implements CustomTimer.TimerC | ... | @@ -101,14 +70,15 @@ public class TimeDateFragment extends BaseFragment implements CustomTimer.TimerC |
| 101 | } | 70 | } |
| 102 | 71 | ||
| 103 | @Override | 72 | @Override |
| 104 | - protected int rootLayout() { | 73 | + protected FgSettingTimedateBinding getViewBinding(LayoutInflater inflater, ViewGroup container) { |
| 105 | - return R.layout.fg_setting_timedate; | 74 | + return FgSettingTimedateBinding.inflate(inflater,container,false); |
| 106 | } | 75 | } |
| 107 | 76 | ||
| 77 | + | ||
| 108 | @Override | 78 | @Override |
| 109 | protected void init() { | 79 | protected void init() { |
| 110 | - hourNumberPicker.setMinValue(0); | 80 | + binding.hourNumberPicker.setMinValue(0); |
| 111 | - hourNumberPicker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() { | 81 | + binding.hourNumberPicker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() { |
| 112 | @Override | 82 | @Override |
| 113 | public void onValueChange(NumberPicker picker, int oldVal, int newVal) { | 83 | public void onValueChange(NumberPicker picker, int oldVal, int newVal) { |
| 114 | Logger.d("hourNumberPicker " + oldVal + " " + newVal); | 84 | Logger.d("hourNumberPicker " + oldVal + " " + newVal); |
| ... | @@ -116,7 +86,7 @@ public class TimeDateFragment extends BaseFragment implements CustomTimer.TimerC | ... | @@ -116,7 +86,7 @@ public class TimeDateFragment extends BaseFragment implements CustomTimer.TimerC |
| 116 | ((ChargeNumberPicker)picker).modifySelectText(); | 86 | ((ChargeNumberPicker)picker).modifySelectText(); |
| 117 | } | 87 | } |
| 118 | }); | 88 | }); |
| 119 | - hourNumberPicker.setOnScrollListener(new NumberPicker.OnScrollListener() { | 89 | + binding.hourNumberPicker.setOnScrollListener(new NumberPicker.OnScrollListener() { |
| 120 | @Override | 90 | @Override |
| 121 | public void onScrollStateChange(NumberPicker view, int scrollState) { | 91 | public void onScrollStateChange(NumberPicker view, int scrollState) { |
| 122 | switch (scrollState) { | 92 | switch (scrollState) { |
| ... | @@ -127,11 +97,11 @@ public class TimeDateFragment extends BaseFragment implements CustomTimer.TimerC | ... | @@ -127,11 +97,11 @@ public class TimeDateFragment extends BaseFragment implements CustomTimer.TimerC |
| 127 | } | 97 | } |
| 128 | } | 98 | } |
| 129 | }); | 99 | }); |
| 130 | - hourNumberPicker.modifySelectText(); | 100 | + binding.hourNumberPicker.modifySelectText(); |
| 131 | 101 | ||
| 132 | - minNumberPicker.setMaxValue(59); | 102 | + binding.minNumberPicker.setMaxValue(59); |
| 133 | - minNumberPicker.setMinValue(0); | 103 | + binding.minNumberPicker.setMinValue(0); |
| 134 | - minNumberPicker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() { | 104 | + binding.minNumberPicker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() { |
| 135 | @Override | 105 | @Override |
| 136 | public void onValueChange(NumberPicker picker,int oldVal,int newVal) { | 106 | public void onValueChange(NumberPicker picker,int oldVal,int newVal) { |
| 137 | Logger.d("minNumberPicker setMin2 " + oldVal + " " + newVal); | 107 | Logger.d("minNumberPicker setMin2 " + oldVal + " " + newVal); |
| ... | @@ -139,7 +109,7 @@ public class TimeDateFragment extends BaseFragment implements CustomTimer.TimerC | ... | @@ -139,7 +109,7 @@ public class TimeDateFragment extends BaseFragment implements CustomTimer.TimerC |
| 139 | ((ChargeNumberPicker)picker).modifySelectText(); | 109 | ((ChargeNumberPicker)picker).modifySelectText(); |
| 140 | } | 110 | } |
| 141 | }); | 111 | }); |
| 142 | - minNumberPicker.setOnScrollListener(new NumberPicker.OnScrollListener() { | 112 | + binding.minNumberPicker.setOnScrollListener(new NumberPicker.OnScrollListener() { |
| 143 | @Override | 113 | @Override |
| 144 | public void onScrollStateChange(NumberPicker view, int scrollState) { | 114 | public void onScrollStateChange(NumberPicker view, int scrollState) { |
| 145 | switch (scrollState) { | 115 | switch (scrollState) { |
| ... | @@ -150,10 +120,10 @@ public class TimeDateFragment extends BaseFragment implements CustomTimer.TimerC | ... | @@ -150,10 +120,10 @@ public class TimeDateFragment extends BaseFragment implements CustomTimer.TimerC |
| 150 | } | 120 | } |
| 151 | } | 121 | } |
| 152 | }); | 122 | }); |
| 153 | - minNumberPicker.modifySelectText(); | 123 | + binding.minNumberPicker.modifySelectText(); |
| 154 | 124 | ||
| 155 | //年份滑动监听 | 125 | //年份滑动监听 |
| 156 | - yearNumberPicker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() { | 126 | + binding.yearNumberPicker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() { |
| 157 | @Override | 127 | @Override |
| 158 | public void onValueChange(NumberPicker picker, int oldVal, int newVal) { | 128 | public void onValueChange(NumberPicker picker, int oldVal, int newVal) { |
| 159 | Logger.i(TAG,"oldVal-----"+oldVal+"-----newVal-----"+newVal); | 129 | Logger.i(TAG,"oldVal-----"+oldVal+"-----newVal-----"+newVal); |
| ... | @@ -165,21 +135,21 @@ public class TimeDateFragment extends BaseFragment implements CustomTimer.TimerC | ... | @@ -165,21 +135,21 @@ public class TimeDateFragment extends BaseFragment implements CustomTimer.TimerC |
| 165 | maxDay = 28; | 135 | maxDay = 28; |
| 166 | } | 136 | } |
| 167 | //设置天数的最大值 | 137 | //设置天数的最大值 |
| 168 | - if ( monthNumberPicker.getValue() == 2 ) { | 138 | + if ( binding.monthNumberPicker.getValue() == 2 ) { |
| 169 | - dateNumberPicker.setMaxValue(maxDay); | 139 | + binding.dateNumberPicker.setMaxValue(maxDay); |
| 170 | - if ( dateNumberPicker.getValue() > maxDay ) { | 140 | + if ( binding.dateNumberPicker.getValue() > maxDay ) { |
| 171 | - dateNumberPicker.setValue(1); | 141 | + binding.dateNumberPicker.setValue(1); |
| 172 | - dateNumberPicker.modifySelectText(); | 142 | + binding.dateNumberPicker.modifySelectText(); |
| 173 | } | 143 | } |
| 174 | } | 144 | } |
| 175 | ((ChargeNumberPicker)picker).modifySelectText(); | 145 | ((ChargeNumberPicker)picker).modifySelectText(); |
| 176 | - txt_calendar_title.setText(newVal + | 146 | + binding.txtCalendarTitle.setText(newVal + |
| 177 | - "-" + String.format("%02d", monthNumberPicker.getValue()) + | 147 | + "-" + String.format("%02d", binding.monthNumberPicker.getValue()) + |
| 178 | - "-" + dateNumberPicker.getValue()); | 148 | + "-" + binding.dateNumberPicker.getValue()); |
| 179 | } | 149 | } |
| 180 | }); | 150 | }); |
| 181 | //月份滑动监听 | 151 | //月份滑动监听 |
| 182 | - monthNumberPicker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() { | 152 | + binding.monthNumberPicker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() { |
| 183 | @Override | 153 | @Override |
| 184 | public void onValueChange(NumberPicker picker, int oldVal, int newVal) { | 154 | public void onValueChange(NumberPicker picker, int oldVal, int newVal) { |
| 185 | Logger.i(TAG,"oldVal-----"+oldVal+"-----newVal-----"+newVal); | 155 | Logger.i(TAG,"oldVal-----"+oldVal+"-----newVal-----"+newVal); |
| ... | @@ -187,7 +157,7 @@ public class TimeDateFragment extends BaseFragment implements CustomTimer.TimerC | ... | @@ -187,7 +157,7 @@ public class TimeDateFragment extends BaseFragment implements CustomTimer.TimerC |
| 187 | //月份判断 | 157 | //月份判断 |
| 188 | switch (newVal){ | 158 | switch (newVal){ |
| 189 | case 2: | 159 | case 2: |
| 190 | - if(yearNumberPicker.getValue() % 4 == 0){ | 160 | + if(binding.yearNumberPicker.getValue() % 4 == 0){ |
| 191 | maxDay = 29; | 161 | maxDay = 29; |
| 192 | }else{ | 162 | }else{ |
| 193 | maxDay = 28; | 163 | maxDay = 28; |
| ... | @@ -207,25 +177,25 @@ public class TimeDateFragment extends BaseFragment implements CustomTimer.TimerC | ... | @@ -207,25 +177,25 @@ public class TimeDateFragment extends BaseFragment implements CustomTimer.TimerC |
| 207 | break; | 177 | break; |
| 208 | } | 178 | } |
| 209 | //设置天数的最大值 | 179 | //设置天数的最大值 |
| 210 | - dateNumberPicker.setMaxValue(maxDay); | 180 | + binding.dateNumberPicker.setMaxValue(maxDay); |
| 211 | - if ( dateNumberPicker.getValue() > maxDay ) { | 181 | + if ( binding.dateNumberPicker.getValue() > maxDay ) { |
| 212 | - dateNumberPicker.setValue(1); | 182 | + binding.dateNumberPicker.setValue(1); |
| 213 | - dateNumberPicker.modifySelectText(); | 183 | + binding.dateNumberPicker.modifySelectText(); |
| 214 | } | 184 | } |
| 215 | ((ChargeNumberPicker)picker).modifySelectText(); | 185 | ((ChargeNumberPicker)picker).modifySelectText(); |
| 216 | - txt_calendar_title.setText(yearNumberPicker.getValue() + | 186 | + binding.txtCalendarTitle.setText(binding.yearNumberPicker.getValue() + |
| 217 | "-" + String.format("%02d", newVal) + | 187 | "-" + String.format("%02d", newVal) + |
| 218 | - "-" + dateNumberPicker.getValue()); | 188 | + "-" + binding.dateNumberPicker.getValue()); |
| 219 | } | 189 | } |
| 220 | }); | 190 | }); |
| 221 | - dateNumberPicker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() { | 191 | + binding.dateNumberPicker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() { |
| 222 | @Override | 192 | @Override |
| 223 | public void onValueChange(NumberPicker picker, int oldVal, int newVal) { | 193 | public void onValueChange(NumberPicker picker, int oldVal, int newVal) { |
| 224 | Logger.i(TAG,"oldVal-----"+oldVal+"-----newVal-----"+newVal); | 194 | Logger.i(TAG,"oldVal-----"+oldVal+"-----newVal-----"+newVal); |
| 225 | isModifyFrag = true; | 195 | isModifyFrag = true; |
| 226 | ((ChargeNumberPicker)picker).modifySelectText(); | 196 | ((ChargeNumberPicker)picker).modifySelectText(); |
| 227 | - txt_calendar_title.setText(yearNumberPicker.getValue() + | 197 | + binding.txtCalendarTitle.setText(binding.yearNumberPicker.getValue() + |
| 228 | - "-" + String.format("%02d", monthNumberPicker.getValue()) + | 198 | + "-" + String.format("%02d", binding.monthNumberPicker.getValue()) + |
| 229 | "-" + newVal); | 199 | "-" + newVal); |
| 230 | } | 200 | } |
| 231 | }); | 201 | }); |
| ... | @@ -235,58 +205,58 @@ public class TimeDateFragment extends BaseFragment implements CustomTimer.TimerC | ... | @@ -235,58 +205,58 @@ public class TimeDateFragment extends BaseFragment implements CustomTimer.TimerC |
| 235 | } | 205 | } |
| 236 | 206 | ||
| 237 | public void initValue() { | 207 | public void initValue() { |
| 238 | - txt_calendar_title.setText(DateUtils.formatDate(System.currentTimeMillis() / 1000)); | 208 | + binding.txtCalendarTitle.setText(DateUtils.formatDate(System.currentTimeMillis() / 1000)); |
| 239 | 209 | ||
| 240 | - hourNumberPicker.setMaxValue(23); | 210 | + binding.hourNumberPicker.setMaxValue(23); |
| 241 | Logger.d(" initValue " + Calendar.getInstance().getTimeZone() + " mCalendar " + Calendar.getInstance().getTime() | 211 | Logger.d(" initValue " + Calendar.getInstance().getTimeZone() + " mCalendar " + Calendar.getInstance().getTime() |
| 242 | + " " + Calendar.getInstance().get(Calendar.HOUR)); | 212 | + " " + Calendar.getInstance().get(Calendar.HOUR)); |
| 243 | - hourNumberPicker.setValue(Calendar.getInstance().get(Calendar.HOUR)); | 213 | + binding.hourNumberPicker.setValue(Calendar.getInstance().get(Calendar.HOUR)); |
| 244 | - minNumberPicker.setValue(Calendar.getInstance().get(Calendar.MINUTE)); | 214 | + binding.minNumberPicker.setValue(Calendar.getInstance().get(Calendar.MINUTE)); |
| 245 | 215 | ||
| 246 | if ( !DateFormat.is24HourFormat(getContext()) ) { | 216 | if ( !DateFormat.is24HourFormat(getContext()) ) { |
| 247 | - rb_12.setChecked(true); | 217 | + binding.rb12.setChecked(true); |
| 248 | } else { | 218 | } else { |
| 249 | - rb_24.setChecked(true); | 219 | + binding.rb24.setChecked(true); |
| 250 | } | 220 | } |
| 251 | //txt_zone.setText(TimeZone.getDefault().getID()); | 221 | //txt_zone.setText(TimeZone.getDefault().getID()); |
| 252 | //final Calendar now = Calendar.getInstance(); | 222 | //final Calendar now = Calendar.getInstance(); |
| 253 | //txt_zone.setText(getTimeZoneText(TimeZone.getDefault(), true)); | 223 | //txt_zone.setText(getTimeZoneText(TimeZone.getDefault(), true)); |
| 254 | //txt_zone.setText(getTimeZoneOffsetAndName(now.getTimeZone(), now.getTime())); | 224 | //txt_zone.setText(getTimeZoneOffsetAndName(now.getTimeZone(), now.getTime())); |
| 255 | - txt_zone.setText(TimeZone.getDefault().getDisplayName()); | 225 | + binding.txtZone.setText(TimeZone.getDefault().getDisplayName()); |
| 256 | 226 | ||
| 257 | Calendar calendar = Calendar.getInstance(); | 227 | Calendar calendar = Calendar.getInstance(); |
| 258 | int year = calendar.get(Calendar.YEAR); | 228 | int year = calendar.get(Calendar.YEAR); |
| 259 | int monthOfYear = calendar.get(Calendar.MONTH) + 1; | 229 | int monthOfYear = calendar.get(Calendar.MONTH) + 1; |
| 260 | int dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH); | 230 | int dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH); |
| 261 | //datepicker.init(year, monthOfYear, dayOfMonth, this); | 231 | //datepicker.init(year, monthOfYear, dayOfMonth, this); |
| 262 | - yearNumberPicker.setMaxValue(2050); | 232 | + binding.yearNumberPicker.setMaxValue(2050); |
| 263 | - yearNumberPicker.setValue(year); //中间参数 设置默认值 | 233 | + binding.yearNumberPicker.setValue(year); //中间参数 设置默认值 |
| 264 | - yearNumberPicker.setMinValue(2023); | 234 | + binding.yearNumberPicker.setMinValue(2023); |
| 265 | - yearNumberPicker.modifySelectText(); | 235 | + binding.yearNumberPicker.modifySelectText(); |
| 266 | //设置月份 | 236 | //设置月份 |
| 267 | - monthNumberPicker.setMaxValue(12); | 237 | + binding.monthNumberPicker.setMaxValue(12); |
| 268 | - monthNumberPicker.setValue(monthOfYear); | 238 | + binding.monthNumberPicker.setValue(monthOfYear); |
| 269 | - monthNumberPicker.setMinValue(1); | 239 | + binding.monthNumberPicker.setMinValue(1); |
| 270 | - monthNumberPicker.modifySelectText(); | 240 | + binding.monthNumberPicker.modifySelectText(); |
| 271 | //设置天数 | 241 | //设置天数 |
| 272 | - dateNumberPicker.setMaxValue(31); | 242 | + binding.dateNumberPicker.setMaxValue(31); |
| 273 | - dateNumberPicker.setValue(dayOfMonth); | 243 | + binding.dateNumberPicker.setValue(dayOfMonth); |
| 274 | - dateNumberPicker.setMinValue(1); | 244 | + binding.dateNumberPicker.setMinValue(1); |
| 275 | - dateNumberPicker.modifySelectText(); | 245 | + binding.dateNumberPicker.modifySelectText(); |
| 276 | } | 246 | } |
| 277 | 247 | ||
| 278 | @Override | 248 | @Override |
| 279 | protected void setListener() { | 249 | protected void setListener() { |
| 280 | - rg_1.setOnCheckedChangeListener(this); | 250 | + binding.rg1.setOnCheckedChangeListener(this); |
| 281 | } | 251 | } |
| 282 | 252 | ||
| 283 | public void setDate() { | 253 | public void setDate() { |
| 284 | //if ( isModifyFrag ) { | 254 | //if ( isModifyFrag ) { |
| 285 | Settings.System.putString(getActivity().getContentResolver(), | 255 | Settings.System.putString(getActivity().getContentResolver(), |
| 286 | - Settings.System.TIME_12_24, rb_12.isChecked() ? "12" : "24"); | 256 | + Settings.System.TIME_12_24, binding.rb12.isChecked() ? "12" : "24"); |
| 287 | - SystemTimeUtil.setSysDate(getContext(), yearNumberPicker.getValue(), | 257 | + SystemTimeUtil.setSysDate(getContext(), binding.yearNumberPicker.getValue(), |
| 288 | - monthNumberPicker.getValue() - 1, dateNumberPicker.getValue()); | 258 | + binding.monthNumberPicker.getValue() - 1, binding.dateNumberPicker.getValue()); |
| 289 | - SystemTimeUtil.setSysTime(getContext(), hourNumberPicker.getValue(), minNumberPicker.getValue()); | 259 | + SystemTimeUtil.setSysTime(getContext(), binding.hourNumberPicker.getValue(), binding.minNumberPicker.getValue()); |
| 290 | //} | 260 | //} |
| 291 | isModifyFrag = false; | 261 | isModifyFrag = false; |
| 292 | } | 262 | } |
| ... | @@ -297,12 +267,11 @@ public class TimeDateFragment extends BaseFragment implements CustomTimer.TimerC | ... | @@ -297,12 +267,11 @@ public class TimeDateFragment extends BaseFragment implements CustomTimer.TimerC |
| 297 | } | 267 | } |
| 298 | 268 | ||
| 299 | @Override | 269 | @Override |
| 300 | - @OnClick({ R.id.lin_zone, R.id.txt_ok, }) | ||
| 301 | public void onClick(View v) { | 270 | public void onClick(View v) { |
| 302 | switch (v.getId()) { | 271 | switch (v.getId()) { |
| 303 | case R.id.lin_zone: | 272 | case R.id.lin_zone: |
| 304 | //homeFragment.backHomeFragment(); | 273 | //homeFragment.backHomeFragment(); |
| 305 | - (new ZonePopWindow(getContext())).showZonePop(lin_zone, txt_zone, img_zone_next); | 274 | + (new ZonePopWindow(getContext())).showZonePop(binding.linZone, binding.txtZone, binding.imgZoneNext); |
| 306 | break; | 275 | break; |
| 307 | case R.id.txt_ok: | 276 | case R.id.txt_ok: |
| 308 | setDate(); | 277 | setDate(); | ... | ... |
| ... | @@ -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) { | ... | ... |
-
Please register or login to post a comment