예제 #1
0
  void getRockDetail() {
    Listener<JSONObject> listener =
        new Listener<JSONObject>() {

          @Override
          public void onResponse(JSONObject response) {
            app.log(this, response.toString());
            ResponseParser parser = new ResponseParser(response);
            if (parser.getStatusCode() == 200) {
              rock = Rock.Parse(parser.getDataObject());
              mRockDesc.setRock(rock);
              mRockComments.setRock(rock);
            }
          }
        };
    ErrorListener errorListener =
        new ErrorListener() {

          @Override
          public void onErrorResponse(VolleyError error) {
            // TODO Auto-generated method stub

          }
        };
    JsonObjectRequest request =
        new JsonObjectRequest(API.ROCK_DETAIL_GET + rockId, null, listener, errorListener);
    app.log(this, request.getUrl());
    app.getQueue().add(request);
  }
예제 #2
0
  @Override
  protected void onCreate(Bundle arg0) {
    super.onCreate(arg0);
    app = (GeoTage) getApplication();
    mContext = this;
    layout = LayoutInflater.from(mContext).inflate(R.layout.rock_detail, null);
    setContentView(layout);
    mPager = (ViewPager) findViewById(R.id.main_viewpager);
    adapter = new ViewPagerAdapter(getSupportFragmentManager());
    mPager = (ViewPager) layout.findViewById(R.id.rock_detail_viewpager);
    mPager.setAdapter(adapter);
    mPager.setOnPageChangeListener(this);
    mPager.setOffscreenPageLimit(3);
    // adapter.addFragment(new AddPlaceFragment());
    app.setActiveMenu(layout, menuIds, 0);

    rockId = getIntent().getIntExtra("rock_id", 0);

    rock = getIntent().getParcelableExtra("rock");
    if (rock == null) {
      rock = new Rock();
    }
    Bundle args = new Bundle();
    args.putParcelable("rock", rock);
    mRockDesc = new RockDescFragment();
    // mRockLocation = new RockLocation();
    mRockComments = new RockCommentsFragment();
    mRockDesc.setArguments(args);
    // mRockLocation.setArguments(args);
    mRockComments.setArguments(args);
    adapter.addFragment(mRockDesc);
    // adapter.addFragment(mRockLocation);
    adapter.addFragment(mRockComments);

    receiver = new NewCommentReceiver();
    getRockDetail();
  }
예제 #3
0
 @Override
 public void onPageSelected(int arg0) {
   app.setActiveMenu(layout, menuIds, arg0);
 }