예제 #1
0
  @Override
  public void spotsLoaded(boolean fromCache, List<SpotData> _spots) {
    // this is called when the spots are loaded.
    // it is called twice,first with values from the local cache and later with new updated values
    // from internet
    if (fromCache && _spots == null) {
      // since this is from cache, show a loading screen. Later this function is called again but
      // with non-cached values
      showLoading();
      return;
    }
    if (!fromCache && _spots == null) {
      // ok, there are really no spots
      showNoData();
      return;
    }

    if (SpotStorage.sameSpots(_spots, mSpots)) {
      return; // no change
    }
    mSpots = _spots;
    if (mTabPageIndicator != null && mFragmentAdapter != null) {
      mFragmentAdapter.setSpots(_spots);
      mTabPageIndicator.notifyDataSetChanged();
    }
    showSpots();
  }
예제 #2
0
 /** get the touch event and call onMone on the active fragment */
 @Override
 public boolean dispatchTouchEvent(MotionEvent ev) {
   int item = mPager.getCurrentItem();
   WindFragment tf = (WindFragment) mFragmentAdapter.getItem(item);
   if (tf != null) {
     tf.onMove(ev);
   }
   return super.dispatchTouchEvent(ev);
 }
예제 #3
0
 public void openHistory() {
   Context context = getApplicationContext();
   Intent intent = new Intent(context, HistoryActivity.class);
   int item = mPager.getCurrentItem();
   WindFragment tf = (WindFragment) mFragmentAdapter.getItem(item);
   if (tf != null) {
     intent.putExtra(Const.EXTRA_INTENTINFO_SPOTID, tf.getSpotID());
     intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
     context.startActivity(intent);
   }
 }