| | |
| | | import android.util.DisplayMetrics; |
| | | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.hdl.linkpm.sdk.utils.HDLFileUtils; |
| | | import com.hdl.photovoltaic.HDLApp; |
| | | import com.hdl.photovoltaic.config.AppConfigManage; |
| | | import com.hdl.photovoltaic.config.UserConfigManage; |
| | | import com.hdl.photovoltaic.other.HdlFileLogic; |
| | | import com.hdl.photovoltaic.ui.adapter.LanguageAdapter; |
| | | import com.hdl.photovoltaic.ui.bean.LongLatListInfo; |
| | | import com.hdl.photovoltaic.ui.bean.NationBean; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | |
| | | } |
| | | |
| | | |
| | | //国家,省份,城市 |
| | | private static List<NationBean> nationBeans = new ArrayList<>(); |
| | | //国家,省份,经纬度 |
| | | private static List<LongLatListInfo> longLatBeans = new ArrayList<>(); |
| | | |
| | | public static void getLocationInfo(Context context) { |
| | | if (isZh()) { |
| | | nationBeans = JSON.parseArray(HdlFileLogic.getInstance().openAssetsFileJson("locationCN.json", context), NationBean.class); |
| | | } else { |
| | | nationBeans = JSON.parseArray(HdlFileLogic.getInstance().openAssetsFileJson("locationEN.json", context), NationBean.class); |
| | | } |
| | | } |
| | | |
| | | public static void getLongLatInfo(Context context) { |
| | | if (isZh()) { |
| | | longLatBeans = JSON.parseArray(HdlFileLogic.getInstance().openAssetsFileJson("longLatCN.json", context), LongLatListInfo.class); |
| | | } else { |
| | | longLatBeans = JSON.parseArray(HdlFileLogic.getInstance().openAssetsFileJson("longLatEN.json", context), LongLatListInfo.class); |
| | | } |
| | | } |
| | | |
| | | |
| | | public static boolean isZh() { |
| | | // Locale locale = context.getResources().getConfiguration().locale; |
| | | // String language = locale.getLanguage(); |
| | | String language = UserConfigManage.getInstance().getCurrentAppLanguage(); |
| | | return language.equals(zh); |
| | | } |
| | | |
| | | public static List<NationBean> getNationBeans() { |
| | | if (nationBeans == null) { |
| | | return new ArrayList<>(); |
| | | } |
| | | return nationBeans; |
| | | } |
| | | |
| | | public static List<LongLatListInfo> getLongLatBeans() { |
| | | if (longLatBeans == null) { |
| | | return new ArrayList<>(); |
| | | } |
| | | return longLatBeans; |
| | | } |
| | | |
| | | |
| | | } |
| | | |