Changeset View
Changeset View
Standalone View
Standalone View
src/it/reyboz/bustorino/ActivityPrincipal.java
Show First 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | protected void onCreate(@Nullable Bundle savedInstanceState) { | ||||
//database check | //database check | ||||
GtfsDatabase gtfsDB = GtfsDatabase.Companion.getGtfsDatabase(this); | GtfsDatabase gtfsDB = GtfsDatabase.Companion.getGtfsDatabase(this); | ||||
final int db_version = gtfsDB.getOpenHelper().getReadableDatabase().getVersion(); | final int db_version = gtfsDB.getOpenHelper().getReadableDatabase().getVersion(); | ||||
boolean dataUpdateRequested = false; | boolean dataUpdateRequested = false; | ||||
final int old_version = PreferencesHolder.getGtfsDBVersion(theShPr); | final int old_version = PreferencesHolder.getGtfsDBVersion(theShPr); | ||||
Log.d(DEBUG_TAG, "GTFS Database: old version is "+old_version+ ", new version is "+db_version); | Log.d(DEBUG_TAG, "GTFS Database: old version is "+old_version+ ", new version is "+db_version); | ||||
if (old_version < db_version){ | if (old_version < db_version){ | ||||
//request db update | //decide update conditions in the future | ||||
if(old_version < 2 && db_version >= 2) { | |||||
dataUpdateRequested = true; | dataUpdateRequested = true; | ||||
DatabaseUpdate.requestDBUpdateWithWork(this, true, true); | DatabaseUpdate.requestDBUpdateWithWork(this, true, true); | ||||
} | |||||
PreferencesHolder.setGtfsDBVersion(theShPr, db_version); | PreferencesHolder.setGtfsDBVersion(theShPr, db_version); | ||||
} | } | ||||
Toolbar mToolbar = findViewById(R.id.default_toolbar); | Toolbar mToolbar = findViewById(R.id.default_toolbar); | ||||
setSupportActionBar(mToolbar); | setSupportActionBar(mToolbar); | ||||
if (getSupportActionBar()!=null) | if (getSupportActionBar()!=null) | ||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true); | getSupportActionBar().setDisplayHomeAsUpEnabled(true); | ||||
▲ Show 20 Lines • Show All 527 Lines • Show Last 20 Lines |
Public contents are in Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) or GNU Free Documentation License (at your option) unless otherwise noted. · Contact / Register