diff --git a/README.md b/README.md index c57f468..0a5dd62 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Set as wallpaper +![Get it on Google Play](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) Provide a useful shortcut to set an image to your Android's wallpaper launcher and lock screen through the "Share" functionality. diff --git a/app/src/main/java/net/crystalyx/setaswallpaper/SetWallpaperActivity.java b/app/src/main/java/net/crystalyx/setaswallpaper/SetWallpaperActivity.java index 7e11228..d6309c0 100644 --- a/app/src/main/java/net/crystalyx/setaswallpaper/SetWallpaperActivity.java +++ b/app/src/main/java/net/crystalyx/setaswallpaper/SetWallpaperActivity.java @@ -17,10 +17,13 @@ import java.util.concurrent.Executors; public class SetWallpaperActivity extends Activity { + private boolean toBeFinished; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + toBeFinished = false; Intent intent = getIntent(); String type = intent.getType(); @@ -29,7 +32,26 @@ public class SetWallpaperActivity extends Activity { handleUrl(intent.getStringExtra(Intent.EXTRA_TEXT)); } else if (type.startsWith("image/")) { 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(); } }