コード例 #1
0
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    Log.d(TAG, "onActivityCreated: started " + hashCode());

    executeSavedInstanceState(savedInstanceState);

    Fragment fragment = null;
    if (getArguments() == null || getArguments().getBoolean(Extra.CREATE_WORKER_FRAGMENT, true)) {
      FragmentManager fm = getFragmentManager();
      fragment = fm.findFragmentByTag(POIsListWorkerFragment.TAG);
      Log.d(TAG, "Found worker fragment:" + fragment);
      if (fragment == null) {
        fragment = new POIsListWorkerFragment();
        fm.beginTransaction().add(fragment, POIsListWorkerFragment.TAG).commit();
      }

    } else if (!getArguments().getBoolean(Extra.CREATE_WORKER_FRAGMENT, false)) {
      Log.d(TAG, "Connecting to Combined Worker Fragment");
      FragmentManager fm = getFragmentManager();
      fragment = fm.findFragmentByTag(CombinedWorkerFragment.TAG);
    }

    mWorkerFragment = (WorkerFragment) fragment;
    mWorkerFragment.registerDisplayFragment(this);
    Log.d(TAG, "result mWorkerFragment = " + mWorkerFragment);

    if (UtilsMisc.isTablet(getActivity()))
      mPullToRefreshListView.getRefreshableView().setChoiceMode(ListView.CHOICE_MODE_SINGLE);
  }
コード例 #2
0
  public void onEventMainThread(MyLocationManager.LocationEvent event) {
    Log.d(TAG, "updateLocation: location = " + event.location);
    mLastLocation = mLocation;
    mLocation = event.location;
    resetCursorLoaderUri();

    if (isNewDistanceFar()) {
      Log.d(TAG, "updateLocation: isNewDistanceFar results true");
      requestUpdate(null);
    }
  }
コード例 #3
0
 @Override
 public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
   Cursor wrappingCursor = new POIsCursorWrapper(cursor, mLocation);
   Log.d(TAG, "cursorloader - new cursor - cursor size = " + wrappingCursor.getCount());
   mCursor = wrappingCursor;
   update();
 }
コード例 #4
0
  @Override
  public void onLoaderReset(Loader<Cursor> arg0) {
    Log.d(TAG, "onLoaderReset - need to set it to null");

    mCursor = null;
    update();
  }
コード例 #5
0
  @Override
  public void executeBundle(Bundle bundle) {
    Log.d(TAG, "executeState fragment is visible = " + isVisible());
    if (bundle == null) return;

    if (bundle.getBoolean(Extra.REQUEST, false)) mWorkerFragment.requestUpdate(null);
  }
コード例 #6
0
 public void onEventMainThread(UserQueryHelper.UserQueryUpdateEvent e) {
   Log.d(TAG, "onUserQueryChanged: received event");
   mQuery = e.query;
   if (mLocation != null) {
     getLoaderManager().restartLoader(LOADER_ID_LIST, null, this);
   }
 }
コード例 #7
0
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   Log.d(TAG, "onActivityResult: requestCode = " + requestCode + " resultCode = " + resultCode);
   if (requestCode == SELECT_WHEELCHAIRSTATE) {
     if (resultCode == RESULT_OK) {
       // newly selected wheelchair state as action data
       if (data != null) {
         WheelchairState state =
             WheelchairState.valueOf(data.getIntExtra(Extra.WHEELCHAIR_STATE, Extra.UNKNOWN));
         updateDatabase(poiIdSelected, state);
         Log.d(TAG, "starting SyncServiceHelper.executeUpdateServer");
         SyncServiceHelper.executeUpdateServer(this, null);
       }
     }
   }
 }
コード例 #8
0
  @Override
  public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    Log.d(TAG, "onCreateLoader");

    return new CursorLoader(
        getActivity(), POIs.createUriSorted(mLocation), POIs.PROJECTION, mQuery, null, null);
  }
コード例 #9
0
  private void updateDatabase(long id, WheelchairState state) {
    Log.d(TAG, "updating id = " + id + " state = " + state.asRequestParameter());
    if (id == Extra.ID_UNKNOWN || state == null) return;

    ContentValues values = new ContentValues();
    values.put(POIs.WHEELCHAIR, state.getId());
    values.put(POIs.DIRTY, POIs.DIRTY_STATE);

    PrepareDatabaseHelper.editCopy(getContentResolver(), id, values);
  }
コード例 #10
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.d(TAG, "onCreate " + hashCode());
    setHasOptionsMenu(true);

    mSensorManager = (SensorManager) getActivity().getSystemService(Context.SENSOR_SERVICE);
    // noinspection deprecation
    mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION);
    mOrientationAvailable = mSensor != null;
  }
コード例 #11
0
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   Log.d(TAG, "onCreate");
   setRetainInstance(true);
   mDistance = getDistanceFromPreferences();
   mReceiver = new DetachableResultReceiver(new Handler());
   mReceiver.setReceiver(this);
   mBus = EventBus.getDefault();
   retrieveInitialLocation();
 }
