示例#1
0
  @Override
  public void onDestroy() {
    initialized = false;
    app.showLoginToast = true;

    super.onDestroy();
  }
示例#2
0
  @Override
  public void onCreate(final Bundle savedInstanceState) {
    // don't call the super implementation with the layout argument, as that would set the wrong
    // theme
    super.onCreate(savedInstanceState);

    // Disable the up navigation for this activity
    getSupportActionBar().setDisplayHomeAsUpEnabled(false);

    setContentView(R.layout.main_activity);
    ButterKnife.inject(this);

    if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0) {
      // If we had been open already, start from the last used activity.
      finish();
      return;
    }

    setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL); // type to search

    version = Version.getVersionCode(this);
    Log.i(
        "Starting " + getPackageName() + ' ' + version + " a.k.a " + Version.getVersionName(this));

    init();

    checkShowChangelog();
  }
示例#3
0
 @Override
 public void onResume() {
   super.onResume(
       Subscriptions.from(
           locationUpdater.start(GeoDirHandler.UPDATE_GEODATA),
           satellitesHandler.start(GeoDirHandler.UPDATE_GEODATA)));
   updateUserInfoHandler.sendEmptyMessage(-1);
   startBackgroundLogin();
   init();
 }
示例#4
0
  @Override
  public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState, R.layout.editwaypoint_activity);

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

      finish();
      return;
    }

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

    buttonLat.setOnClickListener(new CoordDialogListener());
    buttonLon.setOnClickListener(new CoordDialogListener());

    addWaypoint.setOnClickListener(new SaveWaypointListener());

    final List<String> wayPointNames = new ArrayList<>();
    for (final WaypointType wpt : WaypointType.ALL_TYPES_EXCEPT_OWN_AND_ORIGINAL) {
      wayPointNames.add(wpt.getL10n());
    }
    final ArrayAdapter<String> adapter =
        new ArrayAdapter<>(this, android.R.layout.simple_dropdown_item_1line, wayPointNames);
    waypointName.setAdapter(adapter);

    if (savedInstanceState != null) {
      initViews = false;
    }

    if (geocode != null) {
      cache = DataStore.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB);
      setCoordsModificationVisibility(ConnectorFactory.getConnector(geocode), cache);
    }
    if (waypointId > 0) { // existing waypoint
      waitDialog = ProgressDialog.show(this, null, res.getString(R.string.waypoint_loading), true);
      waitDialog.setCancelable(true);

      (new LoadWaypointThread()).start();

    } else { // new waypoint
      initializeWaypointTypeSelector();
    }

    initializeDistanceUnitSelector();

    disableSuggestions(distanceView);
  }
示例#5
0
 @Override
 public boolean onPrepareOptionsMenu(final Menu menu) {
   super.onPrepareOptionsMenu(menu);
   menu.findItem(R.id.menu_pocket_queries).setVisible(Settings.isGCPremiumMember());
   return true;
 }
示例#6
0
 @Override
 public void onPause() {
   initialized = false;
   super.onPause();
 }
示例#7
0
 @Override
 public void onStop() {
   initialized = false;
   super.onStop();
 }
示例#8
0
  @Override
  public void onConfigurationChanged(final Configuration newConfig) {
    super.onConfigurationChanged(newConfig);

    init();
  }
示例#9
0
 @Override
 public void onResume() {
   super.onResume(geoDirHandler.start(GeoDirHandler.UPDATE_GEODATA));
 }