|
@@ -51,6 +51,7 @@ public class MainActivity extends Activity implements Listener.VideoListener {
|
|
|
private JCMediaDeviceVideoCanvas mRemoteCanvas = null;
|
|
|
|
|
|
private RelativeLayout mVideoLayout = null;
|
|
|
+ private RelativeLayout mLoadingLayout = null;
|
|
|
private RelativeLayout mInfoLayout = null;
|
|
|
private ImageView mIconView = null;
|
|
|
private TextView mNameText = null;
|
|
@@ -62,6 +63,9 @@ public class MainActivity extends Activity implements Listener.VideoListener {
|
|
|
private Timer mTalkingTimer = null;
|
|
|
private int mTimeCount = 0;
|
|
|
|
|
|
+ private int mHideCountMax = 5;
|
|
|
+ private int mHideCount = mHideCountMax;
|
|
|
+
|
|
|
//0:呼入 1:呼出
|
|
|
private int mVideoType = 0;
|
|
|
private String mVideoId = "";
|
|
@@ -82,12 +86,19 @@ public class MainActivity extends Activity implements Listener.VideoListener {
|
|
|
private void initView() {
|
|
|
Log.d(TAG, "initView: ");
|
|
|
mVideoLayout = findViewById(R.id.layout_video);
|
|
|
+ mLoadingLayout = findViewById(R.id.layout_loading);
|
|
|
mInfoLayout = findViewById(R.id.layout_info);
|
|
|
mIconView = findViewById(R.id.iconIv);
|
|
|
mNameText = findViewById(R.id.nameTv);
|
|
|
mHintText = findViewById(R.id.hintTv);
|
|
|
mCancelBtn = findViewById(R.id.cancelBtn);
|
|
|
mAnswerBtn = findViewById(R.id.answerBtn);
|
|
|
+ mVideoLayout.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ refreshInfoLayout(0);
|
|
|
+ }
|
|
|
+ });
|
|
|
mCancelBtn.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
@@ -136,6 +147,9 @@ public class MainActivity extends Activity implements Listener.VideoListener {
|
|
|
|
|
|
@Override
|
|
|
public void onCallItemAdd(JCCallItem item) {
|
|
|
+ mLoadingLayout.setVisibility(View.GONE);
|
|
|
+ mInfoLayout.setVisibility(View.VISIBLE);
|
|
|
+
|
|
|
// 2. 做出相应的处理,如在界面上显示“振铃中”
|
|
|
if (mMediaPlayerUtils != null) {
|
|
|
mMediaPlayerUtils.playSound(this, R.raw.video_call, true);
|
|
@@ -323,6 +337,19 @@ public class MainActivity extends Activity implements Listener.VideoListener {
|
|
|
String text = hours > 0 ? String.format("%02d:%02d:%02d", hours, minutes, second) : String.format("%02d:%02d", minutes, second);
|
|
|
Log.d(TAG, "onTalkingTiemrCallback: text:" + text);
|
|
|
mHintText.setText(text);
|
|
|
+ refreshInfoLayout(1);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void refreshInfoLayout(int type) {
|
|
|
+ //0:用户点击 1:倒计时刷新
|
|
|
+ if (type == 0) {
|
|
|
+ boolean isV = mInfoLayout.getVisibility() == View.VISIBLE;
|
|
|
+ mHideCount = isV ? 0 : mHideCountMax;
|
|
|
+ mInfoLayout.setVisibility(isV ? View.INVISIBLE : View.VISIBLE);
|
|
|
+ } else {
|
|
|
+ mHideCount = Math.max(0, mHideCount-=1);
|
|
|
+ mInfoLayout.setVisibility(mHideCount <= 0 ? View.INVISIBLE : View.VISIBLE);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void showToast(String content) {
|