| | |
| | | import com.hdl.photovoltaic.HDLApp; |
| | | import com.hdl.photovoltaic.R; |
| | | import com.hdl.photovoltaic.bean.ModBusBean; |
| | | import com.hdl.photovoltaic.config.AppConfigManage; |
| | | import com.hdl.photovoltaic.config.UserConfigManage; |
| | | import com.hdl.photovoltaic.internet.HttpServer.MyNanoHttpServer; |
| | | import com.hdl.photovoltaic.listener.CloudCallBeak; |
| | |
| | | data = new JSONObject(); |
| | | } |
| | | if (isTokenAndRefreshToken) { |
| | | //小程序那里有自己的请求方法,需要这些数据 |
| | | data.put("token", UserConfigManage.getInstance().getToken()); |
| | | data.put("refreshToken", UserConfigManage.getInstance().getRefreshToken()); |
| | | data.put("serverAddress", AppConfigManage.getUserRegionUrl()); |
| | | data.put("appKey", AppConfigManage.getAppKey()); |
| | | data.put("appSecret", AppConfigManage.getAppSecret()); |
| | | } |
| | | uniCallBackBaseBean.setData(data); |
| | | return getJSONObject(uniCallBackBaseBean); |
| | |
| | | |
| | | import android.Manifest; |
| | | import android.content.IntentFilter; |
| | | import android.content.UriPermission; |
| | | import android.content.pm.PackageManager; |
| | | import android.os.Bundle; |
| | | import android.os.Process; |
| | |
| | | //监听网络状态变化 |
| | | this.networkMonitoring(); |
| | | |
| | | // HdlOtaLogic.getInstance().startLocalService(new ServiceConnection() { |
| | | // @Override |
| | | // public void onServiceConnected(ComponentName name, IBinder service) { |
| | | // |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void onServiceDisconnected(ComponentName name) { |
| | | // |
| | | // } |
| | | // }); |
| | | |
| | | } |
| | | |
| | |
| | | */ |
| | | private void initData() { |
| | | // showLoading(); |
| | | if (UserConfigManage.getInstance().isBAccount()) { |
| | | this.getBUserInfo(); |
| | | } else { |
| | | this.getCMemberInfo(); |
| | | } |
| | | // if (UserConfigManage.getInstance().isBAccount()) { |
| | | // this.getBUserInfo(); |
| | | // } else { |
| | | // this.getCMemberInfo(); |
| | | // } |
| | | //因为uni那边需要,启动的时候就读取啦 |
| | | this.getResidenceTemperatureUnit(); |
| | | } |
| | | |
| | |
| | | //接收外部点击事件 |
| | | if (eventBus.getTopic().equals(ConstantManage.homepage_title_tab_switch)) { |
| | | if (eventBus.getType().equals(HomepageTitleTabSwitch.me.toString())) { |
| | | // |
| | | HdlLogLogic.print("正在点击【我的】"); |
| | | //读取头像 |
| | | if (UserConfigManage.getInstance().isBAccount()) { |
| | | this.getBUserInfo(); |
| | | } else { |
| | | this.getCMemberInfo(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | JSONObject jsonObject = new Gson().fromJson(json, JSONObject.class); |
| | | if (jsonObject.containsKey("tempType")) { |
| | | String unit = jsonObject.getString("tempType"); |
| | | if(unit.contains("C")){ |
| | | unit="℃"; |
| | | }else{ |
| | | unit= "℉"; |
| | | if (unit.contains("C")) { |
| | | unit = "℃"; |
| | | } else { |
| | | unit = "℉"; |
| | | } |
| | | UserConfigManage.getInstance().setTemperature_unit(unit); |
| | | UserConfigManage.getInstance().Save(); |
| | |
| | | import java.io.File; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 个人资料的界面 |
| | | */ |
| | |
| | | } |
| | | changedUserAvatar(); |
| | | } |
| | | }); |
| | | }, true); |
| | | |
| | | } |
| | | }); |
| | |
| | | intent.putExtra("memberName", UserConfigManage.getInstance().getUserName()); |
| | | setResult(10, intent); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | // Intent intent = new Intent(); |
| | | // intent.setClass(_mActivity, FastScanActivity.class); |
| | | // startActivity(intent); |
| | | String path = HDLUniMP.UNI_EVENT_OPEN_HOME_CREATION |
| | | + "&token=" + UserConfigManage.getInstance().getToken() |
| | | + "&refreshToken=" + UserConfigManage.getInstance().getRefreshToken() |
| | | + "®ionUrl=" + AppConfigManage.getUserRegionUrl(); |
| | | // // 打开小程序页面 |
| | | HdlUniLogic.getInstance().openUniMP(path, null); |
| | | HdlUniLogic.getInstance().openUniMP(HDLUniMP.UNI_EVENT_OPEN_HOME_CREATION, null); |
| | | } |
| | | |
| | | @Override |
| | |
| | | String path = HDLUniMP.UNI_EVENT_OPEN_HOME_DETAILS |
| | | + "?homeId=" + houseIdBean.getHomeId() |
| | | + "&homeName=" + houseIdBean.getHomeName() |
| | | + "&powerStationStatus=" + houseIdBean.getPowerStationStatus() |
| | | + "&serverAddress=" + AppConfigManage.getUserRegionUrl(); |
| | | + "&powerStationStatus=" + houseIdBean.getPowerStationStatus(); |
| | | HdlUniLogic.getInstance().openUniMP(path, null); |
| | | |
| | | } |
| | |
| | | |
| | | mPermissionsResultCallback = permissionsResultCallback; |
| | | |
| | | String[] s = new String[]{ |
| | | Manifest.permission.ACCESS_FINE_LOCATION, |
| | | Manifest.permission.CAMERA, |
| | | }; |
| | | String[] s = new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.CAMERA,}; |
| | | String[] ary = PermissionUtils.checkPermission(_mActivity, s); |
| | | if (ary.length > 0) { |
| | | requestPermissions(ary, PermissionUtils.STATUS_SUCCESS); |
| | |
| | | * @param activity - |
| | | * @param permission - |
| | | * @param permissionStateCallback - |
| | | * @param is_skip 拒绝权限后是否引导到设置那里打开(true=引导) |
| | | */ |
| | | public static void requestPermissionsResultCallback(Activity activity, String permission, PermissionState permissionStateCallback) { |
| | | public static void requestPermissionsResultCallback(Activity activity, String permission, PermissionState permissionStateCallback, boolean is_skip) { |
| | | // String permission = Manifest.permission.WRITE_EXTERNAL_STORAGE; |
| | | int status = PermissionUtils.getPermissionState(activity, permission); |
| | | switch (status) { |
| | |
| | | |
| | | @Override |
| | | public void onDenied(List<String> permissions, boolean never) { |
| | | SharedPreUtils.putBoolean(permission, true); |
| | | if (is_skip) { |
| | | SharedPreUtils.putBoolean(permission, true); |
| | | } |
| | | } |
| | | }); |
| | | break; |