diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index bfc142f63..b6243ddd5 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -23,10 +23,10 @@ android:networkSecurityConfig="@xml/network_config" android:label="@string/app_name" android:supportsRtl="true" - android:theme="@style/CandyBar.Theme.App.DayNight" + android:theme="@style/Theme.App.Starting" tools:targetApi="n"> - - + --> + diff --git a/app/src/main/res/drawable-nodpi/ic_splash_screen.png b/app/src/main/res/drawable-nodpi/ic_splash_screen.png new file mode 100644 index 000000000..69bf37432 Binary files /dev/null and b/app/src/main/res/drawable-nodpi/ic_splash_screen.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_splash_screen.png b/app/src/main/res/drawable-xxxhdpi/ic_splash_screen.png deleted file mode 100644 index ef76caec6..000000000 Binary files a/app/src/main/res/drawable-xxxhdpi/ic_splash_screen.png and /dev/null differ diff --git a/app/src/main/res/drawable/ic_splash_screen.png b/app/src/main/res/drawable/ic_splash_screen.png deleted file mode 100644 index 463716e5f..000000000 Binary files a/app/src/main/res/drawable/ic_splash_screen.png and /dev/null differ diff --git a/app/src/main/res/values-night/colors.xml b/app/src/main/res/values-night/colors.xml new file mode 100644 index 000000000..57b624c03 --- /dev/null +++ b/app/src/main/res/values-night/colors.xml @@ -0,0 +1,4 @@ + + + #222222 + \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index d3a2aa3f5..fe2153fb6 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -1,5 +1,7 @@ + + #FFF #26C484 #FFF diff --git a/build.gradle b/build.gradle index 4d01edb2c..0350f4ed3 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:8.1.1' + classpath 'com.android.tools.build:gradle:8.2.1' } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index cb086a5fc..b5fc5a7b8 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip diff --git a/library/build.gradle b/library/build.gradle index 83b80f299..919ff522c 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -93,21 +93,22 @@ android { dependencies { implementation project(':extLibs:PreLollipopTransitions') - api 'androidx.annotation:annotation:1.5.0' - api 'androidx.appcompat:appcompat:1.5.1' + api 'androidx.annotation:annotation:1.7.1' + api 'androidx.appcompat:appcompat:1.6.1' api 'com.google.android.apps.muzei:muzei-api:3.4.0' - api 'com.android.billingclient:billing:6.0.1' + api 'com.android.billingclient:billing:6.1.0' api 'dev.jahir.KustomAPI:api:6369c37' api 'dev.jahir.KustomAPI:preset:6369c37' - implementation 'androidx.work:work-runtime:2.8.1' - implementation 'androidx.recyclerview:recyclerview:1.3.0' + implementation 'androidx.work:work-runtime:2.9.0' + implementation 'androidx.recyclerview:recyclerview:1.3.2' implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' implementation 'androidx.palette:palette:1.0.0' // implementation 'com.google.android.material:material:1.9.0' - implementation 'com.google.android.material:material:1.11.0-alpha03' + implementation 'com.google.android.material:material:1.11.0' implementation 'androidx.viewpager2:viewpager2:1.0.0' implementation 'com.google.android.play:review:2.0.1' + implementation 'androidx.core:core-splashscreen:1.0.1' implementation 'com.bluelinelabs:logansquare:1.3.7' annotationProcessor 'com.bluelinelabs:logansquare-compiler:1.3.7' diff --git a/library/src/main/java/candybar/lib/activities/CandyBarMainActivity.java b/library/src/main/java/candybar/lib/activities/CandyBarMainActivity.java index 9e2a572ae..b947c50aa 100644 --- a/library/src/main/java/candybar/lib/activities/CandyBarMainActivity.java +++ b/library/src/main/java/candybar/lib/activities/CandyBarMainActivity.java @@ -105,6 +105,7 @@ import candybar.lib.services.CandyBarService; import candybar.lib.tasks.IconRequestTask; import candybar.lib.tasks.IconsLoaderTask; +import candybar.lib.tasks.WallpaperThumbPreloaderTask; import candybar.lib.utils.CandyBarGlideModule; import candybar.lib.utils.Extras; import candybar.lib.utils.InAppBillingClient; @@ -259,6 +260,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { } checkWallpapers(); + new WallpaperThumbPreloaderTask(this).execute(); new IconRequestTask(this).executeOnThreadPool(); new IconsLoaderTask(this).execute(); diff --git a/library/src/main/java/candybar/lib/tasks/WallpaperThumbPreloaderTask.java b/library/src/main/java/candybar/lib/tasks/WallpaperThumbPreloaderTask.java new file mode 100644 index 000000000..ee30e1a9f --- /dev/null +++ b/library/src/main/java/candybar/lib/tasks/WallpaperThumbPreloaderTask.java @@ -0,0 +1,74 @@ +package candybar.lib.tasks; + +import android.content.Context; +import android.util.Log; + +import androidx.annotation.NonNull; + +import com.bumptech.glide.Glide; +import com.bumptech.glide.load.engine.DiskCacheStrategy; +import com.danimahardhika.android.helpers.core.utils.LogUtil; + +import java.io.InputStream; +import java.lang.ref.WeakReference; +import java.util.List; +import java.util.Map; + +import candybar.lib.applications.CandyBarApplication; +import candybar.lib.helpers.JsonHelper; +import candybar.lib.helpers.WallpaperHelper; +import candybar.lib.utils.AsyncTaskBase; +import candybar.lib.utils.ImageConfig; + +public class WallpaperThumbPreloaderTask extends AsyncTaskBase { + + private final WeakReference context; + + public WallpaperThumbPreloaderTask(@NonNull Context context) { + this.context = new WeakReference<>(context); + } + + @Override + protected boolean run() { + if (!isCancelled()) { + try { + Thread.sleep(1); + + if (WallpaperHelper.getWallpaperType(context.get()) != WallpaperHelper.CLOUD_WALLPAPERS) + return true; + + InputStream stream = WallpaperHelper.getJSONStream(context.get()); + + if (stream != null) { + List list = JsonHelper.parseList(stream); + if (list == null) { + LogUtil.e("Json error, no array with name: " + + CandyBarApplication.getConfiguration().getWallpaperJsonStructure().getArrayName()); + return false; + } + + if (list.size() > 0 && list.get(0) instanceof Map) { + Map map = (Map) list.get(0); + String thumbUrl = JsonHelper.getThumbUrl(map); + + // Preload the first wallpaper's thumbnail + // It should show up immediately without any delay on first run + // so that the intro popup works correctly + if (context.get() != null) { + Glide.with(context.get()) + .load(thumbUrl) + .diskCacheStrategy(DiskCacheStrategy.RESOURCE) + .override(ImageConfig.getThumbnailSize()) + .preload(); + } + } + } + return true; + } catch (Exception e) { + LogUtil.e(Log.getStackTraceString(e)); + return false; + } + } + return false; + } +} diff --git a/library/src/main/res/layout/activity_main.xml b/library/src/main/res/layout/activity_main.xml index 758303d0c..c97cc016c 100644 --- a/library/src/main/res/layout/activity_main.xml +++ b/library/src/main/res/layout/activity_main.xml @@ -6,6 +6,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="false" + android:background="?cb_mainBackground" tools:openDrawer="start"> + + #FFF #26C484 #FFF diff --git a/library/src/main/res/values/themes.xml b/library/src/main/res/values/themes.xml index 92b8937a8..c014cf949 100644 --- a/library/src/main/res/values/themes.xml +++ b/library/src/main/res/values/themes.xml @@ -123,6 +123,22 @@ @drawable/splash_screen + +