@Override public boolean onOptionsItemSelected(final MenuItem item) { final int id = item.getItemId(); switch (id) { case Menu.FIRST + 1: { if (mHandler != null) mHandler.removeCallbacks(this); request(false); final Toast toast = Toast.makeText(this, R.string.request_relation_refresh, Toast.LENGTH_LONG); toast.show(); } break; case Menu.FIRST + 2: { if (mStatus) mStatus = false; else mStatus = true; final EntityRelation entityRelation = EntityRelation.getRelation(); if (entityRelation != null) { entityRelation.setStatus(mStatus); EntityRelation.writeRelation(entityRelation); } } break; case Menu.FIRST + 3: { if (mLocationClient == null) mLocationClient = EntityLocation.initLocation(this, 0, this); final Toast toast = Toast.makeText(this, R.string.location_my_location, Toast.LENGTH_LONG); toast.show(); } break; case Menu.FIRST + 4: { mWaitfor = new PopWindowWaitfor(this); mWaitfor.start(); final RequestSelects request = new RequestSelects(this, mThreadPool, this); request.request(); } break; } return super.onOptionsItemSelected(item); }
@Override public void onClick(final View view) { final Object object = view.getTag(); final int id = view.getId(); switch (id) { case R.id.tv_time: { if (object != null) { final EntityLocations entityLocations = (EntityLocations) object; final double latitude = entityLocations.getLatitude(); final double longitude = entityLocations.getLongitude(); mapViewRefresh(latitude, longitude, 17.0f, 800); } } break; case R.id.rl_item: { if (mSelectObject != null) { mSelectObject.close(); mSelectObject = null; } if (mEntityRelation == null) mEntityRelation = EntityRelation.getRelation(); if (mEntityRelation != null) { mWaitfor = new PopWindowWaitfor(this); mWaitfor.start(); final EntitySelect entitySelect = (EntitySelect) object; final String name = entitySelect.getName(); mEntityRelation.setTo(name); mRequestSelect = new RequestSelect(this, mThreadPool, this); mRequestSelect.request(name); } } break; } }