liufuhua007

重构代码

Showing 41 changed files with 334 additions and 551 deletions
......@@ -24,6 +24,9 @@ android {
abiFilters 'armeabi-v7a', "arm64-v8a"
}
}
buildFeatures {
viewBinding true
}
signingConfigs {
debug {
......@@ -58,7 +61,7 @@ android {
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_8
}
......@@ -119,21 +122,22 @@ dependencies {
implementation 'com.squareup.okio:okio:1.9.0'
implementation('com.jakewharton:butterknife:10.0.0') {
exclude group: 'com.android.support'
}
annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'
// implementation('com.jakewharton:butterknife:10.0.0') {
// exclude group: 'com.android.support'
// }
// annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'
implementation 'com.github.bumptech.glide:glide:4.0.0'
implementation 'androidx.appcompat:appcompat:1.3.0-alpha02'
//implementation files('libs\\photoview.jar')
implementation 'com.itextpdf:itext7-core:7.1.13'
implementation 'com.github.barteksc:android-pdf-viewer:2.5.1'
// implementation 'com.github.barteksc:android-pdf-viewer:2.5.1'
//implementation 'com.github.barteksc:android-pdf-viewer:3.2.0-beta.1'
implementation files('libs\\signature-pad.jar')
implementation 'com.github.barteksc:android-pdf-viewer:3.2.0-beta.1'
// implementation files('libs\\signature-pad.jar')
// implementation 'com.github.gcacace:signature-pad:1.3.1' // 或最新版本
implementation 'com.github.mhiew:android-pdf-viewer:3.2.0-beta.1'
implementation files('libs\\dcm4che-core-5.27.0.jar')
implementation files('libs\\dcm4che-net-5.27.0.jar')
......
......@@ -10,13 +10,12 @@ import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.Nullable;
import androidx.viewbinding.ViewBinding;
import butterknife.ButterKnife;
public abstract class BaseFragment extends Fragment
implements View.OnClickListener, HomeCallback {
protected View rootView;
public abstract class BaseFragment<VB extends ViewBinding> extends Fragment
implements HomeCallback {
protected VB binding; // ViewBinding 变量
public HomeActivity homeActivity;
public BaseFragment homeFragment;
public String TAG = "";
......@@ -38,32 +37,31 @@ public abstract class BaseFragment extends Fragment
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
rootView = inflater.inflate(rootLayout(), container, false);
ButterKnife.bind(this, rootView);
binding = getViewBinding(inflater, container);
context = getActivity().getApplicationContext();
init();
setListener();
return rootView;
return binding.getRoot();
}
@Override
public void onResume() {
super.onResume();
if (rootView != null) {
rootView.setOnTouchListener(homeActivity);
if (binding != null) {
binding.getRoot().setOnTouchListener(homeActivity);
}
}
@Override
public void onHiddenChanged(boolean hidden) {
super.onHiddenChanged(hidden);
if (rootView != null) {
rootView.setOnTouchListener(homeActivity);
if (binding != null) {
binding.getRoot().setOnTouchListener(homeActivity);
if (hidden) {
//隐藏的时候
rootView.setVisibility(View.GONE);
binding.getRoot().setVisibility(View.GONE);
} else {
rootView.setVisibility(View.VISIBLE);
binding.getRoot().setVisibility(View.VISIBLE);
}
}
}
......@@ -76,10 +74,9 @@ public abstract class BaseFragment extends Fragment
}
public View getRootView() {
return rootView;
return binding != null ? binding.getRoot() : null;
}
protected abstract int rootLayout();
protected abstract VB getViewBinding(LayoutInflater inflater, ViewGroup container);
protected abstract void init();
......
......@@ -2,7 +2,9 @@ package com.sw.laryngoscope.activity.fragment;
import android.app.FragmentManager;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
......@@ -18,41 +20,16 @@ import com.sw.laryngoscope.activity.fragment.setting.LanFragment;
import com.sw.laryngoscope.activity.fragment.setting.LogExportFragment;
import com.sw.laryngoscope.activity.fragment.setting.NetWorkFragment;
import com.sw.laryngoscope.activity.fragment.setting.TimeDateFragment;
import com.sw.laryngoscope.databinding.FgSettingBinding;
import com.sw.laryngoscope.manager.CameraInfoMg;
import com.sw.laryngoscope.utils.Logger;
import butterknife.BindView;
import butterknife.OnClick;
public class SettingFragment extends BaseFragment implements CustomTimer.TimerCallBack,
RadioGroup.OnCheckedChangeListener {
public class SettingFragment extends BaseFragment<FgSettingBinding> implements CustomTimer.TimerCallBack,
RadioGroup.OnCheckedChangeListener,View.OnClickListener {
private static final String TAG = "SettingFragment";
private Context context;
@BindView(R.id.layout_main_show_setting)
View layout_main_show_setting;
@BindView(R.id.setting_fragment)
FrameLayout setting_fragment;
@BindView(R.id.rg_setting_first)
RadioGroup rg_setting_first;
@BindView(R.id.rb_lan)
public RadioButton rb_lan;
@BindView(R.id.rb_timedate)
public RadioButton rb_timedate;
@BindView(R.id.rb_network)
public RadioButton rb_network;
@BindView(R.id.rb_dicom)
public RadioButton rb_dicom;
@BindView(R.id.rb_general_settings)
public RadioButton rb_general_settings;
@BindView(R.id.rb_device_info)
public RadioButton rb_device_info;
@BindView(R.id.rb_log_export)
public RadioButton rb_log_export;
public FragmentManager fragmentManager;
public BaseFragment currFragment;
......@@ -81,18 +58,18 @@ public class SettingFragment extends BaseFragment implements CustomTimer.TimerCa
Logger.d(TAG, "======showFragment===1===hidden ");
//rb_about.setChecked(true);
//rg_setting_first.clearCheck();
layout_main_show_setting.setVisibility(View.VISIBLE);
binding.layoutMainShowSetting.getRoot().setVisibility(View.VISIBLE);
//backHomeFragment();
if ( isBackToSetting ) {
isBackToSetting = false;
if ( rb_network != null ) {
rb_network.setChecked(true);
if ( binding.layoutMainShowSetting.rbNetwork != null ) {
binding.layoutMainShowSetting.rbNetwork.setChecked(true);
}
} else {
if ( !isFirstEnter ) {
isFirstEnter = true;
if ( rb_lan != null ) {
rb_lan.setChecked(true);
if ( binding.layoutMainShowSetting.rbLan != null ) {
binding.layoutMainShowSetting.rbLan.setChecked(true);
}
}
}
......@@ -111,12 +88,12 @@ public class SettingFragment extends BaseFragment implements CustomTimer.TimerCa
//rb_about.setChecked(true);
//rg_setting_first.clearCheck();
Logger.d(TAG, "======showFragment======hidden " + hidden);
layout_main_show_setting.setVisibility(View.VISIBLE);
binding.layoutMainShowSetting.getRoot().setVisibility(View.VISIBLE);
}
@Override
protected int rootLayout() {
return R.layout.fg_setting;
protected FgSettingBinding getViewBinding(LayoutInflater inflater, ViewGroup container) {
return FgSettingBinding.inflate(inflater,container,false);
}
@Override
......@@ -127,11 +104,11 @@ public class SettingFragment extends BaseFragment implements CustomTimer.TimerCa
@Override
protected void setListener() {
rg_setting_first.setOnCheckedChangeListener(this);
binding.layoutMainShowSetting.rgSettingFirst.setOnCheckedChangeListener(this);
binding.layBack.setOnClickListener(this);
}
@Override
@OnClick({ R.id.lay_back, })
public void onClick(View v) {
switch (v.getId()) {
case R.id.lay_back:
......@@ -150,7 +127,7 @@ public class SettingFragment extends BaseFragment implements CustomTimer.TimerCa
@Override
public void onCheckedChanged(RadioGroup radioGroup, int i) {
switch (rg_setting_first.getCheckedRadioButtonId()) {
switch (binding.layoutMainShowSetting.rgSettingFirst.getCheckedRadioButtonId()) {
case R.id.rb_lan:
Logger.d(TAG, "======showFragment======rb_lan");
if (lanFragment == null) {
......@@ -264,7 +241,7 @@ public class SettingFragment extends BaseFragment implements CustomTimer.TimerCa
}
}
currFragment = targetFragment;
setting_fragment.setVisibility(View.VISIBLE);
binding.settingFragment.getRootView().setVisibility(View.VISIBLE);
//layout_main_show_setting.setVisibility(View.GONE);
}
......@@ -277,7 +254,7 @@ public class SettingFragment extends BaseFragment implements CustomTimer.TimerCa
if ( currFragment != null ) {
//rg_setting_first.clearCheck();
fragmentManager.beginTransaction().hide(currFragment).commit();
layout_main_show_setting.setVisibility(View.VISIBLE);
binding.layoutMainShowSetting.getRoot().setVisibility(View.VISIBLE);
}
}
......
......@@ -10,7 +10,9 @@ import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.ImageView;
......@@ -27,6 +29,7 @@ import com.sw.laryngoscope.activity.CustomTimer;
import com.sw.laryngoscope.activity.HomeActivity;
import com.sw.laryngoscope.camera.VideoManager;
import com.sw.laryngoscope.common.InitParam;
import com.sw.laryngoscope.databinding.FgArchiveVideoReportBinding;
import com.sw.laryngoscope.db.RecordInfoDB;
import com.sw.laryngoscope.imageToVideo.VideoConUtil;
import com.sw.laryngoscope.manager.SpManager;
......@@ -39,48 +42,14 @@ import com.sw.laryngoscope.utils.Thumbnail;
import java.text.SimpleDateFormat;
import java.util.Date;
import butterknife.BindView;
import butterknife.OnClick;
public class VideoReportFragment extends BaseFragment implements
public class VideoReportFragment extends BaseFragment<FgArchiveVideoReportBinding> implements
CustomTimer.TimerCallBack, RadioGroup.OnCheckedChangeListener,
StorageStateManager.MountCallBack, VideoConUtil.VideoCallback {
StorageStateManager.MountCallBack, VideoConUtil.VideoCallback,View.OnClickListener {
private static final String TAG = "GraphicReportFragment";
@BindView(R.id.lay_back)
LinearLayout lay_back;
@BindView(R.id.fg_archive_report_info)
View fg_archive_report_info;
@BindView(R.id.ed_name)
EditText ed_name;
@BindView(R.id.ed_age)
EditText ed_age;
@BindView(R.id.ed_patient_id)
EditText ed_patient_id;
@BindView(R.id.ed_hospital)
EditText ed_hospital;
@BindView(R.id.ed_department)
EditText ed_department;
@BindView(R.id.ed_diagnosis)
EditText ed_diagnosis;
@BindView(R.id.lay_doctor_sign)
RelativeLayout lay_doctor_sign;
@BindView(R.id.rg_sex)
RadioGroup rg_sex;
@BindView(R.id.rb_male)
RadioButton rb_male;
@BindView(R.id.rb_female)
RadioButton rb_female;
@BindView(R.id.txt_report_video)
TextView txt_report_video;
@BindView(R.id.txt_video_num_value)
TextView txt_video_num_value;
private CustomTimer scrollTimer;
private final String timerTAG_scroll = "scroll";
......@@ -105,7 +74,7 @@ public class VideoReportFragment extends BaseFragment implements
mVideoConUtil = new VideoConUtil();
mVideoConUtil.setVideoCallback(this);
mVideoMakePopWindow = new VideoMakePopWindow(homeActivity, homeActivity);
lay_doctor_sign.setVisibility(View.GONE);
binding.fgArchiveReportInfo.layDoctorSign.getRootView().setVisibility(View.GONE);
}
public void setMountCallBack() {
......@@ -124,60 +93,62 @@ public class VideoReportFragment extends BaseFragment implements
}
@Override
protected int rootLayout() {
return R.layout.fg_archive_video_report;
protected FgArchiveVideoReportBinding getViewBinding(LayoutInflater inflater, ViewGroup container) {
return FgArchiveVideoReportBinding.inflate(inflater,container,false);
}
@Override
protected void init() {
Logger.d(" curRecordInfoPos " + mFileListMg.curRecordInfoPos);
initView();
ed_diagnosis.setHorizontallyScrolling(false);
ed_diagnosis.setMaxLines(Integer.MAX_VALUE);
binding.fgArchiveReportInfo.edDiagnosis.setHorizontallyScrolling(false);
binding.fgArchiveReportInfo.edDiagnosis.setMaxLines(Integer.MAX_VALUE);
}
public void initView() {
ed_hospital.setText(SpManager.get_value_hospital());
ed_department.setText(SpManager.get_value_department());
binding.fgArchiveReportInfo.edHospital.setText(SpManager.get_value_hospital());
binding.fgArchiveReportInfo.edDepartment.setText(SpManager.get_value_department());
for ( RecordInfoDB tmp:mFileListMg.selectList ) {
if ( tmp.getType() == InitParam.FILE_VIDEO ) {
mVideoDB = tmp;
}
}
mVideoManager = homeActivity.getmVideoModule().getmVideoManager();
txt_video_num_value.setText(mFileListMg.selectList.size() + "");
binding.txtVideoNumValue.setText(mFileListMg.selectList.size() + "");
ed_name.setText("");
ed_age.setText("");
rb_male.setChecked(true);
ed_patient_id.setText("");
ed_diagnosis.setText("");
binding.fgArchiveReportInfo.edName.setText("");
binding.fgArchiveReportInfo.edAge.setText("");
binding.fgArchiveReportInfo.rbMale.setChecked(true);
binding.fgArchiveReportInfo.edPatientId.setText("");
binding.fgArchiveReportInfo.edDiagnosis.setText("");
}
@Override
protected void setListener() {
rg_sex.setOnCheckedChangeListener(this);
binding.fgArchiveReportInfo.rgSex.setOnCheckedChangeListener(this);
binding.layBack.setOnClickListener(this);
binding.txtReportVideo.setOnClickListener(this);
}
@Override
@OnClick({ R.id.lay_back, R.id.txt_report_video, })
public void onClick(View v) {
switch (v.getId()) {
case R.id.lay_back:
homeFragment.backDetailFg();
break;
case R.id.txt_report_video:
int sex = rb_male.isChecked() ? 0 : 1;//0 男 1 女
SpManager.set_value_hospital(ed_hospital.getText().toString());
SpManager.set_value_department(ed_department.getText().toString());
final int sex = binding.fgArchiveReportInfo.rbMale.isChecked() ? 0 : 1;//0 男 1 女
SpManager.set_value_hospital(binding.fgArchiveReportInfo.edHospital.getText().toString());
SpManager.set_value_department(binding.fgArchiveReportInfo.edDepartment.getText().toString());
hideIm();
if ( !ed_name.getText().toString().isEmpty()
&& !ed_age.getText().toString().isEmpty()
&& !ed_patient_id.getText().toString().isEmpty() ) {
mVideoMakePopWindow.showAtLocation(rootView, Gravity.CENTER, 0, 0);
if ( !binding.fgArchiveReportInfo.edName.getText().toString().isEmpty()
&& !binding.fgArchiveReportInfo.edAge.getText().toString().isEmpty()
&& !binding.fgArchiveReportInfo.edPatientId.getText().toString().isEmpty() ) {
mVideoMakePopWindow.showAtLocation(getRootView(), Gravity.CENTER, 0, 0);
txt_report_video.setEnabled(false);
binding.txtReportVideo.setEnabled(false);
new Thread(new Runnable() {
@Override
public void run() {
......@@ -191,9 +162,9 @@ public class VideoReportFragment extends BaseFragment implements
Logger.d("=======onVideoFail========2===" + width + height);
pngbitmap = drawText2Bitmap(homeActivity,
ed_name.getText().toString(), sex, ed_age.getText().toString(),
ed_patient_id.getText().toString(), ed_diagnosis.getText().toString(),
ed_hospital.getText().toString(), ed_department.getText().toString(),
binding.fgArchiveReportInfo.edName.getText().toString(), sex, binding.fgArchiveReportInfo.edAge.getText().toString(),
binding.fgArchiveReportInfo.edPatientId.getText().toString(), binding.fgArchiveReportInfo.edDiagnosis.getText().toString(),
binding.fgArchiveReportInfo.edHospital.getText().toString(), binding.fgArchiveReportInfo.edDepartment.getText().toString(),
width, height);
//pngbitmap = mVideoConUtil.saveViewBitmap(fg_archive_report_info, 1280, 720);
mVideoConUtil.createVideo(
......@@ -216,7 +187,9 @@ public class VideoReportFragment extends BaseFragment implements
@Override
public void onVideoSuc(String path1) {
getActivity().runOnUiThread( () -> {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
mVideoConUtil.saveImage(pngbitmap, mCurReportDB.getThumbnailpath(), mCurReportDB.getThumbnailname());
long time = Thumbnail.getVideoDur(
mCurReportDB.getFilepath() + "/" + mCurReportDB.getFilename());
......@@ -227,30 +200,37 @@ public class VideoReportFragment extends BaseFragment implements
mVideoMakePopWindow.dismiss();
homeFragment.backDetailFg();
txt_report_video.setEnabled(true);
txt_report_video.setVisibility(View.VISIBLE);
binding.txtReportVideo.setEnabled(true);
binding.txtReportVideo.setVisibility(View.VISIBLE);
mFileListMg.getDetailList(mVideoDB.getListMdItemName());
} );
}
});
}
@Override
public void onVideoFail() {
getActivity().runOnUiThread( ()-> {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
mVideoMakePopWindow.dismiss();
txt_report_video.setEnabled(true);
txt_report_video.setVisibility(View.VISIBLE);
binding.txtReportVideo.setEnabled(true);
binding.txtReportVideo.setVisibility(View.VISIBLE);
mCurReportDB.delete();
Logger.d("=======onVideoFail===========");
} );
}
});
}
@Override
public void onVideoProgress(int pro) {
getActivity().runOnUiThread( ()-> {
public void onVideoProgress(final int pro) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
mVideoMakePopWindow.setSb_con(pro);
Logger.d("=======onVideoProgress===========");
} );
}
});
}
public void saveDataDb() {
......@@ -273,7 +253,7 @@ public class VideoReportFragment extends BaseFragment implements
@Override
public void onCheckedChanged(RadioGroup radioGroup, int i) {
switch (rg_sex.getCheckedRadioButtonId()) {
switch (binding.fgArchiveReportInfo.rgSex.getCheckedRadioButtonId()) {
case R.id.rb_male:
Logger.d(TAG, "============rb_male");
break;
......
......@@ -2,7 +2,9 @@ package com.sw.laryngoscope.activity.fragment.setting;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CompoundButton;
import android.widget.RadioButton;
import android.widget.RadioGroup;
......@@ -15,6 +17,7 @@ import com.sw.laryngoscope.activity.CustomTimer;
import com.sw.laryngoscope.activity.HomeActivity;
import com.sw.laryngoscope.common.Constant;
import com.sw.laryngoscope.common.InitParam;
import com.sw.laryngoscope.databinding.FgSettingGeneralBinding;
import com.sw.laryngoscope.manager.LogoutTimerManager;
import com.sw.laryngoscope.manager.SpManager;
import com.sw.laryngoscope.utils.Logger;
......@@ -23,72 +26,12 @@ import com.sw.laryngoscope.widget.PhotoBgView1;
import java.util.Calendar;
import butterknife.BindView;
import butterknife.OnCheckedChanged;
import butterknife.OnClick;
public class GeneralFragment extends BaseFragment implements
CustomTimer.TimerCallBack, Switch.OnCheckedChangeListener, RadioGroup.OnCheckedChangeListener {
public class GeneralFragment extends BaseFragment<FgSettingGeneralBinding> implements
CustomTimer.TimerCallBack, Switch.OnCheckedChangeListener, RadioGroup.OnCheckedChangeListener,View.OnClickListener {
private static final String TAG = "GeneralFragment";
private Context context;
@BindView(R.id.switch_usb_input)
Switch switch_usb_input;
@BindView(R.id.switch_rt_rotation)
Switch switch_rt_rotation;
@BindView(R.id.switch_no_login_visit_doc)
Switch switch_no_login_visit_doc;
@BindView(R.id.switch_boot_psd)
Switch switch_boot_psd;
@BindView(R.id.rg_one_camera_set)
RadioGroup rg_one_camera_set;
@BindView(R.id.rb_one_awb)
RadioButton rb_one_awb;
@BindView(R.id.rb_one_magnify)
RadioButton rb_one_magnify;
@BindView(R.id.rb_one_record)
RadioButton rb_one_record;
@BindView(R.id.rb_one_photo)
RadioButton rb_one_photo;
@BindView(R.id.rb_one_ice)
RadioButton rb_one_ice;
@BindView(R.id.rg_two_camera_set)
RadioGroup rg_two_camera_set;
@BindView(R.id.rb_two_awb)
RadioButton rb_two_awb;
@BindView(R.id.rb_two_magnify)
RadioButton rb_two_magnify;
@BindView(R.id.rb_two_record)
RadioButton rb_two_record;
@BindView(R.id.rb_two_photo)
RadioButton rb_two_photo;
@BindView(R.id.rb_two_ice)
RadioButton rb_two_ice;
@BindView(R.id.rg_inactivity)
RadioGroup rg_inactivity;
@BindView(R.id.rb_10_min)
RadioButton rb_10_min;
@BindView(R.id.rb_30_min)
RadioButton rb_30_min;
@BindView(R.id.rb_60_min)
RadioButton rb_60_min;
@BindView(R.id.rb_never)
RadioButton rb_never;
@BindView(R.id.txt_border_a)
TextView txt_border_a;
@BindView(R.id.txt_border_b)
PhotoBgView1 txt_border_b;
@BindView(R.id.txt_border_c)
TextView txt_border_c;
/*@BindView(R.id.txt_border_d)
PhotoBgView1 txt_border_d;*/
RadioButton[] oneKeyBt = new RadioButton[5];
RadioButton[] twoKeyBt = new RadioButton[5];
......@@ -120,8 +63,8 @@ public class GeneralFragment extends BaseFragment implements
}
@Override
protected int rootLayout() {
return R.layout.fg_setting_general;
protected FgSettingGeneralBinding getViewBinding(LayoutInflater inflater, ViewGroup container) {
return FgSettingGeneralBinding.inflate(inflater,container,false);
}
@Override
......@@ -133,15 +76,15 @@ public class GeneralFragment extends BaseFragment implements
}
public void initValue() {
rb_10_min.setChecked(SpManager.get_inactivity_logout_time() == Constant.INACTIVITY_LOGOUT_TIME_10);
rb_30_min.setChecked(SpManager.get_inactivity_logout_time() == Constant.INACTIVITY_LOGOUT_TIME_30);
rb_60_min.setChecked(SpManager.get_inactivity_logout_time() == Constant.INACTIVITY_LOGOUT_TIME_60);
rb_never.setChecked(SpManager.get_inactivity_logout_time() == Constant.INACTIVITY_LOGOUT_TIME_NEVER);
binding.rb10Min.setChecked(SpManager.get_inactivity_logout_time() == Constant.INACTIVITY_LOGOUT_TIME_10);
binding.rb30Min.setChecked(SpManager.get_inactivity_logout_time() == Constant.INACTIVITY_LOGOUT_TIME_30);
binding.rb60Min.setChecked(SpManager.get_inactivity_logout_time() == Constant.INACTIVITY_LOGOUT_TIME_60);
binding.rbNever.setChecked(SpManager.get_inactivity_logout_time() == Constant.INACTIVITY_LOGOUT_TIME_NEVER);
switch_usb_input.setChecked(!SpManager.get_usb_input_enabled());
switch_rt_rotation.setChecked(!SpManager.get_rt_rotation());
switch_no_login_visit_doc.setChecked(!SpManager.get_no_login_visit_doc());
switch_boot_psd.setChecked(!SpManager.get_boot_psd());
binding.switchUsbInput.setChecked(!SpManager.get_usb_input_enabled());
binding.switchRtRotation.setChecked(!SpManager.get_rt_rotation());
binding.switchNoLoginVisitDoc.setChecked(!SpManager.get_no_login_visit_doc());
binding.switchBootPsd.setChecked(!SpManager.get_boot_psd());
setBonder();
......@@ -149,13 +92,15 @@ public class GeneralFragment extends BaseFragment implements
@Override
protected void setListener() {
rg_inactivity.setOnCheckedChangeListener(this);
rg_one_camera_set.setOnCheckedChangeListener(this);
rg_two_camera_set.setOnCheckedChangeListener(this);
binding.rgInactivity.setOnCheckedChangeListener(this);
binding.rgOneCameraSet.setOnCheckedChangeListener(this);
binding.rgTwoCameraSet.setOnCheckedChangeListener(this);
binding.txtBorderA.setOnClickListener(this);
binding.txtBorderB.setOnClickListener(this);
binding.txtBorderC.setOnClickListener(this);
}
@Override
@OnClick({ R.id.txt_border_a, R.id.txt_border_b, R.id.txt_border_c,/* R.id.txt_border_d,*/ })
public void onClick(View v) {
switch (v.getId()) {
case R.id.txt_border_a:
......@@ -234,16 +179,16 @@ public class GeneralFragment extends BaseFragment implements
}
public void initKeySel() {
oneKeyBt[0] = rb_one_awb;
oneKeyBt[1] = rb_one_magnify;
oneKeyBt[2] = rb_one_record;
oneKeyBt[3] = rb_one_photo;
oneKeyBt[4] = rb_one_ice;
twoKeyBt[0] = rb_two_awb;
twoKeyBt[1] = rb_two_magnify;
twoKeyBt[2] = rb_two_record;
twoKeyBt[3] = rb_two_photo;
twoKeyBt[4] = rb_two_ice;
oneKeyBt[0] = binding.rbOneAwb;
oneKeyBt[1] = binding.rbOneMagnify;
oneKeyBt[2] = binding.rbOneRecord;
oneKeyBt[3] = binding.rbOnePhoto;
oneKeyBt[4] = binding.rbOneIce;
twoKeyBt[0] = binding.rbTwoAwb;
twoKeyBt[1] = binding.rbTwoMagnify;
twoKeyBt[2] = binding.rbTwoRecord;
twoKeyBt[3] = binding.rbTwoPhoto;
twoKeyBt[4] = binding.rbTwoIce;
InitParam.handleOneKey[SpManager.get_handle_one_key()] = true;
InitParam.handleTwoKey[SpManager.get_handle_two_key()] = true;
......@@ -277,8 +222,6 @@ public class GeneralFragment extends BaseFragment implements
}
@Override
@OnCheckedChanged({ R.id.switch_usb_input, R.id.switch_rt_rotation,
R.id.switch_no_login_visit_doc, R.id.switch_boot_psd, })
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
switch (compoundButton.getId()) {
case R.id.switch_usb_input:
......@@ -306,19 +249,19 @@ public class GeneralFragment extends BaseFragment implements
public void setBonder() {
if ( SpManager.get_border_type() == Constant.BORDER_TYPE_A ) {
txt_border_a.setSelected(true);
binding.txtBorderA.setSelected(true);
} else {
txt_border_a.setSelected(false);
binding.txtBorderA.setSelected(false);
}
if ( SpManager.get_border_type() == Constant.BORDER_TYPE_B ) {
txt_border_b.setSelect(true);
binding.txtBorderB.setSelect(true);
} else {
txt_border_b.setSelect(false);
binding.txtBorderB.setSelect(false);
}
if ( SpManager.get_border_type() == Constant.BORDER_TYPE_C ) {
txt_border_c.setSelected(true);
binding.txtBorderC.setSelected(true);
} else {
txt_border_c.setSelected(false);
binding.txtBorderC.setSelected(false);
}
/*if ( SpManager.get_border_type() == Constant.BORDER_TYPE_D ) {
txt_border_d.setSelect(true);
......
......@@ -2,7 +2,9 @@ package com.sw.laryngoscope.activity.fragment.setting;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
......@@ -12,23 +14,15 @@ import com.sw.laryngoscope.activity.BaseFragment;
import com.sw.laryngoscope.activity.CustomTimer;
import com.sw.laryngoscope.activity.HomeActivity;
import com.sw.laryngoscope.common.InitParam;
import com.sw.laryngoscope.databinding.FgSettingLanBinding;
import com.sw.laryngoscope.utils.Logger;
import butterknife.BindView;
import butterknife.OnClick;
public class LanFragment extends BaseFragment implements CustomTimer.TimerCallBack {
public class LanFragment extends BaseFragment<FgSettingLanBinding> implements CustomTimer.TimerCallBack,View.OnClickListener {
private static final String TAG = "LanFragment";
private Context context;
@BindView(R.id.lin_lan)
public LinearLayout lin_lan;
@BindView(R.id.txt_lan)
public TextView txt_lan;
@BindView(R.id.img_lan_next)
public ImageView img_lan_next;
private CustomTimer scrollTimer;
private final String timerTAG_scroll = "scroll";
......@@ -57,8 +51,8 @@ public class LanFragment extends BaseFragment implements CustomTimer.TimerCallBa
}
@Override
protected int rootLayout() {
return R.layout.fg_setting_lan;
protected FgSettingLanBinding getViewBinding(LayoutInflater inflater, ViewGroup container) {
return FgSettingLanBinding.inflate(inflater,container,false);
}
@Override
......@@ -72,22 +66,22 @@ public class LanFragment extends BaseFragment implements CustomTimer.TimerCallBa
for (int i = 0; i < InitParam.LAN_TYPE_RES.length; i++ ) {
if ( getRootView().getResources().getConfiguration().locale.getLanguage()
.equals(InitParam.mLocale[i].getLanguage()) ) {
txt_lan.setText(InitParam.LAN_TYPE_RES[i]);
binding.txtLan.setText(InitParam.LAN_TYPE_RES[i]);
}
}
}
@Override
protected void setListener() {
binding.linLan.setOnClickListener(this);
}
@Override
@OnClick({ R.id.lin_lan, })
public void onClick(View v) {
switch (v.getId()) {
case R.id.lin_lan:
//homeFragment.backHomeFragment();
(new LanPopWindow(getContext())).showLanPop(lin_lan, txt_lan, img_lan_next);
(new LanPopWindow(getContext())).showLanPop(binding.linLan, binding.txtLan, binding.imgLanNext);
break;
default:
break;
......
......@@ -32,7 +32,7 @@ public class LanPopWindow {
this.context = context;
}
public void showLanPop(View view, TextView txtView, View arrow) {
public void showLanPop(View view, final TextView txtView, final View arrow) {
int curPos = -1;
View bottomView = View.inflate(context, R.layout.layout_lan_choose, null);
ListView lt_user = bottomView.findViewById(R.id.lt_user);
......
......@@ -5,7 +5,9 @@ import android.content.Context;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.SeekBar;
......@@ -16,6 +18,7 @@ import com.sw.laryngoscope.activity.BaseFragment;
import com.sw.laryngoscope.activity.CustomTimer;
import com.sw.laryngoscope.activity.HomeActivity;
import com.sw.laryngoscope.adapter.UsbItemAdapter;
import com.sw.laryngoscope.databinding.FgSettingLogBinding;
import com.sw.laryngoscope.db.UsbInfoBean;
import com.sw.laryngoscope.manager.Storage;
import com.sw.laryngoscope.manager.StorageStateManager;
......@@ -26,11 +29,9 @@ import com.sw.laryngoscope.utils.ShellUtils;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.OnClick;
public class LogExportFragment extends BaseFragment implements
CustomTimer.TimerCallBack, StorageStateManager.MountCallBack {
public class LogExportFragment extends BaseFragment<FgSettingLogBinding> implements
CustomTimer.TimerCallBack, StorageStateManager.MountCallBack,View.OnClickListener {
private static final String TAG = "LogExportFragment";
private Context context;
......@@ -38,18 +39,6 @@ public class LogExportFragment extends BaseFragment implements
private CustomTimer scrollTimer;
private final String timerTAG_scroll = "scroll";
@BindView(R.id.listView_usb)
ListView listView_usb;
@BindView(R.id.lay_usb)
RelativeLayout lay_usb;
@BindView(R.id.sb_log)
SeekBar sb_log;
//@BindView(R.id.ptv_open_persentage)
//ProgressTextView ptv_open_persentage;
@BindView(R.id.txt_export)
TextView txt_export;
public UsbItemAdapter mUsbItemAdapter;
public List<UsbInfoBean> usbInfolist = new ArrayList<>();
int mProgress = 0;
......@@ -67,9 +56,9 @@ public class LogExportFragment extends BaseFragment implements
StorageStateManager.getInstance().setMountCallBackFun(this);
Logger.d(TAG, "======showFragment======2");
//禁用状态
sb_log.setClickable(false);
sb_log.setEnabled(false);
sb_log.setFocusable(false);
binding.sbLog.setClickable(false);
binding.sbLog.setEnabled(false);
binding.sbLog.setFocusable(false);
}
@Override
......@@ -83,14 +72,14 @@ public class LogExportFragment extends BaseFragment implements
} else {
mHandler.removeMessages(MSG_COPY_LOG);
//StorageStateManager.getInstance().setMountCallBackFun(null);
lay_usb.setVisibility(View.GONE);
binding.layUsb.setVisibility(View.GONE);
Logger.d(TAG, "======showFragment======2 " + hidden);
}
}
@Override
protected int rootLayout() {
return R.layout.fg_setting_log;
protected FgSettingLogBinding getViewBinding(LayoutInflater inflater, ViewGroup container) {
return FgSettingLogBinding.inflate(inflater,container,false);
}
@Override
......@@ -98,17 +87,17 @@ public class LogExportFragment extends BaseFragment implements
//layout_home_home_guest = (ConstraintLayout) rootView.findViewById(R.id.layout_home_home_guest);
usbInfolist = new ArrayList<>();
mUsbItemAdapter = new UsbItemAdapter(getContext(), usbInfolist);
listView_usb.setAdapter(mUsbItemAdapter);
binding.listViewUsb.setAdapter(mUsbItemAdapter);
initValue();
}
public void initValue() {
if ( !Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath()) ) {
clearList();
lay_usb.setVisibility(View.GONE);
binding.layUsb.setVisibility(View.GONE);
} else if ( Storage.isCheckExist(StorageStateManager.getInstance().getUdiskPath())
/*&& SpManager.get_usb_input_enabled()*/ ) {
txt_export.setEnabled(true);
binding.txtExport.setEnabled(true);
initList(Storage.getUName(getContext()));
}
}
......@@ -119,10 +108,10 @@ public class LogExportFragment extends BaseFragment implements
usbInfolist.add(usbInfoBean);
mUsbItemAdapter.setBeans(usbInfolist);
mUsbItemAdapter.notifyDataSetChanged();
sb_log.setProgress(0);
binding.sbLog.setProgress(0);
//ptv_open_persentage.setProgress(0, 0 + "%");
lay_usb.setVisibility(View.VISIBLE);
sb_log.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
binding.layUsb.setVisibility(View.VISIBLE);
binding.sbLog.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (!fromUser) {
......@@ -152,15 +141,15 @@ public class LogExportFragment extends BaseFragment implements
@Override
protected void setListener() {
binding.txtExport.setOnClickListener(this);
}
@Override
@OnClick({ R.id.txt_export })
public void onClick(View v) {
switch (v.getId()) {
case R.id.txt_export:
sb_log.setProgress(0);
txt_export.setEnabled(false);
binding.sbLog.setProgress(0);
binding.txtExport.setEnabled(false);
mHandler.sendEmptyMessageDelayed(MSG_COPY_LOG, 500);
break;
default:
......@@ -193,10 +182,10 @@ public class LogExportFragment extends BaseFragment implements
public void MountEventProc(boolean mount) {
if ( mount /*&& SpManager.get_usb_input_enabled()*/ ) {
initList(Storage.getUName(getContext()));
txt_export.setEnabled(true);
binding.txtExport.setEnabled(true);
} else {
clearList();
lay_usb.setVisibility(View.GONE);
binding.layUsb.setVisibility(View.GONE);
mHandler.removeMessages(MSG_COPY_LOG);
//LogcatHelper.getInstance(context).stop();
}
......@@ -211,8 +200,8 @@ public class LogExportFragment extends BaseFragment implements
switch (msg.what) {
case MSG_COPY_LOG:
Log.d(TAG, "==.copyToUsb()1============");
int num = sb_log.getProgress();
int max = sb_log.getMax();
int num = binding.sbLog.getProgress();
int max = binding.sbLog.getMax();
if ( num < max ) {
num += 1;
} else {
......@@ -227,12 +216,12 @@ public class LogExportFragment extends BaseFragment implements
}).start();
mProgress = 0;
//ptv_open_persentage.setProgress(0, 0 + "%");
sb_log.setProgress(0);
binding.sbLog.setProgress(0);
mHandler.removeMessages(MSG_COPY_LOG);
txt_export.setEnabled(true);
binding.txtExport.setEnabled(true);
break;
}
sb_log.setProgress(num);
binding.sbLog.setProgress(num);
mHandler.sendEmptyMessageDelayed(MSG_COPY_LOG, 500);
break;
default:
......
......@@ -33,7 +33,7 @@ public class ZonePopWindow {
this.context = context;
}
public void showZonePop(View view, final TextView txtView, View arrow) {
public void showZonePop(View view, final TextView txtView, final View arrow) {
View bottomView = View.inflate(context, R.layout.layout_zone_choose, null);
ListView lt_zone = bottomView.findViewById(R.id.lt_zone);
mZoneItemAdapter = new ZoneItemAdapter(context, InitParam.zoneList);
......
......@@ -24,6 +24,8 @@ import android.widget.Toast;
import com.sw.laryngoscope.R;
import com.sw.laryngoscope.base.BaseActivity;
import com.sw.laryngoscope.base.factory.CreatePresenter;
import com.sw.laryngoscope.databinding.ActivityLoginBinding;
import com.sw.laryngoscope.databinding.ActivityMainBinding;
import com.sw.laryngoscope.db.AccountInfoDB;
import com.sw.laryngoscope.manager.AccountManager;
import com.sw.laryngoscope.manager.LogoutTimerManager;
......@@ -38,7 +40,6 @@ import com.sw.laryngoscope.widget.BatteryStateView;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
/**
* @Description 这里用一句话描述
......@@ -47,34 +48,11 @@ import butterknife.BindView;
*/
@CreatePresenter(LoginPresenter.class)
public class LoginActivity extends
BaseActivity<LoginView, LoginPresenter>
BaseActivity<LoginView, LoginPresenter, ActivityLoginBinding>
implements LoginView, View.OnClickListener, View.OnTouchListener,
LogoutTimerManager.LogoutCallBack,
BatteryStateViewUtil.OnBatteryChargeLitener {
@BindView(R.id.batterView)
public BatteryStateView batterView;
@BindView(R.id.layout_ad)
View layout_ad;
@BindView(R.id.layout_login)
View layout_login;
@BindView(R.id.layout_name)
LinearLayout layout_name;
@BindView(R.id.edit_user_name)
EditText edit_user_name;
@BindView(R.id.img_user_spinner)
ImageView img_user_spinner;
@BindView(R.id.edit_user_psd)
EditText edit_user_psd;
@BindView(R.id.img_hide_secret)
ImageView img_hide_secret;
@BindView(R.id.txt_login)
TextView txt_login;
@BindView(R.id.txt_anonymous)
TextView txt_anonymous;
protected Context context;
/*@BindView(R.id.txt_test)
......@@ -110,9 +88,9 @@ public class LoginActivity extends
getdata = SpManager.getSelectBean();
if (getdata != null && getdata.size() > 0) {
if (!TextUtils.isEmpty(getdata.get(0).getName())) {
edit_user_name.setText(getdata.get(0).getName());
binding.layoutLogin.editUserName.setText(getdata.get(0).getName());
//edit_user_psd.setText(getdata.get(0).getPassword());
edit_user_name.setSelection(edit_user_name.getText().length());
binding.layoutLogin.editUserName.setSelection(binding.layoutLogin.editUserName.getText().length());
//edit_user_psd.setSelection(edit_user_psd.getText().length());
}
Logger.d(" getdata ---- " + getdata.size());
......@@ -134,14 +112,19 @@ public class LoginActivity extends
/*txt_test.setOnMultiClickListener(() -> {
HomeActivity.this.startActivity(new Intent("android.intent.action.WEIKENTEST"));
});*/
layout_ad.postDelayed(runnable, 5 * 1000);
binding.layoutAd.getRoot().postDelayed(runnable, 5 * 1000);
}
@Override
protected ActivityLoginBinding getViewBinding() {
return ActivityLoginBinding.inflate(getLayoutInflater());
}
Runnable runnable = new Runnable() {
@Override
public void run() {
layout_ad.setVisibility(View.GONE);
layout_login.setVisibility(View.VISIBLE);
binding.layoutAd.getRoot().setVisibility(View.GONE);
binding.layoutLogin.getRoot().setVisibility(View.VISIBLE);
}
};
......@@ -164,11 +147,6 @@ public class LoginActivity extends
}
@Override
protected int getLayoutId() {
return R.layout.activity_login;
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.txt_login:
......@@ -180,8 +158,8 @@ public class LoginActivity extends
}
}).start();*/
account = edit_user_name.getText().toString();
password = edit_user_psd.getText().toString();
account = binding.layoutLogin.editUserName.getText().toString();
password = binding.layoutLogin.editUserPsd.getText().toString();
if( TextUtils.isEmpty(account) || TextUtils.isEmpty(password) ){
Toast.makeText(context, getString(R.string.string_account_non), Toast.LENGTH_LONG).show();
break;
......@@ -230,20 +208,20 @@ public class LoginActivity extends
} else {
isShowDialog = true;
if (mSpinerPopWindow != null) {
mSpinerPopWindow.showAsDropDown(layout_name, 0, -2);
mSpinerPopWindow.showAsDropDown(binding.layoutLogin.layoutName, 0, -2);
}
}
break;
case R.id.img_hide_secret:
//Jpg2Dcm.main();
if ( edit_user_psd.getInputType() == 128 ) {
edit_user_psd.setInputType(129);//设置为隐藏密码
img_hide_secret.setSelected(false);
if ( binding.layoutLogin.editUserPsd.getInputType() == 128 ) {
binding.layoutLogin.editUserPsd.setInputType(129);//设置为隐藏密码
binding.layoutLogin.imgHideSecret.setSelected(false);
} else {
edit_user_psd.setInputType(128);//设置为显示密码
img_hide_secret.setSelected(true);
binding.layoutLogin.editUserPsd.setInputType(128);//设置为显示密码
binding.layoutLogin.imgHideSecret.setSelected(true);
}
edit_user_psd.setSelection(edit_user_psd.getText().length());
binding.layoutLogin.editUserPsd.setSelection(binding.layoutLogin.editUserPsd.getText().length());
break;
case R.id.txt_anonymous:
finish();
......@@ -270,10 +248,10 @@ public class LoginActivity extends
@SuppressLint("ClickableViewAccessibility")
private void setListener() {
//((RadioButton) rg_home_bottom.getChildAt(0)).setChecked(true);
img_user_spinner.setOnClickListener(this);
img_hide_secret.setOnClickListener(this);
txt_login.setOnClickListener(this);
txt_anonymous.setOnClickListener(this);
binding.layoutLogin.imgUserSpinner.setOnClickListener(this);
binding.layoutLogin.imgHideSecret.setOnClickListener(this);
binding.layoutLogin.txtLogin.setOnClickListener(this);
binding.layoutLogin.txtAnonymous.setOnClickListener(this);
}
@Override
......@@ -288,7 +266,7 @@ public class LoginActivity extends
private void showInput() {
if (!imm.isActive()) {
imm.showSoftInput(edit_user_name,
imm.showSoftInput(binding.layoutLogin.editUserName,
InputMethodManager.SHOW_IMPLICIT);
}
}
......@@ -296,7 +274,7 @@ public class LoginActivity extends
private void hideInput() {
if (imm.isActive()) {
imm.hideSoftInputFromWindow(
edit_user_name.getWindowToken(), 0);
binding.layoutLogin.editUserName.getWindowToken(), 0);
}
}
......@@ -310,10 +288,10 @@ public class LoginActivity extends
isShowDialog = false;
List<AccountInfoDB> datalist = SpManager.getSelectBean();
if (datalist != null && datalist.size() > 0) {
edit_user_name.setText(datalist.get(0).getName());
edit_user_psd.setText(datalist.get(0).getPassword());
edit_user_name.setSelection(edit_user_name.getText().length());
edit_user_psd.setSelection(edit_user_psd.getText().length());
binding.layoutLogin.editUserName.setText(datalist.get(0).getName());
binding.layoutLogin.editUserPsd.setText(datalist.get(0).getPassword());
binding.layoutLogin.editUserName.setSelection(binding.layoutLogin.editUserName.getText().length());
binding.layoutLogin.editUserPsd.setSelection(binding.layoutLogin.editUserPsd.getText().length());
}
getdata = SpManager.getSelectBean();
mSpinerPopWindow.setList(getdata);
......@@ -337,10 +315,10 @@ public class LoginActivity extends
isShowDialog = false;
mSpinerPopWindow.dismiss();
if ( getdata.size() > 0 ) {
edit_user_name.setText(getdata.get(position).getName());
edit_user_psd.setText(getdata.get(position).getPassword());
edit_user_name.setSelection(edit_user_name.getText().length());
edit_user_psd.setSelection(edit_user_psd.getText().length());
binding.layoutLogin.editUserName.setText(getdata.get(position).getName());
binding.layoutLogin.editUserPsd.setText(getdata.get(position).getPassword());
binding.layoutLogin.editUserName.setSelection(binding.layoutLogin.editUserName.getText().length());
binding.layoutLogin.editUserPsd.setSelection(binding.layoutLogin.editUserPsd.getText().length());
}
}
};
......@@ -350,7 +328,7 @@ public class LoginActivity extends
public void batteryRegister() {
if ( batteryChangedReceiver == null ) {
BatteryStateViewUtil.setOnBatteryLitener(this);
batteryChangedReceiver = BatteryStateViewUtil.createBroadcastReceiver(batterView);
batteryChangedReceiver = BatteryStateViewUtil.createBroadcastReceiver(binding.batterView);
}
//binding.batteryStateView是电量的组件
registerReceiver(batteryChangedReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
......
......@@ -163,7 +163,7 @@ public class DetailGdItemAdapter extends RecyclerView.Adapter<DetailGdItemAdapte
}
@Override
public void onBindViewHolder(ViewHolder holder, @SuppressLint("RecyclerView") int position) {
public void onBindViewHolder(final ViewHolder holder, @SuppressLint("RecyclerView") final int position) {
RecordInfoDB temp = list.get( list.size() - position -1 );
String file;
if ( temp.getType() == InitParam.FILE_PHOTO ) {
......
......@@ -89,7 +89,7 @@ public class FileItemAdapter extends BaseAdapter {
holder = (ViewHolder)convertView.getTag();
}
FileDayBean bean = this.beans.get(position);
final FileDayBean bean = this.beans.get(position);
if ( selPos == position ) {
//holder.lay_value.setBackgroundResource(R.drawable.bg_user_sideview_gray);
/*holder.lay_userlist.setBackgroundColor(
......
......@@ -63,8 +63,8 @@ public class FolderItemAdapter extends RecyclerView.Adapter<FolderItemAdapter.Vi
}
@Override
public void onBindViewHolder(ViewHolder holder, @SuppressLint("RecyclerView") int position) {
FolderItemBean temp = list.get( list.size() - position -1 );
public void onBindViewHolder(ViewHolder holder, @SuppressLint("RecyclerView") final int position) {
final FolderItemBean temp = list.get( list.size() - position -1 );
//Logger.d(" onBindViewHolder ------------- " + list.size());
if ( mFileListMg.curFoldLevel == InitParam.FOLDER_LEVEL.L_ONE.ordinal() ) {
holder.txt_name.setText(temp.getFdName());
......
......@@ -70,7 +70,7 @@ public class ListAdapter extends RecyclerView.Adapter<ListAdapter.ViewHolder> {
}
@Override
public void onBindViewHolder(ViewHolder holder, @SuppressLint("RecyclerView") int position) {
public void onBindViewHolder(ViewHolder holder, @SuppressLint("RecyclerView") final int position) {
if ( curSelPos == position ) {
holder.item_detail_img.setSelected(true);
} else {
......
......@@ -61,7 +61,7 @@ public class ShowGdItemAdapter extends BaseAdapter {
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
public View getView(final int position, View convertView, ViewGroup parent) {
ViewHolder viewHolder;
if (convertView != null) {
viewHolder = (ViewHolder) convertView.getTag();
......
......@@ -9,6 +9,7 @@ import android.view.Window;
import android.view.WindowManager;
import androidx.annotation.Nullable;
import androidx.viewbinding.ViewBinding;
import com.sw.laryngoscope.base.factory.PresenterFactory;
import com.sw.laryngoscope.base.factory.PresenterFactoryImpl;
......@@ -16,7 +17,6 @@ import com.sw.laryngoscope.base.factory.PresenterProxy;
import com.sw.laryngoscope.base.factory.PresenterProxyImpl;
import com.sw.laryngoscope.utils.Logger;
import butterknife.ButterKnife;
/**
* @Description 继承自Activity的基类MvpActivity
......@@ -26,14 +26,14 @@ import butterknife.ButterKnife;
* @Author
* @Time 2019/05/29
*/
public abstract class BaseActivity<V extends BaseView, P extends BasePresenter<V>>
public abstract class BaseActivity<V extends BaseView, P extends BasePresenter<V>,VB extends ViewBinding>
extends Activity implements BaseView, PresenterProxy<V, P> {
public String TAG;
private static final String PRESENTER_SAVE_KEY = "presenter_save_key";
private PresenterProxyImpl<V, P> mProxyImpl;
protected VB binding; // ViewBinding 变量
public View.OnLongClickListener longClickListener = new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
......@@ -56,8 +56,9 @@ public abstract class BaseActivity<V extends BaseView, P extends BasePresenter<V
super.onCreate(savedInstanceState);
TAG = getClass().getSimpleName();
hideBottomUIMenu();
setContentView(getLayoutId());
ButterKnife.bind(this);
// 绑定 ViewBinding
binding = getViewBinding();
setContentView(binding.getRoot());
//创建被代理对象,传入默认Presenter的工厂
mProxyImpl = new PresenterProxyImpl<>(PresenterFactoryImpl.<V, P>createFactory(getClass()));
......@@ -73,7 +74,8 @@ public abstract class BaseActivity<V extends BaseView, P extends BasePresenter<V
mProxyImpl.onResume((V) this);
}
protected abstract int getLayoutId();
// 让子类提供 ViewBinding 实例
protected abstract VB getViewBinding();
@Override
protected void onDestroy() {
......
......@@ -325,9 +325,6 @@ public class VideoCFModule extends BaseModule implements MediaRecorder.OnErrorLi
zoomParam = 0;
previewSizeWidth = 0;
previewSizeHeight = 0;
fragment.getActivity().runOnUiThread(() -> {
//(fragment.getRootView().findViewById(R.id.img_cam_fg_2)).setBackgroundResource(0);
});
try {
if ( frontCamera == null ) {
//TMP_CAM_ID = FACING_FRONT;
......
......@@ -7,35 +7,36 @@ import android.widget.PopupWindow;
import androidx.annotation.IdRes;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.viewbinding.ViewBinding;
import com.sw.laryngoscope.R;
import butterknife.ButterKnife;
public abstract class BasePopWindow
public abstract class BasePopWindow<T extends ViewBinding>
extends PopupWindow
implements View.OnClickListener, View.OnTouchListener {
public String TAG = "";
protected Context mContext;
protected ConstraintLayout rootView;
protected T binding; // 绑定 ViewBinding
protected View view_pop_empty;
public View.OnLongClickListener
longClickListener = v -> true;
public View.OnLongClickListener longClickListener = new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
return true;
}
};
public BasePopWindow(Context context) {
this.mContext = context;
TAG = getClass().getSimpleName();
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
rootView = (ConstraintLayout) inflater.inflate(
getPopLayoutId(), null);
// 使用 ViewBinding 代替 LayoutInflater.inflate()
binding = getViewBinding(LayoutInflater.from(context));
setContentView(rootView);
ButterKnife.bind(this, rootView);
setContentView(binding.getRoot());
setWidth(mContext.getResources()
.getDimensionPixelSize(R.dimen.dp_x_823));
......@@ -70,7 +71,9 @@ public abstract class BasePopWindow
}
public abstract int getPopLayoutId();
// 抽象方法,让子类提供 ViewBinding 实例
protected abstract T getViewBinding(LayoutInflater inflater);
public abstract void init();
......
......@@ -2,6 +2,7 @@ package com.sw.laryngoscope.popWindow;
import android.annotation.SuppressLint;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
......@@ -11,18 +12,11 @@ import android.widget.TextView;
import com.sw.laryngoscope.R;
import com.sw.laryngoscope.activity.HomeActivity;
import com.sw.laryngoscope.databinding.LayoutDlgUserDelBinding;
import butterknife.BindView;
@SuppressLint("NonConstantResourceId")
public class DelUserPopWindow extends BasePopWindow {
@BindView(R.id.txt_title)
TextView txt_title;
@BindView(R.id.img_export_close)
ImageView img_export_close;
@BindView(R.id.img_del)
ImageView img_del;
public class DelUserPopWindow extends BasePopWindow<LayoutDlgUserDelBinding> {
/**
* 是否为公制
......@@ -38,8 +32,8 @@ public class DelUserPopWindow extends BasePopWindow {
}
@Override
public int getPopLayoutId() {
return R.layout.layout_dlg_user_del;
protected LayoutDlgUserDelBinding getViewBinding(LayoutInflater inflater) {
return LayoutDlgUserDelBinding.inflate(inflater);
}
@Override
......@@ -59,12 +53,12 @@ public class DelUserPopWindow extends BasePopWindow {
@Override
public void setListener() {
img_export_close.setOnClickListener(this);
img_del.setOnClickListener(this);
binding.imgExportClose.setOnClickListener(this);
binding.imgDel.setOnClickListener(this);
}
public void setTitle(String name) {
txt_title.setText(homeActivity.getString(R.string.string_is_del_user, name));
binding.txtTitle.setText(homeActivity.getString(R.string.string_is_del_user, name));
}
@Override
......
......@@ -2,6 +2,7 @@ package com.sw.laryngoscope.popWindow;
import android.annotation.SuppressLint;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
......@@ -14,66 +15,16 @@ import android.widget.TextView;
import com.sw.laryngoscope.R;
import com.sw.laryngoscope.activity.HomeActivity;
import com.sw.laryngoscope.databinding.LayoutDetailCopyInfoDialogBinding;
import com.sw.laryngoscope.manager.SpManager;
import com.sw.laryngoscope.utils.Logger;
import butterknife.BindView;
@SuppressLint("NonConstantResourceId")
public class DetailCopyInfoPopWindow extends BasePopWindow implements RadioGroup.OnCheckedChangeListener {
@BindView(R.id.lay_copy_info)
RelativeLayout lay_copy_info;
@BindView(R.id.rg_format)
RadioGroup rg_format;
@BindView(R.id.rb_dicom)
RadioButton rb_dicom;
@BindView(R.id.rb_basic)
RadioButton rb_basic;
@BindView(R.id.ed_patient_id)
EditText ed_patient_id;
@BindView(R.id.ed_name)
EditText ed_name;
@BindView(R.id.ed_age)
EditText ed_age;
@BindView(R.id.rg_sex)
RadioGroup rg_sex;
@BindView(R.id.rb_male)
RadioButton rb_male;
@BindView(R.id.rb_female)
RadioButton rb_female;
@BindView(R.id.img_export_close)
ImageView img_export_close;
@BindView(R.id.img_export)
ImageView img_export;
@BindView(R.id.lay_copying)
RelativeLayout lay_copying;
@BindView(R.id.txt_tip_3)
TextView txt_tip_3;
@BindView(R.id.txt_ok)
TextView txt_ok;
@BindView(R.id.lay_2)
RelativeLayout lay_2;
@BindView(R.id.lay_3)
RelativeLayout lay_3;
@BindView(R.id.lay_4)
RelativeLayout lay_4;
@BindView(R.id.lay_5)
RelativeLayout lay_5;
@BindView(R.id.lay_6)
RelativeLayout lay_6;
/**
* 是否为公制
*/
public class DetailCopyInfoPopWindow extends BasePopWindow<LayoutDetailCopyInfoDialogBinding>
implements RadioGroup.OnCheckedChangeListener {
private boolean isMetric = false;
private InputMethodManager imm;
private final HomeActivity homeActivity;
public DetailCopyInfoPopWindow(HomeActivity activity, Context context) {
......@@ -82,8 +33,8 @@ public class DetailCopyInfoPopWindow extends BasePopWindow implements RadioGroup
}
@Override
public int getPopLayoutId() {
return R.layout.layout_detail_copy_info_dialog;
protected LayoutDetailCopyInfoDialogBinding getViewBinding(LayoutInflater inflater) {
return LayoutDetailCopyInfoDialogBinding.inflate(inflater);
}
@Override
......@@ -91,7 +42,7 @@ public class DetailCopyInfoPopWindow extends BasePopWindow implements RadioGroup
setFocusable(true);
imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
ActionModeCallbackInterceptor interceptor = new ActionModeCallbackInterceptor();
// ActionModeCallbackInterceptor interceptor = new ActionModeCallbackInterceptor();
//edit_login_new_account_name.setCustomSelectionActionModeCallback(interceptor);
//edit_login_new_account_name.setCustomInsertionActionModeCallback(interceptor);
setOutsideTouchable(false);
......@@ -104,13 +55,13 @@ public class DetailCopyInfoPopWindow extends BasePopWindow implements RadioGroup
.getDimensionPixelSize(R.dimen.dp_y_755));
if ( SpManager.get_copy_file_type() == 0 ) {
rb_dicom.setChecked(true);
binding.rbDicom.setChecked(true);
setLayDicomShow(View.VISIBLE);
} else if ( SpManager.get_copy_file_type() == 1 ) {
rb_basic.setChecked(true);
binding.rbBasic.setChecked(true);
setLayDicomShow(View.GONE);
}
rb_male.setChecked(true);
binding.rbMale.setChecked(true);
/*setTouchInterceptor(new View.OnTouchListener() {
@Override
......@@ -127,25 +78,25 @@ public class DetailCopyInfoPopWindow extends BasePopWindow implements RadioGroup
}
void setLayDicomShow(int visibility) {
lay_2.setVisibility(visibility);
lay_3.setVisibility(visibility);
lay_4.setVisibility(visibility);
lay_5.setVisibility(visibility);
lay_6.setVisibility(visibility == View.VISIBLE ? View.GONE : View.VISIBLE);
binding.lay2.setVisibility(visibility);
binding.lay3.setVisibility(visibility);
binding.lay4.setVisibility(visibility);
binding.lay5.setVisibility(visibility);
binding.lay6.setVisibility(visibility == View.VISIBLE ? View.GONE : View.VISIBLE);
}
@Override
public void setListener() {
img_export_close.setOnClickListener(this);
img_export.setOnClickListener(this);
txt_ok.setOnClickListener(this);
binding.imgExportClose.setOnClickListener(this);
binding.imgExport.setOnClickListener(this);
binding.txtOk.setOnClickListener(this);
rg_format.setOnCheckedChangeListener(this);
rg_sex.setOnCheckedChangeListener(this);
binding.rgFormat.setOnCheckedChangeListener(this);
binding.rgSex.setOnCheckedChangeListener(this);
ed_patient_id.setOnClickListener(this);
ed_name.setOnClickListener(this);
ed_age.setOnClickListener(this);
binding.edPatientId.setOnClickListener(this);
binding.edName.setOnClickListener(this);
binding.edAge.setOnClickListener(this);
}
@Override
......@@ -165,12 +116,12 @@ public class DetailCopyInfoPopWindow extends BasePopWindow implements RadioGroup
break;
case R.id.img_export:
if ( mCopyCallback != null ) {
lay_copy_info.setVisibility(View.GONE);
lay_copying.setVisibility(View.VISIBLE);
mCopyCallback.startCopy(SpManager.get_copy_file_type(), ed_name.getText().toString().trim(),
rb_male.isChecked() ? "M" : "F",
ed_patient_id.getText().toString().trim(),
ed_age.getText().toString().trim());
binding.layCopyInfo.setVisibility(View.GONE);
binding.layCopying.setVisibility(View.VISIBLE);
mCopyCallback.startCopy(SpManager.get_copy_file_type(), binding.edName.getText().toString().trim(),
binding.rbMale.isChecked() ? "M" : "F",
binding.edPatientId.getText().toString().trim(),
binding.edAge.getText().toString().trim());
}
break;
case R.id.txt_ok:
......@@ -192,8 +143,8 @@ public class DetailCopyInfoPopWindow extends BasePopWindow implements RadioGroup
@Override
public void showAtLocation(View parent, int gravity, int x, int y) {
super.showAtLocation(parent, gravity, x, y);
lay_copy_info.setVisibility(View.VISIBLE);
lay_copying.setVisibility(View.GONE);
binding.layCopyInfo.setVisibility(View.VISIBLE);
binding.layCopying.setVisibility(View.GONE);
setOnDismissListener(dismissListener);
}
......@@ -214,7 +165,7 @@ public class DetailCopyInfoPopWindow extends BasePopWindow implements RadioGroup
private void showInput() {
//if (!imm.isActive()) {
imm.showSoftInput(ed_patient_id,
imm.showSoftInput(binding.edPatientId,
InputMethodManager.SHOW_IMPLICIT);
Logger.d("======showInput========");
//}
......@@ -223,16 +174,16 @@ public class DetailCopyInfoPopWindow extends BasePopWindow implements RadioGroup
private void hideInput() {
if (imm.isActive()) {
imm.hideSoftInputFromWindow(
ed_patient_id.getWindowToken(), 0);
binding.edPatientId.getWindowToken(), 0);
}
}
private final Runnable immMission = new Runnable() {
@Override
public void run() {
ed_patient_id.requestFocus();
ed_patient_id.performClick();
imm.showSoftInput(ed_patient_id,
binding.edPatientId.requestFocus();
binding.edPatientId.performClick();
imm.showSoftInput(binding.edPatientId,
InputMethodManager.SHOW_IMPLICIT);
}
};
......@@ -255,7 +206,7 @@ public class DetailCopyInfoPopWindow extends BasePopWindow implements RadioGroup
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
switch (rg_format.getCheckedRadioButtonId()) {
switch (binding.rgFormat.getCheckedRadioButtonId()) {
case R.id.rb_dicom:
SpManager.set_copy_file_type(0);
Logger.d(TAG, "============rb_dicom");
......@@ -269,7 +220,7 @@ public class DetailCopyInfoPopWindow extends BasePopWindow implements RadioGroup
default:
break;
}
switch (rg_sex.getCheckedRadioButtonId()) {
switch (binding.rgSex.getCheckedRadioButtonId()) {
case R.id.rb_male:
Logger.d(TAG, "============rb_male");
break;
......@@ -288,7 +239,7 @@ public class DetailCopyInfoPopWindow extends BasePopWindow implements RadioGroup
}
public void setCopyInfo(String cpNum, String checkNum) {
txt_tip_3.setText( homeActivity.getString(R.string.string_copy_tip, cpNum,
binding.txtTip3.setText( homeActivity.getString(R.string.string_copy_tip, cpNum,
checkNum) );
}
......
......@@ -2,43 +2,21 @@ package com.sw.laryngoscope.popWindow;
import android.annotation.SuppressLint;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.PopupWindow;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import com.sw.laryngoscope.R;
import com.sw.laryngoscope.activity.HomeActivity;
import com.sw.laryngoscope.common.InitParam;
import com.sw.laryngoscope.databinding.LayoutMainShowUserinfoDialogBinding;
import butterknife.BindView;
@SuppressLint("NonConstantResourceId")
public class NewPatientIDPopWindow extends BasePopWindow implements RadioGroup.OnCheckedChangeListener {
@BindView(R.id.ed_patient_id)
EditText ed_patient_id;
@BindView(R.id.ed_patient_age)
EditText ed_patient_age;
/*@BindView(R.id.ed_patient_gender)
EditText ed_patient_gender;*/
@BindView(R.id.rg_sex)
RadioGroup rg_sex;
@BindView(R.id.rb_male)
RadioButton rb_male;
@BindView(R.id.rb_female)
RadioButton rb_female;
@BindView(R.id.rb_blank)
RadioButton rb_blank;
/**
* 是否为公制
*/
public class NewPatientIDPopWindow extends BasePopWindow<LayoutMainShowUserinfoDialogBinding> implements RadioGroup.OnCheckedChangeListener {
private boolean isMetric = false;
private InputMethodManager imm;
......@@ -48,10 +26,9 @@ public class NewPatientIDPopWindow extends BasePopWindow implements RadioGroup.O
super(context);
homeActivity = activity;
}
@Override
public int getPopLayoutId() {
return R.layout.layout_main_show_userinfo_dialog;
protected LayoutMainShowUserinfoDialogBinding getViewBinding(LayoutInflater inflater) {
return LayoutMainShowUserinfoDialogBinding.inflate(inflater);
}
@Override
......@@ -112,7 +89,7 @@ public class NewPatientIDPopWindow extends BasePopWindow implements RadioGroup.O
public void afterTextChanged(Editable s) {
}
});*/
rg_sex.setOnCheckedChangeListener(this);
binding.rgSex.setOnCheckedChangeListener(this);
}
@SuppressLint("ClickableViewAccessibility")
......@@ -145,9 +122,9 @@ public class NewPatientIDPopWindow extends BasePopWindow implements RadioGroup.O
public void showAsDropDown(View parent, int x, int y) {
super.showAsDropDown(parent, x, y);
setOnDismissListener(dismissListener);
rb_male.setChecked(InitParam.patientSex == 0);
rb_female.setChecked(InitParam.patientSex == 1);
rb_blank.setChecked(InitParam.patientSex == 2);
binding.rbMale.setChecked(InitParam.patientSex == 0);
binding.rbFemale.setChecked(InitParam.patientSex == 1);
binding.rbBlank.setChecked(InitParam.patientSex == 2);
}
@Override
......@@ -158,7 +135,7 @@ public class NewPatientIDPopWindow extends BasePopWindow implements RadioGroup.O
private void showInput() {
if (!imm.isActive()) {
imm.showSoftInput(ed_patient_id,
imm.showSoftInput(binding.edPatientId,
InputMethodManager.SHOW_IMPLICIT);
}
}
......@@ -166,16 +143,16 @@ public class NewPatientIDPopWindow extends BasePopWindow implements RadioGroup.O
private void hideInput() {
if (imm.isActive()) {
imm.hideSoftInputFromWindow(
ed_patient_id.getWindowToken(), 0);
binding.edPatientId.getWindowToken(), 0);
}
}
private final Runnable immMission = new Runnable() {
@Override
public void run() {
ed_patient_id.requestFocus();
ed_patient_id.performClick();
imm.showSoftInput(ed_patient_id,
binding.edPatientId.requestFocus();
binding.edPatientId.performClick();
imm.showSoftInput(binding.edPatientId,
InputMethodManager.SHOW_IMPLICIT);
}
};
......@@ -184,8 +161,8 @@ public class NewPatientIDPopWindow extends BasePopWindow implements RadioGroup.O
@Override
public void onDismiss() {
if ( minfoCallback != null ) {
minfoCallback.getinfo(ed_patient_id.getText().toString(),
ed_patient_age.getText().toString(),
minfoCallback.getinfo(binding.edPatientId.getText().toString(),
binding.edPatientAge.getText().toString(),
homeActivity.getString(InitParam.SEX_VAL_RES[InitParam.patientSex]));
}
}
......
......@@ -2,29 +2,18 @@ package com.sw.laryngoscope.popWindow;
import android.annotation.SuppressLint;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import com.sw.laryngoscope.R;
import com.sw.laryngoscope.activity.HomeActivity;
import com.sw.laryngoscope.common.InitParam;
import com.sw.laryngoscope.widget.TextThumbSeekBar2;
import com.sw.laryngoscope.databinding.LayoutMainShowVideomakeBinding;
import butterknife.BindView;
@SuppressLint("NonConstantResourceId")
public class VideoMakePopWindow extends BasePopWindow {
public class VideoMakePopWindow extends BasePopWindow<LayoutMainShowVideomakeBinding> {
@BindView(R.id.sb_con)
TextThumbSeekBar2 sb_con;
/**
* 是否为公制
*/
private boolean isMetric = false;
private InputMethodManager imm;
......@@ -36,8 +25,8 @@ public class VideoMakePopWindow extends BasePopWindow {
}
@Override
public int getPopLayoutId() {
return R.layout.layout_main_show_videomake;
protected LayoutMainShowVideomakeBinding getViewBinding(LayoutInflater inflater) {
return LayoutMainShowVideomakeBinding.inflate(inflater);
}
@Override
......@@ -48,9 +37,9 @@ public class VideoMakePopWindow extends BasePopWindow {
//setOutsideTouchable(false);
//setFocusable(false);
//setTouchable(true);
sb_con.setClickable(false);
sb_con.setEnabled(false);
sb_con.setFocusable(false);
binding.sbCon.setClickable(false);
binding.sbCon.setEnabled(false);
binding.sbCon.setFocusable(false);
}
@Override
......@@ -66,7 +55,7 @@ public class VideoMakePopWindow extends BasePopWindow {
@Override
public void showAtLocation(View parent, int gravity, int x, int y) {
super.showAtLocation(parent, gravity, x, y);
sb_con.setProgress(0);
binding.sbCon.setProgress(0);
}
@Override
......@@ -82,7 +71,7 @@ public class VideoMakePopWindow extends BasePopWindow {
}
public void setSb_con(int pro) {
this.sb_con.setProgress(pro);
binding.sbCon.setProgress(pro);
}
private void showInput() {
......
......@@ -125,7 +125,7 @@ public class AnimationUtil {
}
}
public void incFileAnim(View view) {
public void incFileAnim(final View view) {
view.startAnimation(incAnimation);//开始动画
incAnimation.setAnimationListener(new Animation.AnimationListener(){
@Override
......
......@@ -14,7 +14,7 @@ public class BatteryStateViewUtil {
* @param view
* @return
*/
public static BroadcastReceiver createBroadcastReceiver(BatteryStateView view) {
public static BroadcastReceiver createBroadcastReceiver(final BatteryStateView view) {
return new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
......
......@@ -25,7 +25,7 @@ public class SystemTimeUtil {
/**
* 设置系统的时间
*/
public static void setSysTime(Context context, int hourOfDay, int minute) {
public static void setSysTime(Context context, final int hourOfDay, final int minute) {
new Thread(new Runnable() {
@Override
public void run() {
......
......@@ -68,7 +68,7 @@ public class Thumbnail {
return bitmap;
}
public static void createVideoThumbnailBitmap1(String filePath, String toFile) {
public static void createVideoThumbnailBitmap1(final String filePath, final String toFile) {
new Thread(new Runnable() {
@Override
public void run() {
......@@ -114,7 +114,7 @@ public class Thumbnail {
}).start();
}
public static void createVideoThumbnailBitmap(String filePath, String toFile, Bitmap mBitmap) {
public static void createVideoThumbnailBitmap(final String filePath, final String toFile, final Bitmap mBitmap) {
//final String filePath = "/sdcard/DCIM/OCamera/VID_20221103_002616.mp4";
new Thread(new Runnable() {
......
......@@ -4,6 +4,7 @@ import android.annotation.SuppressLint;
import android.content.Context;
import android.os.SystemClock;
import android.util.AttributeSet;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.Nullable;
......@@ -43,16 +44,18 @@ public class MultiClickTextView extends TextView {
private void init(){
mHints = new long[mCount];
setOnClickListener(v -> {
//将原数组的第二位到最后一个复制到第1位到倒数第2位
System.arraycopy(mHints,1,mHints,0,mHints.length - 1);
setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
System.arraycopy(mHints, 1, mHints, 0, mHints.length - 1);
mHints[mHints.length - 1] = SystemClock.uptimeMillis();
if(mHints[0] >= (SystemClock.uptimeMillis() - limiit)){
if(multiClickListener != null){
if (mHints[0] >= (SystemClock.uptimeMillis() - limiit)) {
if (multiClickListener != null) {
mHints = new long[mCount];
multiClickListener.onMultiClick();
}
}
}
});
}
......
......@@ -130,7 +130,12 @@ public class NiceSpinner extends AppCompatTextView {
if (bundle.getBoolean(IS_POPUP_SHOWING)) {
if (popupWindow != null) {
// Post the show request into the looper to avoid bad token exception
post(this::showDropDown);
post(new Runnable() {
@Override
public void run() {
showDropDown();
}
});
}
}
isArrowHidden = bundle.getBoolean(IS_ARROW_HIDDEN, false);
......
......@@ -2,7 +2,7 @@
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.0"
......@@ -15,7 +15,7 @@ buildscript {
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
......