| | |
| | | package com.hdl.photovoltaic.ui; |
| | | |
| | | import androidx.appcompat.app.AppCompatActivity; |
| | | |
| | | import android.content.Intent; |
| | | import android.os.Bundle; |
| | | import android.text.TextUtils; |
| | | |
| | | import com.hdl.linkpm.sdk.core.exception.HDLException; |
| | | import com.hdl.linkpm.sdk.user.HDLLinkPMUser; |
| | | 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.HdlResidenceLogic; |
| | |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | |
| | | /** |
| | | * App启动页(目的是为了让用户点击APP图标的时候有一个瞬间响应的交互体验。) |
| | | */ |
| | | public class StartActivity extends CustomBaseActivity { |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public void onBindView(Bundle savedInstanceState) { |
| | | //7天内免登录 |
| | | if (UserConfigManage.getInstance().isAutoLogin()) { |
| | | setNotificationBarBackgroundColor(CustomColor.white); |
| | | setStatusBarTextColor(); |
| | | |
| | | //初始化服务器域名(用户注册所在服务器域名地址) |
| | | AppConfigManage.setUserRegionUrl(HDLLinkPMUser.getInstance().getUserRegionUrl()); |
| | | //判断AccessToken是否null |
| | | if (!TextUtils.isEmpty(HDLLinkPMUser.getInstance().getAccessToken())) { |
| | | // 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, MyPowerStationActivity.class); |
| | | startActivity(intent); |
| | | finish(); |
| | | if (UserConfigManage.getInstance().isBAccount()) { |
| | | //安装商跳转界面 |
| | | intent.setClass(StartActivity.this, BPowerStationActivity.class); |
| | | } else { |
| | | //C端用户跳转界面 |
| | | intent.setClass(StartActivity.this, CPowerStationActivity.class); |
| | | |
| | | } |
| | | openActivity(intent); |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | // hideLoading(); |
| | | Intent intent = new Intent(); |
| | | intent.setClass(StartActivity.this, MyPowerStationActivity.class); |
| | | startActivity(intent); |
| | | finish(); |
| | | if (UserConfigManage.getInstance().isBAccount()) { |
| | | //安装商跳转界面 |
| | | intent.setClass(StartActivity.this, BPowerStationActivity.class); |
| | | } else { |
| | | //C端用户跳转界面 |
| | | intent.setClass(StartActivity.this, CPowerStationActivity.class); |
| | | } |
| | | openActivity(intent); |
| | | } |
| | | }); |
| | | |
| | | } else { |
| | | Intent intent = new Intent(); |
| | | intent.setClass(this, HomeLoginActivity.class); |
| | | startActivity(intent); |
| | | finish(); |
| | | intent.setClass(this, LoginActivity.class); |
| | | openActivity(intent); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void startActivity(Intent intent) { |
| | | super.startActivity(intent); |
| | | overridePendingTransition(0, 0); |
| | | } |
| | | |
| | | void openActivity(Intent intent) { |
| | | intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); |
| | | startActivity(intent); |
| | | finish(); |
| | | } |
| | | @Override |
| | | protected void onDestroy() { |
| | | super.onDestroy(); |
| | | overridePendingTransition(0, 0); |
| | | } |
| | | |
| | | |
| | | |
| | | } |