@Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setTheme();
    setContentView(R.layout.waypoint);
    setTitle(R.string.waypoint_title);

    // get parameters
    Bundle extras = getIntent().getExtras();

    // try to get data from extras
    if (extras != null) {
      id = extras.getInt("waypoint");
      geocode = extras.getString("geocode");
    }

    if (id <= 0) {
      showToast(res.getString(R.string.err_waypoint_unknown));
      finish();
      return;
    }

    if (geo == null) {
      geo = app.startGeo(geoUpdate);
    }

    waitDialog = ProgressDialog.show(this, null, res.getString(R.string.waypoint_loading), true);
    waitDialog.setCancelable(true);

    (new loadWaypoint()).start();
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setTheme();
    setContentView(R.layout.waypoint_new);
    setTitle("waypoint");

    if (geo == null) {
      geo = app.startGeo(geoUpdate);
    }

    // get parameters
    Bundle extras = getIntent().getExtras();
    if (extras != null) {
      geocode = extras.getString("geocode");
      wpCount = extras.getInt("count", 0);
      id = extras.getInt("waypoint");
    }

    if (StringUtils.isBlank(geocode) && id <= 0) {
      showToast(res.getString(R.string.err_waypoint_cache_unknown));

      finish();
      return;
    }

    if (id <= 0) {
      setTitle(res.getString(R.string.waypoint_add_title));
    } else {
      setTitle(res.getString(R.string.waypoint_edit_title));
    }

    if (geocode != null) {
      app.setAction(geocode);
    }

    Button buttonLat = (Button) findViewById(R.id.buttonLatitude);
    buttonLat.setOnClickListener(new coordDialogListener());
    Button buttonLon = (Button) findViewById(R.id.buttonLongitude);
    buttonLon.setOnClickListener(new coordDialogListener());

    Button addWaypoint = (Button) findViewById(R.id.add_waypoint);
    addWaypoint.setOnClickListener(new coordsListener());

    List<String> wayPointNames = new ArrayList<String>(cgBase.waypointTypes.values());
    AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.name);
    ArrayAdapter<String> adapter =
        new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, wayPointNames);
    textView.setAdapter(adapter);

    if (id > 0) {
      waitDialog = ProgressDialog.show(this, null, res.getString(R.string.waypoint_loading), true);
      waitDialog.setCancelable(true);

      (new loadWaypoint()).start();
    }

    disableSuggestions((EditText) findViewById(R.id.distance));
  }
示例#3
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setTheme();
    setContentView(R.layout.point);
    setTitle(res.getString(R.string.search_destination));

    createHistoryView();

    init();
  }
示例#4
0
  @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();
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState, R.layout.authorization_activity, true);

    Bundle extras = getIntent().getExtras();
    if (extras != null) {
      host = BundleUtils.getString(extras, Intents.EXTRA_OAUTH_HOST, host);
      pathRequest = BundleUtils.getString(extras, Intents.EXTRA_OAUTH_PATH_REQUEST, pathRequest);
      pathAuthorize =
          BundleUtils.getString(extras, Intents.EXTRA_OAUTH_PATH_AUTHORIZE, pathAuthorize);
      pathAccess = BundleUtils.getString(extras, Intents.EXTRA_OAUTH_PATH_ACCESS, pathAccess);
      https = extras.getBoolean(Intents.EXTRA_OAUTH_HTTPS, https);
      consumerKey = BundleUtils.getString(extras, Intents.EXTRA_OAUTH_CONSUMER_KEY, consumerKey);
      consumerSecret =
          BundleUtils.getString(extras, Intents.EXTRA_OAUTH_CONSUMER_SECRET, consumerSecret);
      callback = BundleUtils.getString(extras, Intents.EXTRA_OAUTH_CALLBACK, callback);
    }

    setTitle(getAuthTitle());

    auth_1.setText(getAuthExplainShort());
    auth_2.setText(getAuthExplainLong());

    ImmutablePair<String, String> tempToken = getTempTokens();
    OAtoken = tempToken.left;
    OAtokenSecret = tempToken.right;

    startButton.setText(getAuthAuthorize());
    startButton.setEnabled(true);
    startButton.setOnClickListener(new StartListener());

    if (StringUtils.isBlank(OAtoken) && StringUtils.isBlank(OAtokenSecret)) {
      // start authorization process
      startButton.setText(getAuthStart());
    } else {
      // already have temporary tokens, continue from pin
      startButton.setText(getAuthAgain());
    }
  }
