/** * 获å�–Appå”¯ä¸€æ ‡è¯† * * @return */ public String getAppId() { String uniqueID = getProperty(AppConfig.CONF_APP_UNIQUEID); if (StringUtils.isEmpty(uniqueID)) { uniqueID = UUID.randomUUID().toString(); setProperty(AppConfig.CONF_APP_UNIQUEID, uniqueID); } return uniqueID; }
/** åˆ�始åŒ? */ private void init() { // 设置ä¿�å˜å›¾ç‰‡çš„è·¯å¾? saveImagePath = getProperty(AppConfig.SAVE_IMAGE_PATH); if (StringUtils.isEmpty(saveImagePath)) { setProperty(AppConfig.SAVE_IMAGE_PATH, AppConfig.DEFAULT_SAVE_IMAGE_PATH); saveImagePath = AppConfig.DEFAULT_SAVE_IMAGE_PATH; } }
public UserInformation getInformation( int uid, int hisuid, String hisname, int pageIndex, boolean isRefresh) throws AppException { String _hisname = ""; if (!StringUtils.isEmpty(hisname)) { _hisname = hisname; } UserInformation userinfo = null; String key = "userinfo_" + uid + "_" + hisuid + "_" + (URLEncoder.encode(hisname)) + "_" + pageIndex + "_" + PAGE_SIZE; if (isNetworkConnected() && (!isReadDataCache(key) || isRefresh)) { try { userinfo = ApiClient.information(this, uid, hisuid, _hisname, pageIndex, PAGE_SIZE); if (userinfo != null && pageIndex == 0) { Notice notice = userinfo.getNotice(); userinfo.setNotice(null); userinfo.setCacheKey(key); saveObject(userinfo, key); userinfo.setNotice(notice); } } catch (AppException e) { userinfo = (UserInformation) readObject(key); if (userinfo == null) throw e; } } else { userinfo = (UserInformation) readObject(key); if (userinfo == null) userinfo = new UserInformation(); } return userinfo; }
/** * 获�当�网络类型 * * @return 0:没有网� 1:WIFI网络 2:WAP网络 3:NET网络 */ public int getNetworkType() { int netType = 0; ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo(); if (networkInfo == null) { return netType; } int nType = networkInfo.getType(); if (nType == ConnectivityManager.TYPE_MOBILE) { String extraInfo = networkInfo.getExtraInfo(); if (!StringUtils.isEmpty(extraInfo)) { if (extraInfo.toLowerCase().equals("cmnet")) { netType = NETTYPE_CMNET; } else { netType = NETTYPE_CMWAP; } } } else if (nType == ConnectivityManager.TYPE_WIFI) { netType = NETTYPE_WIFI; } return netType; }
/** * 是�Https登录 * * @return */ public boolean isHttpsLogin() { String perf_httpslogin = getProperty(AppConfig.CONF_HTTPS_LOGIN); // 默认是http if (StringUtils.isEmpty(perf_httpslogin)) return false; else return StringUtils.toBool(perf_httpslogin); }
/** * 是å�¦å·¦å�³æ»‘动 * * @return */ public boolean isScroll() { String perf_scroll = getProperty(AppConfig.CONF_SCROLL); // 默认是关é—å·¦å�³æ»‘åŠ? if (StringUtils.isEmpty(perf_scroll)) return false; else return StringUtils.toBool(perf_scroll); }
/** * 是å�¦å�¯åŠ¨æ£?Ÿ¥æ›´æ–° * * @return */ public boolean isCheckUp() { String perf_checkup = getProperty(AppConfig.CONF_CHECKUP); // 默认是开å�? if (StringUtils.isEmpty(perf_checkup)) return true; else return StringUtils.toBool(perf_checkup); }
/** * 是��出�示� * * @return */ public boolean isVoice() { String perf_voice = getProperty(AppConfig.CONF_VOICE); // 默认是开��示声� if (StringUtils.isEmpty(perf_voice)) return true; else return StringUtils.toBool(perf_voice); }
/** * 是å�¦åŠ è½½æ˜¾ç¤ºæ–‡ç« å›¾ç‰‡ * * @return */ public boolean isLoadImage() { String perf_loadimage = getProperty(AppConfig.CONF_LOAD_IMAGE); // é»˜è®¤æ˜¯åŠ è½½çš„ if (StringUtils.isEmpty(perf_loadimage)) return true; else return StringUtils.toBool(perf_loadimage); }