version:1.2.1
fix: update:优化双卡拨号
This commit is contained in:
@@ -15,8 +15,8 @@ android {
|
|||||||
applicationId "com.xxpatx.os"
|
applicationId "com.xxpatx.os"
|
||||||
minSdkVersion 24
|
minSdkVersion 24
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
versionCode 1021
|
versionCode 1022
|
||||||
versionName "1.2.0"
|
versionName "1.2.1"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
@@ -118,7 +118,7 @@ android {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// implementation fileTree(dir: 'libs', include: ['*.jar'])
|
// implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
// compileOnly files('libs/framework.jar')
|
compileOnly files('libs/framework.jar')
|
||||||
implementation files('libs/QWeather_Public_Android_V4.9.jar')
|
implementation files('libs/QWeather_Public_Android_V4.9.jar')
|
||||||
implementation project(path: ':niceimageview')
|
implementation project(path: ':niceimageview')
|
||||||
implementation project(path: ':verification-view')
|
implementation project(path: ':verification-view')
|
||||||
|
|||||||
BIN
app/libs/framework.jar
Normal file
BIN
app/libs/framework.jar
Normal file
Binary file not shown.
@@ -220,6 +220,7 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".activity.selectnumber.SelectNumberActivity"
|
android:name=".activity.selectnumber.SelectNumberActivity"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
|
android:theme="@style/activity_styles"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.screenlock.ScreenLockActivity"
|
android:name=".activity.screenlock.ScreenLockActivity"
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ import com.jeremyliao.liveeventbus.LiveEventBus;
|
|||||||
import com.tencent.mmkv.MMKV;
|
import com.tencent.mmkv.MMKV;
|
||||||
import com.xxpatx.os.BuildConfig;
|
import com.xxpatx.os.BuildConfig;
|
||||||
import com.xxpatx.os.R;
|
import com.xxpatx.os.R;
|
||||||
import com.xxpatx.os.activity.activation.ActivationActivity;
|
|
||||||
import com.xxpatx.os.activity.dock.DockActivity;
|
import com.xxpatx.os.activity.dock.DockActivity;
|
||||||
import com.xxpatx.os.activity.phone.PhoneActivity;
|
import com.xxpatx.os.activity.phone.PhoneActivity;
|
||||||
import com.xxpatx.os.activity.update.UpdateActivity;
|
import com.xxpatx.os.activity.update.UpdateActivity;
|
||||||
@@ -306,21 +305,21 @@ public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBi
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
// mViewModel.getAppList();
|
// mViewModel.getAppList();
|
||||||
mViewModel.getActivationData().observe(this, new Observer<Integer>() {
|
// mViewModel.getActivationData().observe(this, new Observer<Integer>() {
|
||||||
@Override
|
// @Override
|
||||||
public void onChanged(Integer integer) {
|
// public void onChanged(Integer integer) {
|
||||||
if (integer == 0) {
|
// if (integer == 0) {
|
||||||
if (WiFiUtils.getInstance().isNetworkConnected()) {
|
// if (WiFiUtils.getInstance().isNetworkConnected()) {
|
||||||
Toaster.showLong("请先激活设备");
|
// Toaster.showLong("请先激活设备");
|
||||||
startActivity(new Intent(MainActivity.this, ActivationActivity.class));
|
// startActivity(new Intent(MainActivity.this, ActivationActivity.class));
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
Log.e("getActivationData", "onChanged: 已激活");
|
// Log.e("getActivationData", "onChanged: 已激活");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
|
//
|
||||||
mViewModel.getSnIsActivation();
|
// mViewModel.getSnIsActivation();
|
||||||
|
|
||||||
mViewModel.getAppInfoData().observe(this, new Observer<AppInfo>() {
|
mViewModel.getAppInfoData().observe(this, new Observer<AppInfo>() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,17 +1,24 @@
|
|||||||
package com.xxpatx.os.activity.selectnumber;
|
package com.xxpatx.os.activity.selectnumber;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.telecom.PhoneAccountHandle;
|
import android.telecom.PhoneAccountHandle;
|
||||||
import android.telecom.TelecomManager;
|
import android.telecom.TelecomManager;
|
||||||
import android.telephony.SubscriptionInfo;
|
import android.telephony.SubscriptionInfo;
|
||||||
import android.telephony.SubscriptionManager;
|
import android.telephony.SubscriptionManager;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.xxpatx.os.R;
|
import com.xxpatx.os.R;
|
||||||
|
import com.xxpatx.os.adapter.PhoneAdapter;
|
||||||
import com.xxpatx.os.base.mvvm.BaseMvvmActivity;
|
import com.xxpatx.os.base.mvvm.BaseMvvmActivity;
|
||||||
import com.xxpatx.os.databinding.ActivitySelectNumberBinding;
|
import com.xxpatx.os.databinding.ActivitySelectNumberBinding;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -22,6 +29,7 @@ public class SelectNumberActivity extends BaseMvvmActivity<SelectNumberViewModel
|
|||||||
private TelephonyManager mTelephonyManager;
|
private TelephonyManager mTelephonyManager;
|
||||||
private SubscriptionManager subscriptionManager;
|
private SubscriptionManager subscriptionManager;
|
||||||
private TelecomManager telecomManager;
|
private TelecomManager telecomManager;
|
||||||
|
private PhoneAdapter mPhoneAdapter;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLayoutId() {
|
public int getLayoutId() {
|
||||||
@@ -38,19 +46,50 @@ public class SelectNumberActivity extends BaseMvvmActivity<SelectNumberViewModel
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initView() {
|
public void initView() {
|
||||||
|
Intent intent =getIntent();
|
||||||
|
if (intent==null){
|
||||||
|
finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String phone = intent.getStringExtra("phone_number");
|
||||||
|
if (TextUtils.isEmpty(phone)){
|
||||||
|
finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mPhoneAdapter = new PhoneAdapter();
|
||||||
|
|
||||||
|
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(SelectNumberActivity.this);
|
||||||
|
linearLayoutManager.setOrientation(RecyclerView.VERTICAL);
|
||||||
|
mViewDataBinding.recyclerView.setLayoutManager(linearLayoutManager);
|
||||||
|
mViewDataBinding.recyclerView.setAdapter(mPhoneAdapter);
|
||||||
|
|
||||||
|
mPhoneAdapter.setPhone(phone);
|
||||||
|
mPhoneAdapter.setOutCallback(new PhoneAdapter.OutCallback() {
|
||||||
|
@Override
|
||||||
|
public void onCall() {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
mTelephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
|
mTelephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
|
||||||
subscriptionManager = (SubscriptionManager) getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE);
|
subscriptionManager = (SubscriptionManager) getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE);
|
||||||
telecomManager = (TelecomManager) getSystemService(Context.TELECOM_SERVICE);
|
telecomManager = (TelecomManager) getSystemService(Context.TELECOM_SERVICE);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initData() {
|
public void initData() {
|
||||||
List<SubscriptionInfo> subscriptionInfos = subscriptionManager.getActiveSubscriptionInfoList();
|
List<SubscriptionInfo> subscriptionInfos = subscriptionManager.getActiveSubscriptionInfoList();
|
||||||
|
List<String> stringList =new ArrayList<>();
|
||||||
for (SubscriptionInfo subscriptionInfo : subscriptionInfos) {
|
for (SubscriptionInfo subscriptionInfo : subscriptionInfos) {
|
||||||
Log.e(TAG, "initData: id = " + subscriptionInfo.getSubscriptionId());
|
Log.e(TAG, "initData: id = " + subscriptionInfo.getSubscriptionId());
|
||||||
// Log.e(TAG, "initData: mCardString = " + subscriptionInfo.getCardString());
|
Log.e(TAG, "initData: mCardString = " + subscriptionInfo.getCardString());
|
||||||
// Log.e(TAG, "initData: phone = " + mTelephonyManager.getLine1Number(subscriptionInfo.getSubscriptionId()));
|
Log.e(TAG, "initData: phone = " + mTelephonyManager.getLine1Number(subscriptionInfo.getSubscriptionId()));
|
||||||
|
stringList.add(mTelephonyManager.getLine1Number(subscriptionInfo.getSubscriptionId()));
|
||||||
}
|
}
|
||||||
|
mPhoneAdapter.setPhoneList(stringList);
|
||||||
List<PhoneAccountHandle> phoneAccountHandleList = telecomManager.getCallCapablePhoneAccounts();
|
List<PhoneAccountHandle> phoneAccountHandleList = telecomManager.getCallCapablePhoneAccounts();
|
||||||
Map<String, PhoneAccountHandle> phoneAccountHandleMap = new HashMap<>();
|
Map<String, PhoneAccountHandle> phoneAccountHandleMap = new HashMap<>();
|
||||||
for (PhoneAccountHandle phoneAccountHandle : phoneAccountHandleList) {
|
for (PhoneAccountHandle phoneAccountHandle : phoneAccountHandleList) {
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ public class SettingActivity extends BaseMvvmActivity<SettingViewModel, Activity
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setStatus() {
|
private void setStatus() {
|
||||||
boolean showFloatWindow = mMMKV.decodeBool(CommonConfig.FLOAT_WINDOW, true);
|
boolean showFloatWindow = mMMKV.decodeBool(CommonConfig.FLOAT_WINDOW, CommonConfig.FLOAT_WINDOW_STATU);
|
||||||
Log.e(TAG, "initView: showFloatWindow = " + showFloatWindow);
|
Log.e(TAG, "initView: showFloatWindow = " + showFloatWindow);
|
||||||
mViewDataBinding.setFloatWindowEnable(showFloatWindow);
|
mViewDataBinding.setFloatWindowEnable(showFloatWindow);
|
||||||
|
|
||||||
@@ -206,7 +206,7 @@ public class SettingActivity extends BaseMvvmActivity<SettingViewModel, Activity
|
|||||||
|
|
||||||
public class BtnClick {
|
public class BtnClick {
|
||||||
public void openFloat(View view) {
|
public void openFloat(View view) {
|
||||||
boolean floatWindowEnable = mMMKV.decodeBool(CommonConfig.FLOAT_WINDOW, true);
|
boolean floatWindowEnable = mMMKV.decodeBool(CommonConfig.FLOAT_WINDOW, CommonConfig.FLOAT_WINDOW_STATU);
|
||||||
if (floatWindowEnable) {
|
if (floatWindowEnable) {
|
||||||
hideFloatingWindow();
|
hideFloatingWindow();
|
||||||
} else {
|
} else {
|
||||||
@@ -267,7 +267,7 @@ public class SettingActivity extends BaseMvvmActivity<SettingViewModel, Activity
|
|||||||
intent.putExtra("auto_answer", !autoAccept);
|
intent.putExtra("auto_answer", !autoAccept);
|
||||||
sendBroadcast(intent);
|
sendBroadcast(intent);
|
||||||
} else {
|
} else {
|
||||||
boolean floatWindowEnable = mMMKV.decodeBool(CommonConfig.FLOAT_WINDOW, true);
|
boolean floatWindowEnable = mMMKV.decodeBool(CommonConfig.FLOAT_WINDOW, CommonConfig.FLOAT_WINDOW_STATU);
|
||||||
if (floatWindowEnable) {
|
if (floatWindowEnable) {
|
||||||
Toaster.showLong("因为系统限制,请先关闭悬浮窗功能,开启自动接听后再打开悬浮窗");
|
Toaster.showLong("因为系统限制,请先关闭悬浮窗功能,开启自动接听后再打开悬浮窗");
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -17,9 +17,11 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||||||
|
|
||||||
import com.shehuan.niv.NiceImageView;
|
import com.shehuan.niv.NiceImageView;
|
||||||
import com.xxpatx.os.R;
|
import com.xxpatx.os.R;
|
||||||
|
import com.xxpatx.os.activity.selectnumber.SelectNumberActivity;
|
||||||
import com.xxpatx.os.bean.Contact;
|
import com.xxpatx.os.bean.Contact;
|
||||||
import com.xxpatx.os.bean.RecordsInfo;
|
import com.xxpatx.os.bean.RecordsInfo;
|
||||||
import com.xxpatx.os.utils.GlideLoadUtils;
|
import com.xxpatx.os.utils.GlideLoadUtils;
|
||||||
|
import com.xxpatx.os.utils.Utils;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@@ -85,10 +87,21 @@ public class CallRecordAdapter extends RecyclerView.Adapter<CallRecordAdapter.Ho
|
|||||||
holder.root.setOnClickListener(new View.OnClickListener() {
|
holder.root.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
Intent dialIntent = new Intent(Intent.ACTION_CALL);
|
if (Utils.isMultiSim(mContext)) {
|
||||||
Uri data = Uri.parse("tel:" + phone);
|
Intent intent = new Intent(mContext, SelectNumberActivity.class);
|
||||||
dialIntent.setData(data);
|
intent.putExtra("phone_number", phone);
|
||||||
mContext.startActivity(dialIntent);
|
mContext.startActivity(intent);
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
Intent dialIntent = new Intent(Intent.ACTION_CALL);
|
||||||
|
Uri data = Uri.parse("tel:" + phone);
|
||||||
|
dialIntent.setData(data);
|
||||||
|
dialIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
mContext.startActivity(dialIntent);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e(TAG, "callNumber: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
holder.iv_remove.setOnClickListener(new View.OnClickListener() {
|
holder.iv_remove.setOnClickListener(new View.OnClickListener() {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@@ -19,11 +20,14 @@ import com.hjq.toast.Toaster;
|
|||||||
import com.shehuan.niv.NiceImageView;
|
import com.shehuan.niv.NiceImageView;
|
||||||
import com.xxpatx.os.R;
|
import com.xxpatx.os.R;
|
||||||
import com.xxpatx.os.activity.contact.AddWechatContactActivity;
|
import com.xxpatx.os.activity.contact.AddWechatContactActivity;
|
||||||
|
import com.xxpatx.os.activity.selectnumber.SelectNumberActivity;
|
||||||
import com.xxpatx.os.bean.Contact;
|
import com.xxpatx.os.bean.Contact;
|
||||||
|
import com.xxpatx.os.utils.Utils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ContactAdapter extends RecyclerView.Adapter<ContactAdapter.ContactHolder> {
|
public class ContactAdapter extends RecyclerView.Adapter<ContactAdapter.ContactHolder> {
|
||||||
|
private static final String TAG = "ContactAdapter";
|
||||||
private List<Contact> mContactList;
|
private List<Contact> mContactList;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
|
|
||||||
@@ -68,7 +72,6 @@ public class ContactAdapter extends RecyclerView.Adapter<ContactAdapter.ContactH
|
|||||||
// Toaster.show("电话功能被禁用");
|
// Toaster.show("电话功能被禁用");
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
Intent dialIntent = new Intent(Intent.ACTION_CALL);
|
|
||||||
String phone = contact.getMobile();
|
String phone = contact.getMobile();
|
||||||
if (DIALER_PACKAGE.equals(phone)) {
|
if (DIALER_PACKAGE.equals(phone)) {
|
||||||
try {
|
try {
|
||||||
@@ -82,9 +85,21 @@ public class ContactAdapter extends RecyclerView.Adapter<ContactAdapter.ContactH
|
|||||||
Intent intent = new Intent(mContext, AddWechatContactActivity.class);
|
Intent intent = new Intent(mContext, AddWechatContactActivity.class);
|
||||||
mContext.startActivity(intent);
|
mContext.startActivity(intent);
|
||||||
} else if (!TextUtils.isEmpty(phone)) {
|
} else if (!TextUtils.isEmpty(phone)) {
|
||||||
Uri data = Uri.parse("tel:" + phone);
|
if (Utils.isMultiSim(mContext)) {
|
||||||
dialIntent.setData(data);
|
Intent intent = new Intent(mContext, SelectNumberActivity.class);
|
||||||
mContext.startActivity(dialIntent);
|
intent.putExtra("phone_number", phone);
|
||||||
|
mContext.startActivity(intent);
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
Intent dialIntent = new Intent(Intent.ACTION_CALL);
|
||||||
|
Uri data = Uri.parse("tel:" + phone);
|
||||||
|
dialIntent.setData(data);
|
||||||
|
dialIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
mContext.startActivity(dialIntent);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e(TAG, "callNumber: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
104
app/src/main/java/com/xxpatx/os/adapter/PhoneAdapter.java
Normal file
104
app/src/main/java/com/xxpatx/os/adapter/PhoneAdapter.java
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
package com.xxpatx.os.adapter;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.xxpatx.os.R;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class PhoneAdapter extends RecyclerView.Adapter<PhoneAdapter.Holder> {
|
||||||
|
|
||||||
|
//指定SIM卡拨打
|
||||||
|
public static final String[] DUAL_SIM_TYPES = {"subscription", "Subscription",
|
||||||
|
"com.android.phone.extra.slot",
|
||||||
|
"phone", "com.android.phone.DialingMode",
|
||||||
|
"simId", "simnum", "phone_type",
|
||||||
|
"simSlot"};
|
||||||
|
|
||||||
|
private Context mContext;
|
||||||
|
private List<String> mPhoneList;
|
||||||
|
private String mPhone;
|
||||||
|
|
||||||
|
public void setPhoneList(List<String> phoneList) {
|
||||||
|
mPhoneList = phoneList;
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhone(String phone) {
|
||||||
|
mPhone = phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OutCallback {
|
||||||
|
public void onCall();
|
||||||
|
}
|
||||||
|
|
||||||
|
private OutCallback mOutCallback;
|
||||||
|
|
||||||
|
public void setOutCallback(OutCallback outCallback) {
|
||||||
|
mOutCallback = outCallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public Holder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
mContext = parent.getContext();
|
||||||
|
return new Holder(LayoutInflater.from(mContext).inflate(R.layout.item_phone, parent, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull Holder holder, int position) {
|
||||||
|
String phone = mPhoneList.get(position);
|
||||||
|
if (position == 0) {
|
||||||
|
holder.iv_card.setImageDrawable(mContext.getDrawable(R.drawable.sim_card_1));
|
||||||
|
} else if (position == 1) {
|
||||||
|
holder.iv_card.setImageDrawable(mContext.getDrawable(R.drawable.sim_card_2));
|
||||||
|
}
|
||||||
|
holder.tv_number.setText(phone);
|
||||||
|
holder.root.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent dialIntent = new Intent(Intent.ACTION_CALL);
|
||||||
|
Uri data = Uri.parse("tel:" + mPhone);
|
||||||
|
dialIntent.setData(data);
|
||||||
|
for (int i = 0; i < DUAL_SIM_TYPES.length; i++) {
|
||||||
|
//0代表卡1,1代表卡2
|
||||||
|
dialIntent.putExtra(DUAL_SIM_TYPES[i], position);
|
||||||
|
}
|
||||||
|
mContext.startActivity(dialIntent);
|
||||||
|
if (mOutCallback != null) {
|
||||||
|
mOutCallback.onCall();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return mPhoneList == null ? 0 : mPhoneList.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Holder extends RecyclerView.ViewHolder {
|
||||||
|
ConstraintLayout root;
|
||||||
|
TextView tv_sim, tv_number;
|
||||||
|
ImageView iv_card;
|
||||||
|
|
||||||
|
public Holder(@NonNull View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
root = itemView.findViewById(R.id.root);
|
||||||
|
iv_card = itemView.findViewById(R.id.iv_card);
|
||||||
|
tv_sim = itemView.findViewById(R.id.tv_sim);
|
||||||
|
tv_number = itemView.findViewById(R.id.tv_number);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -83,6 +83,7 @@ public class CommonConfig {
|
|||||||
public static final String WECHAT_CALL_AUTO_ACCEPT = "wechat_call_auto_accept";
|
public static final String WECHAT_CALL_AUTO_ACCEPT = "wechat_call_auto_accept";
|
||||||
/*悬浮窗*/
|
/*悬浮窗*/
|
||||||
public static final String FLOAT_WINDOW = "FloatWindowEnable";
|
public static final String FLOAT_WINDOW = "FloatWindowEnable";
|
||||||
|
public static final boolean FLOAT_WINDOW_STATU = false;
|
||||||
/*禁用音量键*/
|
/*禁用音量键*/
|
||||||
public static final String DISABLE_VOLUME_KEY = "disable_volume_key";
|
public static final String DISABLE_VOLUME_KEY = "disable_volume_key";
|
||||||
/*修改联系人禁用*/
|
/*修改联系人禁用*/
|
||||||
|
|||||||
@@ -94,9 +94,9 @@ public class DialerFragment extends BaseMvvmFragment<DialerViewModel, FragmentDi
|
|||||||
Log.e("initView", "onTextChanged: " + s);
|
Log.e("initView", "onTextChanged: " + s);
|
||||||
if ("*#*#4636#*#*".contentEquals(s)) {
|
if ("*#*#4636#*#*".contentEquals(s)) {
|
||||||
ApkUtils.openPackage(mContext, "com.android.settings", "com.android.settings.Settings$TestingSettingsActivity");
|
ApkUtils.openPackage(mContext, "com.android.settings", "com.android.settings.Settings$TestingSettingsActivity");
|
||||||
}else if ("*#*#0011234#*#*".contentEquals(s)){
|
} else if ("*#*#0011234#*#*".contentEquals(s)) {
|
||||||
ApkUtils.openPackage(mContext, "com.mediatek.factorymode", "com.mediatek.factorymode.FactoryMode");
|
ApkUtils.openPackage(mContext, "com.mediatek.factorymode", "com.mediatek.factorymode.FactoryMode");
|
||||||
}else if ("*#*#0011231#*#*".contentEquals(s)){
|
} else if ("*#*#0011231#*#*".contentEquals(s)) {
|
||||||
ApkUtils.openPackage(mContext, "com.android.agingtest", "com.android.agingtest.AgingTest");
|
ApkUtils.openPackage(mContext, "com.android.agingtest", "com.android.agingtest.AgingTest");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -124,12 +124,15 @@ public class DialerFragment extends BaseMvvmFragment<DialerViewModel, FragmentDi
|
|||||||
Toaster.show("请输入号码");
|
Toaster.show("请输入号码");
|
||||||
} else {
|
} else {
|
||||||
if (Utils.isMultiSim(mContext)) {
|
if (Utils.isMultiSim(mContext)) {
|
||||||
startActivity(new Intent(mContext, SelectNumberActivity.class));
|
Intent intent = new Intent(mContext, SelectNumberActivity.class);
|
||||||
|
intent.putExtra("phone_number", phone);
|
||||||
|
startActivity(intent);
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
Intent dialIntent = new Intent(Intent.ACTION_CALL);
|
Intent dialIntent = new Intent(Intent.ACTION_CALL);
|
||||||
Uri data = Uri.parse("tel:" + phone);
|
Uri data = Uri.parse("tel:" + phone);
|
||||||
dialIntent.setData(data);
|
dialIntent.setData(data);
|
||||||
|
dialIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
startActivity(dialIntent);
|
startActivity(dialIntent);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(TAG, "callNumber: " + e.getMessage());
|
Log.e(TAG, "callNumber: " + e.getMessage());
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ public class MainService extends BaseRxService implements MainSContact.MainSView
|
|||||||
// ApkUtils.UninstallAPP(this, "com.joytv.live");
|
// ApkUtils.UninstallAPP(this, "com.joytv.live");
|
||||||
// ApkUtils.UninstallAPP(this, "com.tencent.android.qqdownloader");
|
// ApkUtils.UninstallAPP(this, "com.tencent.android.qqdownloader");
|
||||||
|
|
||||||
mFloatWindowEnable = mMMKV.decodeBool(CommonConfig.FLOAT_WINDOW, true);
|
mFloatWindowEnable = mMMKV.decodeBool(CommonConfig.FLOAT_WINDOW, CommonConfig.FLOAT_WINDOW_STATU);
|
||||||
mWindowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
|
mWindowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
|
||||||
showPopupWindow();
|
showPopupWindow();
|
||||||
|
|
||||||
|
|||||||
BIN
app/src/main/res/drawable-hdpi/sim_card_1.png
Normal file
BIN
app/src/main/res/drawable-hdpi/sim_card_1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 736 B |
BIN
app/src/main/res/drawable-hdpi/sim_card_2.png
Normal file
BIN
app/src/main/res/drawable-hdpi/sim_card_2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 969 B |
13
app/src/main/res/drawable/phone_background.xml
Normal file
13
app/src/main/res/drawable/phone_background.xml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<!-- 内部颜色 -->
|
||||||
|
<solid android:color="@color/white" />
|
||||||
|
<!-- 圆角的幅度 -->
|
||||||
|
<corners android:radius="8dp" />
|
||||||
|
|
||||||
|
<!-- <padding-->
|
||||||
|
<!-- android:bottom="0dp"-->
|
||||||
|
<!-- android:left="8dp"-->
|
||||||
|
<!-- android:right="8dp"-->
|
||||||
|
<!-- android:top="0dp" />-->
|
||||||
|
</shape>
|
||||||
@@ -10,12 +10,17 @@
|
|||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/recyclerView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/phone_background"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</layout>
|
</layout>
|
||||||
71
app/src/main/res/layout/item_phone.xml
Normal file
71
app/src/main/res/layout/item_phone.xml
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/root"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="64dp"
|
||||||
|
android:background="@drawable/phone_background"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_sim"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="3"
|
||||||
|
android:gravity="center"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:text="SIM卡"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="2">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_card"
|
||||||
|
android:layout_width="32dp"
|
||||||
|
android:layout_height="32dp"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@drawable/sim_card_1"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_number"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="11"
|
||||||
|
android:gravity="center"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:text="1234567890"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
Reference in New Issue
Block a user