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));
  }
Beispiel #2
0
  private void build() {
    mLogger.d("build");
    mUberRequestHandled = false;
    mLastBuildProgress = 0;
    mInternetConnected = ConnectionState.isConnected();

    if (mLastRouterType == Framework.ROUTER_TYPE_TAXI) {
      if (!mInternetConnected) {
        completeUberRequest();
        return;
      }
      requestUberInfo();
    }

    setBuildState(BuildState.BUILDING);
    updatePlan();

    Statistics.INSTANCE.trackRouteBuild(mLastRouterType, mStartPoint, mEndPoint);
    org.alohalytics.Statistics.logEvent(
        AlohaHelper.ROUTING_BUILD,
        new String[] {
          Statistics.EventParam.FROM, Statistics.getPointType(mStartPoint),
          Statistics.EventParam.TO, Statistics.getPointType(mEndPoint)
        });
    Framework.nativeBuildRoute(
        mStartPoint.getLat(), mStartPoint.getLon(), mEndPoint.getLat(), mEndPoint.getLon());
  }
Beispiel #3
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;
        }
Beispiel #4
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;
        }