Example #1
0
  public void onResume() {
    super.onResume();
    // umeng统计
    MobclickAgent.onResume(this);
    //	if ( !GezitechApplication.isActive ) {
    // app 从后台唤醒,进入前台
    //   GezitechApplication.isActive = true;
    // 判断xmpp是否链接
    User user = GezitechService.getInstance().getCurrentLoginUser(this);
    if (user != null) {
      if (GezitechApplication.connection == null
          || (!GezitechApplication.connection.isConnected())
          || (XmppConnectionManager.getInstance().getConnection() != null
              && !XmppConnectionManager.getInstance().getConnection().isConnected())) {
        XmppConnectionManager.getInstance().login();
      }
    }
    /*//是否重新启动app
    if( GezitechApplication.runtime>0 && (System.currentTimeMillis() - GezitechApplication.runtime) > 30*60*1000  ){
    	Intent intent = new Intent(this, WelcomeActivity.class);
    	startActivity( intent );
    	GezitechService.getInstance().exitApp( this );
    }*/
    //	}
    // 过半个小时定位一次
    long currTime = System.currentTimeMillis();
    long LBSCtime = GezitechApplication.systemSp.getLong("LBSCtime", currTime);
    if (AppUtils.isAppOnForeground() && (currTime - LBSCtime) > 35 * 60) {

      GezitechService.getInstance().longitude();
    }
    getNewNearByCount();
  }
Example #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    GezitechService.getInstance().appendActivity(this);
    setContentView(R.layout.activity_zhuye);

    // user = GezitechService.getInstance().getCurrentLoginUser(this);

    home = (RadioButton) findViewById(R.id.home);
    session = (RadioButton) findViewById(R.id.session);
    person = (RadioButton) findViewById(R.id.person);
    group = (RadioGroup) findViewById(R.id.zhuye_group);
    nearby = (RadioButton) findViewById(R.id.nearby);

    // 初始化个推推送
    PushManager.getInstance().initialize(this.getApplicationContext());

    // 提示消息
    ll_unreadcount = (LinearLayout) findViewById(R.id.ll_unreadcount);
    tv_unreadcount = (TextView) findViewById(R.id.tv_unreadcount);
    // 附近人有新消息提示 只显示红点
    ll_nearbycount = (LinearLayout) findViewById(R.id.ll_nearbycount);
    // 喜欢 和 评论的提示条数
    ll_like_comment_count = (LinearLayout) findViewById(R.id.ll_like_comment_count);
    tv_like_comment_count = (TextView) findViewById(R.id.tv_like_comment_count);
    // 计算未读的消息
    unreadcount();
    // 计算 喜欢和 评论的未读消息
    like_comment_count(tv_like_comment_count, ll_like_comment_count);

    home.setOnClickListener(this);
    session.setOnClickListener(this);
    person.setOnClickListener(this);
    nearby.setOnClickListener(this);
    fragmentManager = getSupportFragmentManager();

    mFragments = new Fragment[4];
    fghome = HomeFramgent.newInstance();
    fsession = SessionFramgent.newInstance();
    fperson = PersonFramgent.newInstance();
    fNearby = NearbyFramgent.newInstance();

    mFragments[0] = fghome;
    mFragments[1] = null;
    mFragments[2] = null;
    mFragments[3] = null;
    fragmentManager.beginTransaction().add(R.id.zhuye_content, fghome).show(fghome).commit();

    IntentFilter filter = new IntentFilter();
    filter.addAction(Constant.NEW_MESSAGE_ACTION);
    filter.addAction(Constant.LIKE_COMMENT_ACTION);
    registerReceiver(receiver, filter);

    _jumpActivity(this.getIntent());

    setSelectFragment();
  }
Example #3
0
  // 获取是否有最新消息
  public void getNewNearByCount() {
    // 获取经度纬度
    String longs = GezitechApplication.systemSp.getString("long", "");
    String lat = GezitechApplication.systemSp.getString("lat", "");
    if (longs.equals("") || lat.equals("")) {

      GezitechService.getInstance()
          .longitude(
              new CallBDLocation() {

                @Override
                public void callfunction(String longs, String lat, String city) {
                  _getData(longs, lat);
                }
              });

    } else {
      _getData(longs, lat);
    }
  }