コード例 #12
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.d(TAG, "onCreate");

    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    setSupportProgressBarIndeterminateVisibility(false);
    getSupportActionBar().setDisplayShowTitleEnabled(false);
    setContentView(R.layout.activity_multipane);

    // FragmentManager.enableDebugLogging(true);

    if (savedInstanceState != null) executeState(savedInstanceState);
    else executeDefaultInstanceState();

    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayShowTitleEnabled(false);
    createSearchModeCustomView(actionBar);

    mResizeButton.setOnClickListener(this);

    FragmentManager fm = getSupportFragmentManager();
    FragmentTransaction t = fm.beginTransaction();

    mWorkerFragment = (CombinedWorkerFragment) fm.findFragmentByTag(CombinedWorkerFragment.TAG);
    if (mWorkerFragment == null) {
      mWorkerFragment = new CombinedWorkerFragment();
      t.add(mWorkerFragment, CombinedWorkerFragment.TAG);
    }

    mListFragment = (POIsListFragment) fm.findFragmentById(R.id.list_layout);
    if (mListFragment == null) {
      mListFragment = POIsListFragment.newInstance(false, true);
      t.add(R.id.list_layout, mListFragment, POIsListFragment.TAG);
    }

    mMapFragment = (POIsMapsforgeFragment) fm.findFragmentById(R.id.map_layout);
    if (mMapFragment == null) {
      mMapFragment = POIsMapsforgeFragment.newInstance(false, true);
      t.add(R.id.map_layout, mMapFragment, POIsMapsforgeFragment.TAG);
    }

    mDetailFragment = (POIDetailFragment) fm.findFragmentById(R.id.detail_layout);
    if (mDetailFragment == null) {
      mDetailFragment = POIDetailFragment.newInstance();
      t.add(R.id.detail_layout, mDetailFragment);
    }

    t.commit();
  }
コード例 #13
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Log.d(TAG, "onCreateView " + hashCode());

    View v = inflater.inflate(R.layout.fragment_list, container, false);
    mPullToRefreshListView = (PullToRefreshListView) v.findViewById(R.id.pull_to_refresh_listview);
    mPullToRefreshListView.setOnRefreshListener(this);
    mAdapter = new POIsListCursorAdapter(getActivity(), null, false);
    mPullToRefreshListView.getRefreshableView().setAdapter(mAdapter);

    mBus = WheelmapApp.getBus();
    mBus.register(this);

    return v;
  }
コード例 #14
0
  @Override
  public void execute(long id) throws RestServiceException {
    CategoriesRequestBuilder requestBuilder =
        new CategoriesRequestBuilder(getServer(), getApiKey(), AcceptType.JSON);
    if (mLocale != null) {
      requestBuilder.locale(mLocale);
    }

    clearTempStore();
    setEtag(mEtag);
    retrieveSinglePage(requestBuilder);
    if (mEtag != null && mEtag.equals(getEtag()) && getTempStore().isEmpty()) {
      mContentIsEqual = true;
    }

    LastUpdateContent.storeEtag(getResolver(), LastUpdateContent.MODULE_CATEGORIES, getEtag());
    Log.d(TAG, "etag = " + getEtag());
  }
コード例 #15
0
  private void setCursor(Cursor cursor) {
    Log.d(
        TAG,
        "setCursor cursor "
            + ((cursor != null) ? cursor.hashCode() : "null")
            + " count = "
            + ((cursor != null) ? cursor.getCount() : "null")
            + " isNewCursor = "
            + (cursor != mCursor));
    if (cursor == mCursor) return;

    mCursor = cursor;
    if (mCursor != null) {
      mDirectionCursorWrapper = new DirectionCursorWrapper(mCursor);
    } else {
      mDirectionCursorWrapper = null;
    }
    mAdapter.swapCursor(mDirectionCursorWrapper);
    markItemClear();
    refreshListPosition();
  }
コード例 #16
0
 /** {@inheritDoc} */
 public void onReceiveResult(int resultCode, Bundle resultData) {
   Log.d(TAG, "onReceiveResult resultCode = " + resultCode);
   switch (resultCode) {
     case RestService.STATUS_RUNNING:
       {
         setRefreshStatus(true);
         break;
       }
     case RestService.STATUS_FINISHED:
       {
         setRefreshStatus(false);
         break;
       }
     case RestService.STATUS_ERROR:
       {
         setRefreshStatus(false);
         final RestServiceException e = resultData.getParcelable(Extra.EXCEPTION);
         if (mListener != null) {
           mListener.onError(e);
         }
         break;
       }
   }
 }
コード例 #17
0
 @Override
 public void onRefreshing(boolean isRefreshing) {
   Log.d(TAG, "onRefreshing isRefreshing = " + isRefreshing);
   setSupportProgressBarIndeterminateVisibility(isRefreshing);
 }
コード例 #18
0
 @Override
 public void onSearchModeChange(boolean isSearchMode) {
   Log.d(TAG, "onSearchModeChange: showing custom view in actionbar");
   getSupportActionBar().setDisplayShowCustomEnabled(true);
 }
コード例 #19
0
 private void setMovableGone() {
   mMovableVisible = false;
   Log.d(TAG, "setMovableGone height = " + (-mMovableLayout.getHeight()));
   mMovableLayout.setVisibility(View.INVISIBLE);
 }
コード例 #20
0
 @Override
 public void requestUpdate(Bundle bundle) {
   Log.d(TAG, "requestUpdate mLocation = " + mLocation + " mDistance = " + mDistance);
   RestServiceHelper.retrieveNodesByDistance(getActivity(), mLocation, mDistance, mReceiver);
 }
コード例 #21
0
 @Override
 public void onRefresh(PullToRefreshBase<ListView> refreshView) {
   Log.d(TAG, "onRefresh pulled");
   mFirstVisiblePosition = 0;
   if (mWorkerFragment != null) mWorkerFragment.requestUpdate(null);
 }
コード例 #22
0
 @Override
 protected void onNewIntent(Intent intent) {
   super.onNewIntent(intent);
   Log.d(TAG, "onNewIntent");
   setIntent(intent);
 }
コード例 #23
0
 @Subscribe
 public void onDistanceUnitChanged(DistanceUnitChangedEvent e) {
   Log.d(TAG, "onDistanceUnitChanged");
   mAdapter.changeAdapter();
 }
コード例 #24
0
 public POIsListFragment() {
   super();
   Log.d(TAG, "constructor called " + hashCode());
 }