|
@@ -16,11 +16,13 @@ import com.xplora.xplauncher.R;
|
|
|
import com.xplora.xplauncher.adapter.ContactsRecyclerAdapter;
|
|
|
import com.xplora.xplauncher.adapter.RecyclerAdapter;
|
|
|
import com.xplora.xplauncher.adapter.ViewPagerAdapter;
|
|
|
+import com.xplora.xplauncher.broadcast.SimStateReceiver;
|
|
|
import com.xplora.xplauncher.broadcast.TimeBroadcastReceiver;
|
|
|
import com.xplora.xplauncher.data.DataManager;
|
|
|
import com.xplora.xplauncher.model.AppModel;
|
|
|
import com.xplora.xplauncher.model.ContactModel;
|
|
|
import com.xplora.xplauncher.utils.Constant;
|
|
|
+import com.xplora.xplauncher.utils.ResUtils;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
@@ -29,12 +31,13 @@ public class MainActivity extends BaseActivity {
|
|
|
private int mCurrentPagerIndex = Constant.HOME_INDEX;
|
|
|
private int mAppTitleStatus = 1;
|
|
|
private int mDeleteBtnStatus = 0;
|
|
|
- private int mWarningStatus = 1; //表盘界面,是否显示 warning 及状态, 0:不显示; >0 显示
|
|
|
+ private int mWarningStatus = 0; //表盘界面,是否显示 warning 及状态, 0:不显示; >0 显示
|
|
|
|
|
|
private final List<View> mPagesDatas = new ArrayList<>();
|
|
|
private final List<Object> mPagerViews = new ArrayList<>();
|
|
|
private ViewPagerAdapter mViewPagerAdapter = null;
|
|
|
private TimeBroadcastReceiver mTimeReceiver = null;
|
|
|
+ private SimStateReceiver mSimStateReceiver = null;
|
|
|
|
|
|
private Button mWarningButton;
|
|
|
|
|
@@ -121,7 +124,24 @@ public class MainActivity extends BaseActivity {
|
|
|
mWarningButton.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
-
|
|
|
+ if (mWarningStatus <= 0)
|
|
|
+ return;
|
|
|
+
|
|
|
+ String packageName = "com.xplora.xponboarding";
|
|
|
+ String activity = "";
|
|
|
+ if (mWarningStatus == 1) {//no sim
|
|
|
+ activity = packageName + ".Activity.SimInstallActivity";
|
|
|
+ } else if (mWarningStatus == 2) { //watch 未激活
|
|
|
+ activity = packageName + ".Activity.SimUnactivatedActivity";
|
|
|
+ } else if (mWarningStatus == 3) { //esim 未激活
|
|
|
+ activity = packageName + ".Activity.EsimActivationActivity";
|
|
|
+ } else if (mWarningStatus == 4) {//sim 被锁
|
|
|
+ activity = packageName + ".Activity.SimLockedActivity";
|
|
|
+ }
|
|
|
+ ComponentName component = new ComponentName(packageName, activity);
|
|
|
+ Intent intent = new Intent();
|
|
|
+ intent.setComponent(component);
|
|
|
+ startActivity(intent);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -368,6 +388,11 @@ public class MainActivity extends BaseActivity {
|
|
|
if (mTimeReceiver == null) {
|
|
|
mTimeReceiver = new TimeBroadcastReceiver(this);
|
|
|
}
|
|
|
+
|
|
|
+ //sim 卡状态变化
|
|
|
+ if (mSimStateReceiver == null) {
|
|
|
+ mSimStateReceiver = new SimStateReceiver(this);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public void onReceiveTimeBroadcast() {
|
|
@@ -375,6 +400,18 @@ public class MainActivity extends BaseActivity {
|
|
|
homeView.refreshTime();
|
|
|
}
|
|
|
|
|
|
+ public void onReceiveSimStateBroadcast(int status) {
|
|
|
+ mWarningStatus = status;
|
|
|
+
|
|
|
+ if (status >= 1) {
|
|
|
+ int content = ResUtils.getStringId("sim_status_", status);
|
|
|
+ mWarningButton.setText(getString(content));
|
|
|
+ mWarningButton.setVisibility(View.VISIBLE);
|
|
|
+ } else {
|
|
|
+ mWarningButton.setVisibility(View.GONE);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
protected void onResume() {
|
|
|
super.onResume();
|
|
@@ -395,6 +432,10 @@ public class MainActivity extends BaseActivity {
|
|
|
unregisterReceiver(mTimeReceiver);
|
|
|
mTimeReceiver = null;
|
|
|
}
|
|
|
+ if (mSimStateReceiver != null) {
|
|
|
+ unregisterReceiver(mSimStateReceiver);
|
|
|
+ mSimStateReceiver = null;
|
|
|
+ }
|
|
|
|
|
|
HomePager homeView = (HomePager)mPagerViews.get(1);
|
|
|
homeView.destroyView();
|