示例#6
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setTheme();
    setContentView(R.layout.waypoint);
    setTitle(R.string.waypoint_title);

    // get parameters
    Bundle extras = getIntent().getExtras();

    // try to get data from extras
    if (extras != null) {
      id = extras.getInt("waypoint");
    }

    if (id <= 0) {
      showToast(res.getString(R.string.err_waypoint_unknown));
      finish();
      return;
    }

    waitDialog = ProgressDialog.show(this, null, res.getString(R.string.waypoint_loading), true);
    waitDialog.setCancelable(true);

    (new loadWaypoint()).start();

    ImageView defaultNavigationImageView = (ImageView) findViewById(R.id.defaultNavigation);
    defaultNavigationImageView.setOnLongClickListener(
        new OnLongClickListener() {
          @Override
          public boolean onLongClick(View v) {
            startDefaultNavigation2();
            return true;
          }
        });
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setTheme();
    setContentView(R.layout.visit);
    setTitle(res.getString(R.string.log_new_log));

    // get parameters
    final Bundle extras = getIntent().getExtras();
    if (extras != null) {
      cacheid = extras.getString(EXTRAS_ID);
      geocode = extras.getString(EXTRAS_GEOCODE);
      text = extras.getString(EXTRAS_TEXT);
      alreadyFound = extras.getBoolean(EXTRAS_FOUND);
    }

    if ((StringUtils.isBlank(cacheid)) && StringUtils.isNotBlank(geocode)) {
      cacheid = app.getCacheid(geocode);
    }
    if (StringUtils.isBlank(geocode) && StringUtils.isNotBlank(cacheid)) {
      geocode = app.getGeocode(cacheid);
    }

    cache = cgeoapplication.getInstance().loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB);

    if (StringUtils.isNotBlank(cache.getName())) {
      setTitle(res.getString(R.string.log_new_log) + ": " + cache.getName());
    } else {
      setTitle(res.getString(R.string.log_new_log) + ": " + cache.getGeocode().toUpperCase());
    }

    app.setAction(geocode);

    init();
  }
示例#8
0
  @Override
  public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState, R.layout.imageselect_activity);
    Views.inject(this);

    scaleChoiceIndex = Settings.getLogImageScale();
    imageCaption = "";
    imageDescription = "";
    imageUri = Uri.EMPTY;

    // Get parameters from intent and basic cache information from database
    final Bundle extras = getIntent().getExtras();
    if (extras != null) {
      imageCaption = extras.getString(EXTRAS_CAPTION);
      imageDescription = extras.getString(EXTRAS_DESCRIPTION);
      imageUri = Uri.parse(extras.getString(EXTRAS_URI_AS_STRING));
      scaleChoiceIndex = extras.getInt(EXTRAS_SCALE, scaleChoiceIndex);
    }

    // Restore previous state
    if (savedInstanceState != null) {
      imageCaption = savedInstanceState.getString(SAVED_STATE_IMAGE_CAPTION);
      imageDescription = savedInstanceState.getString(SAVED_STATE_IMAGE_DESCRIPTION);
      imageUri = Uri.parse(savedInstanceState.getString(SAVED_STATE_IMAGE_URI));
      scaleChoiceIndex = savedInstanceState.getInt(SAVED_STATE_IMAGE_SCALE);
    }

    cameraButton.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View view) {
            selectImageFromCamera();
          }
        });

    storedButton.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View view) {
            selectImageFromStorage();
          }
        });

    if (StringUtils.isNotBlank(imageCaption)) {
      captionView.setText(imageCaption);
    }

    if (StringUtils.isNotBlank(imageDescription)) {
      descriptionView.setText(imageDescription);
    }

    scaleView.setSelection(scaleChoiceIndex);
    scaleView.setOnItemSelectedListener(
        new OnItemSelectedListener() {
          @Override
          public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            scaleChoiceIndex = scaleView.getSelectedItemPosition();
            Settings.setLogImageScale(scaleChoiceIndex);
          }

          @Override
          public void onNothingSelected(AdapterView<?> arg0) {}
        });

    saveButton.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            saveImageInfo(true);
          }
        });

    clearButton.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            saveImageInfo(false);
          }
        });

    loadImagePreview();
  }
