diff --git a/services_app/build.gradle b/services_app/build.gradle index 95cd52a2b..b8cacd448 100644 --- a/services_app/build.gradle +++ b/services_app/build.gradle @@ -133,6 +133,7 @@ dependencies { implementation "androidx.navigation:navigation-fragment:2.5.3" implementation "androidx.navigation:navigation-ui:2.5.3" implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' + implementation 'com.github.bumptech.glide:glide:4.15.1' implementation group: 'com.google.zxing', name: 'core', version: '3.3.0' implementation group: 'com.journeyapps', name: 'zxing-android-embedded', version: '3.5.0' diff --git a/services_app/src/main/AndroidManifest.xml b/services_app/src/main/AndroidManifest.xml index fa7ae6c00..5e7e2b418 100644 --- a/services_app/src/main/AndroidManifest.xml +++ b/services_app/src/main/AndroidManifest.xml @@ -108,7 +108,7 @@ android:syncable="false" /> diff --git a/services_app/src/main/java/org/opendatakit/services/SplashScreenActivity.java b/services_app/src/main/java/org/opendatakit/services/SplashScreenActivity.java new file mode 100644 index 000000000..800cea8cc --- /dev/null +++ b/services_app/src/main/java/org/opendatakit/services/SplashScreenActivity.java @@ -0,0 +1,47 @@ +package org.opendatakit.services; + +import android.content.Intent; +import android.os.Bundle; +import android.os.Handler; +import android.widget.ImageView; +import android.widget.LinearLayout; + +import androidx.appcompat.app.AppCompatActivity; + +import com.bumptech.glide.Glide; + +public class SplashScreenActivity extends AppCompatActivity { + + private static final int LOGO_DISPLAY_TIME = 500; + private static final int GIF_DISPLAY_TIME = 10000; + private Handler handler = new Handler(); + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.splash_screen); + + ImageView iv = findViewById(R.id.splash); + LinearLayout ll = findViewById(R.id.splash_layout); + ImageView gif = findViewById(R.id.gif); + + + handler.postDelayed(() -> { + iv.setVisibility(ImageView.GONE); // Hide the logo + ll.setVisibility(LinearLayout.VISIBLE); + + gif.setVisibility(ImageView.VISIBLE); + Glide.with(SplashScreenActivity.this) + .asGif() + .load(R.drawable.settings_gif) // Replace with your actual GIF resource + .into(gif); + }, LOGO_DISPLAY_TIME); + + + handler.postDelayed(() -> { + Intent intent = new Intent(SplashScreenActivity.this, MainActivity.class); + startActivity(intent); + finish(); + }, LOGO_DISPLAY_TIME + GIF_DISPLAY_TIME); // Add the display time of the logo + } +} diff --git a/services_app/src/main/res/drawable/logo_services.png b/services_app/src/main/res/drawable/logo_services.png new file mode 100644 index 000000000..dd4bcffd6 Binary files /dev/null and b/services_app/src/main/res/drawable/logo_services.png differ diff --git a/services_app/src/main/res/drawable/settings_gif.png b/services_app/src/main/res/drawable/settings_gif.png new file mode 100644 index 000000000..cff7b6867 Binary files /dev/null and b/services_app/src/main/res/drawable/settings_gif.png differ diff --git a/services_app/src/main/res/layout/splash_screen.xml b/services_app/src/main/res/layout/splash_screen.xml new file mode 100644 index 000000000..e7eea01d5 --- /dev/null +++ b/services_app/src/main/res/layout/splash_screen.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/services_app/src/main/res/values/strings.xml b/services_app/src/main/res/values/strings.xml index 458002761..9c1fd7497 100644 --- a/services_app/src/main/res/values/strings.xml +++ b/services_app/src/main/res/values/strings.xml @@ -450,5 +450,6 @@ Sign in using Credentials Set Credentials Sign in as Anonymous User + Service GIF