use of de.bahnhoefe.deutschlands.bahnhofsfotos.model.Bahnhof in project RSAndroidApp by RailwayStations.
the class MapsAllActivity method onInfoWindowClick.
@Override
public void onInfoWindowClick(Marker marker) {
BaseApplication baseApplication = (BaseApplication) getApplication();
String countryShortCode = baseApplication.getCountryShortCode();
Class cls = DetailsActivity.class;
Intent intent = new Intent(MapsAllActivity.this, cls);
long id = Long.valueOf(marker.getSnippet());
Bahnhof bahnhof = dbAdapter.fetchBahnhofByBahnhofId(id);
intent.putExtra(DetailsActivity.EXTRA_BAHNHOF, bahnhof);
startActivity(intent);
}
use of de.bahnhoefe.deutschlands.bahnhofsfotos.model.Bahnhof in project RSAndroidApp by RailwayStations.
the class NearbyNotificationService method checkNearestStation.
private void checkNearestStation() {
double minDist = 3e3;
Bahnhof nearest = null;
for (Bahnhof bahnhof : nearStations) {
double dist = calcDistance(bahnhof);
if (dist < minDist) {
nearest = bahnhof;
minDist = dist;
}
}
if (nearest != null && minDist < MIN_NOTIFICATION_DISTANCE) {
notifyNearest(nearest, minDist);
Log.i(TAG, "Issued notification to user");
} else {
Log.d(TAG, "No notification - nearest station was " + minDist + " km away: " + nearest);
}
}
use of de.bahnhoefe.deutschlands.bahnhofsfotos.model.Bahnhof in project RSAndroidApp by RailwayStations.
the class BahnhofsDbAdapter method getAllBahnhoefe.
// Getting All Bahnhoefe
public List<Bahnhof> getAllBahnhoefe(boolean withPhoto) {
List<Bahnhof> bahnhofList = new ArrayList<Bahnhof>();
// Select All Query without any baseLocationValues (myCurrentLocation)
String selectQuery = "SELECT " + KEY_ID + ", " + Constants.DB_JSON_CONSTANTS.KEY_TITLE + ", " + Constants.DB_JSON_CONSTANTS.KEY_LAT + ", " + Constants.DB_JSON_CONSTANTS.KEY_LON + ", " + Constants.DB_JSON_CONSTANTS.KEY_PHOTOFLAG + " FROM " + DATABASE_TABLE + " WHERE " + Constants.DB_JSON_CONSTANTS.KEY_PHOTOFLAG + " IS " + (withPhoto ? "NOT" : "") + " NULL";
Log.d(TAG, selectQuery.toString());
Cursor cursor = db.rawQuery(selectQuery, null);
// looping through all rows and adding to list
if (cursor.moveToFirst()) {
do {
Bahnhof bahnhof = createBahnhofFromCursor(cursor);
// Adding bahnhof to list
bahnhofList.add(bahnhof);
if (Log.isLoggable(TAG, Log.DEBUG))
Log.d(TAG, "Bahnhof #" + bahnhofList.size() + " " + bahnhof);
} while (cursor.moveToNext());
}
cursor.close();
// return bahnhof list
return bahnhofList;
}
Aggregations