示例#9
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // set layout
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    setTheme();
    setContentView(R.layout.navigate);
    setTitle(res.getString(R.string.compass_title));

    // sensor & geolocation manager
    if (geo == null) {
      geo = app.startGeo(this, geoUpdate, base, settings, 0, 0);
    }
    if (settings.useCompass == 1 && dir == null) {
      dir = app.startDir(this, dirUpdate);
    }

    // get parameters
    Bundle extras = getIntent().getExtras();
    if (extras != null) {
      title = extras.getString("geocode");
      name = extras.getString("name");
      dstCoords = new Geopoint(extras.getDouble("latitude"), extras.getDouble("longitude"));

      if (StringUtils.isNotBlank(name)) {
        if (StringUtils.isNotBlank(title)) {
          title = title + ": " + name;
        } else {
          title = name;
        }
      }
    } else {
      Intent pointIntent = new Intent(this, cgeopoint.class);
      startActivity(pointIntent);

      finish();
      return;
    }

    if (StringUtils.isNotBlank(title)) {
      app.setAction(title);
    } else if (StringUtils.isNotBlank(name)) {
      app.setAction(name);
    }

    // set header
    setTitle();
    setDestCoords();

    // get textviews once
    compassView = (cgCompass) findViewById(R.id.rose);

    // start updater thread
    updater = new updaterThread(updaterHandler);
    updater.start();

    if (geo != null) {
      geoUpdate.updateLoc(geo);
    }
    if (dir != null) {
      dirUpdate.updateDir(dir);
    }
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // set layout
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    setTheme();
    setContentView(R.layout.navigate);
    setTitle(res.getString(R.string.compass_title));

    // sensor & geolocation manager
    if (geo == null) {
      geo = app.startGeo(geoUpdate);
    }
    if (Settings.isUseCompass() && dir == null) {
      dir = app.startDir(this, dirUpdate);
    }

    // get parameters
    Bundle extras = getIntent().getExtras();
    if (extras != null) {
      geocode = extras.getString(EXTRAS_GEOCODE);
      title = geocode;
      name = extras.getString(EXTRAS_NAME);
      dstCoords =
          new Geopoint(extras.getDouble(EXTRAS_LATITUDE), extras.getDouble(EXTRAS_LONGITUDE));

      if (StringUtils.isNotBlank(name)) {
        if (StringUtils.isNotBlank(title)) {
          title += ": " + name;
        } else {
          title = name;
        }
      }
    } else {
      Intent pointIntent = new Intent(this, cgeopoint.class);
      startActivity(pointIntent);

      finish();
      return;
    }

    setGo4CacheAction();

    // set header
    setTitle();
    setDestCoords();

    if (geo != null) {
      geoUpdate.updateLocation(geo);
    }
    if (dir != null) {
      dirUpdate.updateDirection(dir);
    }

    // get textviews once
    compassView = (CompassView) findViewById(R.id.rose);

    // start updater thread
    updater = new updaterThread(updaterHandler);
    updater.start();
  }