示例#1
0
 /** @return */
 public User getUserInfo() {
   User lu = new User();
   lu.setUid(StringUtils.toInt(getProperty("user.uid"), 0));
   lu.setName(getProperty("user.name"));
   lu.setFace(getProperty("user.face"));
   lu.setAccount(getProperty("user.account"));
   lu.setPwd(CyptoUtils.decode("oschinaApp", getProperty("user.pwd")));
   lu.setLocation(getProperty("user.location"));
   lu.setFollowers(StringUtils.toInt(getProperty("user.followers"), 0));
   lu.setFans(StringUtils.toInt(getProperty("user.fans"), 0));
   lu.setScore(StringUtils.toInt(getProperty("user.score"), 0));
   lu.setRememberMe(StringUtils.toBool(getProperty("user.isRememberMe")));
   return lu;
 }
示例#2
0
  public LoginInfo getLoginInfo() {
    LoginInfo loginInfo = new LoginInfo();
    loginInfo.setLogin(StringUtils.toBool(getProperty("logininfo.islogin")));
    loginInfo.setRememberme(StringUtils.toBool(getProperty("logininfo.rememberme")));
    loginInfo.setUid(StringUtils.toInt(getProperty("logininfo.userid")));
    loginInfo.setUsername(getProperty("logininfo.username"));
    // loginInfo.setPassword(CyptoUtils.decode("SocialLocation", getProperty("logininfo.password")))
    // ;
    loginInfo.setPassword(getProperty("logininfo.password"));

    this.login = loginInfo.isLogin();
    this.loginUid = loginInfo.getUid();
    return loginInfo;
  }
示例#3
0
 /**
  * 获�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;
 }
示例#4
0
 /** �始� */
 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;
   }
 }
示例#5
0
 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;
 }
示例#6
0
 /**
  * 获�当�网络类型
  *
  * @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;
 }
示例#7
0
 /**
  * 是�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);
 }
示例#8
0
 /**
  * 是�左�滑动
  *
  * @return
  */
 public boolean isScroll() {
   String perf_scroll = getProperty(AppConfig.CONF_SCROLL);
   // 默认是关闭左�滑�
   if (StringUtils.isEmpty(perf_scroll)) return false;
   else return StringUtils.toBool(perf_scroll);
 }
示例#9
0
 /**
  * 是å�¦å�¯åŠ¨æ£?Ÿ¥æ›´æ–°
  *
  * @return
  */
 public boolean isCheckUp() {
   String perf_checkup = getProperty(AppConfig.CONF_CHECKUP);
   // 默认是开�
   if (StringUtils.isEmpty(perf_checkup)) return true;
   else return StringUtils.toBool(perf_checkup);
 }
示例#10
0
 /**
  * 是��出�示�
  *
  * @return
  */
 public boolean isVoice() {
   String perf_voice = getProperty(AppConfig.CONF_VOICE);
   // 默认是开��示声�
   if (StringUtils.isEmpty(perf_voice)) return true;
   else return StringUtils.toBool(perf_voice);
 }
示例#11
0
 /**
  * 是�加载显示文章图片
  *
  * @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);
 }
示例#12
0
 public static MessageList parse(InputStream inputStream) throws IOException, AppException {
   MessageList msglist = new MessageList();
   Messages msg = null;
   // 获得XmlPullParser解析�?
   XmlPullParser xmlParser = Xml.newPullParser();
   try {
     xmlParser.setInput(inputStream, UTF8);
     // 获得解析到的事件类别,这里有�?��文档,结束文档,�?��标签,结束标签,文本等等事件�?
     int evtType = xmlParser.getEventType();
     // �?��循环,直到文档结�?
     while (evtType != XmlPullParser.END_DOCUMENT) {
       String tag = xmlParser.getName();
       int depth = xmlParser.getDepth();
       switch (evtType) {
         case XmlPullParser.START_TAG:
           if (depth == 2 && tag.equalsIgnoreCase("messageCount")) {
             msglist.messageCount = StringUtils.toInt(xmlParser.nextText(), 0);
           } else if (tag.equalsIgnoreCase("pageSize")) {
             msglist.pageSize = StringUtils.toInt(xmlParser.nextText(), 0);
           } else if (tag.equalsIgnoreCase("message")) {
             msg = new Messages();
           } else if (msg != null) {
             if (tag.equalsIgnoreCase("id")) {
               msg.id = StringUtils.toInt(xmlParser.nextText(), 0);
             } else if (tag.equalsIgnoreCase("portrait")) {
               msg.setFace(xmlParser.nextText());
             } else if (tag.equalsIgnoreCase("friendid")) {
               msg.setFriendId(StringUtils.toInt(xmlParser.nextText(), 0));
             } else if (tag.equalsIgnoreCase("friendname")) {
               msg.setFriendName(xmlParser.nextText());
             } else if (tag.equalsIgnoreCase("content")) {
               msg.setContent(xmlParser.nextText());
             } else if (tag.equalsIgnoreCase("sender")) {
               msg.setSender(xmlParser.nextText());
             } else if (tag.equalsIgnoreCase("senderid")) {
               msg.setSenderId(StringUtils.toInt(xmlParser.nextText(), 0));
             } else if (depth == 4 && tag.equalsIgnoreCase("messageCount")) {
               msg.setMessageCount(StringUtils.toInt(xmlParser.nextText(), 0));
             } else if (tag.equalsIgnoreCase("pubDate")) {
               msg.setPubDate(xmlParser.nextText());
             } else if (tag.equalsIgnoreCase("appclient")) {
               msg.setAppClient(StringUtils.toInt(xmlParser.nextText(), 0));
             }
           }
           // 通知信息
           else if (tag.equalsIgnoreCase("notice")) {
             msglist.setNotice(new Notice());
           } else if (msglist.getNotice() != null) {
             if (tag.equalsIgnoreCase("atmeCount")) {
               msglist.getNotice().setAtmeCount(StringUtils.toInt(xmlParser.nextText(), 0));
             } else if (tag.equalsIgnoreCase("msgCount")) {
               msglist.getNotice().setMsgCount(StringUtils.toInt(xmlParser.nextText(), 0));
             } else if (tag.equalsIgnoreCase("reviewCount")) {
               msglist.getNotice().setReviewCount(StringUtils.toInt(xmlParser.nextText(), 0));
             } else if (tag.equalsIgnoreCase("newFansCount")) {
               msglist.getNotice().setNewFansCount(StringUtils.toInt(xmlParser.nextText(), 0));
             }
           }
           break;
         case XmlPullParser.END_TAG:
           // 如果遇到标签结束,则把对象添加进集合�?
           if (tag.equalsIgnoreCase("message") && msg != null) {
             msglist.getMessagelist().add(msg);
             msg = null;
           }
           break;
       }
       // 如果xml没有结束,则导航到下�?��节点
       evtType = xmlParser.next();
     }
   } catch (XmlPullParserException e) {
     throw AppException.xml(e);
   } finally {
     inputStream.close();
   }
   return msglist;
 }