|
|
@@ -1,6 +1,7 @@
|
|
|
package com.ht.gate;
|
|
|
|
|
|
import androidx.appcompat.app.AppCompatActivity;
|
|
|
+import androidx.constraintlayout.widget.ConstraintLayout;
|
|
|
import androidx.core.content.ContextCompat;
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
|
@@ -26,6 +27,7 @@ import android.view.animation.Animation;
|
|
|
import android.view.animation.LinearInterpolator;
|
|
|
import android.view.animation.RotateAnimation;
|
|
|
import android.widget.ImageView;
|
|
|
+import android.widget.LinearLayout;
|
|
|
import android.widget.RelativeLayout;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
@@ -42,6 +44,7 @@ import java.text.ParseException;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.Optional;
|
|
|
import java.util.Timer;
|
|
|
import java.util.TimerTask;
|
|
|
|
|
|
@@ -93,6 +96,10 @@ public class WelcomeActivity extends AppCompatActivity {
|
|
|
TextView tvJobYear;
|
|
|
@BindView(R.id.iv_arrow)
|
|
|
ImageView ivArrow;
|
|
|
+ @BindView(R.id.tv_net_err)
|
|
|
+ TextView tvNetErr;
|
|
|
+ @BindView(R.id.ll_info)
|
|
|
+ LinearLayout llInfo;
|
|
|
|
|
|
private MeetingAdapter adapter;
|
|
|
private DoorService.DoorBinder mDoorBinder;
|
|
|
@@ -151,12 +158,11 @@ public class WelcomeActivity extends AppCompatActivity {
|
|
|
if (mDoorBinder != null) {
|
|
|
mDoorBinder.getService().openDoor();
|
|
|
}
|
|
|
- SoundUtil.getInstance(WelcomeActivity.this).play(SoundUtil.UNLOCK_SUCCESS);
|
|
|
- Toasty.normal(WelcomeActivity.this, "已解锁").show();
|
|
|
+// SoundUtil.getInstance(WelcomeActivity.this).play(SoundUtil.UNLOCK_SUCCESS);
|
|
|
+// Toasty.normal(WelcomeActivity.this, "已解锁").show();
|
|
|
} else {
|
|
|
SoundUtil.getInstance(WelcomeActivity.this).play(SoundUtil.UNLOCK_FAIL);
|
|
|
- Toasty.normal(WelcomeActivity.this, "密码错误", ContextCompat.getDrawable(WelcomeActivity.this, R.mipmap.toast_icon_warn_fill))
|
|
|
- .show();
|
|
|
+ Toasty.error(WelcomeActivity.this, "密码错误").show();
|
|
|
}
|
|
|
Message msg = new Message();
|
|
|
msg.what = HIDE_BAR;
|
|
|
@@ -177,6 +183,7 @@ public class WelcomeActivity extends AppCompatActivity {
|
|
|
if (empInfo.getHalfBodyPhoto() != null) {
|
|
|
Picasso.get().load(empInfo.getHalfBodyPhoto()).placeholder(R.mipmap.portrait).into(ivPortrait);
|
|
|
}
|
|
|
+
|
|
|
if (TextUtils.isEmpty(meeting.getWelcomeText())) {
|
|
|
tvWelcome.setText("欢迎");
|
|
|
tvWelcome.setTextSize(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 63, getResources().getDisplayMetrics()));
|
|
|
@@ -195,6 +202,13 @@ public class WelcomeActivity extends AppCompatActivity {
|
|
|
tvWelcome.setTextSize(TypedValue.COMPLEX_UNIT_SP, 33);
|
|
|
}
|
|
|
}
|
|
|
+ if (Optional.ofNullable(meeting.getWelcomeText()).orElse("").length() > 4) {
|
|
|
+ ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) llInfo.getLayoutParams();
|
|
|
+ params.setMargins((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 44, getResources().getDisplayMetrics()),
|
|
|
+ (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 47, getResources().getDisplayMetrics()),
|
|
|
+ 0, 0);
|
|
|
+ llInfo.setLayoutParams(params);
|
|
|
+ }
|
|
|
tvAdviserName.setText(empInfo.getUserName());
|
|
|
if (empInfo.getDescription() == null) {
|
|
|
tvIntro.setText("20年从业经验,经历多次牛熊转换磨练,对市场具有一定的敏感度,注重价值投资,资产配置,秉承专业的投资理念服务客户");
|
|
|
@@ -216,18 +230,26 @@ public class WelcomeActivity extends AppCompatActivity {
|
|
|
rlJobYear.setVisibility(View.GONE);
|
|
|
} else {
|
|
|
tvCertNo.setText("执业证书编号:" + empInfo.getCertifications().get(0).getCertificateNumber());
|
|
|
- int year;
|
|
|
- if (empInfo.getCertifications().get(0).getCertificateAcquisitionTime() == 0) {
|
|
|
+ }
|
|
|
+
|
|
|
+ int year = 0;
|
|
|
+ try {
|
|
|
+ if (TextUtils.isEmpty(empInfo.getEntryTime())) {
|
|
|
year = 0;
|
|
|
} else {
|
|
|
- year = (int) ((System.currentTimeMillis() - empInfo.getCertifications().get(0).getCertificateAcquisitionTime()) / 1000 / 60 / 60 / 24 / 365);
|
|
|
- }
|
|
|
- if (year < 3) {
|
|
|
- rlJobYear.setVisibility(View.GONE);
|
|
|
- } else {
|
|
|
- tvJobYear.setText(year + "年");
|
|
|
+ year = (int) ((System.currentTimeMillis() - Long.parseLong(empInfo.getEntryTime())) / 1000 / 60 / 60 / 24 / 365);
|
|
|
}
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+
|
|
|
}
|
|
|
+ if (year < 3) {
|
|
|
+ rlJobYear.setVisibility(View.GONE);
|
|
|
+ } else {
|
|
|
+ tvJobYear.setText(year + "年");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
scheduleFinish();
|
|
|
}
|
|
|
|
|
|
@@ -290,12 +312,15 @@ public class WelcomeActivity extends AppCompatActivity {
|
|
|
|
|
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
|
public void onMessageEvent(String msg) {
|
|
|
- updateStatus();
|
|
|
if ("closed".equals(msg)) {
|
|
|
- finish();
|
|
|
- }
|
|
|
- if (Constants.EVENT_MEETINGS.equals(msg)) {
|
|
|
+// finish();
|
|
|
+ updateStatus();
|
|
|
+ } else if (Constants.EVENT_MEETINGS.equals(msg)) {
|
|
|
updateMeetings();
|
|
|
+ } else if (Constants.EVENT_NET_STATUS.equals(msg)) {
|
|
|
+ tvNetErr.setVisibility(MyApplication.netAvailable ? View.GONE : View.VISIBLE);
|
|
|
+ } else {
|
|
|
+ updateStatus();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -321,6 +346,9 @@ public class WelcomeActivity extends AppCompatActivity {
|
|
|
if (mDoorBinder != null) {
|
|
|
String status = mDoorBinder.getService().getStatus();
|
|
|
if ("opened".equals(status)) {
|
|
|
+ if (!unlockView.isUnlocked()) {
|
|
|
+ SoundUtil.getInstance(WelcomeActivity.this).play(SoundUtil.UNLOCK_SUCCESS);
|
|
|
+ }
|
|
|
unlockView.setUnlocked(true);
|
|
|
} else if ("closed".equals(status)) {
|
|
|
unlockView.setUnlocked(false);
|