| | |
| | | |
| | | import com.hdl.linkpm.sdk.core.exception.HDLException; |
| | | import com.hdl.linkpm.sdk.user.HDLLinkPMUser; |
| | | import com.hdl.photovoltaic.HDLApp; |
| | | import com.hdl.photovoltaic.R; |
| | | import com.hdl.photovoltaic.base.CustomBaseActivity; |
| | | import com.hdl.photovoltaic.config.AppConfigManage; |
| | | import com.hdl.photovoltaic.config.UserConfigManage; |
| | | import com.hdl.photovoltaic.listener.CloudCallBeak; |
| | | import com.hdl.photovoltaic.other.HdlCommonLogic; |
| | | import com.hdl.photovoltaic.other.HdlLogLogic; |
| | | import com.hdl.photovoltaic.other.HdlResidenceLogic; |
| | | import com.hdl.photovoltaic.ui.bean.HouseIdBean; |
| | | import com.hdl.photovoltaic.ui.me.WebActivity; |
| | | import com.hdl.photovoltaic.utils.LocalManageUtil; |
| | | import com.hdl.photovoltaic.utils.SharedPreUtils; |
| | | import com.hdl.photovoltaic.widget.ConfirmationCancelDialog; |
| | | import com.hdl.sdk.link.HDLLinkLocalSdk; |
| | | |
| | | import java.util.List; |
| | | |
| | | import cn.jpush.android.api.JPushInterface; |
| | | import io.dcloud.common.util.RuningAcitvityUtil; |
| | | |
| | | |
| | | /** |
| | |
| | | public void onBindView(Bundle savedInstanceState) { |
| | | setStatusBarTranslucent(); |
| | | getWindow().setNavigationBarColor(getColor(R.color.text_FF000000)); |
| | | //初始化服务器域名(用户注册所在服务器域名地址) |
| | | AppConfigManage.setUserRegionUrl(HDLLinkPMUser.getInstance().getUserRegionUrl()); |
| | | //判断AccessToken是否null |
| | | if (!TextUtils.isEmpty(HDLLinkPMUser.getInstance().getAccessToken())) { |
| | | if (UserConfigManage.getInstance().isBAccount()) { |
| | | //安装商跳转界面 |
| | | Intent intent = new Intent(); |
| | | intent.setClass(StartActivity.this, BPowerStationActivity.class); |
| | | openActivity(intent); |
| | | } else { |
| | | //C端用户跳转界面 |
| | | // showLoading(); |
| | | HdlResidenceLogic.getInstance().getResidenceIdList("", "", new CloudCallBeak<List<HouseIdBean>>() { |
| | | @Override |
| | | public void onSuccess(List<HouseIdBean> obj) { |
| | | // hideLoading(); |
| | | HdlResidenceLogic.getInstance().setHouseIdList(obj); |
| | | Intent intent = new Intent(); |
| | | intent.setClass(StartActivity.this, CPowerStationActivity.class); |
| | | openActivity(intent); |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | // hideLoading(); |
| | | Intent intent = new Intent(); |
| | | intent.setClass(StartActivity.this, CPowerStationActivity.class); |
| | | openActivity(intent); |
| | | } |
| | | }); |
| | | } |
| | | //发布审核小米应用市场要求APP第一次启动提前提示《用户协议》和《隐私政策》才允许上线 |
| | | final String key = "is_login"; |
| | | boolean isLogin = SharedPreUtils.getBoolean(key); |
| | | if (!isLogin) { |
| | | ConfirmationCancelDialog confirmationCancelDialog = new ConfirmationCancelDialog(this); |
| | | confirmationCancelDialog.setTitle(getString(R.string.user_agreement_and_privacy_agreement)); |
| | | confirmationCancelDialog.setContent(getString(R.string.thank_you_for_using)); |
| | | confirmationCancelDialog.setConfirmation(getString(R.string.agree)); |
| | | confirmationCancelDialog.setCancel(getString(R.string.loading_on_agree)); |
| | | confirmationCancelDialog.show(); |
| | | setStringDifferentColors(confirmationCancelDialog.getContentTextView()); |
| | | confirmationCancelDialog.setNoOnclickListener(new ConfirmationCancelDialog.onNoOnclickListener() { |
| | | @Override |
| | | public void Cancel() { |
| | | SharedPreUtils.putBoolean(key, false); |
| | | finish(); |
| | | } |
| | | }); |
| | | confirmationCancelDialog.setYesOnclickListener(new ConfirmationCancelDialog.onYesOnclickListener() { |
| | | @Override |
| | | public void Confirm() { |
| | | initSdk(); |
| | | SharedPreUtils.putBoolean(key, true); |
| | | Intent intent = new Intent(); |
| | | intent.setClass(StartActivity.this, LoginActivity.class); |
| | | openActivity(intent); |
| | | } |
| | | }); |
| | | } else { |
| | | //发布审核小米应用市场要求APP第一次启动提前提示《用户协议》和《隐私政策》才允许上线 |
| | | final String key = "is_login"; |
| | | boolean isLogin = SharedPreUtils.getBoolean(key); |
| | | if (isLogin) { |
| | | initSdk(); |
| | | //初始化服务器域名(用户注册所在服务器域名地址) |
| | | AppConfigManage.setUserRegionUrl(HDLLinkPMUser.getInstance().getUserRegionUrl()); |
| | | //判断AccessToken是否null |
| | | if (!TextUtils.isEmpty(HDLLinkPMUser.getInstance().getAccessToken())) { |
| | | if (UserConfigManage.getInstance().isBAccount()) { |
| | | //安装商跳转界面 |
| | | Intent intent = new Intent(); |
| | | intent.setClass(StartActivity.this, BPowerStationActivity.class); |
| | | openActivity(intent); |
| | | } else { |
| | | //C端用户跳转界面 |
| | | // showLoading(); |
| | | HdlResidenceLogic.getInstance().getResidenceIdList("", "", new CloudCallBeak<List<HouseIdBean>>() { |
| | | @Override |
| | | public void onSuccess(List<HouseIdBean> obj) { |
| | | // hideLoading(); |
| | | HdlResidenceLogic.getInstance().setHouseIdList(obj); |
| | | Intent intent = new Intent(); |
| | | intent.setClass(StartActivity.this, CPowerStationActivity.class); |
| | | openActivity(intent); |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | // hideLoading(); |
| | | Intent intent = new Intent(); |
| | | intent.setClass(StartActivity.this, CPowerStationActivity.class); |
| | | openActivity(intent); |
| | | } |
| | | }); |
| | | } |
| | | } else { |
| | | Intent intent = new Intent(); |
| | | intent.setClass(StartActivity.this, LoginActivity.class); |
| | | openActivity(intent); |
| | | } else { |
| | | ConfirmationCancelDialog confirmationCancelDialog = new ConfirmationCancelDialog(this); |
| | | confirmationCancelDialog.setTitle(getString(R.string.user_agreement_and_privacy_agreement)); |
| | | confirmationCancelDialog.setContent(getString(R.string.thank_you_for_using)); |
| | | confirmationCancelDialog.setConfirmation(getString(R.string.agree)); |
| | | confirmationCancelDialog.setCancel(getString(R.string.loading_on_agree)); |
| | | confirmationCancelDialog.show(); |
| | | setStringDifferentColors(confirmationCancelDialog.getContentTextView()); |
| | | confirmationCancelDialog.setNoOnclickListener(new ConfirmationCancelDialog.onNoOnclickListener() { |
| | | @Override |
| | | public void Cancel() { |
| | | SharedPreUtils.putBoolean(key, false); |
| | | finish(); |
| | | } |
| | | }); |
| | | confirmationCancelDialog.setYesOnclickListener(new ConfirmationCancelDialog.onYesOnclickListener() { |
| | | @Override |
| | | public void Confirm() { |
| | | SharedPreUtils.putBoolean(key, true); |
| | | Intent intent = new Intent(); |
| | | intent.setClass(StartActivity.this, LoginActivity.class); |
| | | openActivity(intent); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 初始化三方相关SDK |
| | | * 小米平台上线,需要先同意后,在初始化极光SDK,否则平台审核不让通过 |
| | | */ |
| | | private void initSdk() { |
| | | if (HDLApp.getInstance().isStartInitThirdSDK) { |
| | | return; |
| | | } |
| | | HDLApp.getInstance().isStartInitThirdSDK = true; |
| | | //初始化极光推送 |
| | | initJPush(); |
| | | } |
| | | |
| | | /** |
| | | * 初始化极光SDK |
| | | */ |
| | | private void initJPush() { |
| | | JPushInterface.setDebugMode(true); |
| | | JPushInterface.init(getBaseContext()); |
| | | } |
| | | |
| | | } |