diff --git a/app/build.gradle b/app/build.gradle index 13a8930..f6c621b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,16 +3,15 @@ plugins { } android { - compileSdkVersion 32 + compileSdkVersion 33 namespace "net.crystalyx.setaswallpaper" defaultConfig { applicationId "net.crystalyx.setaswallpaper" minSdk 5 - //noinspection OldTargetApi - targetSdkVersion 32 - versionCode 9 - versionName "3.2" + targetSdkVersion 33 + versionCode 10 + versionName "3.3" } signingConfigs { @@ -41,3 +40,7 @@ android { targetCompatibility JavaVersion.VERSION_1_8 } } + +tasks.withType(JavaCompile) { + options.deprecation = true +} diff --git a/app/src/main/java/net/crystalyx/setaswallpaper/SetWallpaperActivity.java b/app/src/main/java/net/crystalyx/setaswallpaper/SetWallpaperActivity.java index cb0475b..eb7e4cb 100644 --- a/app/src/main/java/net/crystalyx/setaswallpaper/SetWallpaperActivity.java +++ b/app/src/main/java/net/crystalyx/setaswallpaper/SetWallpaperActivity.java @@ -6,6 +6,7 @@ import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.Uri; +import android.os.Build; import android.os.Bundle; import android.widget.Toast; @@ -26,11 +27,20 @@ public class SetWallpaperActivity extends Activity { if ("text/plain".equals(type)) { handleUrl(intent.getStringExtra(Intent.EXTRA_TEXT)); } else if (type.startsWith("image/")) { - handleStream(intent.getParcelableExtra(Intent.EXTRA_STREAM)); + handleStream(getParcelableExtraStream(intent)); } } } + @SuppressWarnings("deprecation") + private Uri getParcelableExtraStream(Intent intent) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + return intent.getParcelableExtra(Intent.EXTRA_STREAM, Uri.class); + } + + return intent.getParcelableExtra(Intent.EXTRA_STREAM); + } + private void handleUrl(String textUrl) { URL url; diff --git a/gradle.properties b/gradle.properties index a03b354..3e927b1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -18,4 +18,4 @@ android.useAndroidX=true # Enables namespacing of each library's R class so that its R class includes only the # resources declared in the library itself and none from the library's dependencies, # thereby reducing the size of the R class for that library -android.nonTransitiveRClass=true +android.nonTransitiveRClass=true \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index ba1067c..5711940 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,8 +1,8 @@ pluginManagement { repositories { - gradlePluginPortal() google() mavenCentral() + gradlePluginPortal() } } dependencyResolutionManagement {