@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));
  }
Beispiel #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();
  }
Beispiel #4
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 #5
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();
 }
Beispiel #6
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();
  }
Beispiel #7
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 #8
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;
        }
Beispiel #9
0
  @Override
  public void onClick(View v) {
    try {
      switch (v.getId()) {
        case R.id.web:
          Statistics.INSTANCE.trackSimpleNamedEvent(Statistics.EventName.Settings.WEB_SITE);
          AlohaHelper.logClick(AlohaHelper.Settings.WEB_SITE);

          startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(Constants.Url.WEB_SITE)));
          break;

        case R.id.blog:
          Statistics.INSTANCE.trackSimpleNamedEvent(Statistics.EventName.Settings.WEB_BLOG);
          AlohaHelper.logClick(AlohaHelper.Settings.WEB_BLOG);

          startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(Constants.Url.WEB_BLOG)));
          break;

        case R.id.facebook:
          Statistics.INSTANCE.trackSimpleNamedEvent(Statistics.EventName.Settings.FACEBOOK);
          AlohaHelper.logClick(AlohaHelper.Settings.FACEBOOK);

          Utils.showFacebookPage(getActivity());
          break;

        case R.id.twitter:
          Statistics.INSTANCE.trackSimpleNamedEvent(Statistics.EventName.Settings.TWITTER);
          AlohaHelper.logClick(AlohaHelper.Settings.TWITTER);

          Utils.showTwitterPage(getActivity());
          break;

        case R.id.subscribe:
          Statistics.INSTANCE.trackSimpleNamedEvent(Statistics.EventName.Settings.SUBSCRIBE);
          AlohaHelper.logClick(AlohaHelper.Settings.MAIL_SUBSCRIBE);

          startActivity(
              new Intent(Intent.ACTION_SENDTO)
                  .setData(
                      Utils.buildMailUri(
                          Constants.Email.SUBSCRIBE,
                          getString(R.string.subscribe_me_subject),
                          getString(R.string.subscribe_me_body))));
          break;

        case R.id.rate:
          Statistics.INSTANCE.trackSimpleNamedEvent(Statistics.EventName.Settings.RATE);
          AlohaHelper.logClick(AlohaHelper.Settings.RATE);

          Utils.openAppInMarket(getActivity(), BuildConfig.REVIEW_URL);
          break;

        case R.id.share:
          Statistics.INSTANCE.trackSimpleNamedEvent(Statistics.EventName.Settings.TELL_FRIEND);
          AlohaHelper.logClick(AlohaHelper.Settings.TELL_FRIEND);

          ShareOption.ANY.share(
              getActivity(), getString(R.string.tell_friends_text), R.string.tell_friends);
          break;

        case R.id.copyright:
          Statistics.INSTANCE.trackSimpleNamedEvent(Statistics.EventName.Settings.COPYRIGHT);
          AlohaHelper.logClick(AlohaHelper.Settings.COPYRIGHT);

          ((SettingsActivity) getActivity())
              .switchToFragment(CopyrightFragment.class, R.string.copyright);
          break;
      }
    } catch (ActivityNotFoundException e) {
      AlohaHelper.logException(e);
    }
  }