Added upgrade dialog

This commit is contained in:
Juan Miguel Boyero Corral 2011-04-13 20:07:11 +02:00
parent a233314e89
commit d4820a7816
3 changed files with 23 additions and 6 deletions

View File

@ -32,8 +32,9 @@
<string name="yesMsg"></string>
<string name="noMsg">No</string>
<string name="firstRunMsg">Antes de usar la aplicación por primera vez debe introducir el nombre de usuario y la contraseña de acceso a SWAD en la pantalla de configuración.\n\nPuede acceder a la pantalla de configuración desde el menú de la aplicación en cualquier momento.\n\n¿Desea abrir ahora la pantalla de configuración?</string>
<string name="initialDialogTitle">IMPORTANTE</string>
<string name="initialDialogTitle">IMPORTANTE</string><string name="upgradeMsg">Debido a cambios en la base de datos todos los datos de las notificaciones han sido borrados.\n\nDisculpe las molestias.</string>
<string name="errorServerResponseMsg">Error en respuesta del servidor</string><string name="errorConnectionMsg">Error durante la conexión con el servidor</string><string name="errorTimeoutMsg">Tiempo de espera agotado intentando conectar con el servidor</string>
</resources>

View File

@ -34,8 +34,8 @@
<string name="messages">Messages</string><string name="evaluation">Evaluation</string><string name="fromMsg">From</string>
<string name="dateMsg">Date</string>
<string name="yesMsg">Yes</string>
<string name="noMsg">No</string><string name="firstRunMsg">Before using the application for the first time you must enter the user name and password for SWAD at the setup screen.\n\nYou can access to the setup screen from the application menu anytime.\n\nDo you want to open the configuration screen now?</string>
<string name="initialDialogTitle">IMPORTANT</string><string name="errorServerResponseMsg">Error in server response</string>
<string name="noMsg">No</string>
<string name="initialDialogTitle">IMPORTANT</string><string name="firstRunMsg">Before using the application for the first time you must enter the user name and password for SWAD at the setup screen.\n\nYou can access to the setup screen from the application menu anytime.\n\nDo you want to open the configuration screen now?</string><string name="upgradeMsg">Due to changes in the database all notifications data have been deleted.\n\nSorry.</string><string name="errorServerResponseMsg">Error in server response</string>
<string name="errorConnectionMsg">Error while connecting to server</string>
<string name="errorTimeoutMsg">Timeout trying to connect to the server</string>

View File

@ -108,9 +108,9 @@ public class SWADMain extends ExpandableListActivity {
}
/**
* Shows initial dialog on first run.
* Shows configuration dialog on first run.
*/
public void showInitialDialog() {
public void showConfigurationDialog() {
new AlertDialog.Builder(this)
.setTitle(R.string.initialDialogTitle)
.setMessage(R.string.firstRunMsg)
@ -126,6 +126,18 @@ public class SWADMain extends ExpandableListActivity {
}
}).show();
}
/**
* Shows initial dialog after application upgrade.
*/
public void showInitialDialog() {
new AlertDialog.Builder(this)
.setTitle(R.string.initialDialogTitle)
.setMessage(R.string.upgradeMsg)
.setCancelable(false)
.setNeutralButton(R.string.close_dialog, null)
.show();
}
/* (non-Javadoc)
* @see android.app.Activity#onCreateOptionsMenu()
@ -292,8 +304,12 @@ public class SWADMain extends ExpandableListActivity {
lastVersion = prefs.getLastVersion();
currentVersion = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
if(lastVersion == 0) {
showInitialDialog();
showConfigurationDialog();
prefs.setLastVersion(currentVersion);
} else if(currentVersion > lastVersion) {
dbHelper.emptyTable(Global.DB_TABLE_NOTIFICATIONS);
prefs.setLastVersion(currentVersion);
showInitialDialog();
}
} catch (Exception ex) {
Log.e(ex.getClass().getSimpleName(), ex.getMessage());