Fix no closing after setting wallpaper and add Play Store badge
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Michel Roux 2021-08-12 11:15:31 +02:00
parent aa71e50b74
commit b67e739141
2 changed files with 24 additions and 0 deletions

View File

@ -1,5 +1,7 @@
# Set as wallpaper # Set as wallpaper
![<img alt="Get it on Google Play" src="https://play.google.com/intl/en_us/badges/static/images/badges/en_badge_web_generic.png" height="50"/>](https://play.google.com/store/apps/details?id=net.crystalyx.setaswallpaper)
[![Build Status](https://ci.crystalyx.net/api/badges/Xefir/SetAsWallpaper/status.svg)](https://ci.crystalyx.net/Xefir/SetAsWallpaper) [![Build Status](https://ci.crystalyx.net/api/badges/Xefir/SetAsWallpaper/status.svg)](https://ci.crystalyx.net/Xefir/SetAsWallpaper)
Provide a useful shortcut to set an image to your Android's wallpaper launcher and lock screen through the "Share" functionality. Provide a useful shortcut to set an image to your Android's wallpaper launcher and lock screen through the "Share" functionality.

View File

@ -17,10 +17,13 @@ import java.util.concurrent.Executors;
public class SetWallpaperActivity extends Activity { public class SetWallpaperActivity extends Activity {
private boolean toBeFinished;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
toBeFinished = false;
Intent intent = getIntent(); Intent intent = getIntent();
String type = intent.getType(); String type = intent.getType();
@ -29,7 +32,26 @@ public class SetWallpaperActivity extends Activity {
handleUrl(intent.getStringExtra(Intent.EXTRA_TEXT)); handleUrl(intent.getStringExtra(Intent.EXTRA_TEXT));
} else if (type.startsWith("image/")) { } else if (type.startsWith("image/")) {
launchWallpaperActivity(intent.getParcelableExtra(Intent.EXTRA_STREAM), type); launchWallpaperActivity(intent.getParcelableExtra(Intent.EXTRA_STREAM), type);
} else {
toBeFinished = true;
} }
} else {
toBeFinished = true;
}
}
@Override
protected void onPause() {
super.onPause();
toBeFinished = true;
}
@Override
protected void onResume() {
super.onResume();
if (!toBeFinished) {
finish();
} }
} }