diff --git a/app/build.gradle b/app/build.gradle
index b3b4634..74b5df4 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -13,7 +13,7 @@ android {
minSdkVersion 29
targetSdkVersion 32
versionCode 4
- versionName "2.1_beta_230620"
+ versionName "2.2_beta_230625"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildFeatures {
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 555f676..adc7407 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -21,17 +21,14 @@
android:configChanges="uiMode" />
+ android:exported="true">
-
-
+
+
-
-
diff --git a/app/src/main/java/com/maary/shareas/MainActivity.java b/app/src/main/java/com/maary/shareas/MainActivity.java
index 4f9c328..174717a 100644
--- a/app/src/main/java/com/maary/shareas/MainActivity.java
+++ b/app/src/main/java/com/maary/shareas/MainActivity.java
@@ -134,12 +134,27 @@ protected void onCreate(Bundle savedInstanceState) {
Intent intent = getIntent();
String action = intent.getAction();
String type = intent.getType();
+ final WallpaperManager wallpaperManager = WallpaperManager.getInstance(getApplicationContext());
try {
if (Intent.ACTION_SEND.equals(action) && type != null) {
if (type.startsWith("image/")) {
- bitmap = Util.getBitmap(intent, MainActivity.this);
- final WallpaperManager wallpaperManager = WallpaperManager.getInstance(getApplicationContext());
+ bitmap = Util.getBitmap(intent, MainActivity.this);}}
+ else {
+ if (ContextCompat.checkSelfPermission(
+ getApplicationContext(), Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
+ requestPermissionLauncher.launch(Manifest.permission.READ_EXTERNAL_STORAGE);
+ }
+ if (wallpaperManager.getWallpaperInfo() == null) {
+ if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
+ bitmap = ((BitmapDrawable) wallpaperManager.getDrawable()).getBitmap();
+ } else {
+ Toast.makeText(getApplicationContext(), R.string.cannot_getpermission_lacking_permission, Toast.LENGTH_SHORT).show();
+ }
+ } else {
+ Toast.makeText(getApplicationContext(), R.string.cannot_get_livewallpaper, Toast.LENGTH_SHORT).show();
+ }
+ }
//Parent layout
ConstraintLayout container = findViewById(R.id.container);
//parent layout of bottomAppBar
@@ -253,7 +268,6 @@ protected void onCreate(Bundle savedInstanceState) {
});
-
//如果 SharedPreferences 里没有关于是否保存图像历史的偏好就询问是否保存
if (!sharedPreferences.contains(getString(R.string.enabled_history_key))) {
AlertDialog dialog_history = saveHistoryDialog();
@@ -578,10 +592,8 @@ public void onBlurFailed(Throwable error) {
}));
bottomAppBarContainer.bringToFront();
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
}
}
diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml
index 93f048f..3f063a6 100644
--- a/app/src/main/res/values-zh-rCN/strings.xml
+++ b/app/src/main/res/values-zh-rCN/strings.xml
@@ -34,4 +34,6 @@
应用到桌面
壁纸已改变
回桌面
+ Wallpaper Tunnel 缺少必要权限,无法获得当前壁纸
+ Wallpaper Tunnel 无法处理动态壁纸
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 4490a4e..0c9ac44 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -38,4 +38,6 @@
Apply to Home
Wallpaper changed.
Go Home
+ Wallpaper Tunnel cannot get current wallpaper due to lacking permission.
+ Wallpaper Tunnel cannot process live wallpaper.