コード例 #1
0
 @Override
 protected void onPostExecute(Boolean result) {
   if (null != activity) {
     progress.dismiss();
     if (result) {
       ActivityMixin.showToast(
           activity,
           getName()
               + ' '
               + getString(R.string.export_exportedto)
               + ": "
               + exportFile.toString());
       if (Settings.getShareAfterExport()) {
         Intent shareIntent = new Intent();
         shareIntent.setAction(Intent.ACTION_SEND);
         shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(exportFile));
         shareIntent.setType("application/xml");
         activity.startActivity(
             Intent.createChooser(shareIntent, getString(R.string.export_gpx_to)));
       }
     } else {
       ActivityMixin.showToast(activity, getString(R.string.export_failed));
     }
   }
 }
コード例 #2
0
    @Override
    protected void onPostExecuteInternal(Boolean result) {
      if (null != activity) {
        if (result) {
          //                    if (onlyNew) {
          //                        // update last export time in settings when doing it ourself
          // (currently we use the date check from gc.com)
          //                    }

          ActivityMixin.showToast(
              activity,
              getName()
                  + ' '
                  + getString(R.string.export_exportedto)
                  + ": "
                  + exportFile.toString());

          if (upload) {
            ActivityMixin.showToast(activity, getString(R.string.export_fieldnotes_upload_success));
          }
        } else {
          ActivityMixin.showToast(activity, getString(R.string.export_failed));
        }
      }
    }
コード例 #3
0
 @Override
 public void goManual(View view) {
   if (id >= 0) {
     ActivityMixin.goManual(this, "c:geo-waypoint-edit");
   } else {
     ActivityMixin.goManual(this, "c:geo-waypoint-new");
   }
 }
コード例 #4
0
  @Override
  public boolean invoke(
      final cgGeo geo,
      final Activity activity,
      final Resources res,
      final cgCache cache,
      final Long searchId,
      final cgWaypoint waypoint,
      final Double latitude,
      final Double longitude) {
    if (activity == null) {
      return false;
    }

    boolean navigationResult = false;
    if (latitude != null && longitude != null) {
      navigationResult = navigateToCoordinates(geo, activity, latitude, longitude);
    } else if (waypoint != null) {
      navigationResult =
          navigateToCoordinates(geo, activity, waypoint.latitude, waypoint.longitude);
    } else if (cache != null) {
      navigationResult = navigateToCoordinates(geo, activity, cache.latitude, cache.longitude);
    }

    if (!navigationResult) {
      if (res != null) {
        ActivityMixin.showToast(activity, res.getString(R.string.err_navigation_no));
      }
      return false;
    }

    return true;
  }
コード例 #5
0
 /**
  * Starts the default navigation tool if correctly set and installed or the compass app as default
  * fallback.
  */
 public static void startDefaultNavigationApplication(
     final int defaultNavigation, final Activity activity, final Waypoint waypoint) {
   if (waypoint == null || waypoint.getCoords() == null) {
     ActivityMixin.showToast(
         activity, CgeoApplication.getInstance().getString(R.string.err_location_unknown));
     return;
   }
   navigateWaypoint(activity, waypoint, getDefaultNavigationApplication(defaultNavigation));
 }
コード例 #6
0
  /**
   * Starts the default navigation tool if correctly set and installed or the compass app as default
   * fallback.
   */
  public static void startDefaultNavigationApplication(
      final int defaultNavigation, final Activity activity, final Geopoint destination) {
    if (destination == null) {
      ActivityMixin.showToast(
          activity, CgeoApplication.getInstance().getString(R.string.err_location_unknown));
      return;
    }

    navigateGeopoint(activity, destination, getDefaultNavigationApplication(defaultNavigation));
  }
コード例 #7
0
  /**
   * Starts the default navigation tool if correctly set and installed or the compass app as default
   * fallback.
   */
  public static void startDefaultNavigationApplication(
      final int defaultNavigation, final Activity activity, final Geocache cache) {
    if (cache == null || cache.getCoords() == null) {
      ActivityMixin.showToast(
          activity, CgeoApplication.getInstance().getString(R.string.err_location_unknown));
      return;
    }

    navigateCache(activity, cache, getDefaultNavigationApplication(defaultNavigation));
  }
コード例 #8
0
 @Override
 public void onClick(final View view) {
   final Activity activity = AbstractCredentialsAuthorizationActivity.this;
   try {
     activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getCreateAccountUrl())));
   } catch (final ActivityNotFoundException e) {
     Log.e("Cannot find suitable activity", e);
     ActivityMixin.showToast(activity, R.string.err_application_no);
   }
 }
