summaryrefslogtreecommitdiff
path: root/app/src/main/java/de/danoeh/antennapod/activity/SplashActivity.java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/de/danoeh/antennapod/activity/SplashActivity.java')
-rw-r--r--app/src/main/java/de/danoeh/antennapod/activity/SplashActivity.java50
1 files changed, 39 insertions, 11 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/activity/SplashActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/SplashActivity.java
index b92ac8577..52102eee1 100644
--- a/app/src/main/java/de/danoeh/antennapod/activity/SplashActivity.java
+++ b/app/src/main/java/de/danoeh/antennapod/activity/SplashActivity.java
@@ -1,23 +1,51 @@
package de.danoeh.antennapod.activity;
import android.content.Intent;
+import android.graphics.PorterDuff;
+import android.graphics.drawable.Drawable;
+import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
+import android.support.v4.graphics.drawable.DrawableCompat;
import android.support.v7.app.AppCompatActivity;
+import android.widget.ProgressBar;
+
+import de.danoeh.antennapod.R;
+import de.danoeh.antennapod.core.storage.PodDBAdapter;
+import io.reactivex.Completable;
+import io.reactivex.android.schedulers.AndroidSchedulers;
+import io.reactivex.schedulers.Schedulers;
/**
- * Creator: vbarad
- * Date: 2016-12-03
- * Project: AntennaPod
+ * Shows the AntennaPod logo while waiting for the main activity to start
*/
-
public class SplashActivity extends AppCompatActivity {
- @Override
- protected void onCreate(@Nullable Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
+ @Override
+ protected void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.splash);
+
+ ProgressBar progressBar = findViewById(R.id.progressBar);
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
+ Drawable wrapDrawable = DrawableCompat.wrap(progressBar.getIndeterminateDrawable());
+ DrawableCompat.setTint(wrapDrawable, 0xffffffff);
+ progressBar.setIndeterminateDrawable(DrawableCompat.unwrap(wrapDrawable));
+ } else {
+ progressBar.getIndeterminateDrawable().setColorFilter(0xffffffff, PorterDuff.Mode.SRC_IN);
+ }
- Intent intent = new Intent(this, MainActivity.class);
- startActivity(intent);
- finish();
- }
+ Completable.create(subscriber -> {
+ // Trigger schema updates
+ PodDBAdapter.getInstance().open();
+ PodDBAdapter.getInstance().close();
+ subscriber.onComplete();
+ })
+ .subscribeOn(Schedulers.io())
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe(() -> {
+ Intent intent = new Intent(SplashActivity.this, MainActivity.class);
+ startActivity(intent);
+ finish();
+ });
+ }
}