|
@@ -10,7 +10,6 @@ import android.content.ComponentName;
|
|
|
import android.content.Context;
|
|
import android.content.Context;
|
|
|
import android.content.Intent;
|
|
import android.content.Intent;
|
|
|
import android.content.ServiceConnection;
|
|
import android.content.ServiceConnection;
|
|
|
-import android.content.SharedPreferences;
|
|
|
|
|
import android.os.Bundle;
|
|
import android.os.Bundle;
|
|
|
import android.os.Handler;
|
|
import android.os.Handler;
|
|
|
import android.os.IBinder;
|
|
import android.os.IBinder;
|
|
@@ -21,6 +20,10 @@ import android.util.TypedValue;
|
|
|
import android.view.MotionEvent;
|
|
import android.view.MotionEvent;
|
|
|
import android.view.View;
|
|
import android.view.View;
|
|
|
import android.view.ViewGroup;
|
|
import android.view.ViewGroup;
|
|
|
|
|
+import android.view.WindowManager;
|
|
|
|
|
+import android.view.animation.Animation;
|
|
|
|
|
+import android.view.animation.LinearInterpolator;
|
|
|
|
|
+import android.view.animation.RotateAnimation;
|
|
|
import android.widget.ImageView;
|
|
import android.widget.ImageView;
|
|
|
import android.widget.RelativeLayout;
|
|
import android.widget.RelativeLayout;
|
|
|
import android.widget.TextView;
|
|
import android.widget.TextView;
|
|
@@ -35,11 +38,9 @@ import org.greenrobot.eventbus.Subscribe;
|
|
|
import org.greenrobot.eventbus.ThreadMode;
|
|
import org.greenrobot.eventbus.ThreadMode;
|
|
|
|
|
|
|
|
import java.text.ParseException;
|
|
import java.text.ParseException;
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
-import java.util.Locale;
|
|
|
|
|
import java.util.Timer;
|
|
import java.util.Timer;
|
|
|
import java.util.TimerTask;
|
|
import java.util.TimerTask;
|
|
|
|
|
|
|
@@ -89,11 +90,15 @@ public class WelcomeActivity extends AppCompatActivity {
|
|
|
RelativeLayout rlJobYear;
|
|
RelativeLayout rlJobYear;
|
|
|
@BindView(R.id.tv_job_year)
|
|
@BindView(R.id.tv_job_year)
|
|
|
TextView tvJobYear;
|
|
TextView tvJobYear;
|
|
|
|
|
+ @BindView(R.id.iv_arrow)
|
|
|
|
|
+ ImageView ivArrow;
|
|
|
|
|
|
|
|
private MeetingAdapter adapter;
|
|
private MeetingAdapter adapter;
|
|
|
private DoorService.DoorBinder mDoorBinder;
|
|
private DoorService.DoorBinder mDoorBinder;
|
|
|
private Meeting meeting;
|
|
private Meeting meeting;
|
|
|
private EmpInfo empInfo;
|
|
private EmpInfo empInfo;
|
|
|
|
|
+ private Timer finishTimer;
|
|
|
|
|
+ private MyLinearLayoutManager layoutManager;
|
|
|
|
|
|
|
|
private ServiceConnection connection = new ServiceConnection() {
|
|
private ServiceConnection connection = new ServiceConnection() {
|
|
|
@Override
|
|
@Override
|
|
@@ -161,7 +166,9 @@ public class WelcomeActivity extends AppCompatActivity {
|
|
|
|
|
|
|
|
bindService(new Intent(this, DoorService.class), connection, BIND_AUTO_CREATE);
|
|
bindService(new Intent(this, DoorService.class), connection, BIND_AUTO_CREATE);
|
|
|
adapter = new MeetingAdapter(this);
|
|
adapter = new MeetingAdapter(this);
|
|
|
- rvMeetings.setLayoutManager(new LinearLayoutManager(this));
|
|
|
|
|
|
|
+ layoutManager = new MyLinearLayoutManager(this);
|
|
|
|
|
+ layoutManager.setCanScroll(false);
|
|
|
|
|
+ rvMeetings.setLayoutManager(layoutManager);
|
|
|
rvMeetings.setAdapter(adapter);
|
|
rvMeetings.setAdapter(adapter);
|
|
|
|
|
|
|
|
if (empInfo.getHalfBodyPhoto() != null) {
|
|
if (empInfo.getHalfBodyPhoto() != null) {
|
|
@@ -177,9 +184,12 @@ public class WelcomeActivity extends AppCompatActivity {
|
|
|
} else if (meeting.getWelcomeText().length() <= 8) {
|
|
} else if (meeting.getWelcomeText().length() <= 8) {
|
|
|
tvWelcome.setText("欢迎\n" + meeting.getWelcomeText());
|
|
tvWelcome.setText("欢迎\n" + meeting.getWelcomeText());
|
|
|
tvWelcome.setTextSize(TypedValue.COMPLEX_UNIT_SP, 55);
|
|
tvWelcome.setTextSize(TypedValue.COMPLEX_UNIT_SP, 55);
|
|
|
- } else {
|
|
|
|
|
|
|
+ } else if (meeting.getWelcomeText().length() <= 10) {
|
|
|
tvWelcome.setText("欢迎\n" + meeting.getWelcomeText());
|
|
tvWelcome.setText("欢迎\n" + meeting.getWelcomeText());
|
|
|
tvWelcome.setTextSize(TypedValue.COMPLEX_UNIT_SP, 44);
|
|
tvWelcome.setTextSize(TypedValue.COMPLEX_UNIT_SP, 44);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ tvWelcome.setText("欢迎\n" + meeting.getWelcomeText());
|
|
|
|
|
+ tvWelcome.setTextSize(TypedValue.COMPLEX_UNIT_SP, 33);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
tvAdviserName.setText(empInfo.getUserName());
|
|
tvAdviserName.setText(empInfo.getUserName());
|
|
@@ -199,19 +209,33 @@ public class WelcomeActivity extends AppCompatActivity {
|
|
|
rlJobYear.setVisibility(View.GONE);
|
|
rlJobYear.setVisibility(View.GONE);
|
|
|
} else {
|
|
} else {
|
|
|
tvCertNo.setText("执业证书编号:" + empInfo.getCertifications().get(0).getCertificateNumber());
|
|
tvCertNo.setText("执业证书编号:" + empInfo.getCertifications().get(0).getCertificateNumber());
|
|
|
- int year = (int) ((System.currentTimeMillis() - empInfo.getCertifications().get(0).getCertificateAcquisitionTime()) / 1000 / 60 / 60 / 24 / 365);
|
|
|
|
|
|
|
+ int year;
|
|
|
|
|
+ if (empInfo.getCertifications().get(0).getCertificateAcquisitionTime() == 0) {
|
|
|
|
|
+ year = 0;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ year = (int) ((System.currentTimeMillis() - empInfo.getCertifications().get(0).getCertificateAcquisitionTime()) / 1000 / 60 / 60 / 24 / 365);
|
|
|
|
|
+ }
|
|
|
if (year < 3) {
|
|
if (year < 3) {
|
|
|
rlJobYear.setVisibility(View.GONE);
|
|
rlJobYear.setVisibility(View.GONE);
|
|
|
} else {
|
|
} else {
|
|
|
tvJobYear.setText(year + "年");
|
|
tvJobYear.setText(year + "年");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ scheduleFinish();
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ private void scheduleFinish() {
|
|
|
try {
|
|
try {
|
|
|
Date endTime = Utils.parseDateTime(meeting.getEndTimeStr());
|
|
Date endTime = Utils.parseDateTime(meeting.getEndTimeStr());
|
|
|
endTime.setTime(endTime.getTime() + 60 * 1000);
|
|
endTime.setTime(endTime.getTime() + 60 * 1000);
|
|
|
- Timer timer = new Timer();
|
|
|
|
|
- timer.schedule(new TimerTask() {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if (finishTimer != null) {
|
|
|
|
|
+ finishTimer.cancel();
|
|
|
|
|
+ finishTimer = null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ finishTimer = new Timer();
|
|
|
|
|
+ finishTimer.schedule(new TimerTask() {
|
|
|
@Override
|
|
@Override
|
|
|
public void run() {
|
|
public void run() {
|
|
|
finish();
|
|
finish();
|
|
@@ -234,6 +258,15 @@ public class WelcomeActivity extends AppCompatActivity {
|
|
|
int dp108 = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 108, getResources().getDisplayMetrics());
|
|
int dp108 = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 108, getResources().getDisplayMetrics());
|
|
|
layoutParams.height = layoutParams.height < dp108 ? dp108 : dp36;
|
|
layoutParams.height = layoutParams.height < dp108 ? dp108 : dp36;
|
|
|
rlMeetings.setLayoutParams(layoutParams);
|
|
rlMeetings.setLayoutParams(layoutParams);
|
|
|
|
|
+
|
|
|
|
|
+ layoutManager.setCanScroll(!(layoutParams.height < dp108));
|
|
|
|
|
+
|
|
|
|
|
+ Animation animation = new RotateAnimation(layoutParams.height < dp108 ? 180 : 0, layoutParams.height < dp108 ? 0 : 180, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
|
|
|
|
|
+ animation.setFillAfter(true);
|
|
|
|
|
+ animation.setDuration(200);
|
|
|
|
|
+ animation.setInterpolator(new LinearInterpolator());
|
|
|
|
|
+ animation.setRepeatCount(0);
|
|
|
|
|
+ ivArrow.startAnimation(animation);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
@@ -248,6 +281,11 @@ public class WelcomeActivity extends AppCompatActivity {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void updateMeetings() {
|
|
private void updateMeetings() {
|
|
|
|
|
+ if (adapter.getItemCount() <= 1) {
|
|
|
|
|
+ ivArrow.setVisibility(View.GONE);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ivArrow.setVisibility(View.VISIBLE);
|
|
|
|
|
+ }
|
|
|
if (MyApplication.todayMeetings.isEmpty()) {
|
|
if (MyApplication.todayMeetings.isEmpty()) {
|
|
|
rlMeetings.setVisibility(View.GONE);
|
|
rlMeetings.setVisibility(View.GONE);
|
|
|
} else {
|
|
} else {
|
|
@@ -285,6 +323,8 @@ public class WelcomeActivity extends AppCompatActivity {
|
|
|
decorView.setSystemUiVisibility(uiOptions);
|
|
decorView.setSystemUiVisibility(uiOptions);
|
|
|
tvRoomName.setText(MyApplication.roomInfo.getRoomName());
|
|
tvRoomName.setText(MyApplication.roomInfo.getRoomName());
|
|
|
tvRoomNum.setText(MyApplication.roomInfo.getRoomBizNum());
|
|
tvRoomNum.setText(MyApplication.roomInfo.getRoomBizNum());
|
|
|
|
|
+ updateMeetings();
|
|
|
|
|
+ scheduleFinish();
|
|
|
updateStatus();
|
|
updateStatus();
|
|
|
}
|
|
}
|
|
|
|
|
|