コード例 #9
0
  private void checkCredentials(final String username, final String password) {
    final String nam = StringUtils.defaultString(username);
    final String pwd = StringUtils.defaultString(password);

    if (StringUtils.isBlank(username) || StringUtils.isBlank(password)) {
      ActivityMixin.showToast(this, R.string.err_missing_auth);
      return;
    }

    final Credentials credentials = new Credentials(nam, pwd);
    final AbstractCredentialsAuthorizationActivity authorizationActivity = this;

    final ProgressDialog loginDialog =
        ProgressDialog.show(
            authorizationActivity,
            res.getString(R.string.init_login_popup),
            getAuthDialogWait(),
            true);
    loginDialog.setCancelable(false);

    AppObservable.bindActivity(
            authorizationActivity,
            Observable.defer(
                new Func0<Observable<StatusCode>>() {
                  @Override
                  public Observable<StatusCode> call() {
                    return Observable.just(checkCredentials(credentials));
                  }
                }))
        .subscribeOn(AndroidRxUtils.networkScheduler)
        .subscribe(
            new Action1<StatusCode>() {
              @Override
              public void call(StatusCode statusCode) {
                loginDialog.dismiss();
                if (statusCode == StatusCode.NO_ERROR) {
                  setCredentials(credentials);
                  showToast(getAuthDialogCompleted());
                  setResult(RESULT_OK);
                  finish();
                } else {
                  Dialogs.message(
                      authorizationActivity,
                      R.string.init_login_popup,
                      res.getString(
                          R.string.init_login_popup_failed_reason, statusCode.getErrorString(res)));
                  checkButton.setText(getAuthCheckAgain());
                  checkButton.setOnClickListener(new CheckListener());
                  checkButton.setEnabled(true);
                }
              }
            });
  }
コード例 #10
0
ファイル: FieldnoteExport.java プロジェクト: nyordanov/cgeo
    @Override
    protected void onPostExecuteInternal(Boolean result) {
      if (null != activity) {
        if (result) {
          Settings.setFieldnoteExportDate(System.currentTimeMillis());

          ActivityMixin.showToast(
              activity,
              getName()
                  + ' '
                  + getString(R.string.export_exportedto)
                  + ": "
                  + exportFile.toString());

          if (upload) {
            ActivityMixin.showToast(activity, getString(R.string.export_fieldnotes_upload_success));
          }
        } else {
          ActivityMixin.showToast(activity, getString(R.string.export_failed));
        }
      }
    }
コード例 #11
0
ファイル: WaypointPopup.java プロジェクト: GodfatherThe/cgeo
  @Override
  public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    supportRequestWindowFeature(Window.FEATURE_NO_TITLE);

    this.setTheme(ActivityMixin.getDialogTheme());

    final Bundle extras = getIntent().getExtras();
    if (extras != null) {
      waypointId = extras.getInt(Intents.EXTRA_WAYPOINT_ID);
      geocode = extras.getString(Intents.EXTRA_GEOCODE);
    }
    showDialog();
  }
コード例 #12
0
  public CoordinatesInputDialog(
      final AbstractActivity context, final Geocache cache, final Geopoint gp, final IGeoData geo) {
    super(context, ActivityMixin.getDialogTheme());
    this.context = context;
    this.geo = geo;
    this.cache = cache;

    if (gp != null) {
      this.gp = gp;
    } else if (geo != null && geo.getCoords() != null) {
      this.gp = geo.getCoords();
    } else {
      this.gp = new Geopoint(0.0, 0.0);
    }
  }
コード例 #13
0
 public final void showProgress(final boolean show) {
   ActivityMixin.showProgress(this, show);
 }
コード例 #14
0
 protected final void insertIntoLog(final String newText, final boolean moveCursor) {
   final EditText log = ButterKnife.findById(this, R.id.log);
   ActivityMixin.insertAtPosition(log, newText, moveCursor);
 }
コード例 #15
0
 public void addVisitMenu(Menu menu, cgCache cache) {
   ActivityMixin.addVisitMenu(this, menu, cache);
 }
コード例 #16
0
 public final void helpDialog(final String title, final String message, final Drawable icon) {
   ActivityMixin.helpDialog(this, title, message, icon);
 }
コード例 #17
0
 public final void helpDialog(final String title, final String message) {
   ActivityMixin.helpDialog(this, title, message, null);
 }
コード例 #18
0
 public final void showShortToast(String text) {
   ActivityMixin.showShortToast(this, text);
 }
コード例 #19
0
 public final void setTheme() {
   ActivityMixin.setTheme(this);
 }
コード例 #20
0
 public final void setTitle(final String title) {
   ActivityMixin.setTitle(this, title);
 }
コード例 #21
0
 public void goManual(final View view) {
   ActivityMixin.goManual(this, helpTopic);
 }
コード例 #22
0
 public final void goHome(final View view) {
   ActivityMixin.goHome(this);
 }