diff --git a/baselib/build.gradle b/baselib/build.gradle index a931e97..be73256 100755 --- a/baselib/build.gradle +++ b/baselib/build.gradle @@ -106,8 +106,11 @@ dependencies { api 'com.liulishuo.okdownload:okhttp:1.0.5' api 'com.liulishuo.okdownload:okdownload:1.0.5' api 'com.haibin:calendarview:3.6.9' - //zxing - api 'com.google.zxing:core:3.4.1' - api ('com.journeyapps:zxing-android-embedded:3.6.0') { transitive = false } +// //zxing +// api 'com.google.zxing:core:3.4.1' +// api ('com.journeyapps:zxing-android-embedded:3.6.0') { transitive = false } + api 'com.github.jenly1314:zxing-lite:2.1.1' + + } diff --git a/baselib/src/main/AndroidManifest.xml b/baselib/src/main/AndroidManifest.xml index 71a6873..66e65cd 100755 --- a/baselib/src/main/AndroidManifest.xml +++ b/baselib/src/main/AndroidManifest.xml @@ -38,6 +38,10 @@ + this.dismiss()); + DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics(); + Window window = this.getWindow(); + window.setGravity(Gravity.CENTER); + window.setWindowAnimations(R.style.dialog_center_alpha); + WindowManager.LayoutParams params = window.getAttributes(); + params.width = (int) (displayMetrics.widthPixels * 0.9); + params.height = WindowManager.LayoutParams.WRAP_CONTENT; + window.setAttributes(params); + window.setBackgroundDrawable(new ColorDrawable()); + } + + private void doConfirm() { + if (checkParams()) { + if (mChangeListener != null) { + String content = mEtContent.getText().toString().trim(); + mChangeListener.doChange(content, level); + } + } + } + + public void HideSoftKeyBoardDialog(Activity activity) { + try { + InputMethodManager imm = (InputMethodManager) activity.getSystemService(activity.INPUT_METHOD_SERVICE); + imm.toggleSoftInput(InputMethodManager.HIDE_NOT_ALWAYS, 0); + } catch (Exception ex) { + } + } + + public void addOnChangeListener(OnChangeListener listener) { + this.mChangeListener = listener; + } + + public interface OnChangeListener { + void doChange(String org, float level); + } + + /** + * 校验参数 + */ + private boolean checkParams() { + return true; + } + + + public static class DialogBuilder { + private Context mContext; + private String mQr; + + public DialogBuilder(Context context) { + this.mContext = context; + } + + public DialogBuilder setQr(String qr) { + this.mQr = qr; + return this; + } + + public QrDialog build() { + return new QrDialog(mContext, mQr); + } + } +} \ No newline at end of file diff --git a/baselib/src/main/res/layout/dialog_meeting_qr.xml b/baselib/src/main/res/layout/dialog_meeting_qr.xml new file mode 100644 index 0000000..b879593 --- /dev/null +++ b/baselib/src/main/res/layout/dialog_meeting_qr.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/build.gradle b/build.gradle index 6b91ac4..397acd4 100644 --- a/build.gradle +++ b/build.gradle @@ -54,7 +54,7 @@ task clean(type: Delete) { } ext { gCompileSdkVersion = 30 - gMinSdkVersion = 16 + gMinSdkVersion = 21 gTargetSdkVersion = 30 gVersionCode = 9 gVersionName = '1.0.8' diff --git a/import-summary.txt b/import-summary.txt new file mode 100644 index 0000000..6777a3b --- /dev/null +++ b/import-summary.txt @@ -0,0 +1,36 @@ +ECLIPSE ANDROID PROJECT IMPORT SUMMARY +====================================== + +Ignored Files: +-------------- +The following files were *not* copied into the new Gradle project; you +should evaluate whether these are still needed in your project and if +so manually move them: + +* pom.xml +* proguard.cfg + +Moved Files: +------------ +Android Gradle projects use a different directory structure than ADT +Eclipse projects. Here's how the projects were restructured: + +* AndroidManifest.xml => zxing/src/main/AndroidManifest.xml +* assets/ => zxing/src/main/assets/ +* res/ => zxing/src/main/res/ +* src/ => zxing/src/main/java/ + +Next Steps: +----------- +You can now build the project. The Gradle project needs network +connectivity to download dependencies. + +Bugs: +----- +If for some reason your project does not build, and you determine that +it is due to a bug or limitation of the Eclipse to Gradle importer, +please file a bug at http://b.android.com with category +Component-Tools. + +(This import summary is for your information only, and can be deleted +after import once you are satisfied with the results.) diff --git a/mainmodule/src/main/java/com/tengshisoft/mainmodule/base/MainTabActivity.java b/mainmodule/src/main/java/com/tengshisoft/mainmodule/base/MainTabActivity.java index 9a2d9b0..133942e 100644 --- a/mainmodule/src/main/java/com/tengshisoft/mainmodule/base/MainTabActivity.java +++ b/mainmodule/src/main/java/com/tengshisoft/mainmodule/base/MainTabActivity.java @@ -13,7 +13,8 @@ import com.alibaba.android.arouter.facade.annotation.Route; import com.google.gson.Gson; import com.gyf.immersionbar.ImmersionBar; import com.hjq.toast.ToastUtils; -import com.journeyapps.barcodescanner.CaptureActivity; +import com.king.zxing.CameraScan; +import com.king.zxing.CaptureActivity; import com.tengshisoft.mainmodule.R; import com.tengshisoft.mainmodule.R2; import com.tenlionsoft.baselib.constant.PathConfig; @@ -38,6 +39,9 @@ import com.tenlionsoft.baselib.utils.UserLgUtils; import java.util.ArrayList; import java.util.List; +import androidx.activity.result.ActivityResultLauncher; +import androidx.activity.result.contract.ActivityResultContracts; +import androidx.annotation.Nullable; import androidx.viewpager2.widget.ViewPager2; import butterknife.BindView; import butterknife.ButterKnife; @@ -97,6 +101,7 @@ public class MainTabActivity extends BaseActivity { private Unbinder mBind; private List mFragments; private long finishTime = 0; + private ActivityResultLauncher mLauncher; @Override protected int setLayoutId() { @@ -109,6 +114,14 @@ public class MainTabActivity extends BaseActivity { refreshView(STATE_LOAD_SUCCESS); mFragments = new ArrayList<>(); initContentView(); + mLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), result -> { + if (result.getResultCode() == RESULT_OK) { + String s = CameraScan.parseScanResult(result.getData()); + LogUtils.e("扫描结果=="+s); + } + }); + + NetworkChangeReceiver.registerReceiver(mActivity); //TODO 检查App版本 checkAppVersion(); } @@ -251,6 +264,8 @@ public class MainTabActivity extends BaseActivity { .titleBar(mVStatusBar) .init(); case 3://加号 + Intent intent = new Intent(mActivity, CaptureActivity.class); + mLauncher.launch(intent); break; case 4://邮件 @@ -278,6 +293,11 @@ public class MainTabActivity extends BaseActivity { } } + @Override + protected void onActivityResult(int requestCode, int resultCode, @Nullable @org.jetbrains.annotations.Nullable Intent data) { + super.onActivityResult(requestCode, resultCode, data); + } + /** * App版本校验 */ diff --git a/oamodule/src/main/java/com/tenlionsoft/oamodule/activity/meeting/MeetingApplyActivity.java b/oamodule/src/main/java/com/tenlionsoft/oamodule/activity/meeting/MeetingApplyActivity.java index b1348fd..a32e384 100644 --- a/oamodule/src/main/java/com/tenlionsoft/oamodule/activity/meeting/MeetingApplyActivity.java +++ b/oamodule/src/main/java/com/tenlionsoft/oamodule/activity/meeting/MeetingApplyActivity.java @@ -41,6 +41,7 @@ import com.tenlionsoft.oamodule.R; import com.tenlionsoft.oamodule.R2; import com.tenlionsoft.oamodule.adapter.BasePersonShowAdapter; import com.tenlionsoft.oamodule.beans.ChoosePersonListBean; +import com.tenlionsoft.oamodule.beans.MeetingAttachListBean; import com.tenlionsoft.oamodule.beans.MeetingRoomBean; import com.tenlionsoft.oamodule.beans.PersonShowBean; import com.tenlionsoft.oamodule.beans.SaveMeetingBean; @@ -113,7 +114,7 @@ public class MeetingApplyActivity extends BaseActivity { private ChoosePersonListBean mSelEmcee; private MeetingRoomBean mSelRoom; - private List mJoinPerson; + private List mJoinPerson; private BasePersonShowAdapter mPersonShowAdapter; @@ -184,13 +185,13 @@ public class MeetingApplyActivity extends BaseActivity { mJoinPerson = new ArrayList<>(); - mJoinPerson.add(new PersonShowBean()); + mJoinPerson.add(new MeetingAttachListBean()); mPersonShowAdapter = new BasePersonShowAdapter(mActivity, mJoinPerson, 1); mRlvJoin.setLayoutManager(new GridLayoutManager(mActivity, 4)); mRlvJoin.setAdapter(mPersonShowAdapter); mPersonShowAdapter.addOnDelListener(this::showConfirmDialog); mPersonShowAdapter.addOnItemClickListener(bean -> { - if (TextUtils.isEmpty(bean.getId())) { + if (TextUtils.isEmpty(bean.getUserId())) { ARouter.getInstance() .build(PathConfig.PATH_MODULE_OA_ACTIVITY_SEL_PERSON) .withBoolean("isSingle", false) @@ -200,7 +201,7 @@ public class MeetingApplyActivity extends BaseActivity { mBtnConfirm.setOnClickListener(v -> doConfirm()); } - private void showConfirmDialog(PersonShowBean bean, int i) { + private void showConfirmDialog(MeetingAttachListBean bean, int i) { new AlertDialog.Builder(mActivity) .setTitle("提示") .setMessage("确定要删除该参会人员吗?") @@ -260,17 +261,17 @@ public class MeetingApplyActivity extends BaseActivity { String[] ids = id.split(","); for (int i = 0; i < names.length; i++) { boolean isExist = false; - for (PersonShowBean person : mJoinPerson) { - if (TextUtils.isEmpty(person.getId())) continue; - if (person.getId().equals(ids[i])) { + for (MeetingAttachListBean person : mJoinPerson) { + if (TextUtils.isEmpty(person.getUserId())) continue; + if (person.getUserId().equals(ids[i])) { isExist = true; break; } } if (!isExist) { - PersonShowBean bean = new PersonShowBean(); - bean.setName(names[i]); - bean.setId(ids[i]); + MeetingAttachListBean bean = new MeetingAttachListBean(); + bean.setUserName(names[i]); + bean.setUserId(ids[i]); mJoinPerson.add(0, bean); } } @@ -509,10 +510,10 @@ public class MeetingApplyActivity extends BaseActivity { } StringBuilder ids = new StringBuilder(); StringBuilder names = new StringBuilder(); - for (PersonShowBean person : mJoinPerson) { - if (TextUtils.isEmpty(person.getId())) continue; - ids.append(person.getId()).append("_"); - names.append(person.getName()).append(","); + for (MeetingAttachListBean person : mJoinPerson) { + if (TextUtils.isEmpty(person.getUserId())) continue; + ids.append(person.getUserId()).append("_"); + names.append(person.getUserName()).append(","); } if (ids.toString().endsWith("_")) { String id = ids.substring(0, ids.toString().length() - 1); diff --git a/oamodule/src/main/java/com/tenlionsoft/oamodule/activity/meeting/MeetingDetailActivity.java b/oamodule/src/main/java/com/tenlionsoft/oamodule/activity/meeting/MeetingDetailActivity.java index ad67bda..3fa2b21 100644 --- a/oamodule/src/main/java/com/tenlionsoft/oamodule/activity/meeting/MeetingDetailActivity.java +++ b/oamodule/src/main/java/com/tenlionsoft/oamodule/activity/meeting/MeetingDetailActivity.java @@ -1,7 +1,9 @@ package com.tenlionsoft.oamodule.activity.meeting; +import android.app.ProgressDialog; import android.text.TextUtils; import android.view.View; +import android.widget.Button; import android.widget.CheckBox; import android.widget.TextView; @@ -14,11 +16,15 @@ import com.tenlionsoft.baselib.core.retrofit_net.RetrofitManager; import com.tenlionsoft.baselib.core.retrofit_net.conver.RxTransformer; import com.tenlionsoft.baselib.core.widget.base.BaseActivity; import com.tenlionsoft.baselib.core.widget.base.ShowFileAdapter; +import com.tenlionsoft.baselib.core.widget.views.QrDialog; import com.tenlionsoft.baselib.utils.ExceptionHandler; +import com.tenlionsoft.baselib.utils.UIUtil; import com.tenlionsoft.baselib.utils.UserLgUtils; import com.tenlionsoft.oamodule.R; import com.tenlionsoft.oamodule.R2; import com.tenlionsoft.oamodule.adapter.BasePersonShowAdapter; +import com.tenlionsoft.oamodule.beans.MeetingAttachListBean; +import com.tenlionsoft.oamodule.beans.MeetingQrBean; import com.tenlionsoft.oamodule.beans.MeetingRoomRecordBean; import com.tenlionsoft.oamodule.beans.PersonShowBean; import com.tenlionsoft.oamodule.net.OAApi; @@ -63,10 +69,13 @@ public class MeetingDetailActivity extends BaseActivity { RecyclerView mRlvFiles; @BindView(R2.id.tv_file_hint) TextView mTvFileHint; + @BindView(R2.id.btn_qr) + Button mBtnQr; private Unbinder mBind; private String mId; private List mJoinPerson; private BasePersonShowAdapter mPersonShowAdapter; + private String mQr; @Override protected int setLayoutId() { @@ -78,6 +87,12 @@ public class MeetingDetailActivity extends BaseActivity { mBind = ButterKnife.bind(this); mTvBaseTitle.setText("会议详情"); mId = getIntent().getStringExtra("id"); + String type = getIntent().getStringExtra("type"); + if ("mine".equals(type)) { + mBtnQr.setVisibility(View.VISIBLE); + } else { + mBtnQr.setVisibility(View.GONE); + } if (TextUtils.isEmpty(mId)) { ToastUtils.show("数据有误"); finish(); @@ -133,22 +148,13 @@ public class MeetingDetailActivity extends BaseActivity { if (b.getMeetingNoticeType().contains("1")) mCbNoticeMsg.setChecked(true); if (b.getMeetingNoticeType().contains("2")) mCbNoticeEmail.setChecked(true); } + //TODO 参会人员 if (!TextUtils.isEmpty(b.getMeetingUserIds())) { - mJoinPerson = new ArrayList<>(); - String[] ids = b.getMeetingUserIds().split("_"); - String[] names = b.getMeetingUserNames().split(","); - for (int i = 0; i < ids.length; i++) { - PersonShowBean bean = new PersonShowBean(); - bean.setId(ids[i]); - bean.setName(names[i]); - mJoinPerson.add(bean); - } - mPersonShowAdapter = new BasePersonShowAdapter(mActivity, mJoinPerson, 2); - mRlvJoin.setLayoutManager(new GridLayoutManager(mActivity, 4)); - mRlvJoin.setAdapter(mPersonShowAdapter); + //获取参会人员 + getMeetingAttachList(); } - //参会人员 mTvContent.setText(b.getMeetingContent()); + //文件 if (!TextUtils.isEmpty(b.getMeetingFile())) { mRlvFiles.setVisibility(View.VISIBLE); @@ -169,6 +175,91 @@ public class MeetingDetailActivity extends BaseActivity { mRlvFiles.setVisibility(View.GONE); mTvFileHint.setVisibility(View.VISIBLE); } + mBtnQr.setOnClickListener(v -> onShowQr()); + } + + private void onShowQr() { + if (TextUtils.isEmpty(mQr)) { + doGetQr(); + } else { + QrDialog dialog = new QrDialog.DialogBuilder(mActivity) + .setQr(mQr) + .build(); + dialog.show(); + } + } + + private void doGetQr() { + ProgressDialog dialog = UIUtil.initDialog(mActivity, "获取中..."); + dialog.show(); + RetrofitManager.getInstance() + .create(OAApi.class) + .getMeetingSignQr(mId, UserLgUtils.getToken()) + .compose(RxTransformer.getTransformer()) + .subscribe(new Observer() { + @Override + public void onSubscribe(@NonNull Disposable d) { + + } + + @Override + public void onNext(@NonNull MeetingQrBean meetingQrBean) { + if (dialog.isShowing()) dialog.dismiss(); + if (TextUtils.isEmpty(meetingQrBean.getQrId())) { + ToastUtils.show("未获取到签到码,请稍后重试"); + } else { + mQr = meetingQrBean.getQrId(); + onShowQr(); + } + } + + @Override + public void onError(@NonNull Throwable e) { + if (dialog.isShowing()) dialog.dismiss(); + ExceptionHandler.handleException(e); + } + + @Override + public void onComplete() { + + } + }); + } + + private void getMeetingAttachList() { + ProgressDialog dialog = UIUtil.initDialog(mActivity, "获取中..."); + dialog.show(); + RetrofitManager.getInstance() + .create(OAApi.class) + .getMeetingAttachList(mId, UserLgUtils.getToken()) + .compose(RxTransformer.getTransformer()) + .subscribe(new Observer>() { + @Override + public void onSubscribe(@NonNull Disposable d) { + + } + + @Override + public void onNext(@NonNull List meetingAttachListBeans) { + if (dialog.isShowing()) dialog.dismiss(); + mJoinPerson = new ArrayList<>(); + mPersonShowAdapter = new BasePersonShowAdapter(mActivity, meetingAttachListBeans, 2); + mRlvJoin.setLayoutManager(new GridLayoutManager(mActivity, 4)); + mRlvJoin.setAdapter(mPersonShowAdapter); + } + + @Override + public void onError(@NonNull Throwable e) { + if (dialog.isShowing()) dialog.dismiss(); + ExceptionHandler.handleException(e); + } + + @Override + public void onComplete() { + + } + }); + } @Override diff --git a/oamodule/src/main/java/com/tenlionsoft/oamodule/activity/meeting/MineMeetingListActivity.java b/oamodule/src/main/java/com/tenlionsoft/oamodule/activity/meeting/MineMeetingListActivity.java index 06f10d6..bd85617 100644 --- a/oamodule/src/main/java/com/tenlionsoft/oamodule/activity/meeting/MineMeetingListActivity.java +++ b/oamodule/src/main/java/com/tenlionsoft/oamodule/activity/meeting/MineMeetingListActivity.java @@ -89,6 +89,7 @@ public class MineMeetingListActivity extends BaseActivity { mAdapter.addOnItemClickListener(rowsBean -> ARouter.getInstance() .build(PathConfig.PATH_MODULE_OA_ACTIVITY_MEETING_DETAIL) .withString("id", rowsBean.getMeetingId()) + .withString("type", "mine") .navigation(mActivity, 12)); refreshStateView(LionActions.STATE_LOAD); doRefresh(); diff --git a/oamodule/src/main/java/com/tenlionsoft/oamodule/adapter/BasePersonShowAdapter.java b/oamodule/src/main/java/com/tenlionsoft/oamodule/adapter/BasePersonShowAdapter.java index f951c8c..3b1cccc 100644 --- a/oamodule/src/main/java/com/tenlionsoft/oamodule/adapter/BasePersonShowAdapter.java +++ b/oamodule/src/main/java/com/tenlionsoft/oamodule/adapter/BasePersonShowAdapter.java @@ -9,7 +9,7 @@ import android.view.ViewGroup; import com.bumptech.glide.Glide; import com.tenlionsoft.baselib.core.widget.base.BaseRecyclerAdapter; import com.tenlionsoft.oamodule.R; -import com.tenlionsoft.oamodule.beans.PersonShowBean; +import com.tenlionsoft.oamodule.beans.MeetingAttachListBean; import com.tenlionsoft.oamodule.holder.BasePersonShowHolder; import java.util.List; @@ -20,10 +20,10 @@ import java.util.List; * 邮箱: itgaojian@163.com * 描述: */ -public class BasePersonShowAdapter extends BaseRecyclerAdapter { +public class BasePersonShowAdapter extends BaseRecyclerAdapter { private int mType = 1; - public BasePersonShowAdapter(Context ctx, List list, int type) { + public BasePersonShowAdapter(Context ctx, List list, int type) { super(ctx, list); this.mType = type; } @@ -36,18 +36,26 @@ public class BasePersonShowAdapter extends BaseRecyclerAdapter getMeetingDetail(@Path("meetingId") String id, @Header("token") String token); - //========日常工作======== + /** + * 获取会议参会人员列表 + */ + @Headers({"base_url_name:oa", "Content-Type: application/json", "Accept: application/json"}) + @GET("app/meetinguser/list-bymeetingid/{meetingId}") + Observable> getMeetingAttachList(@Path("meetingId") String id, @Header("token") String token); + + /** + * 获取会议签到码 + */ + @Headers({"base_url_name:oa", "Content-Type: application/json", "Accept: application/json"}) + @GET("app/meeting/get-signqrcode/{meetingId}") + Observable getMeetingSignQr(@Path("meetingId") String id, @Header("token") String token); + + /*========日常工作========*/ /** * 提交日常工作 diff --git a/oamodule/src/main/res/layout/activity_meeting_detail.xml b/oamodule/src/main/res/layout/activity_meeting_detail.xml index bc59ea6..83c3e3e 100644 --- a/oamodule/src/main/res/layout/activity_meeting_detail.xml +++ b/oamodule/src/main/res/layout/activity_meeting_detail.xml @@ -332,7 +332,11 @@ - +