|
@@ -1,19 +1,21 @@
|
|
|
package com.sikey.skcontact.activity;
|
|
|
|
|
|
+import android.annotation.SuppressLint;
|
|
|
import android.os.Bundle;
|
|
|
import android.view.View;
|
|
|
import android.widget.LinearLayout;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
import com.sikey.skcontact.R;
|
|
|
+import com.sikey.skcontact.model.BaseModel;
|
|
|
+import com.sikey.skcontact.model.ContactBean;
|
|
|
+import com.sikey.skcontact.model.RecentBean;
|
|
|
import com.sikey.skcontact.utils.Constant;
|
|
|
|
|
|
-public class CallActivity extends BaseCallActivity {
|
|
|
- private String mName = "";
|
|
|
- private String mCode = "";
|
|
|
- private String mPhoneNumber = "";
|
|
|
- private String mCallNumber = "";
|
|
|
- private int isSupportVideo = 0;
|
|
|
+public class CallActivity extends BaseActionActivity {
|
|
|
+ private int mType = 0;
|
|
|
+ private ContactBean mContactModel = new ContactBean();
|
|
|
+ private RecentBean mRecentModel = new RecentBean();
|
|
|
|
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
@@ -24,32 +26,39 @@ public class CallActivity extends BaseCallActivity {
|
|
|
}
|
|
|
|
|
|
private void initData() {
|
|
|
- mName = getIntent().getStringExtra(Constant.INTENT_NAME);
|
|
|
- mCode = getIntent().getStringExtra(Constant.INTENT_CODE);
|
|
|
- mPhoneNumber = getIntent().getStringExtra(Constant.INTENT_PHONENUMBER);
|
|
|
- mCallNumber = getIntent().getStringExtra(Constant.INTENT_CALLNUMBER);
|
|
|
- isSupportVideo = getIntent().getIntExtra(Constant.INTENT_VIDEO, 0);
|
|
|
+ mType = getIntent().getIntExtra(Constant.INTENT_VIEW_TYPE, 0);
|
|
|
+ BaseModel model = (BaseModel) getIntent().getSerializableExtra(Constant.INTENT_VIEW_VALUE);
|
|
|
+ if (mType == 0) {
|
|
|
+ mContactModel = (ContactBean)model;
|
|
|
+ } else {
|
|
|
+ mRecentModel = (RecentBean) model;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+ @SuppressLint("SetTextI18n")
|
|
|
private void initView() {
|
|
|
TextView nameTv = findViewById(R.id.nameTv);
|
|
|
TextView hintTv = findViewById(R.id.hintTv);
|
|
|
LinearLayout videoLayout = findViewById(R.id.videoLayout);
|
|
|
LinearLayout callLayout = findViewById(R.id.callLayout);
|
|
|
|
|
|
- nameTv.setText(mName);
|
|
|
- if (mCallNumber.length() > 0) {
|
|
|
- hintTv.setText(mCallNumber);
|
|
|
+ if (mType == 0) {
|
|
|
+ nameTv.setText(mContactModel.name);
|
|
|
+ hintTv.setText(mContactModel.countryPN +" " + mContactModel.phoneNumber);
|
|
|
+ videoLayout.setVisibility(mContactModel.isVideo > 0 ? View.VISIBLE : View.GONE);
|
|
|
} else {
|
|
|
- hintTv.setText(mCode +" " + mPhoneNumber);
|
|
|
+ hintTv.setText(mRecentModel.caller);
|
|
|
}
|
|
|
|
|
|
- videoLayout.setVisibility(isSupportVideo > 0 ? View.VISIBLE : View.GONE);
|
|
|
videoLayout.setOnClickListener(v -> {
|
|
|
-
|
|
|
+ onVideo("");
|
|
|
});
|
|
|
callLayout.setOnClickListener(v -> {
|
|
|
- callAction(mCode, mPhoneNumber, mCallNumber);
|
|
|
+ if (mType == 0) {
|
|
|
+ callAction(mContactModel.countryPN, mContactModel.phoneNumber, "");
|
|
|
+ } else {
|
|
|
+ callAction("", "", mRecentModel.caller);
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
}
|