Пример #1
0
 @Override
 public void propertyChange(PropertyChangeEvent event) {
   if (event.getPropertyName().equals(PropertyCenter.PROPERTY_CONNECT_STATE)
       || event.getPropertyName().equals(PropertyCenter.PROPERTY_SUBSCRIBE_DEL)) {
     if (adapter != null) {
       adapter.notifyDataSetChanged();
     }
   } else if (event.getPropertyName().equals(PropertyCenter.PROPERTY_REFRESH_SUBSCRIBE_CHAT)) {
     if (controller != null) {
       controller.getNewItemsFromServer(null, null, null);
     }
   }
 }
Пример #2
0
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    account = AccountProxy.getInstance().getCurrentAccount();
    if (account != null) {
      initAdapter();
      initController();
      adapter.setCache(controller.getCache());
      mGridView.setAdapter(adapter);
      mGridView.setOnItemClickListener(
          new OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
              Subscribe subscribe = adapter.getItem(position);

              switch (subscribe.getType()) {
                case Subscribe.TYPE_BUILT_IN_ALARM:
                  AlarmListActivity.callMe(getActivity());
                  break;
                case Subscribe.TYPE_BUILT_IN_HEALTH:
                  jumpToWebSite(NetworkClient.URL_DOWNLOAD_APK);
                  break;
                case Subscribe.TYPE_BUILT_IN_STORE:
                  jumpToWebSite(null);
                  break;
                case Subscribe.TYPE_BUILT_IN_HEALTH_ASSESSMENT:
                  HealthAssessmentActivity.jump2AQHealth(getActivity());
                  break;
                case Subscribe.TYPE_BUILT_IN_APPLY_SERVICE:
                  ActivityWebViewContainer.toApplyService(getActivity());
                  break;
                case Subscribe.TYPE_NET:
                  if (subscribe.isAdmin()) {
                    SubscribeAdminActivity.callMe(getActivity(), subscribe);
                  } else {
                    ChatRoomActivity.callMe(getActivity(), subscribe);
                  }
                  break;
              }
            }
          });
    } else {
      AccountProxy.getInstance().doLogout(getActivity(), true);
    }
  }