@Override
 public void onClick(View v) {
   // TODO show/hide spinners
   switch (v.getId()) {
     case R.id.login_osm:
       Statistics.INSTANCE.trackAuthRequest(OsmOAuth.AuthType.OSM);
       loginOsm();
       break;
     case R.id.login_facebook:
       Statistics.INSTANCE.trackAuthRequest(OsmOAuth.AuthType.FACEBOOK);
       loginWebview(OsmOAuth.AuthType.FACEBOOK);
       break;
     case R.id.login_google:
       Statistics.INSTANCE.trackAuthRequest(OsmOAuth.AuthType.GOOGLE);
       loginWebview(OsmOAuth.AuthType.GOOGLE);
       break;
     case R.id.lost_password:
       Statistics.INSTANCE.trackEvent(Statistics.EventName.EDITOR_LOST_PASSWORD);
       recoverPassword();
       break;
     case R.id.register:
       Statistics.INSTANCE.trackEvent(Statistics.EventName.EDITOR_REG_REQUEST);
       register();
       break;
   }
 }
  protected void processAuth(@Size(2) String[] auth, OsmOAuth.AuthType type, String username) {
    if (auth == null) {
      if (mFragment.isAdded()) {
        new AlertDialog.Builder(mFragment.getActivity())
            .setTitle(R.string.editor_login_error_dialog)
            .setPositiveButton(android.R.string.ok, null)
            .show();

        Statistics.INSTANCE.trackEvent(
            Statistics.EventName.EDITOR_AUTH_REQUEST_RESULT,
            Statistics.params()
                .add(Statistics.EventParam.IS_SUCCESS, false)
                .add(Statistics.EventParam.TYPE, type.name));
      }
      return;
    }

    OsmOAuth.setAuthorization(auth[0], auth[1], username);
    if (mFragment.isAdded()) Utils.navigateToParent(mFragment.getActivity());
    Statistics.INSTANCE.trackEvent(
        Statistics.EventName.EDITOR_AUTH_REQUEST_RESULT,
        Statistics.params()
            .add(Statistics.EventParam.IS_SUCCESS, true)
            .add(Statistics.EventParam.TYPE, type.name));
  }
Exemple #3
0
  public void start() {
    mLogger.d("start");

    if (!MapObject.isOfType(MapObject.MY_POSITION, mStartPoint)) {
      Statistics.INSTANCE.trackEvent(Statistics.EventName.ROUTING_START_SUGGEST_REBUILD);
      AlohaHelper.logClick(AlohaHelper.ROUTING_START_SUGGEST_REBUILD);
      suggestRebuildRoute();
      return;
    }

    MapObject my = LocationHelper.INSTANCE.getMyPosition();
    if (my == null) {
      mRoutingListener.onRoutingEvent(ResultCodesHelper.NO_POSITION, null);
      return;
    }

    mStartPoint = my;
    Statistics.INSTANCE.trackEvent(Statistics.EventName.ROUTING_START);
    AlohaHelper.logClick(AlohaHelper.ROUTING_START);
    setState(State.NAVIGATION);

    mContainer.showRoutePlan(false, null);
    mContainer.showNavigation(true);

    ThemeSwitcher.restart();

    Framework.nativeFollowRoute();
    LocationHelper.INSTANCE.restart();
  }
Exemple #4
0
 void searchPoi(int slotId) {
   mLogger.d("searchPoi: " + slotId);
   Statistics.INSTANCE.trackEvent(Statistics.EventName.ROUTING_SEARCH_POINT);
   AlohaHelper.logClick(AlohaHelper.ROUTING_SEARCH_POINT);
   mWaitingPoiPickSlot = slotId;
   mContainer.showSearch();
   mContainer.updateMenu();
 }
Exemple #5
0
  void swapPoints() {
    mLogger.d("swapPoints");

    MapObject point = mStartPoint;
    mStartPoint = mEndPoint;
    mEndPoint = point;

    Statistics.INSTANCE.trackEvent(Statistics.EventName.ROUTING_SWAP_POINTS);
    AlohaHelper.logClick(AlohaHelper.ROUTING_SWAP_POINTS);

    setPointsInternal();
    checkAndBuildRoute();
  }
Exemple #6
0
        @Override
        public boolean onPreferenceChange(Preference preference, Object newValue) {
          if (newValue == null) return false;

          mSelectedLanguage = (String) newValue;
          Statistics.INSTANCE.trackEvent(
              Statistics.EventName.Settings.VOICE_LANGUAGE,
              Statistics.params().add(Statistics.EventParam.LANGUAGE, mSelectedLanguage));
          LanguageData lang = mLanguages.get(mSelectedLanguage);
          if (lang == null) return false;

          if (lang.downloaded) setLanguage(lang);
          else
            startActivityForResult(
                new Intent(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA), REQUEST_INSTALL_DATA);

          return false;
        }
Exemple #7
0
        @Override
        public boolean onPreferenceChange(Preference preference, Object newValue) {
          Statistics.INSTANCE.trackEvent(
              Statistics.EventName.Settings.VOICE_ENABLED,
              Statistics.params().add(Statistics.EventParam.ENABLED, newValue.toString()));
          boolean set = (Boolean) newValue;
          if (!set) {
            TtsPlayer.setEnabled(false);
            mPrefLanguages.setEnabled(false);
            return true;
          }

          if (mCurrentLanguage != null && mCurrentLanguage.downloaded) {
            setLanguage(mCurrentLanguage);
            return true;
          }

          mPrefLanguages.setEnabled(true);
          getPreferenceScreen().onItemClick(null, null, mPrefLanguages.getOrder(), 0);
          mPrefLanguages.setEnabled(false);
          return false;
        }