Пример #1
0
 /** 加载入口 */
 public void loadEntry() {
   boolean sentry = false;
   if (null == Profile.instance().region && 0 != currentRegionId) {
     currentRegionId = 0;
     sentry = true;
   } else if (null != Profile.instance().region
       && Profile.instance().region.id != currentRegionId) {
     currentRegionId = Profile.instance().region.id;
     sentry = true;
   }
   if (null == Me.instance && null != currentUserId) {
     currentUserId = null;
     sentry = true;
   } else if (null != Me.instance && !Me.instance.id.equals(currentUserId)) {
     currentUserId = Me.instance.id;
     sentry = true;
   }
   if (sentry) {
     if (null == Me.instance) {
       browser.loadUrl(Networking.fetchURL("HomePage", "", currentRegionId));
     } else {
       browser.loadUrl(Networking.fetchURL("HomePage", Me.instance.token, currentRegionId));
     }
   }
 }
Пример #2
0
 /** 处理区域按钮 */
 public void dealRegion() {
   btnRegion.setOnClickListener(
       new View.OnClickListener() {
         @Override
         public void onClick(View v) {
           Intent intent = new Intent(HomeActivity.this.getActivity(), RegionActivity.class);
           HomeActivity.this.startActivityForResult(intent, MESSAGE_REGION);
         }
       });
   btnBell.setOnClickListener(
       new View.OnClickListener() {
         @Override
         public void onClick(View v) {
           if (null == Me.instance) {
             Intent intent = new Intent(HomeActivity.this.getActivity(), LoginActivity.class);
             HomeActivity.this.startActivity(intent);
             Toast.makeText(HomeActivity.this.getActivity(), "请先登录账号", Toast.LENGTH_LONG).show();
             return;
           }
           Intent intent = new Intent();
           intent.setClass(HomeActivity.this.getActivity(), MyMessagesActivity.class);
           HomeActivity.this.getActivity().startActivity(intent);
         }
       });
   if (null == Profile.instance().region) {
     Intent intent = new Intent(HomeActivity.this.getActivity(), RegionActivity.class);
     HomeActivity.this.startActivityForResult(intent, MESSAGE_REGION);
   } else {
     btnRegion.setText(fetchRegionName());
   }
 }
Пример #3
0
 /**
  * 获取处理后的区域名称
  *
  * @return 处理后的区域名称
  */
 public String fetchRegionName() {
   if (null == Profile.instance().region) {
     return "选择小区";
   }
   return Profile.instance().region.getShortName();
 }