Skip to content

Commit

Permalink
Add splash screen with spinner while the migration is happening
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsarm committed Mar 12, 2021
1 parent 9f31159 commit 38ba520
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
<activity android:name="EmbeddedBrowserActivity"
android:screenOrientation="portrait"
android:configChanges="orientation|screenSize"/>
<activity android:name="UpgradingActivity"
android:screenOrientation="portrait"
android:configChanges="orientation|screenSize"/>
<activity android:name="FreeSpaceWarningActivity"
android:screenOrientation="portrait"/>
<activity android:name="SettingsDialogActivity"
Expand Down
39 changes: 39 additions & 0 deletions src/main/res/layout/upgrading.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="16dp"
android:paddingRight="16dp">

<ProgressBar
android:id="@+id/progressBarIcon"
style="?android:attr/progressBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="80dp"
android:contentDescription="@string/loadingIconDescription"
android:padding="20dp" />

<TextView
android:id="@+id/upgradingTitleText"
style="@android:style/Widget.DeviceDefault.Light.TextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/progressBarIcon"
android:layout_marginTop="5dp"
android:padding="20dp"
android:text="@string/upgradingTitle"
android:textSize="20sp"
android:textStyle="bold" />

<TextView
android:id="@+id/upgradingMessageText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/upgradingTitleText"
android:padding="20dp"
android:text="@string/upgradingMessage"
android:textSize="18sp" />

</RelativeLayout>
4 changes: 4 additions & 0 deletions src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@
<string name="locRequestOkButton">Activar</string>
<string name="locRequestDenyButton">No gracias</string>
<string name="locRequestIconDescription">Ícono de mi ubicación</string>

<string name="loadingIconDescription">Cargando...</string>
<string name="upgradingTitle">Actualizando la app</string>
<string name="upgradingMessage">Estás actualizando a la última versión. Por favor aguarda mientras tus datos son migrados.</string>
</resources>
4 changes: 4 additions & 0 deletions src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@
<string name="locRequestOkButton">Activer</string>
<string name="locRequestDenyButton">Non merci</string>
<string name="locRequestIconDescription">Icône de mon emplacement</string>

<string name="loadingIconDescription">Chargement...</string>
<string name="upgradingTitle">Mettre à jour votre application</string>
<string name="upgradingMessage">Vous passez à la dernière version. Veuillez patienter pendant la migration de vos données.</string>
</resources>
4 changes: 4 additions & 0 deletions src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,8 @@
<string name="locRequestOkButton">Turn on</string>
<string name="locRequestDenyButton">No thanks</string>
<string name="locRequestIconDescription">My location icon</string>

<string name="loadingIconDescription">Loading...</string>
<string name="upgradingTitle">Upgrading your app</string>
<string name="upgradingMessage">You\'re upgrading to the latest version. Please wait while your data is being migrated.</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ protected void onStart() {
XWalkMigration xWalkMigration = new XWalkMigration(this.getApplicationContext());
if (xWalkMigration.hasToMigrate()) {
log(this, "onStart() :: Running Crosswalk migration ...");
//TODO display waiting...
isMigrationRunning = true;
startActivity(new Intent(this, UpgradingActivity.class));
xWalkMigration.run();
} else {
trace(this, "onStart() :: Crosswalk installation not found - skipping migration");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.medicmobile.webapp.mobile;

import android.os.Bundle;
import android.view.Window;

public class UpgradingActivity extends LockableActivity {

@Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.upgrading);
}
}

0 comments on commit 38ba520

Please sign in to comment.